diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5edc5d57febb4e05df0582ac89b5f70ffa2b21a2..646ba011b97ca6a78f960f37b775a3a90a2d20dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -159,8 +159,8 @@ ENDIF (NOT CMAKE_CXX_FLAGS_RELEASE)
# and make it available to the code so it can be built into the binaries.
SET(OPENMM_LIBRARY_NAME OpenMM)
-SET(OPENMM_MAJOR_VERSION 6)
-SET(OPENMM_MINOR_VERSION 3)
+SET(OPENMM_MAJOR_VERSION 7)
+SET(OPENMM_MINOR_VERSION 0)
SET(OPENMM_BUILD_VERSION 0)
SET(OPENMM_COPYRIGHT_YEARS "2008-2015")
@@ -340,6 +340,7 @@ ELSE(DL_LIBRARY)
ENDIF(DL_LIBRARY)
IF(BUILD_TESTING)
+ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/tests)
ADD_SUBDIRECTORY(platforms/reference/tests)
ENDIF(BUILD_TESTING)
diff --git a/devtools/forcefield-scripts/processAmberForceField.py b/devtools/forcefield-scripts/processAmberForceField.py
index 337032f568b50368c791347018c6ad43829f27f5..ed25ab5f450c66cfaf207b810ed0205bb34877f5 100644
--- a/devtools/forcefield-scripts/processAmberForceField.py
+++ b/devtools/forcefield-scripts/processAmberForceField.py
@@ -405,8 +405,10 @@ for index, type in enumerate(types):
sigma = (params[0]/params[1])**(1.0/6.0)
epsilon = 4.184*params[1]*params[1]/(4*params[0])
else:
- sigma = 0
+ sigma = 1
epsilon = 0
+ if sigma == 0 or epsilon == 0:
+ sigma, epsilon = 1, 0
if q != 0 or epsilon != 0:
print """ """ % (index, q, sigma, epsilon)
print " "
diff --git a/docs-source/usersguide/application.rst b/docs-source/usersguide/application.rst
index e556f28936983123733d704f8a3324d0250a69ad..aa5dfdb53a97af15076b2a6d8d1834649b9fa6d8 100644
--- a/docs-source/usersguide/application.rst
+++ b/docs-source/usersguide/application.rst
@@ -675,11 +675,17 @@ Platforms
When creating a :class:`Simulation`, you can optionally tell it what :class:`Platform` to use.
OpenMM includes four platforms: :class:`Reference`, :class:`CPU`, :class:`CUDA`, and :class:`OpenCL`. For a
-description of the differences between them, see Section :ref:`platforms`. If you do not
-specify a :class:`Platform`, it will select one automatically. Usually its choice will
-be reasonable, but you may want to change it.
+description of the differences between them, see Section :ref:`platforms`. There are three ways in which
+the :class:`Platform` can be chosen:
-The following lines specify to use the :class:`CUDA` platform:
+1. By default, OpenMM will try to select the fastest available :class:`Platform`. Usually its choice will
+be reasonable, but sometimes you may want to change it.
+
+2. Alternatively, you can set the :envvar:`OPENMM_DEFAULT_PLATFORM` environment variable to the name
+of the :class:`Platform` to use. This overrides the default logic.
+
+3. Finally, you can explicitly specify a :class:`Platform` object in your script when you create the
+:class:`Simulation`. The following lines specify to use the :class:`CUDA` platform:
::
platform = Platform.getPlatformByName('CUDA')
diff --git a/examples/benchmark.py b/examples/benchmark.py
index 629162509d864de7b1afab84fb16b83e8d4a9a5b..2b286db83d5b4b0f8580a71ffcd0d33f33417285 100644
--- a/examples/benchmark.py
+++ b/examples/benchmark.py
@@ -52,7 +52,11 @@ def runOneTest(testName, options):
cutoff = 2.0*unit.nanometers
vdwCutoff = 1.2*unit.nanometers
system = ff.createSystem(pdb.topology, nonbondedMethod=app.NoCutoff, constraints=constraints, mutualInducedTargetEpsilon=epsilon, polarization=polarization)
- dt = 0.001*unit.picoseconds
+ for f in system.getForces():
+ if isinstance(f, mm.AmoebaMultipoleForce) or isinstance(f, mm.AmoebaVdwForce) or isinstance(f, mm.AmoebaGeneralizedKirkwoodForce) or isinstance(f, mm.AmoebaWcaDispersionForce):
+ f.setForceGroup(1)
+ dt = 0.002*unit.picoseconds
+ integ = mm.MTSIntegrator(dt, [(0,2), (1,1)])
else:
if explicit:
ff = app.ForceField('amber99sb.xml', 'tip3p.xml')
@@ -77,6 +81,7 @@ def runOneTest(testName, options):
constraints = app.HBonds
hydrogenMass = None
system = ff.createSystem(pdb.topology, nonbondedMethod=method, nonbondedCutoff=cutoff, constraints=constraints, hydrogenMass=hydrogenMass)
+ integ = mm.LangevinIntegrator(300*unit.kelvin, 91*(1/unit.picoseconds), dt)
print('Step Size: %g fs' % dt.value_in_unit(unit.femtoseconds))
properties = {}
initialSteps = 5
@@ -95,7 +100,6 @@ def runOneTest(testName, options):
# Run the simulation.
- integ = mm.LangevinIntegrator(300*unit.kelvin, 91*(1/unit.picoseconds), dt)
integ.setConstraintTolerance(1e-5)
if len(properties) > 0:
context = mm.Context(system, integ, platform, properties)
diff --git a/libraries/sfmt/src/SFMT.cpp b/libraries/sfmt/src/SFMT.cpp
index 13d2e0db25eedf77fef596b4c41a23201754f0e8..07c26b0c0e3eae47623d63d04dd3034d1170e951 100644
--- a/libraries/sfmt/src/SFMT.cpp
+++ b/libraries/sfmt/src/SFMT.cpp
@@ -124,11 +124,13 @@ public:
};
void SFMT::createCheckpoint(std::ostream& stream) {
+ stream.write((char*) &data->baseData, sizeof(data->baseData));
stream.write((char*) &data->sfmt, sizeof(data->sfmt));
stream.write((char*) &data->idx, sizeof(data->idx));
}
void SFMT::loadCheckpoint(std::istream& stream) {
+ stream.read((char*) &data->baseData, sizeof(data->baseData));
stream.read((char*) &data->sfmt, sizeof(data->sfmt));
stream.read((char*) &data->idx, sizeof(data->idx));
}
diff --git a/openmmapi/include/openmm/CustomAngleForce.h b/openmmapi/include/openmm/CustomAngleForce.h
index 0f7c0632fcfa0ff6f2e5640949e07c96a179f4b4..7e890cef7387401e6c16f00186b78d074a5182dd 100644
--- a/openmmapi/include/openmm/CustomAngleForce.h
+++ b/openmmapi/include/openmm/CustomAngleForce.h
@@ -171,7 +171,7 @@ public:
* @param parameters the list of parameters for the new angle
* @return the index of the angle that was added
*/
- int addAngle(int particle1, int particle2, int particle3, const std::vector& parameters);
+ int addAngle(int particle1, int particle2, int particle3, const std::vector& parameters=std::vector());
/**
* Get the force field parameters for an angle term.
*
@@ -191,7 +191,7 @@ public:
* @param particle3 the index of the third particle connected by the angle
* @param parameters the list of parameters for the angle
*/
- void setAngleParameters(int index, int particle1, int particle2, int particle3, const std::vector& parameters);
+ void setAngleParameters(int index, int particle1, int particle2, int particle3, const std::vector& parameters=std::vector());
/**
* Update the per-angle parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
diff --git a/openmmapi/include/openmm/CustomBondForce.h b/openmmapi/include/openmm/CustomBondForce.h
index fa8660cb0472ba6cf583e86bca2d1a5ab7a236dd..a366276a568f19f159551f6a338f3639152aead9 100644
--- a/openmmapi/include/openmm/CustomBondForce.h
+++ b/openmmapi/include/openmm/CustomBondForce.h
@@ -170,7 +170,7 @@ public:
* @param parameters the list of parameters for the new bond
* @return the index of the bond that was added
*/
- int addBond(int particle1, int particle2, const std::vector& parameters);
+ int addBond(int particle1, int particle2, const std::vector& parameters=std::vector());
/**
* Get the force field parameters for a bond term.
*
@@ -188,7 +188,7 @@ public:
* @param particle2 the index of the second particle connected by the bond
* @param parameters the list of parameters for the bond
*/
- void setBondParameters(int index, int particle1, int particle2, const std::vector& parameters);
+ void setBondParameters(int index, int particle1, int particle2, const std::vector& parameters=std::vector());
/**
* Update the per-bond parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
diff --git a/openmmapi/include/openmm/CustomCentroidBondForce.h b/openmmapi/include/openmm/CustomCentroidBondForce.h
index 985c28c25b9ec56bc7914724fd8b8912c4d4c8fb..dac5ca442465b933b5aeeca79e00b4c06d9425b1 100644
--- a/openmmapi/include/openmm/CustomCentroidBondForce.h
+++ b/openmmapi/include/openmm/CustomCentroidBondForce.h
@@ -237,7 +237,7 @@ public:
* If this is omitted, then particle masses will be used as weights.
* @return the index of the group that was added
*/
- int addGroup(const std::vector& particles, const std::vector& weights = std::vector());
+ int addGroup(const std::vector& particles, const std::vector& weights=std::vector());
/**
* Get the properties of a group.
*
@@ -256,7 +256,7 @@ public:
* @param weights the weight to use for each particle when computing the center position.
* If this is omitted, then particle masses will be used as weights.
*/
- void setGroupParameters(int index, const std::vector& particles, const std::vector& weights = std::vector());
+ void setGroupParameters(int index, const std::vector& particles, const std::vector& weights=std::vector());
/**
* Add a bond to the force
*
@@ -264,7 +264,7 @@ public:
* @param parameters the list of per-bond parameter values for the new bond
* @return the index of the bond that was added
*/
- int addBond(const std::vector& groups, const std::vector& parameters);
+ int addBond(const std::vector& groups, const std::vector& parameters=std::vector());
/**
* Get the properties of a bond.
*
@@ -280,7 +280,7 @@ public:
* @param groups the indices of the groups in the bond
* @param parameters the list of per-bond parameter values for the bond
*/
- void setBondParameters(int index, const std::vector& groups, const std::vector& parameters);
+ void setBondParameters(int index, const std::vector& groups, const std::vector& parameters=std::vector());
/**
* Add a tabulated function that may appear in the energy expression.
*
diff --git a/openmmapi/include/openmm/CustomCompoundBondForce.h b/openmmapi/include/openmm/CustomCompoundBondForce.h
index acddf2abaad87f3b4afdec82a06b192b7d6be3d7..c67f9d5ecf1292fd5ada53e56b6fbfab7e8b86a9 100644
--- a/openmmapi/include/openmm/CustomCompoundBondForce.h
+++ b/openmmapi/include/openmm/CustomCompoundBondForce.h
@@ -219,7 +219,7 @@ public:
* @param parameters the list of per-bond parameter values for the new bond
* @return the index of the bond that was added
*/
- int addBond(const std::vector& particles, const std::vector& parameters);
+ int addBond(const std::vector& particles, const std::vector& parameters=std::vector());
/**
* Get the properties of a bond.
*
@@ -235,7 +235,7 @@ public:
* @param particles the indices of the particles in the bond
* @param parameters the list of per-bond parameter values for the bond
*/
- void setBondParameters(int index, const std::vector& particles, const std::vector& parameters);
+ void setBondParameters(int index, const std::vector& particles, const std::vector& parameters=std::vector());
/**
* Add a tabulated function that may appear in the energy expression.
*
diff --git a/openmmapi/include/openmm/CustomExternalForce.h b/openmmapi/include/openmm/CustomExternalForce.h
index 77be2d046e4fd27a9ecbbb3953b38fd631dbd523..7e38dd776090507114593cf24c0263cde357fc8f 100644
--- a/openmmapi/include/openmm/CustomExternalForce.h
+++ b/openmmapi/include/openmm/CustomExternalForce.h
@@ -67,6 +67,14 @@ namespace OpenMM {
* force->addPerParticleParameter("z0");
*
*
+ * Special care is needed in systems that use periodic boundary conditions. In that case, each particle really represents
+ * an infinite set of particles repeating through space. The variables x, y, and z contain the coordinates of one of those
+ * periodic copies, but there is no guarantee about which. It might even change from one time step to the next. You can handle
+ * this situation by using the function periodicdistance(x1, y1, z1, x2, y2, z2), which returns the minimum distance between
+ * periodic copies of the points (x1, y1, z1) and (x2, y2, z2). For example, the force given above would be rewritten as
+ *
+ * CustomExternalForce* force = new CustomExternalForce("k*periodicdistance(x, y, z, x0, y0, z0)^2");
+ *
* Expressions may involve the operators + (add), - (subtract), * (multiply), / (divide), and ^ (power), and the following
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta, select. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise.
@@ -172,7 +180,7 @@ public:
* @param parameters the list of parameters for the new force term
* @return the index of the particle term that was added
*/
- int addParticle(int particle, const std::vector& parameters);
+ int addParticle(int particle, const std::vector& parameters=std::vector());
/**
* Get the force field parameters for a force field term.
*
@@ -188,7 +196,7 @@ public:
* @param particle the index of the particle this term is applied to
* @param parameters the list of parameters for the force field term
*/
- void setParticleParameters(int index, int particle, const std::vector& parameters);
+ void setParticleParameters(int index, int particle, const std::vector& parameters=std::vector());
/**
* Update the per-particle parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
@@ -206,9 +214,7 @@ public:
*
* @returns false
*/
- bool usesPeriodicBoundaryConditions() const {
- return false;
- }
+ bool usesPeriodicBoundaryConditions() const;
protected:
ForceImpl* createImpl() const;
private:
diff --git a/openmmapi/include/openmm/CustomGBForce.h b/openmmapi/include/openmm/CustomGBForce.h
index 0a03bbdc82f679fa395f32daef26966ccb7f98e2..28576252fedcf3e1692dbef3a66c029cbb83ad56 100644
--- a/openmmapi/include/openmm/CustomGBForce.h
+++ b/openmmapi/include/openmm/CustomGBForce.h
@@ -319,7 +319,7 @@ public:
* @param parameters the list of parameters for the new particle
* @return the index of the particle that was added
*/
- int addParticle(const std::vector& parameters);
+ int addParticle(const std::vector& parameters=std::vector());
/**
* Get the nonbonded force parameters for a particle.
*
diff --git a/openmmapi/include/openmm/CustomHbondForce.h b/openmmapi/include/openmm/CustomHbondForce.h
index 1f471a729f0a8bef5c19bff5c4b957d90eb5627f..fc56f5e6883e47458bf11c656df453b6d86de494 100644
--- a/openmmapi/include/openmm/CustomHbondForce.h
+++ b/openmmapi/include/openmm/CustomHbondForce.h
@@ -296,7 +296,7 @@ public:
* @param parameters the list of per-donor parameter values for the new donor
* @return the index of the donor that was added
*/
- int addDonor(int d1, int d2, int d3, const std::vector& parameters);
+ int addDonor(int d1, int d2, int d3, const std::vector& parameters=std::vector());
/**
* Get the properties of a donor group.
*
@@ -320,7 +320,7 @@ public:
* less than three particles, this must be -1.
* @param parameters the list of per-donor parameter values for the donor
*/
- void setDonorParameters(int index, int d1, int d2, int d3, const std::vector& parameters);
+ void setDonorParameters(int index, int d1, int d2, int d3, const std::vector& parameters=std::vector());
/**
* Add an acceptor group to the force
*
@@ -332,7 +332,7 @@ public:
* @param parameters the list of per-acceptor parameter values for the new acceptor
* @return the index of the acceptor that was added
*/
- int addAcceptor(int a1, int a2, int a3, const std::vector& parameters);
+ int addAcceptor(int a1, int a2, int a3, const std::vector& parameters=std::vector());
/**
* Get the properties of an acceptor group.
*
@@ -356,7 +356,7 @@ public:
* less than three particles, this must be -1.
* @param parameters the list of per-acceptor parameter values for the acceptor
*/
- void setAcceptorParameters(int index, int a1, int a2, int a3, const std::vector& parameters);
+ void setAcceptorParameters(int index, int a1, int a2, int a3, const std::vector& parameters=std::vector());
/**
* Add a donor-acceptor pair to the list of interactions that should be excluded.
*
diff --git a/openmmapi/include/openmm/CustomManyParticleForce.h b/openmmapi/include/openmm/CustomManyParticleForce.h
index 44e9dbe0f8b2dbbb2dab54819f433f9341e7586f..1c62d9f4fd1dd83a7da97663982e91dc22967a38 100644
--- a/openmmapi/include/openmm/CustomManyParticleForce.h
+++ b/openmmapi/include/openmm/CustomManyParticleForce.h
@@ -348,7 +348,7 @@ public:
* @param type the type of the new particle
* @return the index of the particle that was added
*/
- int addParticle(const std::vector& parameters, int type=0);
+ int addParticle(const std::vector& parameters=std::vector(), int type=0);
/**
* Get the nonbonded force parameters for a particle.
*
diff --git a/openmmapi/include/openmm/CustomNonbondedForce.h b/openmmapi/include/openmm/CustomNonbondedForce.h
index 05039e7d73ffc64a1f2b3dea374a375be017172c..0414139b39e834df661b5f53c8f85962a697c5aa 100644
--- a/openmmapi/include/openmm/CustomNonbondedForce.h
+++ b/openmmapi/include/openmm/CustomNonbondedForce.h
@@ -328,7 +328,7 @@ public:
* @param parameters the list of parameters for the new particle
* @return the index of the particle that was added
*/
- int addParticle(const std::vector& parameters);
+ int addParticle(const std::vector& parameters=std::vector());
/**
* Get the nonbonded force parameters for a particle.
*
diff --git a/openmmapi/include/openmm/CustomTorsionForce.h b/openmmapi/include/openmm/CustomTorsionForce.h
index 77ee821aba3dfaf0ce50eae3945f89870bbae796..7c38269af0a1fa82d1a01697f6118700b0e6c9d5 100644
--- a/openmmapi/include/openmm/CustomTorsionForce.h
+++ b/openmmapi/include/openmm/CustomTorsionForce.h
@@ -172,7 +172,7 @@ public:
* @param parameters the list of parameters for the new torsion
* @return the index of the torsion that was added
*/
- int addTorsion(int particle1, int particle2, int particle3, int particle4, const std::vector& parameters);
+ int addTorsion(int particle1, int particle2, int particle3, int particle4, const std::vector& parameters=std::vector());
/**
* Get the force field parameters for a torsion term.
*
@@ -194,7 +194,7 @@ public:
* @param particle4 the index of the fourth particle connected by the torsion
* @param parameters the list of parameters for the torsion
*/
- void setTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, const std::vector& parameters);
+ void setTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, const std::vector& parameters=std::vector());
/**
* Update the per-torsion parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
diff --git a/openmmapi/include/openmm/internal/CustomCentroidBondForceImpl.h b/openmmapi/include/openmm/internal/CustomCentroidBondForceImpl.h
index f6e4d69ba4185b683776625ccee392dd44428862..345ddf8f6ba8d08002da03e70de5d2a132706103 100644
--- a/openmmapi/include/openmm/internal/CustomCentroidBondForceImpl.h
+++ b/openmmapi/include/openmm/internal/CustomCentroidBondForceImpl.h
@@ -41,6 +41,7 @@
#include "lepton/ParsedExpression.h"
#include
#include