"vscode:/vscode.git/clone" did not exist on "4cf722abcb765092d3f70a3b3032e59260e42bb6"
Unverified Commit d0a8058d authored by Andy Simmonett's avatar Andy Simmonett
Browse files

Replaced Nose-Hoover chain label by chain ID

parent 6343be0a
...@@ -57,13 +57,13 @@ public: ...@@ -57,13 +57,13 @@ public:
* This is the name of the parameter that stores the position of the ith bead * This is the name of the parameter that stores the position of the ith bead
*/ */
std::string Position(int i) const { std::string Position(int i) const {
return defaultLabel + "NoseHooverChainPosition" + std::to_string(i); return std::to_string(defaultChainID) + "NoseHooverChainPosition" + std::to_string(i);
} }
/** /**
* This is the name of the parameter that stores the velocity of the ith bead * This is the name of the parameter that stores the velocity of the ith bead
*/ */
std::string Velocity(int i) const { std::string Velocity(int i) const {
return defaultLabel + "NoseHooverChainVelocity" + std::to_string(i); return std::to_string(defaultChainID) + "NoseHooverChainVelocity" + std::to_string(i);
} }
/** /**
* Create a NoseHooverChain. * Create a NoseHooverChain.
...@@ -75,13 +75,13 @@ public: ...@@ -75,13 +75,13 @@ public:
* @param defaultChainLength the default length of (number of particles in) this heat bath * @param defaultChainLength the default length of (number of particles in) this heat bath
* @param defaultNumMTS the default number of multi time steps used to propagate this chain * @param defaultNumMTS the default number of multi time steps used to propagate this chain
* @param defaultNumYoshidaSuzuki the default number of Yoshida Suzuki steps used to propagate this chain (1, 3, or 5). * @param defaultNumYoshidaSuzuki the default number of Yoshida Suzuki steps used to propagate this chain (1, 3, or 5).
* @param defaultLabel the default label used to distinguish this Nose-Hoover chain from others that may * @param defaultChainID the default chain id used to distinguish this Nose-Hoover chain from others that may
* be used to control a different set of particles, e.g. for Drude oscillators * be used to control a different set of particles, e.g. for Drude oscillators
* @param thermostatedAtoms the list of atoms to be handled by this thermostat * @param thermostatedAtoms the list of atoms to be handled by this thermostat
* @param parentAtoms the list of parent atoms, if this thermostat handles Drude particles. Empty vector otherwise. * @param parentAtoms the list of parent atoms, if this thermostat handles Drude particles. Empty vector otherwise.
*/ */
NoseHooverChain(double defaultTemperature, double defaultCollisionFrequency, int defaultNumDOFs, int defaultChainLength, NoseHooverChain(double defaultTemperature, double defaultCollisionFrequency, int defaultNumDOFs, int defaultChainLength,
int defaultNumMTS, int defaultNumYoshidaSuzuki, const std::string &defaultLabel, int defaultNumMTS, int defaultNumYoshidaSuzuki, int defaultChainID,
const std::vector<int>& thermostatedAtoms, const std::vector<int>& parentAtoms); const std::vector<int>& thermostatedAtoms, const std::vector<int>& parentAtoms);
/** /**
* Get the default temperature of the heat bath (in Kelvin). * Get the default temperature of the heat bath (in Kelvin).
...@@ -188,21 +188,21 @@ public: ...@@ -188,21 +188,21 @@ public:
defaultNumYS = numSteps; defaultNumYS = numSteps;
} }
/** /**
* Get the default label used to identify this chain * Get the default chain id used to identify this chain
* *
* @returns the default label * @returns the default chain id
*/ */
std::string getDefaultLabel() const { int getDefaultChainID() const {
return defaultLabel; return defaultChainID;
} }
/** /**
* Set the default label used to identify this chain * Set the default chain id used to identify this chain
* This will affect any new Contexts you create, but not those that already exist. * This will affect any new Contexts you create, but not those that already exist.
* *
* @param the default label * @param the default chain id
*/ */
void setDefaultLabel(const std::string& label) { void setDefaultChainID(int chainID) {
defaultLabel = label; defaultChainID = chainID;
} }
/** /**
* Get the atom ids of all atoms that are thermostated * Get the atom ids of all atoms that are thermostated
...@@ -263,7 +263,7 @@ private: ...@@ -263,7 +263,7 @@ private:
double defaultTemp, defaultFreq, defaultTimeStep; double defaultTemp, defaultFreq, defaultTimeStep;
int defaultNumDOFs, defaultChainLength, defaultNumMTS, defaultNumYS; int defaultNumDOFs, defaultChainLength, defaultNumMTS, defaultNumYS;
// The suffix used to distinguish NH chains, e.g. for Drude particles vs. regular particles. // The suffix used to distinguish NH chains, e.g. for Drude particles vs. regular particles.
std::string defaultLabel; int defaultChainID;
std::vector<int> thermostatedAtoms, parentAtoms; std::vector<int> thermostatedAtoms, parentAtoms;
}; };
......
...@@ -37,11 +37,11 @@ using namespace OpenMM; ...@@ -37,11 +37,11 @@ using namespace OpenMM;
NoseHooverChain::NoseHooverChain(double defaultTemperature, double defaultCollisionFrequency, NoseHooverChain::NoseHooverChain(double defaultTemperature, double defaultCollisionFrequency,
int defaultNumDOFs, int defaultChainLength, int defaultNumMTS, int defaultNumDOFs, int defaultChainLength, int defaultNumMTS,
int defaultNumYoshidaSuzuki, const std::string &defaultLabel, int defaultNumYoshidaSuzuki, int defaultChainID,
const std::vector<int>& thermostatedAtoms, const std::vector<int>& parentAtoms): const std::vector<int>& thermostatedAtoms, const std::vector<int>& parentAtoms):
defaultTemp(defaultTemperature), defaultFreq(defaultCollisionFrequency), defaultNumDOFs(defaultNumDOFs), defaultTemp(defaultTemperature), defaultFreq(defaultCollisionFrequency), defaultNumDOFs(defaultNumDOFs),
defaultChainLength(defaultChainLength), defaultNumMTS(defaultNumMTS), defaultNumYS(defaultNumYoshidaSuzuki), defaultChainLength(defaultChainLength), defaultNumMTS(defaultNumMTS), defaultNumYS(defaultNumYoshidaSuzuki),
defaultLabel(defaultLabel), thermostatedAtoms(thermostatedAtoms), parentAtoms(parentAtoms) defaultChainID(defaultChainID), thermostatedAtoms(thermostatedAtoms), parentAtoms(parentAtoms)
{} {}
ForceImpl* NoseHooverChain::createImpl() const { ForceImpl* NoseHooverChain::createImpl() const {
......
...@@ -81,7 +81,7 @@ int VelocityVerletIntegrator::addNoseHooverChainThermostat(System& system, doubl ...@@ -81,7 +81,7 @@ int VelocityVerletIntegrator::addNoseHooverChainThermostat(System& system, doubl
} }
auto nhcForce = new NoseHooverChain(temperature, collisionFrequency, nDOF, chainLength, auto nhcForce = new NoseHooverChain(temperature, collisionFrequency, nDOF, chainLength,
numMTS, numYoshidaSuzuki, std::to_string(noseHooverChains.size()), numMTS, numYoshidaSuzuki, noseHooverChains.size(),
thermostatedParticles, parentParticles); thermostatedParticles, parentParticles);
system.addForce(nhcForce); system.addForce(nhcForce);
noseHooverChains.push_back(nhcForce); noseHooverChains.push_back(nhcForce);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment