const gmx_mtop_t &top_global,
const t_inputrec *ir,
gmx::ImdSession *imdSession,
+ pull_t *pull_work,
t_state *state_local,
PaddedVector<gmx::RVec> *f,
gmx::MDAtoms *mdAtoms,
if (ir->bPull)
{
/* Update the local pull groups */
- dd_make_local_pull_groups(cr, ir->pull_work);
+ dd_make_local_pull_groups(cr, pull_work);
}
if (dd->atomSets != nullptr)
struct gmx_mtop_t;
struct gmx_vsite_t;
struct gmx_wallcycle;
+struct pull_t;
struct t_commrec;
struct t_forcerec;
struct t_inputrec;
const gmx_mtop_t &top_global,
const t_inputrec *ir,
gmx::ImdSession *imdSession,
+ pull_t *pull_work,
t_state *state_local,
PaddedVector<gmx::RVec> *f,
gmx::MDAtoms *mdatoms,
public:
Impl(const gmx_mtop_t &mtop_p,
const t_inputrec &ir_p,
+ pull_t *pull_work,
FILE *log_p,
const t_mdatoms &md_p,
const t_commrec *cr_p,
const t_commrec *cr = nullptr;
//! Multi-sim support.
const gmx_multisim_t *ms = nullptr;
+ //! Pulling code object, if any.
+ pull_t *pull_work = nullptr;
/*!\brief Input options.
*
* \todo Replace with IMdpOptions */
if (econq == ConstraintVariable::Positions)
{
- if (ir.bPull && pull_have_constraint(ir.pull_work))
+ if (ir.bPull && pull_have_constraint(pull_work))
{
if (EI_DYNAMICS(ir.eI))
{
t = ir.init_t;
}
set_pbc(&pbc, ir.ePBC, box);
- pull_constraint(ir.pull_work, &md, &pbc, cr, ir.delta_t, t, x, xprime, v, *vir);
+ pull_constraint(pull_work, &md, &pbc, cr, ir.delta_t, t, x, xprime, v, *vir);
}
if (ed && delta_step > 0)
{
Constraints::Constraints(const gmx_mtop_t &mtop,
const t_inputrec &ir,
+ pull_t *pull_work,
FILE *log,
const t_mdatoms &md,
const t_commrec *cr,
int numSettles)
: impl_(new Impl(mtop,
ir,
+ pull_work,
log,
md,
cr,
Constraints::Impl::Impl(const gmx_mtop_t &mtop_p,
const t_inputrec &ir_p,
+ pull_t *pull_work,
FILE *log_p,
const t_mdatoms &md_p,
const t_commrec *cr_p,
log(log_p),
cr(cr_p),
ms(ms_p),
+ pull_work(pull_work),
ir(ir_p),
nrnb(nrnb_p),
wcycle(wcycle_p)
struct gmx_mtop_t;
struct gmx_multisim_t;
struct gmx_wallcycle;
+struct pull_t;
struct t_blocka;
struct t_commrec;
struct t_ilist;
* function. */
Constraints(const gmx_mtop_t &mtop,
const t_inputrec &ir,
+ pull_t *pull_work,
FILE *log,
const t_mdatoms &md,
const t_commrec *cr,
t_mdebin *init_mdebin(ener_file_t fp_ene,
const gmx_mtop_t *mtop,
const t_inputrec *ir,
+ const pull_t *pull_work,
FILE *fp_dhdl,
bool isRerun)
{
}
else if (i == F_COM_PULL)
{
- md->bEner[i] = ((ir->bPull && pull_have_potential(ir->pull_work)) ||
+ md->bEner[i] = ((ir->bPull && pull_have_potential(pull_work)) ||
ir->bRot);
}
else if (i == F_ECONSERVED)
void EnergyOutput::prepare(ener_file *fp_ene,
const gmx_mtop_t *mtop,
const t_inputrec *ir,
+ const pull_t *pull_work,
FILE *fp_dhdl,
bool isRerun)
{
- mdebin = init_mdebin(fp_ene, mtop, ir, fp_dhdl, isRerun);
+ mdebin = init_mdebin(fp_ene, mtop, ir, pull_work, fp_dhdl, isRerun);
}
EnergyOutput::~EnergyOutput()
struct SimulationGroups;
struct gmx_mtop_t;
struct gmx_output_env_t;
+struct pull_t;
struct t_ebin;
struct t_expanded;
struct t_fcdata;
void prepare(ener_file *fp_ene,
const gmx_mtop_t *mtop,
const t_inputrec *ir,
+ const pull_t *pull_work,
FILE *fp_dhdl,
bool isRerun = false);
~EnergyOutput();
struct gmx_vsite_t;
struct gmx_wallcycle;
class history_t;
+struct pull_t;
struct t_blocka;
struct t_commrec;
struct t_fcdata;
gmx::Awh *awh,
gmx_enfrot *enforcedRotation,
gmx::ImdSession *imdSession,
+ pull_t *pull_work,
int64_t step,
t_nrnb *nrnb,
gmx_wallcycle *wcycle,
template<typename ... Args>
std::unique_ptr<Constraints> makeConstraints(const gmx_mtop_t &mtop,
const t_inputrec &ir,
+ pull_t *pull_work,
bool doEssentialDynamics,
Args && ... args)
{
int numConstraints = (gmx_mtop_ftype_count(mtop, F_CONSTR) +
gmx_mtop_ftype_count(mtop, F_CONSTRNC));
int numSettles = gmx_mtop_ftype_count(mtop, F_SETTLE);
- GMX_RELEASE_ASSERT(!ir.bPull || ir.pull_work != nullptr,
+ GMX_RELEASE_ASSERT(!ir.bPull || pull_work != nullptr,
"When COM pulling is active, it must be initialized before constraints are initialized");
- bool doPullingWithConstraints = ir.bPull && pull_have_constraint(ir.pull_work);
+ bool doPullingWithConstraints = ir.bPull && pull_have_constraint(pull_work);
if (numConstraints + numSettles == 0 &&
!doPullingWithConstraints && !doEssentialDynamics)
{
return nullptr;
}
return std::make_unique<Constraints::CreationHelper>
- (mtop, ir, std::forward<Args>(args) ..., numConstraints, numSettles);
+ (mtop, ir, pull_work, std::forward<Args>(args) ..., numConstraints, numSettles);
}
} // namespace gmx
gmx::ForceWithVirial *force,
const t_mdatoms *mdatoms,
gmx_enerdata_t *enerd,
+ pull_t *pull_work,
const real *lambda,
double t,
gmx_wallcycle_t wcycle)
set_pbc(&pbc, ir->ePBC, box);
dvdl = 0;
enerd->term[F_COM_PULL] +=
- pull_potential(ir->pull_work, mdatoms, &pbc,
+ pull_potential(pull_work, mdatoms, &pbc,
cr, t, lambda[efptRESTRAINT], as_rvec_array(x.data()), force, &dvdl);
enerd->dvdl_lin[efptRESTRAINT] += dvdl;
wallcycle_stop(wcycle, ewcPULLPOT);
static bool
haveSpecialForces(const t_inputrec *inputrec,
ForceProviders *forceProviders,
+ const pull_t *pull_work,
int forceFlags,
const gmx_edsam *ed)
{
return
((computeForces && forceProviders->hasForceProvider()) || // forceProviders
- (inputrec->bPull && pull_have_potential(inputrec->pull_work)) || // pull
+ (inputrec->bPull && pull_have_potential(pull_work)) || // pull
inputrec->bRot || // enforced rotation
(ed != nullptr) || // flooding
(inputrec->bIMD && computeForces)); // IMD
* \param[in] awh The Awh module (nullptr if none in use).
* \param[in] enforcedRotation Enforced rotation module.
* \param[in] imdSession The IMD session
+ * \param[in] pull_work The pull work structure.
* \param[in] step The current MD step
* \param[in] t The current time
* \param[in,out] wcycle Wallcycle accounting struct
gmx::Awh *awh,
gmx_enfrot *enforcedRotation,
gmx::ImdSession *imdSession,
+ pull_t *pull_work,
int64_t step,
double t,
gmx_wallcycle_t wcycle,
forceProviders->calculateForces(forceProviderInput, &forceProviderOutput);
}
- if (inputrec->bPull && pull_have_potential(inputrec->pull_work))
+ if (inputrec->bPull && pull_have_potential(pull_work))
{
pull_potential_wrapper(cr, inputrec, box, x,
forceWithVirial,
- mdatoms, enerd, lambda, t,
+ mdatoms, enerd, pull_work, lambda, t,
wcycle);
if (awh)
/*! \brief Set up the different force buffers; also does clearing.
*
* \param[in] fr force record pointer
+ * \param[in] pull_work The pull work object.
* \param[in] inputrec input record
* \param[in] force force array
* \param[in] bDoForces True if force are computed this step
*/
static ForceOutputs
setupForceOutputs(const t_forcerec *fr,
+ pull_t *pull_work,
const t_inputrec &inputrec,
gmx::ArrayRefWithPadding<gmx::RVec> force,
const bool bDoForces,
clear_rvecs_omp(forceWithVirial.force_.size(), as_rvec_array(forceWithVirial.force_.data()));
}
- if (inputrec.bPull && pull_have_constraint(inputrec.pull_work))
+ if (inputrec.bPull && pull_have_constraint(pull_work))
{
- clear_pull_forces(inputrec.pull_work);
+ clear_pull_forces(pull_work);
}
wallcycle_sub_stop(wcycle, ewcsCLEAR_FORCE_BUFFER);
setupForceWorkload(gmx::PpForceWorkload *forceWork,
const t_inputrec *inputrec,
const t_forcerec *fr,
+ const pull_t *pull_work,
const gmx_edsam *ed,
const t_idef &idef,
const t_fcdata *fcd,
const int forceFlags
)
{
- forceWork->haveSpecialForces = haveSpecialForces(inputrec, fr->forceProviders, forceFlags, ed);
+ forceWork->haveSpecialForces = haveSpecialForces(inputrec, fr->forceProviders, pull_work, forceFlags, ed);
forceWork->haveCpuBondedWork = haveCpuBondeds(*fr);
forceWork->haveGpuBondedWork = ((fr->gpuBonded != nullptr) && fr->gpuBonded->haveInteractions());
forceWork->haveRestraintsWork = havePositionRestraints(idef, *fcd);
gmx::Awh *awh,
gmx_enfrot *enforcedRotation,
gmx::ImdSession *imdSession,
+ pull_t *pull_work,
int64_t step,
t_nrnb *nrnb,
gmx_wallcycle_t wcycle,
setupForceWorkload(ppForceWorkload,
inputrec,
fr,
+ pull_work,
ed,
top->idef,
fcd,
wallcycle_start(wcycle, ewcFORCE);
// set up and clear force outputs
- struct ForceOutputs forceOut = setupForceOutputs(fr, *inputrec, force, bDoForces, ((flags & GMX_FORCE_VIRIAL) != 0), wcycle);
+ struct ForceOutputs forceOut = setupForceOutputs(fr, pull_work, *inputrec, force, bDoForces,
+ ((flags & GMX_FORCE_VIRIAL) != 0), wcycle);
/* We calculate the non-bonded forces, when done on the CPU, here.
* We do this before calling do_force_lowlevel, because in that
wallcycle_stop(wcycle, ewcFORCE);
computeSpecialForces(fplog, cr, inputrec, awh, enforcedRotation,
- imdSession, step, t, wcycle,
+ imdSession, pull_work, step, t, wcycle,
fr->forceProviders, box, x.unpaddedArrayRef(), mdatoms, lambda.data(),
flags, &forceOut.forceWithVirial, enerd,
ed, bNS);
log_(std::fopen(logFilename_.c_str(), "w")), logFileGuard_(log_),
checker_(refData_.rootChecker())
{
- energyOutput_.prepare(nullptr, &mtop_, &inputrec_, nullptr, false);
- constraints_ = makeConstraints(mtop_, inputrec_, false, log_, mdatoms_, nullptr,
+ energyOutput_.prepare(nullptr, &mtop_, &inputrec_, nullptr, nullptr, false);
+ constraints_ = makeConstraints(mtop_, inputrec_, nullptr, false, log_, mdatoms_, nullptr,
nullptr, nullptr, nullptr, false);
}
//! Helper function to generate synthetic data to output
struct gmx_wallcycle;
struct gmx_walltime_accounting;
struct ObservablesHistory;
+struct pull_t;
struct ReplicaExchangeParameters;
struct t_commrec;
struct t_fcdata;
t_inputrec *inputrec;
//! The Interactive Molecular Dynamics session.
ImdSession *imdSession;
+ //! The pull work object.
+ pull_t *pull_work;
//! The coordinate-swapping session.
t_swap *swap;
//! Full system topology.
init_nrnb(nrnb);
gmx_mdoutf *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, ir, top_global, oenv, wcycle);
gmx::EnergyOutput energyOutput;
- energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, mdoutf_get_fp_dhdl(outf));
+ energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, pull_work, mdoutf_get_fp_dhdl(outf));
/* Kinetic energy data */
std::unique_ptr<gmx_ekindata_t> eKinData = std::make_unique<gmx_ekindata_t>();
/* Distribute the charge groups over the nodes from the master node */
dd_partition_system(fplog, mdlog, ir->init_step, cr, TRUE, 1,
state_global, *top_global, ir, imdSession,
+ pull_work,
state, &f, mdAtoms, &top, fr,
vsite, constr,
nrnb, nullptr, FALSE);
energyOutput.fillEnergyHistory(observablesHistory->energyHistory.get());
}
- preparePrevStepPullCom(ir, mdatoms, state, state_global, cr, startingFromCheckpoint);
+ preparePrevStepPullCom(ir, pull_work, mdatoms, state, state_global, cr, startingFromCheckpoint);
// TODO: Remove this by converting AWH into a ForceProvider
auto awh = prepareAwhModule(fplog, *ir, state_global, cr, ms, startingFromCheckpoint,
shellfc != nullptr,
- opt2fn("-awh", nfile, fnm), ir->pull_work);
+ opt2fn("-awh", nfile, fnm), pull_work);
const bool useReplicaExchange = (replExParams.exchangeInterval > 0);
if (useReplicaExchange && MASTER(cr))
dd_partition_system(fplog, mdlog, step, cr,
bMasterState, nstglobalcomm,
state_global, *top_global, ir, imdSession,
+ pull_work,
state, &f, mdAtoms, &top, fr,
vsite, constr,
nrnb, wcycle,
/* Now is the time to relax the shells */
relax_shell_flexcon(fplog, cr, ms, mdrunOptions.verbose,
enforcedRotation, step,
- ir, imdSession, bNS, force_flags, &top,
+ ir, imdSession, pull_work, bNS, force_flags, &top,
constr, enerd, fcd,
state, f.arrayRefWithPadding(), force_vir, mdatoms,
nrnb, wcycle, graph,
* Check comments in sim_util.c
*/
do_force(fplog, cr, ms, ir, awh.get(), enforcedRotation, imdSession,
+ pull_work,
step, nrnb, wcycle, &top,
state->box, state->x.arrayRefWithPadding(), &state->hist,
f.arrayRefWithPadding(), force_vir, mdatoms, enerd, fcd,
if (ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)
{
- updatePrevStepPullCom(ir->pull_work, state);
+ updatePrevStepPullCom(pull_work, state);
}
if (ir->eI == eiVVAK)
if (ir->bPull)
{
- pull_print_output(ir->pull_work, step, t);
+ pull_print_output(pull_work, step, t);
}
if (do_per_step(step, ir->nstlog))
{
dd_partition_system(fplog, mdlog, step, cr, TRUE, 1,
state_global, *top_global, ir, imdSession,
+ pull_work,
state, &f, mdAtoms, &top, fr,
vsite, constr,
nrnb, wcycle, FALSE);
gmx_mdoutf *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, ir, top_global, oenv, wcycle);
gmx::EnergyOutput energyOutput;
- energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, mdoutf_get_fp_dhdl(outf), true);
+ energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, pull_work, mdoutf_get_fp_dhdl(outf), true);
/* Kinetic energy data */
std::unique_ptr<gmx_ekindata_t> eKinData = std::make_unique<gmx_ekindata_t>();
/* Distribute the charge groups over the nodes from the master node */
dd_partition_system(fplog, mdlog, ir->init_step, cr, TRUE, 1,
state_global, *top_global, ir, imdSession,
+ pull_work,
state, &f, mdAtoms, &top, fr,
vsite, constr,
nrnb, nullptr, FALSE);
dd_partition_system(fplog, mdlog, step, cr,
bMasterState, nstglobalcomm,
state_global, *top_global, ir, imdSession,
+ pull_work,
state, &f, mdAtoms, &top, fr,
vsite, constr,
nrnb, wcycle,
/* Now is the time to relax the shells */
relax_shell_flexcon(fplog, cr, ms, mdrunOptions.verbose,
enforcedRotation, step,
- ir, imdSession, bNS, force_flags, &top,
+ ir, imdSession, pull_work, bNS, force_flags, &top,
constr, enerd, fcd,
state, f.arrayRefWithPadding(), force_vir, mdatoms,
nrnb, wcycle, graph,
Awh *awh = nullptr;
gmx_edsam *ed = nullptr;
do_force(fplog, cr, ms, ir, awh, enforcedRotation, imdSession,
+ pull_work,
step, nrnb, wcycle, &top,
state->box, state->x.arrayRefWithPadding(), &state->hist,
f.arrayRefWithPadding(), force_vir, mdatoms, enerd, fcd,
const t_commrec *cr,
t_inputrec *ir,
gmx::ImdSession *imdSession,
+ pull_t *pull_work,
t_state *state_global, gmx_mtop_t *top_global,
em_state_t *ems, gmx_localtop_t *top,
t_nrnb *nrnb,
/* Distribute the charge groups over the nodes from the master node */
dd_partition_system(fplog, mdlog, ir->init_step, cr, TRUE, 1,
- state_global, *top_global, ir, imdSession,
+ state_global, *top_global, ir, imdSession, pull_work,
&ems->s, &ems->f, mdAtoms, top,
fr, vsite, constr,
nrnb, nullptr, FALSE);
int step, const t_commrec *cr,
gmx_mtop_t *top_global, t_inputrec *ir,
gmx::ImdSession *imdSession,
+ pull_t *pull_work,
em_state_t *ems, gmx_localtop_t *top,
gmx::MDAtoms *mdAtoms, t_forcerec *fr,
gmx_vsite_t *vsite, gmx::Constraints *constr,
{
/* Repartition the domain decomposition */
dd_partition_system(fplog, mdlog, step, cr, FALSE, 1,
- nullptr, *top_global, ir, imdSession,
+ nullptr, *top_global, ir, imdSession, pull_work,
&ems->s, &ems->f,
mdAtoms, top, fr, vsite, constr,
nrnb, wcycle, FALSE);
t_inputrec *inputrec;
//! The Interactive Molecular Dynamics session.
gmx::ImdSession *imdSession;
+ //! The pull work object.
+ pull_t *pull_work;
//! Manages flop accounting.
t_nrnb *nrnb;
//! Manages wall cycle accounting.
{
/* Repartition the domain decomposition */
em_dd_partition_system(fplog, mdlog, count, cr, top_global, inputrec, imdSession,
+ pull_work,
ems, top, mdAtoms, fr, vsite, constr,
nrnb, wcycle);
}
* We do not unshift, so molecules are always whole in congrad.c
*/
do_force(fplog, cr, ms, inputrec, nullptr, nullptr, imdSession,
+ pull_work,
count, nrnb, wcycle, top,
ems->s.box, ems->s.x.arrayRefWithPadding(), &ems->s.hist,
ems->f.arrayRefWithPadding(), force_vir, mdAtoms->mdatoms(), enerd, fcd,
/* Init em and store the local state in s_min */
init_em(fplog, mdlog, CG, cr, inputrec, imdSession,
+ pull_work,
state_global, top_global, s_min, &top,
nrnb, fr, &graph, mdAtoms, &gstat,
vsite, constr, nullptr);
gmx_mdoutf *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, inputrec, top_global, nullptr, wcycle);
gmx::EnergyOutput energyOutput;
- energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, nullptr);
+ energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, pull_work, nullptr);
/* Print to log file */
print_em_start(fplog, cr, walltime_accounting, wcycle, CG);
EnergyEvaluator energyEvaluator {
fplog, mdlog, cr, ms,
top_global, &top,
- inputrec, imdSession, nrnb, wcycle, gstat,
+ inputrec, imdSession, pull_work, nrnb, wcycle, gstat,
vsite, constr, fcd, graph,
mdAtoms, fr, ppForceWorkload, enerd
};
if (DOMAINDECOMP(cr) && s_min->s.ddp_count < cr->dd->ddp_count)
{
em_dd_partition_system(fplog, mdlog, step, cr, top_global, inputrec, imdSession,
+ pull_work,
s_min, &top, mdAtoms, fr, vsite, constr,
nrnb, wcycle);
}
{
/* Reload the old state */
em_dd_partition_system(fplog, mdlog, -1, cr, top_global, inputrec, imdSession,
+ pull_work,
s_min, &top, mdAtoms, fr, vsite, constr,
nrnb, wcycle);
}
/* Init em */
init_em(fplog, mdlog, LBFGS, cr, inputrec, imdSession,
+ pull_work,
state_global, top_global, &ems, &top,
nrnb, fr, &graph, mdAtoms, &gstat,
vsite, constr, nullptr);
gmx_mdoutf *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, inputrec, top_global, nullptr, wcycle);
gmx::EnergyOutput energyOutput;
- energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, nullptr);
+ energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, pull_work, nullptr);
start = 0;
end = mdatoms->homenr;
EnergyEvaluator energyEvaluator {
fplog, mdlog, cr, ms,
top_global, &top,
- inputrec, imdSession, nrnb, wcycle, gstat,
+ inputrec, imdSession, pull_work, nrnb, wcycle, gstat,
vsite, constr, fcd, graph,
mdAtoms, fr, ppForceWorkload, enerd
};
/* Init em and store the local state in s_try */
init_em(fplog, mdlog, SD, cr, inputrec, imdSession,
+ pull_work,
state_global, top_global, s_try, &top,
nrnb, fr, &graph, mdAtoms, &gstat,
vsite, constr, nullptr);
gmx_mdoutf *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, inputrec, top_global, nullptr, wcycle);
gmx::EnergyOutput energyOutput;
- energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, nullptr);
+ energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, inputrec, pull_work, nullptr);
/* Print to log file */
print_em_start(fplog, cr, walltime_accounting, wcycle, SD);
EnergyEvaluator energyEvaluator {
fplog, mdlog, cr, ms,
top_global, &top,
- inputrec, imdSession, nrnb, wcycle, gstat,
+ inputrec, imdSession, pull_work, nrnb, wcycle, gstat,
vsite, constr, fcd, graph,
mdAtoms, fr, ppForceWorkload, enerd
};
{
/* Reload the old state */
em_dd_partition_system(fplog, mdlog, count, cr, top_global, inputrec, imdSession,
+ pull_work,
s_min, &top, mdAtoms, fr, vsite, constr,
nrnb, wcycle);
}
/* Init em and store the local state in state_minimum */
init_em(fplog, mdlog, NM, cr, inputrec, imdSession,
+ pull_work,
state_global, top_global, &state_work, &top,
nrnb, fr, &graph, mdAtoms, &gstat,
vsite, constr, &shellfc);
EnergyEvaluator energyEvaluator {
fplog, mdlog, cr, ms,
top_global, &top,
- inputrec, imdSession, nrnb, wcycle, gstat,
+ inputrec, imdSession, pull_work, nrnb, wcycle, gstat,
vsite, constr, fcd, graph,
mdAtoms, fr, ppForceWorkload, enerd
};
step,
inputrec,
imdSession,
+ pull_work,
bNS,
force_flags,
&top,
init_nrnb(nrnb);
gmx_mdoutf *outf = init_mdoutf(fplog, nfile, fnm, mdrunOptions, cr, outputProvider, ir, top_global, oenv, wcycle);
gmx::EnergyOutput energyOutput;
- energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, mdoutf_get_fp_dhdl(outf), true);
+ energyOutput.prepare(mdoutf_get_fp_ene(outf), top_global, ir, pull_work, mdoutf_get_fp_dhdl(outf), true);
/* Kinetic energy data */
std::unique_ptr<gmx_ekindata_t> eKinData = std::make_unique<gmx_ekindata_t>();
/* Distribute the charge groups over the nodes from the master node */
dd_partition_system(fplog, mdlog, ir->init_step, cr, TRUE, 1,
state_global, *top_global, ir, imdSession,
+ pull_work,
state, &f, mdAtoms, &top, fr,
vsite, constr,
nrnb, nullptr, FALSE);
dd_partition_system(fplog, mdlog, step, cr,
bMasterState, nstglobalcomm,
state_global, *top_global, ir, imdSession,
+ pull_work,
state, &f, mdAtoms, &top, fr,
vsite, constr,
nrnb, wcycle,
/* Now is the time to relax the shells */
relax_shell_flexcon(fplog, cr, ms, mdrunOptions.verbose,
enforcedRotation, step,
- ir, imdSession, bNS, force_flags, &top,
+ ir, imdSession, pull_work, bNS, force_flags, &top,
constr, enerd, fcd,
state, f.arrayRefWithPadding(), force_vir, mdatoms,
nrnb, wcycle, graph,
Awh *awh = nullptr;
gmx_edsam *ed = nullptr;
do_force(fplog, cr, ms, ir, awh, enforcedRotation, imdSession,
+ pull_work,
step, nrnb, wcycle, &top,
state->box, state->x.arrayRefWithPadding(), &state->hist,
f.arrayRefWithPadding(), force_vir, mdatoms, enerd, fcd,
signal_handler_install();
}
+ pull_t *pull_work = nullptr;
if (thisRankHasDuty(cr, DUTY_PP))
{
/* Assumes uniform use of the number of OpenMP threads */
if (inputrec->bPull)
{
/* Initialize pull code */
- inputrec->pull_work =
+ pull_work =
init_pull(fplog, inputrec->pull, inputrec,
&mtop, cr, &atomSets, inputrec->fepvals->init_lambda);
if (inputrec->pull->bXOutAverage || inputrec->pull->bFOutAverage)
{
- initPullHistory(inputrec->pull_work, &observablesHistory);
+ initPullHistory(pull_work, &observablesHistory);
}
if (EI_DYNAMICS(inputrec->eI) && MASTER(cr))
{
- init_pull_output_files(inputrec->pull_work,
+ init_pull_output_files(pull_work,
filenames.size(), filenames.data(), oenv,
continuationOptions);
}
*/
bool doEssentialDynamics = (opt2fn_null("-ei", filenames.size(), filenames.data()) != nullptr
|| observablesHistory.edsamHistory);
- auto constr = makeConstraints(mtop, *inputrec, doEssentialDynamics,
+ auto constr = makeConstraints(mtop, *inputrec, pull_work, doEssentialDynamics,
fplog, *mdAtoms->mdatoms(),
cr, ms, nrnb, wcycle, fr->bMolPBC);
enforcedRotation ? enforcedRotation->getLegacyEnfrot() : nullptr,
deform.get(),
mdModules_->outputProvider(),
- inputrec, imdSession.get(), swap, &mtop,
+ inputrec, imdSession.get(), pull_work, swap, &mtop,
fcd,
globalState.get(),
&observablesHistory,
if (inputrec->bPull)
{
- finish_pull(inputrec->pull_work);
+ finish_pull(pull_work);
}
destroy_enerdata(enerd);
sfree(enerd);
int64_t mdstep,
const t_inputrec *inputrec,
gmx::ImdSession *imdSession,
+ pull_t *pull_work,
gmx_bool bDoNS,
int force_flags,
gmx_localtop_t *top,
}
int shellfc_flags = force_flags | (bVerbose ? GMX_FORCE_ENERGY : 0);
do_force(fplog, cr, ms, inputrec, nullptr, enforcedRotation, imdSession,
+ pull_work,
mdstep, nrnb, wcycle, top,
state->box, state->x.arrayRefWithPadding(), &state->hist,
forceWithPadding[Min], force_vir, md, enerd, fcd,
}
/* Try the new positions */
do_force(fplog, cr, ms, inputrec, nullptr, enforcedRotation, imdSession,
+ pull_work,
1, nrnb, wcycle,
top, state->box, posWithPadding[Try], &state->hist,
forceWithPadding[Try], force_vir,
struct gmx_multisim_t;
struct gmx_shellfc_t;
struct gmx_mtop_t;
+struct pull_t;
struct t_forcerec;
struct t_fcdata;
struct t_graph;
int64_t mdstep,
const t_inputrec *inputrec,
gmx::ImdSession *imdSession,
+ pull_t *pull_work,
gmx_bool bDoNS,
int force_flags,
gmx_localtop_t *top,
std::fenv_t floatingPointEnvironment;
std::feholdexcept(&floatingPointEnvironment);
do_force(fplog, cr, ms, inputrec, nullptr, nullptr, imdSession,
+ pull_work,
step, nrnb, wcycle, &top,
state_global->box, state_global->x.arrayRefWithPadding(), &state_global->hist,
f.arrayRefWithPadding(), force_vir, mdatoms, enerd, fcd,
struct gmx_enfrot;
struct gmx_enfrotgrp;
struct pull_params_t;
-struct pull_t;
namespace gmx
{
gmx_bool bPull;
//! The data for center of mass pulling
pull_params_t *pull;
- // TODO: Remove this by converting pull into a ForceProvider
- //! The COM pull force calculation data structure
- pull_t *pull_work;
/* AWH bias data */
//! Whether to use AWH biasing for PMF calculations
delete pull;
}
-void preparePrevStepPullCom(const t_inputrec *ir, const t_mdatoms *md, t_state *state, const t_state *state_global, const t_commrec *cr, bool startingFromCheckpoint)
+void preparePrevStepPullCom(const t_inputrec *ir, pull_t *pull_work,
+ const t_mdatoms *md, t_state *state, const t_state *state_global,
+ const t_commrec *cr, bool startingFromCheckpoint)
{
if (!ir->pull || !ir->pull->bSetPbcRefToPrevStepCOM)
{
return;
}
- allocStatePrevStepPullCom(state, ir->pull_work);
+ allocStatePrevStepPullCom(state, pull_work);
if (startingFromCheckpoint)
{
if (MASTER(cr))
/* Only the master rank has the checkpointed COM from the previous step */
gmx_bcast(sizeof(double) * state->pull_com_prev_step.size(), &state->pull_com_prev_step[0], cr);
}
- setPrevStepPullComFromState(ir->pull_work, state);
+ setPrevStepPullComFromState(pull_work, state);
}
else
{
t_pbc pbc;
set_pbc(&pbc, ir->ePBC, state->box);
- initPullComFromPrevStep(cr, ir->pull_work, md, &pbc, state->x.rvec_array());
- updatePrevStepPullCom(ir->pull_work, state);
+ initPullComFromPrevStep(cr, pull_work, md, &pbc, state->x.rvec_array());
+ updatePrevStepPullCom(pull_work, state);
}
}
struct gmx_output_env_t;
struct pull_coord_work_t;
struct pull_params_t;
+struct pull_t;
struct t_commrec;
struct t_filenm;
struct t_inputrec;
* If ir->pull->bSetPbcRefToPrevStepCOM is not true nothing is done.
*
* \param[in] ir The input options/settings of the simulation.
+ * \param[in] pull_work The COM pull force calculation data structure
* \param[in] md All atoms.
* \param[in] state The local (to this rank) state.
* \param[in] state_global The global state.
* \param[in] cr Struct for communication info.
* \param[in] startingFromCheckpoint Is the simulation starting from a checkpoint?
*/
-void preparePrevStepPullCom(const t_inputrec *ir, const t_mdatoms *md, t_state *state, const t_state *state_global, const t_commrec *cr, bool startingFromCheckpoint);
+void preparePrevStepPullCom(const t_inputrec *ir, pull_t *pull_work, const t_mdatoms *md,
+ t_state *state, const t_state *state_global, const t_commrec *cr,
+ bool startingFromCheckpoint);
/*! \brief Initializes the COM of the previous step (set to initial COM)
*
std::vector<double> cylinderBuffer; /* cylinder ref. groups calculation buffer */
};
+// The COM pull force calculation data structure
+// TODO Convert this into a ForceProvider
struct pull_t
{
/* Global parameters */
* \param[in] state The global state container
* \param[in] pull The COM pull force calculation data structure
*/
-void allocStatePrevStepPullCom(t_state *state, pull_t *pull);
+void allocStatePrevStepPullCom(t_state *state, const pull_t *pull);
#endif
}
}
-void allocStatePrevStepPullCom(t_state *state, pull_t *pull)
+void allocStatePrevStepPullCom(t_state *state, const pull_t *pull)
{
if (!pull)
{