Commit 2e9c418a authored by peastman's avatar peastman
Browse files

Merge branch 'master' into gayberne

parents 8f532e31 a4d327f5
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -89,15 +89,21 @@ void Platform::setPropertyValue(Context& context, const string& property, const ...@@ -89,15 +89,21 @@ void Platform::setPropertyValue(Context& context, const string& property, const
} }
const string& Platform::getPropertyDefaultValue(const string& property) const { const string& Platform::getPropertyDefaultValue(const string& property) const {
map<string, string>::const_iterator value = defaultProperties.find(property); string propertyName = property;
if (deprecatedPropertyReplacements.find(property) != deprecatedPropertyReplacements.end())
propertyName = deprecatedPropertyReplacements.find(property)->second;
map<string, string>::const_iterator value = defaultProperties.find(propertyName);
if (value == defaultProperties.end()) if (value == defaultProperties.end())
throw OpenMMException("getPropertyDefaultValue: Illegal property name"); throw OpenMMException("getPropertyDefaultValue: Illegal property name");
return value->second; return value->second;
} }
void Platform::setPropertyDefaultValue(const string& property, const string& value) { void Platform::setPropertyDefaultValue(const string& property, const string& value) {
string propertyName = property;
if (deprecatedPropertyReplacements.find(property) != deprecatedPropertyReplacements.end())
propertyName = deprecatedPropertyReplacements.find(property)->second;
for (int i = 0; i < (int) platformProperties.size(); i++) for (int i = 0; i < (int) platformProperties.size(); i++)
if (platformProperties[i] == property) { if (platformProperties[i] == propertyName) {
defaultProperties[property] = value; defaultProperties[property] = value;
return; return;
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010-2015 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -159,15 +159,18 @@ public: ...@@ -159,15 +159,18 @@ public:
* new bonds and torsions cannot be added. * new bonds and torsions cannot be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns false * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -175,6 +178,7 @@ private: ...@@ -175,6 +178,7 @@ private:
class CMAPTorsionInfo; class CMAPTorsionInfo;
std::vector<MapInfo> maps; std::vector<MapInfo> maps;
std::vector<CMAPTorsionInfo> torsions; std::vector<CMAPTorsionInfo> torsions;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010-2012 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -203,15 +203,18 @@ public: ...@@ -203,15 +203,18 @@ public:
* the Context. The set of particles involved in a angle cannot be changed, nor can new angles be added. * the Context. The set of particles involved in a angle cannot be changed, nor can new angles be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns false * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -222,6 +225,7 @@ private: ...@@ -222,6 +225,7 @@ private:
std::vector<AngleParameterInfo> parameters; std::vector<AngleParameterInfo> parameters;
std::vector<GlobalParameterInfo> globalParameters; std::vector<GlobalParameterInfo> globalParameters;
std::vector<AngleInfo> angles; std::vector<AngleInfo> angles;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -200,15 +200,18 @@ public: ...@@ -200,15 +200,18 @@ public:
* the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added. * the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns false * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -219,6 +222,7 @@ private: ...@@ -219,6 +222,7 @@ private:
std::vector<BondParameterInfo> parameters; std::vector<BondParameterInfo> parameters;
std::vector<GlobalParameterInfo> globalParameters; std::vector<GlobalParameterInfo> globalParameters;
std::vector<BondInfo> bonds; std::vector<BondInfo> bonds;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2015 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -324,15 +324,18 @@ public: ...@@ -324,15 +324,18 @@ public:
* bonds be added. * bonds be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns false * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -348,6 +351,7 @@ private: ...@@ -348,6 +351,7 @@ private:
std::vector<GroupInfo> groups; std::vector<GroupInfo> groups;
std::vector<BondInfo> bonds; std::vector<BondInfo> bonds;
std::vector<FunctionInfo> functions; std::vector<FunctionInfo> functions;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2014 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -298,15 +298,18 @@ public: ...@@ -298,15 +298,18 @@ public:
* the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added. * the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns false * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -320,6 +323,7 @@ private: ...@@ -320,6 +323,7 @@ private:
std::vector<GlobalParameterInfo> globalParameters; std::vector<GlobalParameterInfo> globalParameters;
std::vector<BondInfo> bonds; std::vector<BondInfo> bonds;
std::vector<FunctionInfo> functions; std::vector<FunctionInfo> functions;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2011-2012 Stanford University and the Authors. * * Portions copyright (c) 2011-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -266,15 +266,15 @@ public: ...@@ -266,15 +266,15 @@ public:
/** /**
* Begin an "if" block. * Begin an "if" block.
*/ */
BeginIfBlock = 6, IfBlockStart = 6,
/** /**
* Begin a while" block. * Begin a while" block.
*/ */
BeginWhileBlock = 7, WhileBlockStart = 7,
/** /**
* End an "if" or "while" block. * End an "if" or "while" block.
*/ */
EndBlock = 8 BlockEnd = 8
}; };
/** /**
* Create a CustomIntegrator. * Create a CustomIntegrator.
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010-2012 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -206,15 +206,18 @@ public: ...@@ -206,15 +206,18 @@ public:
* the Context. The set of particles involved in a torsion cannot be changed, nor can new torsions be added. * the Context. The set of particles involved in a torsion cannot be changed, nor can new torsions be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns true if force uses PBC and false otherwise * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -225,6 +228,7 @@ private: ...@@ -225,6 +228,7 @@ private:
std::vector<TorsionParameterInfo> parameters; std::vector<TorsionParameterInfo> parameters;
std::vector<GlobalParameterInfo> globalParameters; std::vector<GlobalParameterInfo> globalParameters;
std::vector<TorsionInfo> torsions; std::vector<TorsionInfo> torsions;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -102,20 +102,23 @@ public: ...@@ -102,20 +102,23 @@ public:
* in a angle cannot be changed, nor can new angles be added. * in a angle cannot be changed, nor can new angles be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns true if force uses PBC and false otherwise * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;protected:
return false;
}
protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
class AngleInfo; class AngleInfo;
std::vector<AngleInfo> angles; std::vector<AngleInfo> angles;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -99,20 +99,24 @@ public: ...@@ -99,20 +99,24 @@ public:
* in a bond cannot be changed, nor can new bonds be added. * in a bond cannot be changed, nor can new bonds be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns true if force uses PBC and false otherwise * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
class BondInfo; class BondInfo;
std::vector<BondInfo> bonds; std::vector<BondInfo> bonds;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010-2013 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman, Lee-Ping Wang * * Authors: Peter Eastman, Lee-Ping Wang *
* Contributors: * * Contributors: *
* * * *
...@@ -81,17 +81,25 @@ public: ...@@ -81,17 +81,25 @@ public:
static const std::string key = "MonteCarloPressureZ"; static const std::string key = "MonteCarloPressureZ";
return key; return key;
} }
/**
* This is the name of the parameter which stores the current temperature at which the
* system is being maintained (in Kelvin)
*/
static const std::string& Temperature() {
static const std::string key = "AnisotropicMonteCarloTemperature";
return key;
}
/** /**
* Create a MonteCarloAnisotropicBarostat. * Create a MonteCarloAnisotropicBarostat.
* *
* @param defaultPressure The default pressure acting on each axis (in bar) * @param defaultPressure The default pressure acting on each axis (in bar)
* @param temperature the temperature at which the system is being maintained (in Kelvin) * @param defaultTemperature the default temperature at which the system is being maintained (in Kelvin)
* @param scaleX whether to allow the X dimension of the periodic box to change size * @param scaleX whether to allow the X dimension of the periodic box to change size
* @param scaleY whether to allow the Y dimension of the periodic box to change size * @param scaleY whether to allow the Y dimension of the periodic box to change size
* @param scaleZ whether to allow the Z dimension of the periodic box to change size * @param scaleZ whether to allow the Z dimension of the periodic box to change size
* @param frequency the frequency at which Monte Carlo pressure changes should be attempted (in time steps) * @param frequency the frequency at which Monte Carlo pressure changes should be attempted (in time steps)
*/ */
MonteCarloAnisotropicBarostat(const Vec3& defaultPressure, double temperature, bool scaleX = true, bool scaleY = true, bool scaleZ = true, int frequency = 25); MonteCarloAnisotropicBarostat(const Vec3& defaultPressure, double defaultTemperature, bool scaleX = true, bool scaleY = true, bool scaleZ = true, int frequency = 25);
/** /**
* Get the default pressure (in bar). * Get the default pressure (in bar).
* *
...@@ -142,18 +150,19 @@ public: ...@@ -142,18 +150,19 @@ public:
frequency = freq; frequency = freq;
} }
/** /**
* Get the temperature at which the system is being maintained, measured in Kelvin. * Get the default temperature at which the system is being maintained, measured in Kelvin.
*/ */
double getTemperature() const { double getDefaultTemperature() const {
return temperature; return defaultTemperature;
} }
/** /**
* Set the temperature at which the system is being maintained. * Set the default temperature at which the system is being maintained. This will affect any new Contexts you create,
* but not ones that already exist.
* *
* @param temp the system temperature, measured in Kelvin. * @param temp the system temperature, measured in Kelvin.
*/ */
void setTemperature(double temp) { void setDefaultTemperature(double temp) {
temperature = temp; defaultTemperature = temp;
} }
/** /**
* Get the random number seed. See setRandomNumberSeed() for details. * Get the random number seed. See setRandomNumberSeed() for details.
...@@ -188,7 +197,7 @@ protected: ...@@ -188,7 +197,7 @@ protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
Vec3 defaultPressure; Vec3 defaultPressure;
double temperature; double defaultTemperature;
bool scaleX, scaleY, scaleZ; bool scaleX, scaleY, scaleZ;
int frequency, randomNumberSeed; int frequency, randomNumberSeed;
}; };
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -58,14 +58,22 @@ public: ...@@ -58,14 +58,22 @@ public:
static const std::string key = "MonteCarloPressure"; static const std::string key = "MonteCarloPressure";
return key; return key;
} }
/**
* This is the name of the parameter which stores the current temperature at which the
* system is being maintained (in Kelvin)
*/
static const std::string& Temperature() {
static const std::string key = "MonteCarloTemperature";
return key;
}
/** /**
* Create a MonteCarloBarostat. * Create a MonteCarloBarostat.
* *
* @param defaultPressure the default pressure acting on the system (in bar) * @param defaultPressure the default pressure acting on the system (in bar)
* @param temperature the temperature at which the system is being maintained (in Kelvin) * @param defaultTemperature the default temperature at which the system is being maintained (in Kelvin)
* @param frequency the frequency at which Monte Carlo pressure changes should be attempted (in time steps) * @param frequency the frequency at which Monte Carlo pressure changes should be attempted (in time steps)
*/ */
MonteCarloBarostat(double defaultPressure, double temperature, int frequency = 25); MonteCarloBarostat(double defaultPressure, double defaultTemperature, int frequency = 25);
/** /**
* Get the default pressure acting on the system (in bar). * Get the default pressure acting on the system (in bar).
* *
...@@ -98,18 +106,19 @@ public: ...@@ -98,18 +106,19 @@ public:
frequency = freq; frequency = freq;
} }
/** /**
* Get the temperature at which the system is being maintained, measured in Kelvin. * Get the default temperature at which the system is being maintained, measured in Kelvin.
*/ */
double getTemperature() const { double getDefaultTemperature() const {
return temperature; return defaultTemperature;
} }
/** /**
* Set the temperature at which the system is being maintained. * Set the default temperature at which the system is being maintained. This will affect any new Contexts you create,
* but not ones that already exist.
* *
* @param temp the system temperature, measured in Kelvin. * @param temp the system temperature, measured in Kelvin.
*/ */
void setTemperature(double temp) { void setDefaultTemperature(double temp) {
temperature = temp; defaultTemperature = temp;
} }
/** /**
* Get the random number seed. See setRandomNumberSeed() for details. * Get the random number seed. See setRandomNumberSeed() for details.
...@@ -143,7 +152,7 @@ public: ...@@ -143,7 +152,7 @@ public:
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
double defaultPressure, temperature; double defaultPressure, defaultTemperature;
int frequency, randomNumberSeed; int frequency, randomNumberSeed;
}; };
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010-2014 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -111,17 +111,25 @@ public: ...@@ -111,17 +111,25 @@ public:
static const std::string key = "MembraneMonteCarloSurfaceTension"; static const std::string key = "MembraneMonteCarloSurfaceTension";
return key; return key;
} }
/**
* This is the name of the parameter which stores the current temperature at which the
* system is being maintained (in Kelvin)
*/
static const std::string& Temperature() {
static const std::string key = "MembraneMonteCarloTemperature";
return key;
}
/** /**
* Create a MonteCarloMembraneBarostat. * Create a MonteCarloMembraneBarostat.
* *
* @param defaultPressure the default pressure acting on the system (in bar) * @param defaultPressure the default pressure acting on the system (in bar)
* @param defaultSurfaceTension the default surface tension acting on the system (in bar*nm) * @param defaultSurfaceTension the default surface tension acting on the system (in bar*nm)
* @param temperature the temperature at which the system is being maintained (in Kelvin) * @param defaultTemperature the default temperature at which the system is being maintained (in Kelvin)
* @param xymode the mode specifying the behavior of the X and Y axes * @param xymode the mode specifying the behavior of the X and Y axes
* @param zmode the mode specifying the behavior of the Z axis * @param zmode the mode specifying the behavior of the Z axis
* @param frequency the frequency at which Monte Carlo volume changes should be attempted (in time steps) * @param frequency the frequency at which Monte Carlo volume changes should be attempted (in time steps)
*/ */
MonteCarloMembraneBarostat(double defaultPressure, double defaultSurfaceTension, double temperature, XYMode xymode, ZMode zmode, int frequency = 25); MonteCarloMembraneBarostat(double defaultPressure, double defaultSurfaceTension, double defaultTemperature, XYMode xymode, ZMode zmode, int frequency = 25);
/** /**
* Get the default pressure acting on the system (in bar). * Get the default pressure acting on the system (in bar).
* *
...@@ -171,18 +179,19 @@ public: ...@@ -171,18 +179,19 @@ public:
frequency = freq; frequency = freq;
} }
/** /**
* Get the temperature at which the system is being maintained, measured in Kelvin. * Get the default temperature at which the system is being maintained, measured in Kelvin.
*/ */
double getTemperature() const { double getDefaultTemperature() const {
return temperature; return defaultTemperature;
} }
/** /**
* Set the temperature at which the system is being maintained. * Set the default temperature at which the system is being maintained. This will affect any new Contexts you create,
* but not ones that already exist.
* *
* @param temp the system temperature, measured in Kelvin. * @param temp the system temperature, measured in Kelvin.
*/ */
void setTemperature(double temp) { void setDefaultTemperature(double temp) {
temperature = temp; defaultTemperature = temp;
} }
/** /**
* Get the mode specifying the behavior of the X and Y axes. * Get the mode specifying the behavior of the X and Y axes.
...@@ -240,7 +249,7 @@ public: ...@@ -240,7 +249,7 @@ public:
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
double defaultPressure, defaultSurfaceTension, temperature; double defaultPressure, defaultSurfaceTension, defaultTemperature;
XYMode xymode; XYMode xymode;
ZMode zmode; ZMode zmode;
int frequency, randomNumberSeed; int frequency, randomNumberSeed;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -108,20 +108,24 @@ public: ...@@ -108,20 +108,24 @@ public:
* in a torsion cannot be changed, nor can new torsions be added. * in a torsion cannot be changed, nor can new torsions be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns true if force uses PBC and false otherwise * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
class PeriodicTorsionInfo; class PeriodicTorsionInfo;
std::vector<PeriodicTorsionInfo> periodicTorsions; std::vector<PeriodicTorsionInfo> periodicTorsions;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -117,20 +117,24 @@ public: ...@@ -117,20 +117,24 @@ public:
* in a torsion cannot be changed, nor can new torsions be added. * in a torsion cannot be changed, nor can new torsions be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns true if force uses PBC and false otherwise * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
class RBTorsionInfo; class RBTorsionInfo;
std::vector<RBTorsionInfo> rbTorsions; std::vector<RBTorsionInfo> rbTorsions;
bool usePeriodic;
}; };
/** /**
......
#ifndef OPENMM_OSRNGSEED_H_ #ifndef OPENMM_OSRNGSEED_H_
#define OPENMM_OSRNGSEED_H_ #define OPENMM_OSRNGSEED_H_
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010-2015 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
using namespace OpenMM; using namespace OpenMM;
CMAPTorsionForce::CMAPTorsionForce() { CMAPTorsionForce::CMAPTorsionForce() : usePeriodic(false) {
} }
int CMAPTorsionForce::addMap(int size, const std::vector<double>& energy) { int CMAPTorsionForce::addMap(int size, const std::vector<double>& energy) {
...@@ -99,3 +99,11 @@ ForceImpl* CMAPTorsionForce::createImpl() const { ...@@ -99,3 +99,11 @@ ForceImpl* CMAPTorsionForce::createImpl() const {
void CMAPTorsionForce::updateParametersInContext(Context& context) { void CMAPTorsionForce::updateParametersInContext(Context& context) {
dynamic_cast<CMAPTorsionForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context)); dynamic_cast<CMAPTorsionForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
} }
void CMAPTorsionForce::setUsesPeriodicBoundaryConditions(bool periodic) {
usePeriodic = periodic;
}
bool CMAPTorsionForce::usesPeriodicBoundaryConditions() const {
return usePeriodic;
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2013 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -84,15 +84,20 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ ...@@ -84,15 +84,20 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ
// Validate the list of properties. // Validate the list of properties.
const vector<string>& platformProperties = platform->getPropertyNames(); const vector<string>& platformProperties = platform->getPropertyNames();
map<string, string> validatedProperties;
for (map<string, string>::const_iterator iter = properties.begin(); iter != properties.end(); ++iter) { for (map<string, string>::const_iterator iter = properties.begin(); iter != properties.end(); ++iter) {
string property = iter->first;
if (platform->deprecatedPropertyReplacements.find(property) != platform->deprecatedPropertyReplacements.end())
property = platform->deprecatedPropertyReplacements[property];
bool valid = false; bool valid = false;
for (int i = 0; i < (int) platformProperties.size(); i++) for (int i = 0; i < (int) platformProperties.size(); i++)
if (platformProperties[i] == iter->first) { if (platformProperties[i] == property) {
valid = true; valid = true;
break; break;
} }
if (!valid) if (!valid)
throw OpenMMException("Illegal property name: "+iter->first); throw OpenMMException("Illegal property name: "+iter->first);
validatedProperties[property] = iter->second;
} }
// Find the list of kernels required. // Find the list of kernels required.
...@@ -139,7 +144,7 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ ...@@ -139,7 +144,7 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ
for (int i = candidatePlatforms.size()-1; i >= 0; i--) { for (int i = candidatePlatforms.size()-1; i >= 0; i--) {
try { try {
this->platform = platform = candidatePlatforms[i].second; this->platform = platform = candidatePlatforms[i].second;
platform->contextCreated(*this, properties); platform->contextCreated(*this, validatedProperties);
break; break;
} }
catch (...) { catch (...) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -44,7 +44,7 @@ using std::string; ...@@ -44,7 +44,7 @@ using std::string;
using std::stringstream; using std::stringstream;
using std::vector; using std::vector;
CustomAngleForce::CustomAngleForce(const string& energy) : energyExpression(energy) { CustomAngleForce::CustomAngleForce(const string& energy) : energyExpression(energy), usePeriodic(false) {
} }
const string& CustomAngleForce::getEnergyFunction() const { const string& CustomAngleForce::getEnergyFunction() const {
...@@ -123,3 +123,11 @@ ForceImpl* CustomAngleForce::createImpl() const { ...@@ -123,3 +123,11 @@ ForceImpl* CustomAngleForce::createImpl() const {
void CustomAngleForce::updateParametersInContext(Context& context) { void CustomAngleForce::updateParametersInContext(Context& context) {
dynamic_cast<CustomAngleForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context)); dynamic_cast<CustomAngleForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
} }
void CustomAngleForce::setUsesPeriodicBoundaryConditions(bool periodic) {
usePeriodic = periodic;
}
bool CustomAngleForce::usesPeriodicBoundaryConditions() const {
return usePeriodic;
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -44,7 +44,7 @@ using std::string; ...@@ -44,7 +44,7 @@ using std::string;
using std::stringstream; using std::stringstream;
using std::vector; using std::vector;
CustomBondForce::CustomBondForce(const string& energy) : energyExpression(energy) { CustomBondForce::CustomBondForce(const string& energy) : energyExpression(energy), usePeriodic(false) {
} }
const string& CustomBondForce::getEnergyFunction() const { const string& CustomBondForce::getEnergyFunction() const {
...@@ -121,3 +121,11 @@ ForceImpl* CustomBondForce::createImpl() const { ...@@ -121,3 +121,11 @@ ForceImpl* CustomBondForce::createImpl() const {
void CustomBondForce::updateParametersInContext(Context& context) { void CustomBondForce::updateParametersInContext(Context& context) {
dynamic_cast<CustomBondForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context)); dynamic_cast<CustomBondForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
} }
void CustomBondForce::setUsesPeriodicBoundaryConditions(bool periodic) {
usePeriodic = periodic;
}
bool CustomBondForce::usesPeriodicBoundaryConditions() const {
return usePeriodic;
}
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