From a9dc01a9ea61252376142d6ea0158f2fbce850bd Mon Sep 17 00:00:00 2001 From: Bernd Doser Date: Fri, 19 Jul 2024 14:36:50 +0000 Subject: [PATCH] preparePrevStepPullCom for residence time groups --- src/gromacs/mdrun/md.cpp | 16 ++++++++-------- src/gromacs/ramd/ramd.cpp | 14 +++++++++++++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/gromacs/mdrun/md.cpp b/src/gromacs/mdrun/md.cpp index d251221c22..37fbec4a85 100644 --- a/src/gromacs/mdrun/md.cpp +++ b/src/gromacs/mdrun/md.cpp @@ -514,6 +514,14 @@ void gmx::LegacySimulator::do_md() { EnergyData::initializeEnergyHistory(startingBehavior_, observablesHistory_, &energyOutput); } + + /* RAMD */ + std::unique_ptr ramd = nullptr; + if (ir->bRAMD) + { + ramd = std::make_unique(*ir->ramdParams, pullWork_, startingBehavior_, cr_, nFile_, fnm_, oenv_, fpLog_); + fr_->forceProviders->addForceProvider(ramd.get()); + } preparePrevStepPullCom( ir, pullWork_, md->massT, state_, stateGlobal_, cr_, startingBehavior_ != StartingBehavior::NewSimulation); @@ -626,14 +634,6 @@ void gmx::LegacySimulator::do_md() int64_t step = ir->init_step; int64_t step_rel = 0; - /* RAMD */ - std::unique_ptr ramd = nullptr; - if (ir->bRAMD) - { - ramd = std::make_unique(*ir->ramdParams, pullWork_, startingBehavior_, cr_, nFile_, fnm_, oenv_, fpLog_); - fr_->forceProviders->addForceProvider(ramd.get()); - } - /* To minimize communication, compute_globals computes the COM velocity * and the kinetic energy for the velocities without COM motion removed. * Thus to get the kinetic energy without the COM contribution, we need diff --git a/src/gromacs/ramd/ramd.cpp b/src/gromacs/ramd/ramd.cpp index aaf78caab7..9ce3570e40 100644 --- a/src/gromacs/ramd/ramd.cpp +++ b/src/gromacs/ramd/ramd.cpp @@ -83,11 +83,23 @@ RAMD::RAMD(const RAMDParams& params, for (int g = 2 * params.ngroup + 1; g < pull->params.ngroup; ++g) { - if (!pull->group[g].params_.ind.empty()){ + if (!pull->group[g].params_.ind.empty()) + { pull->group[g].needToCalcCom = true; } } + if (params.use_residence_dist) + { + for (size_t g = 2 * params.ngroup + 1; g < std::size(pull->group); ++g) + { + if (!pull->group[g].params_.ind.empty()) + { + pull->group[g].needToCalcCom = true; + } + } + } + if (MAIN(cr) and opt2bSet("-ramd", nfile, fnm)) { auto filename = std::string(opt2fn("-ramd", nfile, fnm));