#include "parrinellorahmanbarostat.h"
#include "simulatoralgorithm.h"
#include "statepropagatordata.h"
-#include "vrescalethermostat.h"
+#include "velocityscalingtemperaturecoupling.h"
struct pull_t;
class t_state;
startingBehavior_(startingBehavior),
statePropagatorData_(statePropagatorData),
freeEnergyPerturbationData_(freeEnergyPerturbationData),
- vRescaleThermostat_(nullptr),
+ velocityScalingTemperatureCoupling_(nullptr),
parrinelloRahmanBarostat_(nullptr),
inputrec_(inputrec),
top_global_(globalTopology),
{
enerd_->term[F_ECONSERVED] =
enerd_->term[F_ETOT]
- + (vRescaleThermostat_ ? vRescaleThermostat_->conservedEnergyContribution() : 0)
+ + (velocityScalingTemperatureCoupling_
+ ? velocityScalingTemperatureCoupling_->conservedEnergyContribution()
+ : 0)
+ (parrinelloRahmanBarostat_ ? parrinelloRahmanBarostat_->conservedEnergyContribution() : 0);
}
matrix nullMatrix = {};
energyOutput->fillEnergyHistory(observablesHistory->energyHistory.get());
}
-void EnergyData::setVRescaleThermostat(const gmx::VRescaleThermostat* vRescaleThermostat)
+void EnergyData::setVelocityScalingTemperatureCoupling(const VelocityScalingTemperatureCoupling* velocityScalingTemperatureCoupling)
{
- vRescaleThermostat_ = vRescaleThermostat;
+ velocityScalingTemperatureCoupling_ = velocityScalingTemperatureCoupling;
}
void EnergyData::setParrinelloRahamnBarostat(const gmx::ParrinelloRahmanBarostat* parrinelloRahmanBarostat)
class ModularSimulatorAlgorithmBuilderHelper;
class ParrinelloRahmanBarostat;
class StatePropagatorData;
-class VRescaleThermostat;
+class VelocityScalingTemperatureCoupling;
struct MdModulesNotifier;
/*! \internal
*/
[[nodiscard]] bool hasReadEkinFromCheckpoint() const;
- /*! \brief set vrescale thermostat
+ /*! \brief Set velocity scaling temperature coupling
*
- * This allows to set a pointer to the vrescale thermostat used to
- * print the thermostat integral.
+ * This allows to set a pointer to a velocity scaling temperature coupling
+ * element used to obtain contributions to the conserved energy.
* TODO: This should be made obsolete my a more modular energy element
*/
- void setVRescaleThermostat(const VRescaleThermostat* vRescaleThermostat);
+ void setVelocityScalingTemperatureCoupling(const VelocityScalingTemperatureCoupling* velocityScalingTemperatureCoupling);
/*! \brief set Parrinello-Rahman barostat
*
//! Pointer to the free energy perturbation data
FreeEnergyPerturbationData* freeEnergyPerturbationData_;
//! Pointer to the vrescale thermostat
- const VRescaleThermostat* vRescaleThermostat_;
+ const VelocityScalingTemperatureCoupling* velocityScalingTemperatureCoupling_;
//! Pointer to the Parrinello-Rahman barostat
const ParrinelloRahmanBarostat* parrinelloRahmanBarostat_;
//! Contains user input mdp options.
#include "parrinellorahmanbarostat.h"
#include "simulatoralgorithm.h"
#include "statepropagatordata.h"
-#include "vrescalethermostat.h"
+#include "velocityscalingtemperaturecoupling.h"
namespace gmx
{
builder->add<StatePropagatorData::Element>();
if (legacySimulatorData_->inputrec->etc == etcVRESCALE)
{
- builder->add<VRescaleThermostat>(-1, UseFullStepKE::No, ReportPreviousStepConservedEnergy::No);
+ builder->add<VelocityScalingTemperatureCoupling>(-1, UseFullStepKE::No,
+ ReportPreviousStepConservedEnergy::No);
}
builder->add<Propagator<IntegrationStep::LeapFrog>>(legacySimulatorData_->inputrec->delta_t,
RegisterWithThermostat::True,
builder->add<StatePropagatorData::Element>();
if (legacySimulatorData_->inputrec->etc == etcVRESCALE)
{
- builder->add<VRescaleThermostat>(0, UseFullStepKE::Yes, ReportPreviousStepConservedEnergy::Yes);
+ builder->add<VelocityScalingTemperatureCoupling>(
+ 0, UseFullStepKE::Yes, ReportPreviousStepConservedEnergy::Yes);
}
builder->add<Propagator<IntegrationStep::VelocityVerletPositionsAndVelocities>>(
legacySimulatorData_->inputrec->delta_t, RegisterWithThermostat::True,
#include "pmeloadbalancehelper.h"
#include "propagator.h"
#include "statepropagatordata.h"
-#include "vrescalethermostat.h"
+#include "velocityscalingtemperaturecoupling.h"
namespace gmx
{
* the research papers on the package. Check out http://www.gromacs.org.
*/
/*! \internal \file
- * \brief Defines the v-rescale thermostat for the modular simulator
+ * \brief Defines a velocity-scaling temperature coupling element for
+ * the modular simulator
*
* \author Pascal Merz <pascal.merz@me.com>
* \ingroup module_modularsimulator
#include "gmxpre.h"
-#include "vrescalethermostat.h"
+#include "velocityscalingtemperaturecoupling.h"
#include <numeric>
namespace gmx
{
-VRescaleThermostat::VRescaleThermostat(int nstcouple,
- int offset,
- UseFullStepKE useFullStepKE,
- ReportPreviousStepConservedEnergy reportPreviousConservedEnergy,
- int64_t seed,
- int numTemperatureGroups,
- double couplingTimeStep,
- const real* referenceTemperature,
- const real* couplingTime,
- const real* numDegreesOfFreedom,
- EnergyData* energyData) :
+VelocityScalingTemperatureCoupling::VelocityScalingTemperatureCoupling(
+ int nstcouple,
+ int offset,
+ UseFullStepKE useFullStepKE,
+ ReportPreviousStepConservedEnergy reportPreviousConservedEnergy,
+ int64_t seed,
+ int numTemperatureGroups,
+ double couplingTimeStep,
+ const real* referenceTemperature,
+ const real* couplingTime,
+ const real* numDegreesOfFreedom,
+ EnergyData* energyData) :
nstcouple_(nstcouple),
offset_(offset),
useFullStepKE_(useFullStepKE),
{
thermostatIntegralPreviousStep_ = thermostatIntegral_;
}
- energyData->setVRescaleThermostat(this);
+ energyData->setVelocityScalingTemperatureCoupling(this);
}
-void VRescaleThermostat::connectWithPropagator(const PropagatorThermostatConnection& connectionData)
+void VelocityScalingTemperatureCoupling::connectWithPropagator(const PropagatorThermostatConnection& connectionData)
{
connectionData.setNumVelocityScalingVariables(numTemperatureGroups_);
lambda_ = connectionData.getViewOnVelocityScaling();
propagatorCallback_ = connectionData.getVelocityScalingCallback();
}
-void VRescaleThermostat::elementSetup()
+void VelocityScalingTemperatureCoupling::elementSetup()
{
if (!propagatorCallback_ || lambda_.empty())
{
throw MissingElementConnectionError(
- "V-rescale thermostat was not connected to a propagator.\n"
+ "Velocity scaling temperature coupling was not connected to a propagator.\n"
"Connection to a propagator element is needed to scale the velocities.\n"
"Use connectWithPropagator(...) before building the ModularSimulatorAlgorithm "
"object.");
}
}
-void VRescaleThermostat::scheduleTask(Step step, Time gmx_unused time, const RegisterRunFunction& registerRunFunction)
+void VelocityScalingTemperatureCoupling::scheduleTask(Step step,
+ Time gmx_unused time,
+ const RegisterRunFunction& registerRunFunction)
{
/* The thermostat will need a valid kinetic energy when it is running.
* Currently, computeGlobalCommunicationPeriod() is making sure this
}
}
-void VRescaleThermostat::setLambda(Step step)
+void VelocityScalingTemperatureCoupling::setLambda(Step step)
{
// if we report the previous energy, calculate before the step
if (reportPreviousConservedEnergy_ == ReportPreviousStepConservedEnergy::Yes)
namespace
{
/*!
- * \brief Enum describing the contents VRescaleThermostat writes to modular checkpoint
+ * \brief Enum describing the contents VelocityScalingTemperatureCoupling writes to modular checkpoint
*
* When changing the checkpoint content, add a new element just above Count, and adjust the
* checkpoint functionality.
} // namespace
template<CheckpointDataOperation operation>
-void VRescaleThermostat::doCheckpointData(CheckpointData<operation>* checkpointData, const t_commrec* cr)
+void VelocityScalingTemperatureCoupling::doCheckpointData(CheckpointData<operation>* checkpointData,
+ const t_commrec* cr)
{
if (MASTER(cr))
{
}
}
-void VRescaleThermostat::writeCheckpoint(WriteCheckpointData checkpointData, const t_commrec* cr)
+void VelocityScalingTemperatureCoupling::writeCheckpoint(WriteCheckpointData checkpointData,
+ const t_commrec* cr)
{
doCheckpointData<CheckpointDataOperation::Write>(&checkpointData, cr);
}
-void VRescaleThermostat::readCheckpoint(ReadCheckpointData checkpointData, const t_commrec* cr)
+void VelocityScalingTemperatureCoupling::readCheckpoint(ReadCheckpointData checkpointData,
+ const t_commrec* cr)
{
doCheckpointData<CheckpointDataOperation::Read>(&checkpointData, cr);
}
-const std::string& VRescaleThermostat::clientID()
+const std::string& VelocityScalingTemperatureCoupling::clientID()
{
return identifier_;
}
-real VRescaleThermostat::conservedEnergyContribution() const
+real VelocityScalingTemperatureCoupling::conservedEnergyContribution() const
{
return (reportPreviousConservedEnergy_ == ReportPreviousStepConservedEnergy::Yes)
? std::accumulate(thermostatIntegralPreviousStep_.begin(),
: std::accumulate(thermostatIntegral_.begin(), thermostatIntegral_.end(), 0.0);
}
-ISimulatorElement* VRescaleThermostat::getElementPointerImpl(
+ISimulatorElement* VelocityScalingTemperatureCoupling::getElementPointerImpl(
LegacySimulatorData* legacySimulatorData,
ModularSimulatorAlgorithmBuilderHelper* builderHelper,
StatePropagatorData gmx_unused* statePropagatorData,
UseFullStepKE useFullStepKE,
ReportPreviousStepConservedEnergy reportPreviousStepConservedEnergy)
{
- auto* element = builderHelper->storeElement(std::make_unique<VRescaleThermostat>(
+ auto* element = builderHelper->storeElement(std::make_unique<VelocityScalingTemperatureCoupling>(
legacySimulatorData->inputrec->nsttcouple, offset, useFullStepKE, reportPreviousStepConservedEnergy,
legacySimulatorData->inputrec->ld_seed, legacySimulatorData->inputrec->opts.ngtc,
legacySimulatorData->inputrec->delta_t * legacySimulatorData->inputrec->nsttcouple,
legacySimulatorData->inputrec->opts.ref_t, legacySimulatorData->inputrec->opts.tau_t,
legacySimulatorData->inputrec->opts.nrdf, energyData));
- auto* thermostat = static_cast<VRescaleThermostat*>(element);
+ auto* thermostat = static_cast<VelocityScalingTemperatureCoupling*>(element);
builderHelper->registerThermostat([thermostat](const PropagatorThermostatConnection& connection) {
thermostat->connectWithPropagator(connection);
});
* the research papers on the package. Check out http://www.gromacs.org.
*/
/*! \internal \file
- * \brief Declares the v-rescale thermostat for the modular simulator
+ * \brief Declares a velocity-scaling temperature coupling element for
+ * the modular simulator
*
* \author Pascal Merz <pascal.merz@me.com>
* \ingroup module_modularsimulator
* This header is only used within the modular simulator module
*/
-#ifndef GMX_MODULARSIMULATOR_VRESCALETHERMOSTAT_H
-#define GMX_MODULARSIMULATOR_VRESCALETHERMOSTAT_H
+#ifndef GMX_MODULARSIMULATOR_VELOCITYSCALINGTEMPERATURECOUPLING_H
+#define GMX_MODULARSIMULATOR_VELOCITYSCALINGTEMPERATURECOUPLING_H
#include "gromacs/utility/arrayref.h"
* This element takes a callback to the propagator and updates the velocity
* scaling factor according to the v-rescale thermostat.
*/
-class VRescaleThermostat final : public ISimulatorElement, public ICheckpointHelperClient
+class VelocityScalingTemperatureCoupling final : public ISimulatorElement, public ICheckpointHelperClient
{
public:
//! Constructor
- VRescaleThermostat(int nstcouple,
- int offset,
- UseFullStepKE useFullStepKE,
- ReportPreviousStepConservedEnergy reportPreviousConservedEnergy,
- int64_t seed,
- int numTemperatureGroups,
- double couplingTimeStep,
- const real* referenceTemperature,
- const real* couplingTime,
- const real* numDegreesOfFreedom,
- EnergyData* energyData);
+ VelocityScalingTemperatureCoupling(int nstcouple,
+ int offset,
+ UseFullStepKE useFullStepKE,
+ ReportPreviousStepConservedEnergy reportPreviousConservedEnergy,
+ int64_t seed,
+ int numTemperatureGroups,
+ double couplingTimeStep,
+ const real* referenceTemperature,
+ const real* couplingTime,
+ const real* numDegreesOfFreedom,
+ EnergyData* energyData);
/*! \brief Register run function for step / time
*
void setLambda(Step step);
//! CheckpointHelper identifier
- const std::string identifier_ = "VRescaleThermostat";
+ const std::string identifier_ = "VelocityScalingTemperatureCoupling";
//! Helper function to read from / write to CheckpointData
template<CheckpointDataOperation operation>
void doCheckpointData(CheckpointData<operation>* checkpointData, const t_commrec* cr);
} // namespace gmx
-#endif // GMX_MODULARSIMULATOR_VRESCALETHERMOSTAT_H
+#endif // GMX_MODULARSIMULATOR_VELOCITYSCALINGTEMPERATURECOUPLING_H