Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
dca54ec7
Commit
dca54ec7
authored
Jun 30, 2016
by
Saurabh Belsare
Browse files
Merged fork with latest original master
parents
cace5edf
01f9e415
Changes
384
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
242 additions
and
94 deletions
+242
-94
openmmapi/include/openmm/PeriodicTorsionForce.h
openmmapi/include/openmm/PeriodicTorsionForce.h
+8
-4
openmmapi/include/openmm/RBTorsionForce.h
openmmapi/include/openmm/RBTorsionForce.h
+8
-4
openmmapi/include/openmm/System.h
openmmapi/include/openmm/System.h
+1
-1
openmmapi/include/openmm/TabulatedFunction.h
openmmapi/include/openmm/TabulatedFunction.h
+49
-49
openmmapi/include/openmm/internal/OSRngSeed.h
openmmapi/include/openmm/internal/OSRngSeed.h
+1
-1
openmmapi/include/openmm/internal/timer.h
openmmapi/include/openmm/internal/timer.h
+59
-0
openmmapi/src/CMAPTorsionForce.cpp
openmmapi/src/CMAPTorsionForce.cpp
+10
-2
openmmapi/src/ContextImpl.cpp
openmmapi/src/ContextImpl.cpp
+9
-3
openmmapi/src/CustomAngleForce.cpp
openmmapi/src/CustomAngleForce.cpp
+10
-2
openmmapi/src/CustomBondForce.cpp
openmmapi/src/CustomBondForce.cpp
+10
-2
openmmapi/src/CustomCentroidBondForce.cpp
openmmapi/src/CustomCentroidBondForce.cpp
+10
-2
openmmapi/src/CustomCompoundBondForce.cpp
openmmapi/src/CustomCompoundBondForce.cpp
+10
-2
openmmapi/src/CustomIntegrator.cpp
openmmapi/src/CustomIntegrator.cpp
+3
-3
openmmapi/src/CustomIntegratorUtilities.cpp
openmmapi/src/CustomIntegratorUtilities.cpp
+5
-5
openmmapi/src/CustomNonbondedForce.cpp
openmmapi/src/CustomNonbondedForce.cpp
+4
-1
openmmapi/src/CustomTorsionForce.cpp
openmmapi/src/CustomTorsionForce.cpp
+10
-2
openmmapi/src/HarmonicAngleForce.cpp
openmmapi/src/HarmonicAngleForce.cpp
+10
-2
openmmapi/src/HarmonicBondForce.cpp
openmmapi/src/HarmonicBondForce.cpp
+9
-1
openmmapi/src/LocalEnergyMinimizer.cpp
openmmapi/src/LocalEnergyMinimizer.cpp
+13
-5
openmmapi/src/MonteCarloAnisotropicBarostat.cpp
openmmapi/src/MonteCarloAnisotropicBarostat.cpp
+3
-3
No files found.
openmmapi/include/openmm/PeriodicTorsionForce.h
View file @
dca54ec7
...
@@ -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-201
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
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
;
};
};
/**
/**
...
...
openmmapi/include/openmm/RBTorsionForce.h
View file @
dca54ec7
...
@@ -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-201
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
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
;
};
};
/**
/**
...
...
openmmapi/include/openmm/System.h
View file @
dca54ec7
...
@@ -243,7 +243,7 @@ public:
...
@@ -243,7 +243,7 @@ public:
*
*
* @return true if at least one force uses PBC and false otherwise
* @return true if at least one force uses PBC and false otherwise
*/
*/
bool
usesPeriodicBoundaryConditions
();
bool
usesPeriodicBoundaryConditions
()
const
;
private:
private:
class
ConstraintInfo
;
class
ConstraintInfo
;
Vec3
periodicBoxVectors
[
3
];
Vec3
periodicBoxVectors
[
3
];
...
...
openmmapi/include/openmm/TabulatedFunction.h
View file @
dca54ec7
...
@@ -40,10 +40,10 @@ namespace OpenMM {
...
@@ -40,10 +40,10 @@ namespace OpenMM {
/**
/**
* A TabulatedFunction uses a set of tabulated values to define a mathematical function.
* A TabulatedFunction uses a set of tabulated values to define a mathematical function.
* It can be used by various custom forces.
* It can be used by various custom forces.
*
*
* TabulatedFunction is an abstract class with concrete subclasses for more specific
* TabulatedFunction is an abstract class with concrete subclasses for more specific
* types of functions. There are subclasses for:
* types of functions. There are subclasses for:
*
*
* <ul>
* <ul>
* <li>1, 2, and 3 dimensional functions. The dimensionality of a function means
* <li>1, 2, and 3 dimensional functions. The dimensionality of a function means
* the number of input arguments it takes.</li>
* the number of input arguments it takes.</li>
...
@@ -69,7 +69,7 @@ class OPENMM_EXPORT Continuous1DFunction : public TabulatedFunction {
...
@@ -69,7 +69,7 @@ class OPENMM_EXPORT Continuous1DFunction : public TabulatedFunction {
public:
public:
/**
/**
* Create a Continuous1DFunction f(x) based on a set of tabulated values.
* Create a Continuous1DFunction f(x) based on a set of tabulated values.
*
*
* @param values the tabulated values of the function f(x) at uniformly spaced values of x between min
* @param values the tabulated values of the function f(x) at uniformly spaced values of x between min
* and max. A natural cubic spline is used to interpolate between the tabulated values.
* and max. A natural cubic spline is used to interpolate between the tabulated values.
* The function is assumed to be zero for x < min or x > max.
* The function is assumed to be zero for x < min or x > max.
...
@@ -80,11 +80,11 @@ public:
...
@@ -80,11 +80,11 @@ public:
/**
/**
* Get the parameters for the tabulated function.
* Get the parameters for the tabulated function.
*
*
* @param values the tabulated values of the function f(x) at uniformly spaced values of x between min
* @param
[out]
values the tabulated values of the function f(x) at uniformly spaced values of x between min
* and max. A natural cubic spline is used to interpolate between the tabulated values.
*
and max. A natural cubic spline is used to interpolate between the tabulated values.
* The function is assumed to be zero for x < min or x > max.
*
The function is assumed to be zero for x < min or x > max.
* @param min the value of x corresponding to the first element of values
* @param
[out]
min the value of x corresponding to the first element of values
* @param max the value of x corresponding to the last element of values
* @param
[out]
max the value of x corresponding to the last element of values
*/
*/
void
getFunctionParameters
(
std
::
vector
<
double
>&
values
,
double
&
min
,
double
&
max
)
const
;
void
getFunctionParameters
(
std
::
vector
<
double
>&
values
,
double
&
min
,
double
&
max
)
const
;
/**
/**
...
@@ -113,7 +113,7 @@ class OPENMM_EXPORT Continuous2DFunction : public TabulatedFunction {
...
@@ -113,7 +113,7 @@ class OPENMM_EXPORT Continuous2DFunction : public TabulatedFunction {
public:
public:
/**
/**
* Create a Continuous2DFunction f(x,y) based on a set of tabulated values.
* Create a Continuous2DFunction f(x,y) based on a set of tabulated values.
*
*
* @param values the tabulated values of the function f(x,y) at xsize uniformly spaced values of x between xmin
* @param values the tabulated values of the function f(x,y) at xsize uniformly spaced values of x between xmin
* and xmax, and ysize values of y between ymin and ymax. A natural cubic spline is used to interpolate between the tabulated values.
* and xmax, and ysize values of y between ymin and ymax. A natural cubic spline is used to interpolate between the tabulated values.
* The function is assumed to be zero when x or y is outside its specified range. The values should be ordered so that
* The function is assumed to be zero when x or y is outside its specified range. The values should be ordered so that
...
@@ -129,16 +129,16 @@ public:
...
@@ -129,16 +129,16 @@ public:
/**
/**
* Get the parameters for the tabulated function.
* Get the parameters for the tabulated function.
*
*
* @param values the tabulated values of the function f(x,y) at xsize uniformly spaced values of x between xmin
* @param
[out]
values the tabulated values of the function f(x,y) at xsize uniformly spaced values of x between xmin
* and xmax, and ysize values of y between ymin and ymax. A natural cubic spline is used to interpolate between the tabulated values.
*
and xmax, and ysize values of y between ymin and ymax. A natural cubic spline is used to interpolate between the tabulated values.
* The function is assumed to be zero when x or y is outside its specified range. The values should be ordered so that
*
The function is assumed to be zero when x or y is outside its specified range. The values should be ordered so that
* values[i+xsize*j] = f(x_i,y_j), where x_i is the i'th uniformly spaced value of x. This must be of length xsize*ysize.
*
values[i+xsize*j] = f(x_i,y_j), where x_i is the i'th uniformly spaced value of x. This must be of length xsize*ysize.
* @param xsize the number of table elements along the x direction
* @param
[out]
xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction
* @param
[out]
ysize the number of table elements along the y direction
* @param xmin the value of x corresponding to the first element of values
* @param
[out]
xmin the value of x corresponding to the first element of values
* @param xmax the value of x corresponding to the last element of values
* @param
[out]
xmax the value of x corresponding to the last element of values
* @param ymin the value of y corresponding to the first element of values
* @param
[out]
ymin the value of y corresponding to the first element of values
* @param ymax the value of y corresponding to the last element of values
* @param
[out]
ymax the value of y corresponding to the last element of values
*/
*/
void
getFunctionParameters
(
int
&
xsize
,
int
&
ysize
,
std
::
vector
<
double
>&
values
,
double
&
xmin
,
double
&
xmax
,
double
&
ymin
,
double
&
ymax
)
const
;
void
getFunctionParameters
(
int
&
xsize
,
int
&
ysize
,
std
::
vector
<
double
>&
values
,
double
&
xmin
,
double
&
xmax
,
double
&
ymin
,
double
&
ymax
)
const
;
/**
/**
...
@@ -173,7 +173,7 @@ class OPENMM_EXPORT Continuous3DFunction : public TabulatedFunction {
...
@@ -173,7 +173,7 @@ class OPENMM_EXPORT Continuous3DFunction : public TabulatedFunction {
public:
public:
/**
/**
* Create a Continuous3DFunction f(x,y,z) based on a set of tabulated values.
* Create a Continuous3DFunction f(x,y,z) based on a set of tabulated values.
*
*
* @param values the tabulated values of the function f(x,y,z) at xsize uniformly spaced values of x between xmin
* @param values the tabulated values of the function f(x,y,z) at xsize uniformly spaced values of x between xmin
* and xmax, ysize values of y between ymin and ymax, and zsize values of z between zmin and zmax.
* and xmax, ysize values of y between ymin and ymax, and zsize values of z between zmin and zmax.
* A natural cubic spline is used to interpolate between the tabulated values. The function is
* A natural cubic spline is used to interpolate between the tabulated values. The function is
...
@@ -194,21 +194,21 @@ public:
...
@@ -194,21 +194,21 @@ public:
/**
/**
* Get the parameters for the tabulated function.
* Get the parameters for the tabulated function.
*
*
* @param values the tabulated values of the function f(x,y,z) at xsize uniformly spaced values of x between xmin
* @param
[out]
values the tabulated values of the function f(x,y,z) at xsize uniformly spaced values of x between xmin
* and xmax, ysize values of y between ymin and ymax, and zsize values of z between zmin and zmax.
*
and xmax, ysize values of y between ymin and ymax, and zsize values of z between zmin and zmax.
* A natural cubic spline is used to interpolate between the tabulated values. The function is
*
A natural cubic spline is used to interpolate between the tabulated values. The function is
* assumed to be zero when x, y, or z is outside its specified range. The values should be ordered so
*
assumed to be zero when x, y, or z is outside its specified range. The values should be ordered so
* that values[i+xsize*j+xsize*ysize*k] = f(x_i,y_j,z_k), where x_i is the i'th uniformly spaced value of x.
*
that values[i+xsize*j+xsize*ysize*k] = f(x_i,y_j,z_k), where x_i is the i'th uniformly spaced value of x.
* This must be of length xsize*ysize*zsize.
*
This must be of length xsize*ysize*zsize.
* @param xsize the number of table elements along the x direction
* @param
[out]
xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction
* @param
[out]
ysize the number of table elements along the y direction
* @param
y
size the number of table elements along the z direction
* @param
[out] z
size the number of table elements along the z direction
* @param xmin the value of x corresponding to the first element of values
* @param
[out]
xmin the value of x corresponding to the first element of values
* @param xmax the value of x corresponding to the last element of values
* @param
[out]
xmax the value of x corresponding to the last element of values
* @param ymin the value of y corresponding to the first element of values
* @param
[out]
ymin the value of y corresponding to the first element of values
* @param ymax the value of y corresponding to the last element of values
* @param
[out]
ymax the value of y corresponding to the last element of values
* @param zmin the value of z corresponding to the first element of values
* @param
[out]
zmin the value of z corresponding to the first element of values
* @param zmax the value of z corresponding to the last element of values
* @param
[out]
zmax the value of z corresponding to the last element of values
*/
*/
void
getFunctionParameters
(
int
&
xsize
,
int
&
ysize
,
int
&
zsize
,
std
::
vector
<
double
>&
values
,
double
&
xmin
,
double
&
xmax
,
double
&
ymin
,
double
&
ymax
,
double
&
zmin
,
double
&
zmax
)
const
;
void
getFunctionParameters
(
int
&
xsize
,
int
&
ysize
,
int
&
zsize
,
std
::
vector
<
double
>&
values
,
double
&
xmin
,
double
&
xmax
,
double
&
ymin
,
double
&
ymax
,
double
&
zmin
,
double
&
zmax
)
const
;
/**
/**
...
@@ -222,7 +222,7 @@ public:
...
@@ -222,7 +222,7 @@ public:
* This must be of length xsize*ysize*zsize.
* This must be of length xsize*ysize*zsize.
* @param xsize the number of table elements along the x direction
* @param xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction
* @param ysize the number of table elements along the y direction
* @param
y
size the number of table elements along the z direction
* @param
z
size the number of table elements along the z direction
* @param xmin the value of x corresponding to the first element of values
* @param xmin the value of x corresponding to the first element of values
* @param xmax the value of x corresponding to the last element of values
* @param xmax the value of x corresponding to the last element of values
* @param ymin the value of y corresponding to the first element of values
* @param ymin the value of y corresponding to the first element of values
...
@@ -250,14 +250,14 @@ class OPENMM_EXPORT Discrete1DFunction : public TabulatedFunction {
...
@@ -250,14 +250,14 @@ class OPENMM_EXPORT Discrete1DFunction : public TabulatedFunction {
public:
public:
/**
/**
* Create a Discrete1DFunction f(x) based on a set of tabulated values.
* Create a Discrete1DFunction f(x) based on a set of tabulated values.
*
*
* @param values the tabulated values of the function f(x)
* @param values the tabulated values of the function f(x)
*/
*/
Discrete1DFunction
(
const
std
::
vector
<
double
>&
values
);
Discrete1DFunction
(
const
std
::
vector
<
double
>&
values
);
/**
/**
* Get the parameters for the tabulated function.
* Get the parameters for the tabulated function.
*
*
* @param values
the tabulated values of the function f(x)
* @param
[out]
values the tabulated values of the function f(x)
*/
*/
void
getFunctionParameters
(
std
::
vector
<
double
>&
values
)
const
;
void
getFunctionParameters
(
std
::
vector
<
double
>&
values
)
const
;
/**
/**
...
@@ -283,7 +283,7 @@ class OPENMM_EXPORT Discrete2DFunction : public TabulatedFunction {
...
@@ -283,7 +283,7 @@ class OPENMM_EXPORT Discrete2DFunction : public TabulatedFunction {
public:
public:
/**
/**
* Create a Discrete2DFunction f(x,y) based on a set of tabulated values.
* Create a Discrete2DFunction f(x,y) based on a set of tabulated values.
*
*
* @param xsize the number of table elements along the x direction
* @param xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction
* @param ysize the number of table elements along the y direction
* @param values the tabulated values of the function f(x,y), ordered so that
* @param values the tabulated values of the function f(x,y), ordered so that
...
@@ -293,10 +293,10 @@ public:
...
@@ -293,10 +293,10 @@ public:
/**
/**
* Get the parameters for the tabulated function.
* Get the parameters for the tabulated function.
*
*
* @param xsize the number of table elements along the x direction
* @param
[out]
xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction
* @param
[out]
ysize the number of table elements along the y direction
* @param values the tabulated values of the function f(x,y), ordered so that
* @param
[out]
values the tabulated values of the function f(x,y), ordered so that
* values[i+xsize*j] = f(i,j). This must be of length xsize*ysize.
*
values[i+xsize*j] = f(i,j). This must be of length xsize*ysize.
*/
*/
void
getFunctionParameters
(
int
&
xsize
,
int
&
ysize
,
std
::
vector
<
double
>&
values
)
const
;
void
getFunctionParameters
(
int
&
xsize
,
int
&
ysize
,
std
::
vector
<
double
>&
values
)
const
;
/**
/**
...
@@ -326,7 +326,7 @@ class OPENMM_EXPORT Discrete3DFunction : public TabulatedFunction {
...
@@ -326,7 +326,7 @@ class OPENMM_EXPORT Discrete3DFunction : public TabulatedFunction {
public:
public:
/**
/**
* Create a Discrete3DFunction f(x,y,z) based on a set of tabulated values.
* Create a Discrete3DFunction f(x,y,z) based on a set of tabulated values.
*
*
* @param xsize the number of table elements along the x direction
* @param xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction
* @param ysize the number of table elements along the y direction
* @param zsize the number of table elements along the z direction
* @param zsize the number of table elements along the z direction
...
@@ -337,11 +337,11 @@ public:
...
@@ -337,11 +337,11 @@ public:
/**
/**
* Get the parameters for the tabulated function.
* Get the parameters for the tabulated function.
*
*
* @param xsize the number of table elements along the x direction
* @param
[out]
xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction
* @param
[out]
ysize the number of table elements along the y direction
* @param zsize the number of table elements along the z direction
* @param
[out]
zsize the number of table elements along the z direction
* @param values the tabulated values of the function f(x,y,z), ordered so that
* @param
[out]
values the tabulated values of the function f(x,y,z), ordered so that
* values[i+xsize*j+xsize*ysize*k] = f(i,j,k). This must be of length xsize*ysize*zsize.
*
values[i+xsize*j+xsize*ysize*k] = f(i,j,k). This must be of length xsize*ysize*zsize.
*/
*/
void
getFunctionParameters
(
int
&
xsize
,
int
&
ysize
,
int
&
zsize
,
std
::
vector
<
double
>&
values
)
const
;
void
getFunctionParameters
(
int
&
xsize
,
int
&
ysize
,
int
&
zsize
,
std
::
vector
<
double
>&
values
)
const
;
/**
/**
...
...
openmmapi/include/openmm/internal/OSRngSeed.h
View file @
dca54ec7
#
ifndef
OPENMM_OSRNGSEED_H_
#ifndef OPENMM_OSRNGSEED_H_
#define OPENMM_OSRNGSEED_H_
#define OPENMM_OSRNGSEED_H_
...
...
openmmapi/include/openmm/internal/timer.h
0 → 100644
View file @
dca54ec7
#ifndef OPENMM_TIMER_H_
#define OPENMM_TIMER_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2016 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
/**
* This header provides a static function for querying the current system time in seconds.
* It is useful when profiling.
*/
#ifdef _MSC_VER
#include <Windows.h>
static
double
getCurrentTime
()
{
FILETIME
ft
;
GetSystemTimeAsFileTime
(
&
ft
);
// 100-nanoseconds since 1-1-1601
ULARGE_INTEGER
result
;
result
.
LowPart
=
ft
.
dwLowDateTime
;
result
.
HighPart
=
ft
.
dwHighDateTime
;
return
1e-7
*
result
.
QuadPart
;
}
#else
#include <sys/time.h>
static
double
getCurrentTime
()
{
struct
timeval
tod
;
gettimeofday
(
&
tod
,
0
);
return
tod
.
tv_sec
+
1e-6
*
tod
.
tv_usec
;
}
#endif
#endif
/*OPENMM_TIMER_H_*/
openmmapi/src/CMAPTorsionForce.cpp
View file @
dca54ec7
...
@@ -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-201
5
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
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
;
}
openmmapi/src/ContextImpl.cpp
View file @
dca54ec7
...
@@ -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-201
3
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
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
,
p
roperties
);
platform
->
contextCreated
(
*
this
,
validatedP
roperties
);
break
;
break
;
}
}
catch
(...)
{
catch
(...)
{
...
@@ -449,4 +454,5 @@ void ContextImpl::loadCheckpoint(istream& stream) {
...
@@ -449,4 +454,5 @@ void ContextImpl::loadCheckpoint(istream& stream) {
parameters
[
name
]
=
value
;
parameters
[
name
]
=
value
;
}
}
updateStateDataKernel
.
getAs
<
UpdateStateDataKernel
>
().
loadCheckpoint
(
*
this
,
stream
);
updateStateDataKernel
.
getAs
<
UpdateStateDataKernel
>
().
loadCheckpoint
(
*
this
,
stream
);
hasSetPositions
=
true
;
}
}
openmmapi/src/CustomAngleForce.cpp
View file @
dca54ec7
...
@@ -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
;
}
openmmapi/src/CustomBondForce.cpp
View file @
dca54ec7
...
@@ -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-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
16
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
;
}
openmmapi/src/CustomCentroidBondForce.cpp
View file @
dca54ec7
...
@@ -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) 2015 Stanford University and the Authors.
*
* Portions copyright (c) 2015
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -48,7 +48,7 @@ using std::string;
...
@@ -48,7 +48,7 @@ using std::string;
using
std
::
stringstream
;
using
std
::
stringstream
;
using
std
::
vector
;
using
std
::
vector
;
CustomCentroidBondForce
::
CustomCentroidBondForce
(
int
numGroups
,
const
string
&
energy
)
:
groupsPerBond
(
numGroups
),
energyExpression
(
energy
)
{
CustomCentroidBondForce
::
CustomCentroidBondForce
(
int
numGroups
,
const
string
&
energy
)
:
groupsPerBond
(
numGroups
),
energyExpression
(
energy
)
,
usePeriodic
(
false
)
{
}
}
CustomCentroidBondForce
::~
CustomCentroidBondForce
()
{
CustomCentroidBondForce
::~
CustomCentroidBondForce
()
{
...
@@ -173,3 +173,11 @@ ForceImpl* CustomCentroidBondForce::createImpl() const {
...
@@ -173,3 +173,11 @@ ForceImpl* CustomCentroidBondForce::createImpl() const {
void
CustomCentroidBondForce
::
updateParametersInContext
(
Context
&
context
)
{
void
CustomCentroidBondForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
CustomCentroidBondForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
CustomCentroidBondForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
CustomCentroidBondForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
CustomCentroidBondForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
openmmapi/src/CustomCompoundBondForce.cpp
View file @
dca54ec7
...
@@ -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-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -48,7 +48,7 @@ using std::string;
...
@@ -48,7 +48,7 @@ using std::string;
using
std
::
stringstream
;
using
std
::
stringstream
;
using
std
::
vector
;
using
std
::
vector
;
CustomCompoundBondForce
::
CustomCompoundBondForce
(
int
numParticles
,
const
string
&
energy
)
:
particlesPerBond
(
numParticles
),
energyExpression
(
energy
)
{
CustomCompoundBondForce
::
CustomCompoundBondForce
(
int
numParticles
,
const
string
&
energy
)
:
particlesPerBond
(
numParticles
),
energyExpression
(
energy
)
,
usePeriodic
(
false
)
{
}
}
...
@@ -176,3 +176,11 @@ ForceImpl* CustomCompoundBondForce::createImpl() const {
...
@@ -176,3 +176,11 @@ ForceImpl* CustomCompoundBondForce::createImpl() const {
void
CustomCompoundBondForce
::
updateParametersInContext
(
Context
&
context
)
{
void
CustomCompoundBondForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
CustomCompoundBondForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
CustomCompoundBondForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
CustomCompoundBondForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
CustomCompoundBondForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
openmmapi/src/CustomIntegrator.cpp
View file @
dca54ec7
...
@@ -248,21 +248,21 @@ int CustomIntegrator::addUpdateContextState() {
...
@@ -248,21 +248,21 @@ int CustomIntegrator::addUpdateContextState() {
int
CustomIntegrator
::
beginIfBlock
(
const
string
&
expression
)
{
int
CustomIntegrator
::
beginIfBlock
(
const
string
&
expression
)
{
if
(
owner
!=
NULL
)
if
(
owner
!=
NULL
)
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
computations
.
push_back
(
ComputationInfo
(
Begin
IfBlock
,
""
,
expression
));
computations
.
push_back
(
ComputationInfo
(
IfBlock
Start
,
""
,
expression
));
return
computations
.
size
()
-
1
;
return
computations
.
size
()
-
1
;
}
}
int
CustomIntegrator
::
beginWhileBlock
(
const
string
&
expression
)
{
int
CustomIntegrator
::
beginWhileBlock
(
const
string
&
expression
)
{
if
(
owner
!=
NULL
)
if
(
owner
!=
NULL
)
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
computations
.
push_back
(
ComputationInfo
(
Begin
WhileBlock
,
""
,
expression
));
computations
.
push_back
(
ComputationInfo
(
WhileBlock
Start
,
""
,
expression
));
return
computations
.
size
()
-
1
;
return
computations
.
size
()
-
1
;
}
}
int
CustomIntegrator
::
endBlock
()
{
int
CustomIntegrator
::
endBlock
()
{
if
(
owner
!=
NULL
)
if
(
owner
!=
NULL
)
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
computations
.
push_back
(
ComputationInfo
(
End
Block
,
""
,
""
));
computations
.
push_back
(
ComputationInfo
(
Block
End
,
""
,
""
));
return
computations
.
size
()
-
1
;
return
computations
.
size
()
-
1
;
}
}
...
...
openmmapi/src/CustomIntegratorUtilities.cpp
View file @
dca54ec7
...
@@ -87,7 +87,7 @@ void CustomIntegratorUtilities::analyzeComputations(const ContextImpl& context,
...
@@ -87,7 +87,7 @@ void CustomIntegratorUtilities::analyzeComputations(const ContextImpl& context,
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
string
expression
;
string
expression
;
integrator
.
getComputationStep
(
step
,
stepType
[
step
],
stepVariable
[
step
],
expression
);
integrator
.
getComputationStep
(
step
,
stepType
[
step
],
stepVariable
[
step
],
expression
);
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
IfBlock
||
stepType
[
step
]
==
CustomIntegrator
::
Begin
WhileBlock
)
{
if
(
stepType
[
step
]
==
CustomIntegrator
::
IfBlock
Start
||
stepType
[
step
]
==
CustomIntegrator
::
WhileBlock
Start
)
{
// This step involves a condition.
// This step involves a condition.
string
lhs
,
rhs
;
string
lhs
,
rhs
;
...
@@ -158,9 +158,9 @@ void CustomIntegratorUtilities::analyzeComputations(const ContextImpl& context,
...
@@ -158,9 +158,9 @@ void CustomIntegratorUtilities::analyzeComputations(const ContextImpl& context,
vector
<
int
>
blockStart
;
vector
<
int
>
blockStart
;
blockEnd
.
resize
(
numSteps
,
-
1
);
blockEnd
.
resize
(
numSteps
,
-
1
);
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
IfBlock
||
stepType
[
step
]
==
CustomIntegrator
::
Begin
WhileBlock
)
if
(
stepType
[
step
]
==
CustomIntegrator
::
IfBlock
Start
||
stepType
[
step
]
==
CustomIntegrator
::
WhileBlock
Start
)
blockStart
.
push_back
(
step
);
blockStart
.
push_back
(
step
);
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
End
Block
)
{
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
Block
End
)
{
if
(
blockStart
.
size
()
==
0
)
{
if
(
blockStart
.
size
()
==
0
)
{
stringstream
error
(
"CustomIntegrator: Unexpected end of block at computation "
);
stringstream
error
(
"CustomIntegrator: Unexpected end of block at computation "
);
error
<<
step
;
error
<<
step
;
...
@@ -207,7 +207,7 @@ void CustomIntegratorUtilities::enumeratePaths(int firstStep, vector<int> steps,
...
@@ -207,7 +207,7 @@ void CustomIntegratorUtilities::enumeratePaths(int firstStep, vector<int> steps,
jumps
[
step
]
=
-
1
;
jumps
[
step
]
=
-
1
;
step
=
nextStep
;
step
=
nextStep
;
}
}
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
IfBlock
)
{
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
IfBlock
Start
)
{
// Consider skipping the block.
// Consider skipping the block.
enumeratePaths
(
blockEnd
[
step
]
+
1
,
steps
,
jumps
,
blockEnd
,
stepType
,
needsForces
,
needsEnergy
,
invalidatesForces
,
forceGroup
,
computeBoth
);
enumeratePaths
(
blockEnd
[
step
]
+
1
,
steps
,
jumps
,
blockEnd
,
stepType
,
needsForces
,
needsEnergy
,
invalidatesForces
,
forceGroup
,
computeBoth
);
...
@@ -216,7 +216,7 @@ void CustomIntegratorUtilities::enumeratePaths(int firstStep, vector<int> steps,
...
@@ -216,7 +216,7 @@ void CustomIntegratorUtilities::enumeratePaths(int firstStep, vector<int> steps,
step
++
;
step
++
;
}
}
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
WhileBlock
&&
jumps
[
step
]
!=
-
2
)
{
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
WhileBlock
Start
&&
jumps
[
step
]
!=
-
2
)
{
// Consider skipping the block.
// Consider skipping the block.
enumeratePaths
(
blockEnd
[
step
]
+
1
,
steps
,
jumps
,
blockEnd
,
stepType
,
needsForces
,
needsEnergy
,
invalidatesForces
,
forceGroup
,
computeBoth
);
enumeratePaths
(
blockEnd
[
step
]
+
1
,
steps
,
jumps
,
blockEnd
,
stepType
,
needsForces
,
needsEnergy
,
invalidatesForces
,
forceGroup
,
computeBoth
);
...
...
openmmapi/src/CustomNonbondedForce.cpp
View file @
dca54ec7
...
@@ -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-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -195,6 +195,9 @@ void CustomNonbondedForce::setExclusionParticles(int index, int particle1, int p
...
@@ -195,6 +195,9 @@ void CustomNonbondedForce::setExclusionParticles(int index, int particle1, int p
void
CustomNonbondedForce
::
createExclusionsFromBonds
(
const
vector
<
pair
<
int
,
int
>
>&
bonds
,
int
bondCutoff
)
{
void
CustomNonbondedForce
::
createExclusionsFromBonds
(
const
vector
<
pair
<
int
,
int
>
>&
bonds
,
int
bondCutoff
)
{
if
(
bondCutoff
<
1
)
if
(
bondCutoff
<
1
)
return
;
return
;
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
size
();
++
i
)
if
(
bonds
[
i
].
first
<
0
||
bonds
[
i
].
second
<
0
||
bonds
[
i
].
first
>=
particles
.
size
()
||
bonds
[
i
].
second
>=
particles
.
size
())
throw
OpenMMException
(
"createExclusionsFromBonds: Illegal particle index in list of bonds"
);
vector
<
set
<
int
>
>
exclusions
(
particles
.
size
());
vector
<
set
<
int
>
>
exclusions
(
particles
.
size
());
vector
<
set
<
int
>
>
bonded12
(
exclusions
.
size
());
vector
<
set
<
int
>
>
bonded12
(
exclusions
.
size
());
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
size
();
++
i
)
{
...
...
openmmapi/src/CustomTorsionForce.cpp
View file @
dca54ec7
...
@@ -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
;
CustomTorsionForce
::
CustomTorsionForce
(
const
string
&
energy
)
:
energyExpression
(
energy
)
{
CustomTorsionForce
::
CustomTorsionForce
(
const
string
&
energy
)
:
energyExpression
(
energy
)
,
usePeriodic
(
false
)
{
}
}
const
string
&
CustomTorsionForce
::
getEnergyFunction
()
const
{
const
string
&
CustomTorsionForce
::
getEnergyFunction
()
const
{
...
@@ -125,3 +125,11 @@ ForceImpl* CustomTorsionForce::createImpl() const {
...
@@ -125,3 +125,11 @@ ForceImpl* CustomTorsionForce::createImpl() const {
void
CustomTorsionForce
::
updateParametersInContext
(
Context
&
context
)
{
void
CustomTorsionForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
CustomTorsionForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
CustomTorsionForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
CustomTorsionForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
CustomTorsionForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
openmmapi/src/HarmonicAngleForce.cpp
View file @
dca54ec7
...
@@ -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-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
16
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
;
HarmonicAngleForce
::
HarmonicAngleForce
()
{
HarmonicAngleForce
::
HarmonicAngleForce
()
:
usePeriodic
(
false
)
{
}
}
int
HarmonicAngleForce
::
addAngle
(
int
particle1
,
int
particle2
,
int
particle3
,
double
angle
,
double
k
)
{
int
HarmonicAngleForce
::
addAngle
(
int
particle1
,
int
particle2
,
int
particle3
,
double
angle
,
double
k
)
{
...
@@ -70,3 +70,11 @@ ForceImpl* HarmonicAngleForce::createImpl() const {
...
@@ -70,3 +70,11 @@ ForceImpl* HarmonicAngleForce::createImpl() const {
void
HarmonicAngleForce
::
updateParametersInContext
(
Context
&
context
)
{
void
HarmonicAngleForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
HarmonicAngleForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
HarmonicAngleForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
HarmonicAngleForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
HarmonicAngleForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
openmmapi/src/HarmonicBondForce.cpp
View file @
dca54ec7
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
HarmonicBondForce
::
HarmonicBondForce
()
{
HarmonicBondForce
::
HarmonicBondForce
()
:
usePeriodic
(
false
)
{
}
}
int
HarmonicBondForce
::
addBond
(
int
particle1
,
int
particle2
,
double
length
,
double
k
)
{
int
HarmonicBondForce
::
addBond
(
int
particle1
,
int
particle2
,
double
length
,
double
k
)
{
...
@@ -68,3 +68,11 @@ ForceImpl* HarmonicBondForce::createImpl() const {
...
@@ -68,3 +68,11 @@ ForceImpl* HarmonicBondForce::createImpl() const {
void
HarmonicBondForce
::
updateParametersInContext
(
Context
&
context
)
{
void
HarmonicBondForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
HarmonicBondForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
HarmonicBondForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
HarmonicBondForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
HarmonicBondForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
openmmapi/src/LocalEnergyMinimizer.cpp
View file @
dca54ec7
...
@@ -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-201
2
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <cmath>
#include <cmath>
#include <sstream>
#include <sstream>
#include <vector>
#include <vector>
#include <algorithm>
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
...
@@ -108,7 +109,8 @@ void LocalEnergyMinimizer::minimize(Context& context, double tolerance, int maxI
...
@@ -108,7 +109,8 @@ void LocalEnergyMinimizer::minimize(Context& context, double tolerance, int maxI
if
(
x
==
NULL
)
if
(
x
==
NULL
)
throw
OpenMMException
(
"LocalEnergyMinimizer: Failed to allocate memory"
);
throw
OpenMMException
(
"LocalEnergyMinimizer: Failed to allocate memory"
);
double
constraintTol
=
context
.
getIntegrator
().
getConstraintTolerance
();
double
constraintTol
=
context
.
getIntegrator
().
getConstraintTolerance
();
double
k
=
tolerance
/
constraintTol
;
double
workingConstraintTol
=
std
::
max
(
1e-4
,
constraintTol
);
double
k
=
tolerance
/
workingConstraintTol
;
// Initialize the minimizer.
// Initialize the minimizer.
...
@@ -121,7 +123,7 @@ void LocalEnergyMinimizer::minimize(Context& context, double tolerance, int maxI
...
@@ -121,7 +123,7 @@ void LocalEnergyMinimizer::minimize(Context& context, double tolerance, int maxI
// Make sure the initial configuration satisfies all constraints.
// Make sure the initial configuration satisfies all constraints.
context
.
applyConstraints
(
c
onstraintTol
);
context
.
applyConstraints
(
workingC
onstraintTol
);
// Record the initial positions and determine a normalization constant for scaling the tolerance.
// Record the initial positions and determine a normalization constant for scaling the tolerance.
...
@@ -162,14 +164,14 @@ void LocalEnergyMinimizer::minimize(Context& context, double tolerance, int maxI
...
@@ -162,14 +164,14 @@ void LocalEnergyMinimizer::minimize(Context& context, double tolerance, int maxI
if
(
error
>
maxError
)
if
(
error
>
maxError
)
maxError
=
error
;
maxError
=
error
;
}
}
if
(
maxError
<=
c
onstraintTol
)
if
(
maxError
<=
workingC
onstraintTol
)
break
;
// All constraints are satisfied.
break
;
// All constraints are satisfied.
context
.
setPositions
(
initialPos
);
context
.
setPositions
(
initialPos
);
if
(
maxError
>=
prevMaxError
)
if
(
maxError
>=
prevMaxError
)
break
;
// Further tightening the springs doesn't seem to be helping, so just give up.
break
;
// Further tightening the springs doesn't seem to be helping, so just give up.
prevMaxError
=
maxError
;
prevMaxError
=
maxError
;
k
*=
10
;
k
*=
10
;
if
(
maxError
>
100
*
c
onstraintTol
)
{
if
(
maxError
>
100
*
workingC
onstraintTol
)
{
// We've gotten far enough from a valid state that we might have trouble getting
// We've gotten far enough from a valid state that we might have trouble getting
// back, so reset to the original positions.
// back, so reset to the original positions.
...
@@ -181,5 +183,11 @@ void LocalEnergyMinimizer::minimize(Context& context, double tolerance, int maxI
...
@@ -181,5 +183,11 @@ void LocalEnergyMinimizer::minimize(Context& context, double tolerance, int maxI
}
}
}
}
lbfgs_free
(
x
);
lbfgs_free
(
x
);
// If necessary, do a final constraint projection to make sure they are satisfied
// to the full precision requested by the user.
if
(
constraintTol
<
workingConstraintTol
)
context
.
applyConstraints
(
workingConstraintTol
);
}
}
openmmapi/src/MonteCarloAnisotropicBarostat.cpp
View file @
dca54ec7
...
@@ -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: *
* *
* *
...
@@ -34,8 +34,8 @@
...
@@ -34,8 +34,8 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
MonteCarloAnisotropicBarostat
::
MonteCarloAnisotropicBarostat
(
const
Vec3
&
defaultPressure
,
double
t
emperature
,
bool
scaleX
,
bool
scaleY
,
bool
scaleZ
,
int
frequency
)
:
MonteCarloAnisotropicBarostat
::
MonteCarloAnisotropicBarostat
(
const
Vec3
&
defaultPressure
,
double
defaultT
emperature
,
bool
scaleX
,
bool
scaleY
,
bool
scaleZ
,
int
frequency
)
:
defaultPressure
(
defaultPressure
),
t
emperature
(
t
emperature
),
scaleX
(
scaleX
),
scaleY
(
scaleY
),
scaleZ
(
scaleZ
),
frequency
(
frequency
)
{
defaultPressure
(
defaultPressure
),
defaultT
emperature
(
defaultT
emperature
),
scaleX
(
scaleX
),
scaleY
(
scaleY
),
scaleZ
(
scaleZ
),
frequency
(
frequency
)
{
setRandomNumberSeed
(
0
);
setRandomNumberSeed
(
0
);
}
}
...
...
Prev
1
2
3
4
5
6
7
8
…
20
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment