* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_vcm::t_vcm(const SimulationGroups& groups, const t_inputrec& ir) :
integratorConservesMomentum(!EI_RANDOM(ir.eI))
{
- mode = (ir.nstcomm > 0) ? ir.comm_mode : ecmNO;
+ mode = (ir.nstcomm > 0) ? ir.comm_mode : ComRemovalAlgorithm::No;
ndim = ndof_com(&ir);
timeStep = ir.nstcomm * ir.delta_t;
- if (mode == ecmANGULAR && ndim < 3)
+ if (mode == ComRemovalAlgorithm::Angular && ndim < 3)
{
gmx_fatal(FARGS, "Can not have angular comm removal with pbc=%s", c_pbcTypeNames[ir.pbcType].c_str());
}
- if (mode != ecmNO)
+ if (mode != ComRemovalAlgorithm::No)
{
nr = groups.groups[SimulationAtomGroupType::MassCenterVelocityRemoval].size();
/* Allocate one extra for a possible rest group */
* invalidation we add 2 elements to get a 152 byte separation.
*/
stride = nr + 3;
- if (mode == ecmANGULAR)
+ if (mode == ComRemovalAlgorithm::Angular)
{
snew(group_i, size);
t_vcm::~t_vcm()
{
- if (mode == ecmANGULAR)
+ if (mode == ComRemovalAlgorithm::Angular)
{
sfree(group_i);
}
{
/* Copy pointer to group names and print it. */
- if (fp && vcm.mode != ecmNO)
+ if (fp && vcm.mode != ComRemovalAlgorithm::No)
{
- fprintf(fp, "Center of mass motion removal mode is %s\n", ECOM(vcm.mode));
+ fprintf(fp, "Center of mass motion removal mode is %s\n", enumValueToString(vcm.mode));
fprintf(fp,
"We have the following groups for center of"
" mass motion removal:\n");
gmx::ArrayRef<const gmx::RVec> v,
t_vcm* vcm)
{
- if (vcm->mode == ecmNO)
+ if (vcm->mode == ComRemovalAlgorithm::No)
{
return;
}
t_vcm_thread* vcm_t = &vcm->thread_vcm[t * vcm->stride + g];
vcm_t->mass = 0;
clear_rvec(vcm_t->p);
- if (vcm->mode == ecmANGULAR)
+ if (vcm->mode == ComRemovalAlgorithm::Angular)
{
/* Reset angular momentum */
clear_rvec(vcm_t->j);
vcm_t->p[m] += m0 * v[i][m];
}
- if (vcm->mode == ecmANGULAR)
+ if (vcm->mode == ComRemovalAlgorithm::Angular)
{
/* Calculate angular momentum */
rvec j0;
/* Reset linear momentum */
vcm->group_mass[g] = 0;
clear_rvec(vcm->group_p[g]);
- if (vcm->mode == ecmANGULAR)
+ if (vcm->mode == ComRemovalAlgorithm::Angular)
{
/* Reset angular momentum */
clear_rvec(vcm->group_j[g]);
t_vcm_thread* vcm_t = &vcm->thread_vcm[t * vcm->stride + g];
vcm->group_mass[g] += vcm_t->mass;
rvec_inc(vcm->group_p[g], vcm_t->p);
- if (vcm->mode == ecmANGULAR)
+ if (vcm->mode == ComRemovalAlgorithm::Angular)
{
rvec_inc(vcm->group_j[g], vcm_t->j);
rvec_inc(vcm->group_x[g], vcm_t->x);
gmx::ArrayRef<gmx::RVec> v,
const t_vcm& vcm)
{
- if (vcm.mode == ecmNO)
+ if (vcm.mode == ComRemovalAlgorithm::No)
{
return;
}
#pragma omp parallel num_threads(nth) default(none) shared(x, v, vcm, group_id, mdatoms) \
firstprivate(homenr)
{
- if (vcm.mode == ecmLINEAR || vcm.mode == ecmANGULAR
- || (vcm.mode == ecmLINEAR_ACCELERATION_CORRECTION && x.empty()))
+ if (vcm.mode == ComRemovalAlgorithm::Linear || vcm.mode == ComRemovalAlgorithm::Angular
+ || (vcm.mode == ComRemovalAlgorithm::LinearAccelerationCorrection && x.empty()))
{
/* Subtract linear momentum for v */
switch (vcm.ndim)
}
else
{
- GMX_ASSERT(vcm.mode == ecmLINEAR_ACCELERATION_CORRECTION,
+ GMX_ASSERT(vcm.mode == ComRemovalAlgorithm::LinearAccelerationCorrection,
"When the mode is not linear or angular, it should be acceleration "
"correction");
/* Subtract linear momentum for v and x*/
break;
}
}
- if (vcm.mode == ecmANGULAR)
+ if (vcm.mode == ComRemovalAlgorithm::Angular)
{
/* Subtract angular momentum */
GMX_ASSERT(!x.empty(), "Need x to compute angular momentum correction");
tensor Icm;
/* First analyse the total results */
- if (vcm->mode != ecmNO)
+ if (vcm->mode != ComRemovalAlgorithm::No)
{
for (g = 0; (g < vcm->nr); g++)
{
}
/* Else it's zero anyway! */
}
- if (vcm->mode == ecmANGULAR)
+ if (vcm->mode == ComRemovalAlgorithm::Angular)
{
for (g = 0; (g < vcm->nr); g++)
{
Temp_cm);
}
- if (vcm->mode == ecmANGULAR)
+ if (vcm->mode == ComRemovalAlgorithm::Angular)
{
ekrot = 0.5 * iprod(vcm->group_j[g], vcm->group_w[g]);
// TODO: Change absolute energy comparison to relative
gmx::ArrayRef<gmx::RVec> x,
gmx::ArrayRef<gmx::RVec> v)
{
- if (vcm->mode != ecmNO)
+ if (vcm->mode != ComRemovalAlgorithm::No)
{
// TODO: Replace fixed temperature of 1 by a system value
process_and_check_cm_grp(fplog, vcm, 1);