/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 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.
namespace test
{
-LeapFrogTestData::LeapFrogTestData(int numAtoms, real timestep, const rvec v0, const rvec f0, int numTCoupleGroups, int nstpcouple) :
+LeapFrogTestData::LeapFrogTestData(int numAtoms,
+ real timestep,
+ const rvec v0,
+ const rvec f0,
+ int numTCoupleGroups,
+ int nstpcouple) :
numAtoms_(numAtoms),
timestep_(timestep),
x0_(numAtoms),
f_(numAtoms),
inverseMasses_(numAtoms),
inverseMassesPerDim_(numAtoms),
+ kineticEnergyData_(numTCoupleGroups == 0 ? 1 : numTCoupleGroups, 0.0, 1),
numTCoupleGroups_(numTCoupleGroups)
{
mdAtoms_.nr = numAtoms_;
for (int i = 0; i < numAtoms_; i++)
{
// Typical PBC box size is tens of nanometers
- x_[i][XX] = (i%21)*1.0;
- x_[i][YY] = 6.5 + (i%13)*(-1.0);
- x_[i][ZZ] = (i%32)*(0.0);
+ x_[i][XX] = (i % 21) * 1.0;
+ x_[i][YY] = 6.5 + (i % 13) * (-1.0);
+ x_[i][ZZ] = (i % 32) * (0.0);
for (int d = 0; d < DIM; d++)
{
v0_[i][d] = v_[i][d];
}
// Atom masses are ~1-100 g/mol
- inverseMasses_[i] = 1.0/(1.0 + i%100);
+ inverseMasses_[i] = 1.0 / (1.0 + i % 100);
for (int d = 0; d < DIM; d++)
{
inverseMassesPerDim_[i][d] = inverseMasses_[i];
if (numTCoupleGroups_ == 0)
{
- inputRecord_.etc = etcNO;
+ inputRecord_.etc = TemperatureCoupling::No;
for (int i = 0; i < numAtoms_; i++)
{
mdAtoms_.cTC[i] = 0;
}
- kineticEnergyData_.ngtc = 1;
t_grp_tcstat temperatureCouplingGroupData;
temperatureCouplingGroupData.lambda = 1.0;
- kineticEnergyData_.tcstat.emplace_back(temperatureCouplingGroupData);
+ kineticEnergyData_.tcstat[0] = temperatureCouplingGroupData;
}
else
{
- inputRecord_.etc = etcYES;
+ inputRecord_.etc = TemperatureCoupling::Yes;
for (int i = 0; i < numAtoms_; i++)
{
mdAtoms_.cTC[i] = i % numTCoupleGroups_;
}
- kineticEnergyData_.ngtc = numTCoupleGroups_;
- for (int i = 0; i < numTCoupleGroups; i++)
+ for (int i = 0; i < numTCoupleGroups_; i++)
{
- real tCoupleLambda = 1.0 - (i + 1.0)/10.0;
+ real tCoupleLambda = 1.0 - (i + 1.0) / 10.0;
t_grp_tcstat temperatureCouplingGroupData;
temperatureCouplingGroupData.lambda = tCoupleLambda;
- kineticEnergyData_.tcstat.emplace_back(temperatureCouplingGroupData);
+ kineticEnergyData_.tcstat[i] = temperatureCouplingGroupData;
}
}
- inputRecord_.eI = eiMD;
+ inputRecord_.eI = IntegrationAlgorithm::MD;
inputRecord_.delta_t = timestep_;
state_.flags = 0;
state_.box[ZZ][YY] = 0.0;
state_.box[ZZ][ZZ] = 10.0;
- kineticEnergyData_.bNEMD = false;
- kineticEnergyData_.cosacc.cos_accel = 0.0;
-
- kineticEnergyData_.nthreads = 1;
- snew(kineticEnergyData_.ekin_work_alloc, kineticEnergyData_.nthreads);
- snew(kineticEnergyData_.ekin_work, kineticEnergyData_.nthreads);
- snew(kineticEnergyData_.dekindl_work, kineticEnergyData_.nthreads);
-
mdAtoms_.homenr = numAtoms_;
mdAtoms_.haveVsites = false;
mdAtoms_.havePartiallyFrozenAtoms = false;
mdAtoms_.cFREEZE = nullptr;
+ mdAtoms_.ptype = nullptr;
- update_ = std::make_unique<Update>(&inputRecord_, nullptr);
- update_->setNumAtoms(numAtoms);
+ update_ = std::make_unique<Update>(inputRecord_, nullptr);
+ update_->updateAfterPartition(numAtoms,
+ gmx::ArrayRef<const unsigned short>(),
+ gmx::arrayRefFromArray(mdAtoms_.cTC, mdAtoms_.nr),
+ gmx::ArrayRef<const unsigned short>());
doPressureCouple_ = (nstpcouple != 0);
if (doPressureCouple_)
{
- inputRecord_.epc = epcPARRINELLORAHMAN;
+ inputRecord_.epc = PressureCoupling::ParrinelloRahman;
inputRecord_.nstpcouple = nstpcouple;
- dtPressureCouple_ = inputRecord_.nstpcouple*inputRecord_.delta_t;
+ dtPressureCouple_ = inputRecord_.nstpcouple * inputRecord_.delta_t;
velocityScalingMatrix_[XX][XX] = 1.2;
velocityScalingMatrix_[XX][YY] = 0.0;
}
else
{
- inputRecord_.epc = epcNO;
+ inputRecord_.epc = PressureCoupling::No;
velocityScalingMatrix_[XX][XX] = 1.0;
velocityScalingMatrix_[XX][YY] = 0.0;
velocityScalingMatrix_[XX][ZZ] = 0.0;
velocityScalingMatrix_[ZZ][YY] = 0.0;
velocityScalingMatrix_[ZZ][ZZ] = 1.0;
}
-
}
LeapFrogTestData::~LeapFrogTestData()
sfree(mdAtoms_.cTC);
}
-} // namespace test
-} // namespace gmx
+} // namespace test
+} // namespace gmx