"openmmapi/vscode:/vscode.git/clone" did not exist on "641de8945d2251174bbd6a814449fd8a6b0ce38a"
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)
# 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)
......
......@@ -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 """ <Atom type="%d" charge="%s" sigma="%s" epsilon="%s"/>""" % (index, q, sigma, epsilon)
print " </NonbondedForce>"
......
......@@ -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')
......
......@@ -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)
......
......@@ -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));
}
......
......@@ -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<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.
*
......@@ -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<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
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
......
......@@ -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<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.
*
......@@ -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<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
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
......
......@@ -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<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.
*
......@@ -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<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
*
......@@ -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<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.
*
......@@ -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<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.
*
......
......@@ -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<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.
*
......@@ -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<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.
*
......
......@@ -67,6 +67,14 @@ namespace OpenMM {
* force->addPerParticleParameter("z0");
* </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
* 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<double>& parameters);
int addParticle(int particle, const std::vector<double>& parameters=std::vector<double>());
/**
* 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<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
* 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:
......
......@@ -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<double>& parameters);
int addParticle(const std::vector<double>& parameters=std::vector<double>());
/**
* Get the nonbonded force parameters for a particle.
*
......
......@@ -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<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.
*
......@@ -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<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
*
......@@ -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<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.
*
......@@ -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<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.
*
......
......@@ -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<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.
*
......
......@@ -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<double>& parameters);
int addParticle(const std::vector<double>& parameters=std::vector<double>());
/**
* Get the nonbonded force parameters for a particle.
*
......
......@@ -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<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.
*
......@@ -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<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
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
......
......@@ -41,6 +41,7 @@
#include "lepton/ParsedExpression.h"
#include <utility>
#include <map>
#include <set>
#include <string>
namespace OpenMM {
......@@ -93,7 +94,7 @@ private:
class FunctionPlaceholder;
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> >& 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;
const CustomCentroidBondForce& owner;
Kernel kernel;
......
......@@ -40,6 +40,7 @@
#include "lepton/ParsedExpression.h"
#include <utility>
#include <map>
#include <set>
#include <string>
namespace OpenMM {
......@@ -83,7 +84,7 @@ private:
class FunctionPlaceholder;
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> >& dihedrals);
std::map<std::string, std::vector<int> >& dihedrals, std::set<std::string>& variables);
const CustomCompoundBondForce& owner;
Kernel kernel;
};
......
......@@ -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-2010 Stanford University and the Authors. *
* Portions copyright (c) 2008-2015 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
......@@ -40,6 +40,7 @@
#include "lepton/ParsedExpression.h"
#include <utility>
#include <map>
#include <set>
#include <string>
namespace OpenMM {
......@@ -84,7 +85,7 @@ private:
class FunctionPlaceholder;
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> >& dihedrals);
std::map<std::string, std::vector<int> >& dihedrals, std::set<std::string>& variables);
const CustomHbondForce& owner;
Kernel kernel;
};
......
......@@ -40,6 +40,7 @@
#include "lepton/ParsedExpression.h"
#include <utility>
#include <map>
#include <set>
#include <string>
namespace OpenMM {
......@@ -98,7 +99,7 @@ private:
class FunctionPlaceholder;
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> >& 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);
const CustomManyParticleForce& owner;
Kernel kernel;
......
......@@ -41,6 +41,7 @@
#include "openmm/Context.h"
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <utility>
......@@ -115,6 +116,11 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ
// Select a platform to use.
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) {
for (int i = 0; i < Platform::getNumPlatforms(); 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