Commit 6bde69d9 authored by Andy Simmonett's avatar Andy Simmonett
Browse files

Merge branch 'master' of github.com:pandegroup/openmm into genpt

parents e6dbc863 ec799972
...@@ -159,8 +159,8 @@ ENDIF (NOT CMAKE_CXX_FLAGS_RELEASE) ...@@ -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. # and make it available to the code so it can be built into the binaries.
SET(OPENMM_LIBRARY_NAME OpenMM) SET(OPENMM_LIBRARY_NAME OpenMM)
SET(OPENMM_MAJOR_VERSION 6) SET(OPENMM_MAJOR_VERSION 7)
SET(OPENMM_MINOR_VERSION 3) SET(OPENMM_MINOR_VERSION 0)
SET(OPENMM_BUILD_VERSION 0) SET(OPENMM_BUILD_VERSION 0)
SET(OPENMM_COPYRIGHT_YEARS "2008-2015") SET(OPENMM_COPYRIGHT_YEARS "2008-2015")
...@@ -340,6 +340,7 @@ ELSE(DL_LIBRARY) ...@@ -340,6 +340,7 @@ ELSE(DL_LIBRARY)
ENDIF(DL_LIBRARY) ENDIF(DL_LIBRARY)
IF(BUILD_TESTING) IF(BUILD_TESTING)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/tests)
ADD_SUBDIRECTORY(platforms/reference/tests) ADD_SUBDIRECTORY(platforms/reference/tests)
ENDIF(BUILD_TESTING) ENDIF(BUILD_TESTING)
......
...@@ -405,8 +405,10 @@ for index, type in enumerate(types): ...@@ -405,8 +405,10 @@ for index, type in enumerate(types):
sigma = (params[0]/params[1])**(1.0/6.0) sigma = (params[0]/params[1])**(1.0/6.0)
epsilon = 4.184*params[1]*params[1]/(4*params[0]) epsilon = 4.184*params[1]*params[1]/(4*params[0])
else: else:
sigma = 0 sigma = 1
epsilon = 0 epsilon = 0
if sigma == 0 or epsilon == 0:
sigma, epsilon = 1, 0
if q != 0 or epsilon != 0: if q != 0 or epsilon != 0:
print """ <Atom type="%d" charge="%s" sigma="%s" epsilon="%s"/>""" % (index, q, sigma, epsilon) print """ <Atom type="%d" charge="%s" sigma="%s" epsilon="%s"/>""" % (index, q, sigma, epsilon)
print " </NonbondedForce>" print " </NonbondedForce>"
......
...@@ -675,11 +675,17 @@ Platforms ...@@ -675,11 +675,17 @@ Platforms
When creating a :class:`Simulation`, you can optionally tell it what :class:`Platform` to use. 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 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 description of the differences between them, see Section :ref:`platforms`. There are three ways in which
specify a :class:`Platform`, it will select one automatically. Usually its choice will the :class:`Platform` can be chosen:
be reasonable, but you may want to change it.
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') platform = Platform.getPlatformByName('CUDA')
......
...@@ -52,7 +52,11 @@ def runOneTest(testName, options): ...@@ -52,7 +52,11 @@ def runOneTest(testName, options):
cutoff = 2.0*unit.nanometers cutoff = 2.0*unit.nanometers
vdwCutoff = 1.2*unit.nanometers vdwCutoff = 1.2*unit.nanometers
system = ff.createSystem(pdb.topology, nonbondedMethod=app.NoCutoff, constraints=constraints, mutualInducedTargetEpsilon=epsilon, polarization=polarization) 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: else:
if explicit: if explicit:
ff = app.ForceField('amber99sb.xml', 'tip3p.xml') ff = app.ForceField('amber99sb.xml', 'tip3p.xml')
...@@ -77,6 +81,7 @@ def runOneTest(testName, options): ...@@ -77,6 +81,7 @@ def runOneTest(testName, options):
constraints = app.HBonds constraints = app.HBonds
hydrogenMass = None hydrogenMass = None
system = ff.createSystem(pdb.topology, nonbondedMethod=method, nonbondedCutoff=cutoff, constraints=constraints, hydrogenMass=hydrogenMass) 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)) print('Step Size: %g fs' % dt.value_in_unit(unit.femtoseconds))
properties = {} properties = {}
initialSteps = 5 initialSteps = 5
...@@ -95,7 +100,6 @@ def runOneTest(testName, options): ...@@ -95,7 +100,6 @@ def runOneTest(testName, options):
# Run the simulation. # Run the simulation.
integ = mm.LangevinIntegrator(300*unit.kelvin, 91*(1/unit.picoseconds), dt)
integ.setConstraintTolerance(1e-5) integ.setConstraintTolerance(1e-5)
if len(properties) > 0: if len(properties) > 0:
context = mm.Context(system, integ, platform, properties) context = mm.Context(system, integ, platform, properties)
......
...@@ -124,11 +124,13 @@ public: ...@@ -124,11 +124,13 @@ public:
}; };
void SFMT::createCheckpoint(std::ostream& stream) { 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->sfmt, sizeof(data->sfmt));
stream.write((char*) &data->idx, sizeof(data->idx)); stream.write((char*) &data->idx, sizeof(data->idx));
} }
void SFMT::loadCheckpoint(std::istream& stream) { 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->sfmt, sizeof(data->sfmt));
stream.read((char*) &data->idx, sizeof(data->idx)); stream.read((char*) &data->idx, sizeof(data->idx));
} }
......
...@@ -171,7 +171,7 @@ public: ...@@ -171,7 +171,7 @@ public:
* @param parameters the list of parameters for the new angle * @param parameters the list of parameters for the new angle
* @return the index of the angle that was added * @return the index of the angle that was added
*/ */
int addAngle(int particle1, int particle2, int particle3, const std::vector<double>& parameters); int addAngle(int particle1, int particle2, int particle3, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Get the force field parameters for an angle term. * Get the force field parameters for an angle term.
* *
...@@ -191,7 +191,7 @@ public: ...@@ -191,7 +191,7 @@ public:
* @param particle3 the index of the third particle connected by the angle * @param particle3 the index of the third particle connected by the angle
* @param parameters the list of parameters for the angle * @param parameters the list of parameters for the angle
*/ */
void setAngleParameters(int index, int particle1, int particle2, int particle3, const std::vector<double>& parameters); void setAngleParameters(int index, int particle1, int particle2, int particle3, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Update the per-angle parameters in a Context to match those stored in this Force object. This method provides * 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. * an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
......
...@@ -170,7 +170,7 @@ public: ...@@ -170,7 +170,7 @@ public:
* @param parameters the list of parameters for the new bond * @param parameters the list of parameters for the new bond
* @return the index of the bond that was added * @return the index of the bond that was added
*/ */
int addBond(int particle1, int particle2, const std::vector<double>& parameters); int addBond(int particle1, int particle2, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Get the force field parameters for a bond term. * Get the force field parameters for a bond term.
* *
...@@ -188,7 +188,7 @@ public: ...@@ -188,7 +188,7 @@ public:
* @param particle2 the index of the second particle connected by the bond * @param particle2 the index of the second particle connected by the bond
* @param parameters the list of parameters for the bond * @param parameters the list of parameters for the bond
*/ */
void setBondParameters(int index, int particle1, int particle2, const std::vector<double>& parameters); void setBondParameters(int index, int particle1, int particle2, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Update the per-bond parameters in a Context to match those stored in this Force object. This method provides * 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. * an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
......
...@@ -237,7 +237,7 @@ public: ...@@ -237,7 +237,7 @@ public:
* If this is omitted, then particle masses will be used as weights. * If this is omitted, then particle masses will be used as weights.
* @return the index of the group that was added * @return the index of the group that was added
*/ */
int addGroup(const std::vector<int>& particles, const std::vector<double>& weights = std::vector<double>()); int addGroup(const std::vector<int>& particles, const std::vector<double>& weights=std::vector<double>());
/** /**
* Get the properties of a group. * Get the properties of a group.
* *
...@@ -256,7 +256,7 @@ public: ...@@ -256,7 +256,7 @@ public:
* @param weights the weight to use for each particle when computing the center position. * @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. * If this is omitted, then particle masses will be used as weights.
*/ */
void setGroupParameters(int index, const std::vector<int>& particles, const std::vector<double>& weights = std::vector<double>()); void setGroupParameters(int index, const std::vector<int>& particles, const std::vector<double>& weights=std::vector<double>());
/** /**
* Add a bond to the force * Add a bond to the force
* *
...@@ -264,7 +264,7 @@ public: ...@@ -264,7 +264,7 @@ public:
* @param parameters the list of per-bond parameter values for the new bond * @param parameters the list of per-bond parameter values for the new bond
* @return the index of the bond that was added * @return the index of the bond that was added
*/ */
int addBond(const std::vector<int>& groups, const std::vector<double>& parameters); int addBond(const std::vector<int>& groups, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Get the properties of a bond. * Get the properties of a bond.
* *
...@@ -280,7 +280,7 @@ public: ...@@ -280,7 +280,7 @@ public:
* @param groups the indices of the groups in the bond * @param groups the indices of the groups in the bond
* @param parameters the list of per-bond parameter values for the bond * @param parameters the list of per-bond parameter values for the bond
*/ */
void setBondParameters(int index, const std::vector<int>& groups, const std::vector<double>& parameters); void setBondParameters(int index, const std::vector<int>& groups, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Add a tabulated function that may appear in the energy expression. * Add a tabulated function that may appear in the energy expression.
* *
......
...@@ -219,7 +219,7 @@ public: ...@@ -219,7 +219,7 @@ public:
* @param parameters the list of per-bond parameter values for the new bond * @param parameters the list of per-bond parameter values for the new bond
* @return the index of the bond that was added * @return the index of the bond that was added
*/ */
int addBond(const std::vector<int>& particles, const std::vector<double>& parameters); int addBond(const std::vector<int>& particles, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Get the properties of a bond. * Get the properties of a bond.
* *
...@@ -235,7 +235,7 @@ public: ...@@ -235,7 +235,7 @@ public:
* @param particles the indices of the particles in the bond * @param particles the indices of the particles in the bond
* @param parameters the list of per-bond parameter values for the bond * @param parameters the list of per-bond parameter values for the bond
*/ */
void setBondParameters(int index, const std::vector<int>& particles, const std::vector<double>& parameters); void setBondParameters(int index, const std::vector<int>& particles, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Add a tabulated function that may appear in the energy expression. * Add a tabulated function that may appear in the energy expression.
* *
......
...@@ -67,6 +67,14 @@ namespace OpenMM { ...@@ -67,6 +67,14 @@ namespace OpenMM {
* force->addPerParticleParameter("z0"); * force->addPerParticleParameter("z0");
* </pre></tt> * </pre></tt>
* *
* 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
*
* <tt>CustomExternalForce* force = new CustomExternalForce("k*periodicdistance(x, y, z, x0, y0, z0)^2");</tt>
*
* Expressions may involve the operators + (add), - (subtract), * (multiply), / (divide), and ^ (power), and the following * 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 * 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. * 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: ...@@ -172,7 +180,7 @@ public:
* @param parameters the list of parameters for the new force term * @param parameters the list of parameters for the new force term
* @return the index of the particle term that was added * @return the index of the particle term that was added
*/ */
int addParticle(int particle, const std::vector<double>& parameters); int addParticle(int particle, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Get the force field parameters for a force field term. * Get the force field parameters for a force field term.
* *
...@@ -188,7 +196,7 @@ public: ...@@ -188,7 +196,7 @@ public:
* @param particle the index of the particle this term is applied to * @param particle the index of the particle this term is applied to
* @param parameters the list of parameters for the force field term * @param parameters the list of parameters for the force field term
*/ */
void setParticleParameters(int index, int particle, const std::vector<double>& parameters); void setParticleParameters(int index, int particle, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Update the per-particle parameters in a Context to match those stored in this Force object. This method provides * 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. * an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
...@@ -206,9 +214,7 @@ public: ...@@ -206,9 +214,7 @@ public:
* *
* @returns false * @returns false
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
......
...@@ -319,7 +319,7 @@ public: ...@@ -319,7 +319,7 @@ public:
* @param parameters the list of parameters for the new particle * @param parameters the list of parameters for the new particle
* @return the index of the particle that was added * @return the index of the particle that was added
*/ */
int addParticle(const std::vector<double>& parameters); int addParticle(const std::vector<double>& parameters=std::vector<double>());
/** /**
* Get the nonbonded force parameters for a particle. * Get the nonbonded force parameters for a particle.
* *
......
...@@ -296,7 +296,7 @@ public: ...@@ -296,7 +296,7 @@ public:
* @param parameters the list of per-donor parameter values for the new donor * @param parameters the list of per-donor parameter values for the new donor
* @return the index of the donor that was added * @return the index of the donor that was added
*/ */
int addDonor(int d1, int d2, int d3, const std::vector<double>& parameters); int addDonor(int d1, int d2, int d3, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Get the properties of a donor group. * Get the properties of a donor group.
* *
...@@ -320,7 +320,7 @@ public: ...@@ -320,7 +320,7 @@ public:
* less than three particles, this must be -1. * less than three particles, this must be -1.
* @param parameters the list of per-donor parameter values for the donor * @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<double>& parameters); void setDonorParameters(int index, int d1, int d2, int d3, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Add an acceptor group to the force * Add an acceptor group to the force
* *
...@@ -332,7 +332,7 @@ public: ...@@ -332,7 +332,7 @@ public:
* @param parameters the list of per-acceptor parameter values for the new acceptor * @param parameters the list of per-acceptor parameter values for the new acceptor
* @return the index of the acceptor that was added * @return the index of the acceptor that was added
*/ */
int addAcceptor(int a1, int a2, int a3, const std::vector<double>& parameters); int addAcceptor(int a1, int a2, int a3, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Get the properties of an acceptor group. * Get the properties of an acceptor group.
* *
...@@ -356,7 +356,7 @@ public: ...@@ -356,7 +356,7 @@ public:
* less than three particles, this must be -1. * less than three particles, this must be -1.
* @param parameters the list of per-acceptor parameter values for the acceptor * @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<double>& parameters); void setAcceptorParameters(int index, int a1, int a2, int a3, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Add a donor-acceptor pair to the list of interactions that should be excluded. * Add a donor-acceptor pair to the list of interactions that should be excluded.
* *
......
...@@ -348,7 +348,7 @@ public: ...@@ -348,7 +348,7 @@ public:
* @param type the type of the new particle * @param type the type of the new particle
* @return the index of the particle that was added * @return the index of the particle that was added
*/ */
int addParticle(const std::vector<double>& parameters, int type=0); int addParticle(const std::vector<double>& parameters=std::vector<double>(), int type=0);
/** /**
* Get the nonbonded force parameters for a particle. * Get the nonbonded force parameters for a particle.
* *
......
...@@ -328,7 +328,7 @@ public: ...@@ -328,7 +328,7 @@ public:
* @param parameters the list of parameters for the new particle * @param parameters the list of parameters for the new particle
* @return the index of the particle that was added * @return the index of the particle that was added
*/ */
int addParticle(const std::vector<double>& parameters); int addParticle(const std::vector<double>& parameters=std::vector<double>());
/** /**
* Get the nonbonded force parameters for a particle. * Get the nonbonded force parameters for a particle.
* *
......
...@@ -172,7 +172,7 @@ public: ...@@ -172,7 +172,7 @@ public:
* @param parameters the list of parameters for the new torsion * @param parameters the list of parameters for the new torsion
* @return the index of the torsion that was added * @return the index of the torsion that was added
*/ */
int addTorsion(int particle1, int particle2, int particle3, int particle4, const std::vector<double>& parameters); int addTorsion(int particle1, int particle2, int particle3, int particle4, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Get the force field parameters for a torsion term. * Get the force field parameters for a torsion term.
* *
...@@ -194,7 +194,7 @@ public: ...@@ -194,7 +194,7 @@ public:
* @param particle4 the index of the fourth particle connected by the torsion * @param particle4 the index of the fourth particle connected by the torsion
* @param parameters the list of parameters for 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<double>& parameters); void setTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, const std::vector<double>& parameters=std::vector<double>());
/** /**
* Update the per-torsion parameters in a Context to match those stored in this Force object. This method provides * 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. * an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "lepton/ParsedExpression.h" #include "lepton/ParsedExpression.h"
#include <utility> #include <utility>
#include <map> #include <map>
#include <set>
#include <string> #include <string>
namespace OpenMM { namespace OpenMM {
...@@ -93,7 +94,7 @@ private: ...@@ -93,7 +94,7 @@ private:
class FunctionPlaceholder; class FunctionPlaceholder;
static Lepton::ExpressionTreeNode replaceFunctions(const Lepton::ExpressionTreeNode& node, std::map<std::string, int> atoms, static Lepton::ExpressionTreeNode replaceFunctions(const Lepton::ExpressionTreeNode& node, std::map<std::string, int> atoms,
std::map<std::string, std::vector<int> >& distances, std::map<std::string, std::vector<int> >& angles, std::map<std::string, std::vector<int> >& distances, std::map<std::string, std::vector<int> >& angles,
std::map<std::string, std::vector<int> >& dihedrals); std::map<std::string, std::vector<int> >& dihedrals, std::set<std::string>& variables);
void addBondsBetweenGroups(int group1, int group2, std::vector<std::pair<int, int> >& bonds) const; void addBondsBetweenGroups(int group1, int group2, std::vector<std::pair<int, int> >& bonds) const;
const CustomCentroidBondForce& owner; const CustomCentroidBondForce& owner;
Kernel kernel; Kernel kernel;
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "lepton/ParsedExpression.h" #include "lepton/ParsedExpression.h"
#include <utility> #include <utility>
#include <map> #include <map>
#include <set>
#include <string> #include <string>
namespace OpenMM { namespace OpenMM {
...@@ -83,7 +84,7 @@ private: ...@@ -83,7 +84,7 @@ private:
class FunctionPlaceholder; class FunctionPlaceholder;
static Lepton::ExpressionTreeNode replaceFunctions(const Lepton::ExpressionTreeNode& node, std::map<std::string, int> atoms, static Lepton::ExpressionTreeNode replaceFunctions(const Lepton::ExpressionTreeNode& node, std::map<std::string, int> atoms,
std::map<std::string, std::vector<int> >& distances, std::map<std::string, std::vector<int> >& angles, std::map<std::string, std::vector<int> >& distances, std::map<std::string, std::vector<int> >& angles,
std::map<std::string, std::vector<int> >& dihedrals); std::map<std::string, std::vector<int> >& dihedrals, std::set<std::string>& variables);
const CustomCompoundBondForce& owner; const CustomCompoundBondForce& owner;
Kernel kernel; Kernel kernel;
}; };
......
...@@ -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-2010 Stanford University and the Authors. * * Portions copyright (c) 2008-2015 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "lepton/ParsedExpression.h" #include "lepton/ParsedExpression.h"
#include <utility> #include <utility>
#include <map> #include <map>
#include <set>
#include <string> #include <string>
namespace OpenMM { namespace OpenMM {
...@@ -84,7 +85,7 @@ private: ...@@ -84,7 +85,7 @@ private:
class FunctionPlaceholder; class FunctionPlaceholder;
static Lepton::ExpressionTreeNode replaceFunctions(const Lepton::ExpressionTreeNode& node, std::map<std::string, int> atoms, static Lepton::ExpressionTreeNode replaceFunctions(const Lepton::ExpressionTreeNode& node, std::map<std::string, int> atoms,
std::map<std::string, std::vector<int> >& distances, std::map<std::string, std::vector<int> >& angles, std::map<std::string, std::vector<int> >& distances, std::map<std::string, std::vector<int> >& angles,
std::map<std::string, std::vector<int> >& dihedrals); std::map<std::string, std::vector<int> >& dihedrals, std::set<std::string>& variables);
const CustomHbondForce& owner; const CustomHbondForce& owner;
Kernel kernel; Kernel kernel;
}; };
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "lepton/ParsedExpression.h" #include "lepton/ParsedExpression.h"
#include <utility> #include <utility>
#include <map> #include <map>
#include <set>
#include <string> #include <string>
namespace OpenMM { namespace OpenMM {
...@@ -98,7 +99,7 @@ private: ...@@ -98,7 +99,7 @@ private:
class FunctionPlaceholder; class FunctionPlaceholder;
static Lepton::ExpressionTreeNode replaceFunctions(const Lepton::ExpressionTreeNode& node, std::map<std::string, int> atoms, static Lepton::ExpressionTreeNode replaceFunctions(const Lepton::ExpressionTreeNode& node, std::map<std::string, int> atoms,
std::map<std::string, std::vector<int> >& distances, std::map<std::string, std::vector<int> >& angles, std::map<std::string, std::vector<int> >& distances, std::map<std::string, std::vector<int> >& angles,
std::map<std::string, std::vector<int> >& dihedrals); std::map<std::string, std::vector<int> >& dihedrals, std::set<std::string>& variables);
static void generatePermutations(std::vector<int>& values, int numFixed, std::vector<std::vector<int> >& result); static void generatePermutations(std::vector<int>& values, int numFixed, std::vector<std::vector<int> >& result);
const CustomManyParticleForce& owner; const CustomManyParticleForce& owner;
Kernel kernel; Kernel kernel;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "openmm/Context.h" #include "openmm/Context.h"
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <cstdlib>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <utility> #include <utility>
...@@ -115,6 +116,11 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ ...@@ -115,6 +116,11 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ
// Select a platform to use. // Select a platform to use.
vector<pair<double, Platform*> > candidatePlatforms; vector<pair<double, Platform*> > candidatePlatforms;
if (platform == NULL) {
char* defaultPlatform = getenv("OPENMM_DEFAULT_PLATFORM");
if (defaultPlatform != NULL)
platform = &Platform::getPlatformByName(string(defaultPlatform));
}
if (platform == NULL) { if (platform == NULL) {
for (int i = 0; i < Platform::getNumPlatforms(); i++) { for (int i = 0; i < Platform::getNumPlatforms(); i++) {
Platform& p = Platform::getPlatform(i); Platform& p = Platform::getPlatform(i);
......
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