Skip to content

Commit

Permalink
preparePrevStepPullCom for residence time groups
Browse files Browse the repository at this point in the history
  • Loading branch information
BerndDoser committed Jul 19, 2024
1 parent c434319 commit a9dc01a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/gromacs/mdrun/md.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,14 @@ void gmx::LegacySimulator::do_md()
{
EnergyData::initializeEnergyHistory(startingBehavior_, observablesHistory_, &energyOutput);
}

/* RAMD */
std::unique_ptr<RAMD> ramd = nullptr;
if (ir->bRAMD)
{
ramd = std::make_unique<RAMD>(*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);
Expand Down Expand Up @@ -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> ramd = nullptr;
if (ir->bRAMD)
{
ramd = std::make_unique<RAMD>(*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
Expand Down
14 changes: 13 additions & 1 deletion src/gromacs/ramd/ramd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit a9dc01a

Please sign in to comment.