wallcycle_start(wcycle, ewcPULLPOT);
set_pbc(&pbc, ir.pbcType, box);
dvdl = 0;
- enerd->term[F_COM_PULL] += pull_potential(
- pull_work, mdatoms->massT, &pbc, cr, t, lambda[efptRESTRAINT], as_rvec_array(x.data()), force, &dvdl);
- enerd->dvdl_lin[efptRESTRAINT] += dvdl;
+ enerd->term[F_COM_PULL] +=
+ pull_potential(pull_work,
+ mdatoms->massT,
+ &pbc,
+ cr,
+ t,
+ lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Restraint)],
+ as_rvec_array(x.data()),
+ force,
+ &dvdl);
+ enerd->dvdl_lin[FreeEnergyPerturbationCouplingType::Restraint] += dvdl;
wallcycle_stop(wcycle, ewcPULLPOT);
}
&cycles_seppme);
enerd->term[F_COUL_RECIP] += e_q;
enerd->term[F_LJ_RECIP] += e_lj;
- enerd->dvdl_lin[efptCOUL] += dvdl_q;
- enerd->dvdl_lin[efptVDW] += dvdl_lj;
+ enerd->dvdl_lin[FreeEnergyPerturbationCouplingType::Coul] += dvdl_q;
+ enerd->dvdl_lin[FreeEnergyPerturbationCouplingType::Vdw] += dvdl_lj;
if (wcycle)
{
}
domainWork.haveGpuBondedWork = ((fr.gpuBonded != nullptr) && fr.gpuBonded->haveInteractions());
// Note that haveFreeEnergyWork is constant over the whole run
- domainWork.haveFreeEnergyWork = (fr.efep != efepNO && mdatoms.nPerturbed != 0);
+ domainWork.haveFreeEnergyWork =
+ (fr.efep != FreeEnergyPerturbationType::No && mdatoms.nPerturbed != 0);
// We assume we have local force work if there are CPU
// force tasks including PME or nonbondeds.
domainWork.haveCpuLocalForceWork =
{
for (int j = 0; j < DIM; j++)
{
- muTotal[j] = (1.0 - lambda[efptCOUL]) * dipoleData->muStateAB[0][j]
- + lambda[efptCOUL] * dipoleData->muStateAB[1][j];
+ muTotal[j] = (1.0 - lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Coul)])
+ * dipoleData->muStateAB[0][j]
+ + lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Coul)]
+ * dipoleData->muStateAB[1][j];
}
}
}
cr,
box,
as_rvec_array(x.unpaddedArrayRef().data()),
- lambda[efptCOUL],
- lambda[efptVDW],
+ lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Coul)],
+ lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Vdw)],
(stepWork.computeVirial || stepWork.computeEnergy),
step,
simulationWork.useGpuPmePpCommunication,
cr,
box,
as_rvec_array(x.unpaddedArrayRef().data()),
- lambda[efptCOUL],
- lambda[efptVDW],
+ lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Coul)],
+ lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Vdw)],
(stepWork.computeVirial || stepWork.computeEnergy),
step,
simulationWork.useGpuPmePpCommunication,
if (useGpuPmeOnThisRank)
{
- launchPmeGpuSpread(fr->pmedata, box, stepWork, localXReadyOnDevice, lambda[efptCOUL], wcycle);
+ launchPmeGpuSpread(fr->pmedata,
+ box,
+ stepWork,
+ localXReadyOnDevice,
+ lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Coul)],
+ wcycle);
}
const gmx::DomainLifetimeWorkload& domainWork = runScheduleWork->domainWork;
// X copy/transform to allow overlap as well as after the GPU NB
// launch to avoid FFT launch overhead hijacking the CPU and delaying
// the nonbonded kernel.
- launchPmeGpuFftAndGather(fr->pmedata, lambda[efptCOUL], wcycle, stepWork);
+ launchPmeGpuFftAndGather(fr->pmedata,
+ lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Coul)],
+ wcycle,
+ stepWork);
}
/* Communicate coordinates and sum dipole if necessary +
dipoleData.muStaging[0],
dipoleData.muStaging[1]);
- reduceAndUpdateMuTot(&dipoleData, cr, (fr->efep != efepNO), lambda, muTotal, ddBalanceRegionHandler);
+ reduceAndUpdateMuTot(
+ &dipoleData, cr, (fr->efep != FreeEnergyPerturbationType::No), lambda, muTotal, ddBalanceRegionHandler);
}
/* Reset energies */
do_nb_verlet(fr, ic, enerd, stepWork, InteractionLocality::Local, enbvClearFYes, step, nrnb, wcycle);
}
- if (fr->efep != efepNO && stepWork.computeNonbondedForces)
+ if (fr->efep != FreeEnergyPerturbationType::No && stepWork.computeNonbondedForces)
{
/* Calculate the local and non-local free energy interactions here.
* Happens here on the CPU both with and without GPU.
as_rvec_array(x.unpaddedArrayRef().data()),
&forceOutNonbonded->forceWithShiftForces(),
*mdatoms,
- inputrec.fepvals,
+ inputrec.fepvals.get(),
lambda,
enerd,
stepWork,
as_rvec_array(x.unpaddedArrayRef().data()),
&forceOutNonbonded->forceWithShiftForces(),
*mdatoms,
- inputrec.fepvals,
+ inputrec.fepvals.get(),
lambda,
enerd,
stepWork,
*mdatoms,
x.unpaddedConstArrayRef(),
&forceOutMtsLevel0.forceWithVirial(),
- lambda[efptVDW],
+ lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Vdw)],
enerd->grpp.ener[egLJSR].data(),
nrnb);
- enerd->dvdl_lin[efptVDW] += dvdl_walls;
+ enerd->dvdl_lin[FreeEnergyPerturbationCouplingType::Vdw] += dvdl_walls;
}
if (stepWork.computeListedForces)
ForceOutputs& forceOut = (mtsIndex == 0 ? forceOutMtsLevel0 : *forceOutMtsLevel1);
listedForces.calculate(wcycle,
box,
- inputrec.fepvals,
+ inputrec.fepvals.get(),
cr,
ms,
x,
&pbc,
enerd,
nrnb,
- lambda.data(),
+ lambda,
mdatoms,
DOMAINDECOMP(cr) ? cr->dd->globalAtomIndices.data() : nullptr,
stepWork);
if ((stepWork.computeEnergy || stepWork.computeVirial) && fr->dispersionCorrection && MASTER(cr))
{
// Calculate long range corrections to pressure and energy
- const DispersionCorrection::Correction correction =
- fr->dispersionCorrection->calculate(box, lambda[efptVDW]);
+ const DispersionCorrection::Correction correction = fr->dispersionCorrection->calculate(
+ box, lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Vdw)]);
if (stepWork.computeEnergy)
{
enerd->term[F_DISPCORR] = correction.energy;
enerd->term[F_DVDL_VDW] += correction.dvdl;
- enerd->dvdl_lin[efptVDW] += correction.dvdl;
+ enerd->dvdl_lin[FreeEnergyPerturbationCouplingType::Vdw] += correction.dvdl;
}
if (stepWork.computeVirial)
{
&& !DOMAINDECOMP(cr) && !stepWork.useGpuFBufferOps);
if (alternateGpuWait)
{
- alternatePmeNbGpuWaitReduce(
- fr->nbv.get(), fr->pmedata, forceOutNonbonded, forceOutMtsLevel1, enerd, lambda[efptCOUL], stepWork, wcycle);
+ alternatePmeNbGpuWaitReduce(fr->nbv.get(),
+ fr->pmedata,
+ forceOutNonbonded,
+ forceOutMtsLevel1,
+ enerd,
+ lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Coul)],
+ stepWork,
+ wcycle);
}
if (!alternateGpuWait && useGpuPmeOnThisRank)
{
- pme_gpu_wait_and_reduce(
- fr->pmedata, stepWork, wcycle, &forceOutMtsLevel1->forceWithVirial(), enerd, lambda[efptCOUL]);
+ pme_gpu_wait_and_reduce(fr->pmedata,
+ stepWork,
+ wcycle,
+ &forceOutMtsLevel1->forceWithVirial(),
+ enerd,
+ lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Coul)]);
}
/* Wait for local GPU NB outputs on the non-alternating wait path */
if (stepWork.computeEnergy)
{
/* Compute the final potential energy terms */
- accumulatePotentialEnergies(enerd, lambda, inputrec.fepvals);
+ accumulatePotentialEnergies(enerd, lambda, inputrec.fepvals.get());
if (!EI_TPI(inputrec.eI))
{