"examples/cpp-examples/CMakeLists.txt" did not exist on "31cd86f854aae9d4fe4c2b56549bf4f73a1b134f"
Unverified Commit f5eea219 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Max Drude distance defaults to 0.02 nm (#3508)

* Max Drude distance defaults to 0.2 nm

* Fixed incorrect number in docs

* Fixed a test case
parent a76c2de1
......@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2021 Stanford University and the Authors. *
* Portions copyright (c) 2008-2022 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
......@@ -72,12 +72,12 @@ public:
void setDrudeTemperature(double temp);
/**
* Get the maximum distance a Drude particle can ever move from its parent particle, measured in nm. This is implemented
* with a hard wall constraint. If this distance is set to 0 (the default), the hard wall constraint is omitted.
* with a hard wall constraint. The default value is 0.02. If this distance is set to 0, the hard wall constraint is omitted.
*/
double getMaxDrudeDistance() const;
/**
* Set the maximum distance a Drude particle can ever move from its parent particle, measured in nm. This is implemented
* with a hard wall constraint. If this distance is set to 0 (the default), the hard wall constraint is omitted.
* with a hard wall constraint. The default value is 0.02. If this distance is set to 0, the hard wall constraint is omitted.
*/
void setMaxDrudeDistance(double distance);
/**
......
......@@ -47,7 +47,7 @@ namespace OpenMM {
*
* This integrator can optionally set an upper limit on how far any Drude particle is ever allowed to
* get from its parent particle. This can sometimes help to improve stability. The limit is enforced
* with a hard wall constraint.
* with a hard wall constraint. By default the limit is set to 0.02 nm.
*
* This Integrator requires the System to include a DrudeForce, which it uses to identify the Drude
* particles.
......
......@@ -45,6 +45,10 @@ namespace OpenMM {
* A second thermostat, typically with a much lower temperature, is applied to the relative internal
* displacement of each pair.
*
* This integrator can optionally set an upper limit on how far any Drude particle is ever allowed to
* get from its parent particle. This can sometimes help to improve stability. The limit is enforced
* with a hard wall constraint. By default the limit is set to 0.02 nm.
*
* This Integrator requires the System to include a DrudeForce, which it uses to identify the Drude
* particles.
*/
......
......@@ -52,7 +52,7 @@ DrudeLangevinIntegrator::DrudeLangevinIntegrator(double temperature, double fric
setFriction(frictionCoeff);
setDrudeTemperature(drudeTemperature);
setDrudeFriction(drudeFrictionCoeff);
setMaxDrudeDistance(0);
setMaxDrudeDistance(0.02);
setStepSize(stepSize);
setConstraintTolerance(1e-5);
setRandomNumberSeed(0);
......
......@@ -54,10 +54,8 @@ namespace OpenMM {
DrudeNoseHooverIntegrator::DrudeNoseHooverIntegrator(double temperature, double collisionFrequency,
double drudeTemperature, double drudeCollisionFrequency,
double stepSize, int chainLength, int numMTS, int numYoshidaSuzuki) :
NoseHooverIntegrator(stepSize),
drudeTemperature(drudeTemperature)
{
setMaxDrudeDistance(0);
NoseHooverIntegrator(stepSize), drudeTemperature(drudeTemperature) {
setMaxDrudeDistance(0.02);
hasSubsystemThermostats_ = false;
addSubsystemThermostat(std::vector<int>(), std::vector<std::pair<int, int>>(), temperature,
collisionFrequency, drudeTemperature, drudeCollisionFrequency,
......
......@@ -48,6 +48,7 @@ DrudeSCFIntegrator::DrudeSCFIntegrator(double stepSize) : DrudeIntegrator(stepSi
setStepSize(stepSize);
setMinimizationErrorTolerance(0.1);
setConstraintTolerance(1e-5);
setMaxDrudeDistance(0.0);
}
void DrudeSCFIntegrator::initialize(ContextImpl& contextRef) {
......@@ -64,6 +65,8 @@ void DrudeSCFIntegrator::initialize(ContextImpl& contextRef) {
}
if (force == NULL)
throw OpenMMException("The System does not contain a DrudeForce");
if (getMaxDrudeDistance() != 0.0)
throw OpenMMException("DrudeSCFIntegrator does not currently support setting max Drude distance");
context = &contextRef;
owner = &contextRef.getOwner();
kernel = context->getPlatform().createKernel(IntegrateDrudeSCFStepKernel::Name(), contextRef);
......
......@@ -1051,7 +1051,7 @@ class TestAPIUnits(unittest.TestCase):
self.assertEqual(integrator.getStepSize(), 0.1*femtosecond)
integrator.setStepSize(0.0005)
self.assertEqual(integrator.getStepSize(), 0.0005*picosecond)
self.assertEqual(integrator.getMaxDrudeDistance(), 0*nanometer)
self.assertEqual(integrator.getMaxDrudeDistance(), 0.02*nanometer)
integrator.setMaxDrudeDistance(0.05)
self.assertEqual(integrator.getMaxDrudeDistance(), 0.05*nanometer)
......
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