int* fep_state = MASTER(cr) ? &state_global->fep_state : nullptr;
gmx::ArrayRef<real> lambda = MASTER(cr) ? state_global->lambda : gmx::ArrayRef<real>();
- initialize_lambdas(fplog, *ir, MASTER(cr), fep_state, lambda);
+ initialize_lambdas(
+ fplog, *ir, gmx::arrayRefFromArray(ir->opts.ref_t, ir->opts.ngtc), MASTER(cr), fep_state, lambda);
Update upd(*ir, deform);
bool doSimulatedAnnealing = false;
{
nonConstGlobalTopology->intermolecularExclusionGroup = genQmmmIndices(top_global);
}
- initialize_lambdas(fplog, *ir, MASTER(cr), &state_global->fep_state, state_global->lambda);
+ initialize_lambdas(fplog,
+ *ir,
+ gmx::arrayRefFromArray(ir->opts.ref_t, ir->opts.ngtc),
+ MASTER(cr),
+ &state_global->fep_state,
+ state_global->lambda);
const bool simulationsShareState = false;
gmx_mdoutf* outf = init_mdoutf(fplog,
}
int* fep_state = MASTER(cr) ? &state_global->fep_state : nullptr;
gmx::ArrayRef<real> lambda = MASTER(cr) ? state_global->lambda : gmx::ArrayRef<real>();
- initialize_lambdas(fplog, *ir, MASTER(cr), fep_state, lambda);
+ initialize_lambdas(
+ fplog, *ir, gmx::arrayRefFromArray(ir->opts.ref_t, ir->opts.ngtc), MASTER(cr), fep_state, lambda);
if (ir->eI == IntegrationAlgorithm::NM)
{
}
int* fep_state = MASTER(cr) ? &state_global->fep_state : nullptr;
gmx::ArrayRef<real> lambda = MASTER(cr) ? state_global->lambda : gmx::ArrayRef<real>();
- initialize_lambdas(fplog, *ir, MASTER(cr), fep_state, lambda);
+ initialize_lambdas(
+ fplog, *ir, gmx::arrayRefFromArray(ir->opts.ref_t, ir->opts.ngtc), MASTER(cr), fep_state, lambda);
const bool simulationsShareState = false;
gmx_mdoutf* outf = init_mdoutf(fplog,
nfile,
}
}
-void initialize_lambdas(FILE* fplog, const t_inputrec& ir, bool isMaster, int* fep_state, gmx::ArrayRef<real> lambda)
+void initialize_lambdas(FILE* fplog,
+ const t_inputrec& ir,
+ gmx::ArrayRef<real> ref_t,
+ bool isMaster,
+ int* fep_state,
+ gmx::ArrayRef<real> lambda)
{
/* TODO: Clean up initialization of fep_state and lambda in
t_state. This function works, but could probably use a logic
if (ir.bSimTemp)
{
/* need to rescale control temperatures to match current state */
- for (int i = 0; i < ir.opts.ngtc; i++)
+ for (int i = 0; i < ref_t.ssize(); i++)
{
- if (ir.opts.ref_t[i] > 0)
+ if (ref_t[i] > 0)
{
- ir.opts.ref_t[i] = ir.simtempvals->temperatures[fep->init_fep_state];
+ ref_t[i] = ir.simtempvals->temperatures[fep->init_fep_state];
}
}
}
tensor Winvm; /* inverse pressure mass tensor, computed */
};
-
-typedef struct
-{
- real veta;
- double rscale;
- double vscale;
- double rvscale;
- double alpha;
- double* vscale_nhc;
-} t_vetavars;
-
#endif // DOXYGEN
//! Resizes the T- and P-coupling state variables
* and lambda on master rank.
*
* Reports the initial lambda state to the log file. */
-void initialize_lambdas(FILE* fplog, const t_inputrec& ir, bool isMaster, int* fep_state, gmx::ArrayRef<real> lambda);
+void initialize_lambdas(FILE* fplog,
+ const t_inputrec& ir,
+ gmx::ArrayRef<real> ref_t,
+ bool isMaster,
+ int* fep_state,
+ gmx::ArrayRef<real> lambda);
#endif
namespace gmx
{
-FreeEnergyPerturbationData::FreeEnergyPerturbationData(FILE* fplog, const t_inputrec* inputrec, MDAtoms* mdAtoms) :
- element_(std::make_unique<Element>(this, inputrec->fepvals->delta_lambda)),
+FreeEnergyPerturbationData::FreeEnergyPerturbationData(FILE* fplog, const t_inputrec& inputrec, MDAtoms* mdAtoms) :
+ element_(std::make_unique<Element>(this, inputrec.fepvals->delta_lambda)),
lambda_(),
currentFEPState_(0),
fplog_(fplog),
// The legacy implementation only filled the lambda vector in state_global, which is only
// available on master. We have the lambda vector available everywhere, so we pass a `true`
// for isMaster on all ranks. See #3647.
- initialize_lambdas(fplog_, *inputrec_, true, ¤tFEPState_, lambda_);
+ initialize_lambdas(fplog_,
+ inputrec_,
+ gmx::arrayRefFromArray(inputrec_.opts.ref_t, inputrec_.opts.ngtc),
+ true,
+ ¤tFEPState_,
+ lambda_);
}
void FreeEnergyPerturbationData::Element::scheduleTask(Step step,
void FreeEnergyPerturbationData::updateLambdas(Step step)
{
// at beginning of step (if lambdas change...)
- lambda_ = currentLambdas(step, *(inputrec_->fepvals), currentFEPState_);
+ lambda_ = currentLambdas(step, *(inputrec_.fepvals), currentFEPState_);
updateMDAtoms();
}
{
if (readCheckpointData)
{
- FreeEnergyPerturbationData freeEnergyPerturbationData;
+ FreeEnergyPerturbationData freeEnergyPerturbationData(nullptr, t_inputrec(), nullptr);
freeEnergyPerturbationData.doCheckpointData(&readCheckpointData.value());
trxFrame->lambda = freeEnergyPerturbationData.lambda_[FreeEnergyPerturbationCouplingType::Fep];
trxFrame->fep_state = freeEnergyPerturbationData.currentFEPState_;
{
public:
//! Constructor
- FreeEnergyPerturbationData(FILE* fplog, const t_inputrec* inputrec, MDAtoms* mdAtoms);
+ FreeEnergyPerturbationData(FILE* fplog, const t_inputrec& inputrec, MDAtoms* mdAtoms);
//! Get a view of the current lambda vector
ArrayRef<real> lambdaView();
static const std::string& checkpointID();
private:
- //! Default constructor - only used internally
- FreeEnergyPerturbationData() = default;
//! Update the lambda values
void updateLambdas(Step step);
//! Helper function to read from / write to CheckpointData
//! Handles logging.
FILE* fplog_;
//! Contains user input mdp options.
- const t_inputrec* inputrec_;
+ const t_inputrec& inputrec_;
//! Atom parameters for this domain.
MDAtoms* mdAtoms_;
};
if (legacySimulatorData->inputrec->efep != FreeEnergyPerturbationType::No)
{
freeEnergyPerturbationData_ = std::make_unique<FreeEnergyPerturbationData>(
- legacySimulatorData->fplog, legacySimulatorData->inputrec, legacySimulatorData->mdAtoms);
+ legacySimulatorData->fplog, *legacySimulatorData->inputrec, legacySimulatorData->mdAtoms);
}
statePropagatorData_ = std::make_unique<StatePropagatorData>(