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
855ece90
"vscode:/vscode.git/clone" did not exist on "875426081fc495492e75c87873838a71add0adb9"
Commit
855ece90
authored
Oct 17, 2013
by
leeping
Browse files
Merge branch 'master' of
https://github.com/SimTk/openmm
parents
471bea82
a42c55ad
Changes
115
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
541 additions
and
379 deletions
+541
-379
platforms/cuda/tests/TestCudaVariableVerletIntegrator.cpp
platforms/cuda/tests/TestCudaVariableVerletIntegrator.cpp
+32
-0
platforms/cuda/tests/TestCudaVerletIntegrator.cpp
platforms/cuda/tests/TestCudaVerletIntegrator.cpp
+32
-0
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
+14
-8
platforms/opencl/tests/TestOpenCLBrownianIntegrator.cpp
platforms/opencl/tests/TestOpenCLBrownianIntegrator.cpp
+32
-0
platforms/opencl/tests/TestOpenCLCustomIntegrator.cpp
platforms/opencl/tests/TestOpenCLCustomIntegrator.cpp
+38
-0
platforms/opencl/tests/TestOpenCLLangevinIntegrator.cpp
platforms/opencl/tests/TestOpenCLLangevinIntegrator.cpp
+32
-0
platforms/opencl/tests/TestOpenCLVariableLangevinIntegrator.cpp
...rms/opencl/tests/TestOpenCLVariableLangevinIntegrator.cpp
+32
-0
platforms/opencl/tests/TestOpenCLVariableVerletIntegrator.cpp
...forms/opencl/tests/TestOpenCLVariableVerletIntegrator.cpp
+33
-0
platforms/opencl/tests/TestOpenCLVerletIntegrator.cpp
platforms/opencl/tests/TestOpenCLVerletIntegrator.cpp
+32
-0
platforms/reference/include/ReferenceCCMAAlgorithm.h
platforms/reference/include/ReferenceCCMAAlgorithm.h
+76
-138
platforms/reference/include/ReferenceConstraint.h
platforms/reference/include/ReferenceConstraint.h
+0
-142
platforms/reference/include/ReferenceConstraintAlgorithm.h
platforms/reference/include/ReferenceConstraintAlgorithm.h
+23
-43
platforms/reference/include/ReferenceConstraints.h
platforms/reference/include/ReferenceConstraints.h
+86
-0
platforms/reference/include/ReferenceCustomAngleIxn.h
platforms/reference/include/ReferenceCustomAngleIxn.h
+10
-7
platforms/reference/include/ReferenceCustomBondIxn.h
platforms/reference/include/ReferenceCustomBondIxn.h
+10
-7
platforms/reference/include/ReferenceCustomExternalIxn.h
platforms/reference/include/ReferenceCustomExternalIxn.h
+17
-10
platforms/reference/include/ReferenceCustomNonbondedIxn.h
platforms/reference/include/ReferenceCustomNonbondedIxn.h
+12
-10
platforms/reference/include/ReferenceCustomTorsionIxn.h
platforms/reference/include/ReferenceCustomTorsionIxn.h
+10
-7
platforms/reference/include/ReferenceForce.h
platforms/reference/include/ReferenceForce.h
+14
-2
platforms/reference/include/ReferenceKernels.h
platforms/reference/include/ReferenceKernels.h
+6
-5
No files found.
platforms/cuda/tests/TestCudaVariableVerletIntegrator.cpp
View file @
855ece90
...
...
@@ -211,6 +211,37 @@ void testConstrainedClusters() {
ASSERT
(
context
.
getState
(
State
::
Positions
).
getTime
()
>
0.1
);
}
void
testConstrainedMasslessParticles
()
{
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
system
.
addConstraint
(
0
,
1
,
1.5
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
positions
[
1
]
=
Vec3
(
1
,
0
,
0
);
VariableVerletIntegrator
integrator
(
0.01
);
bool
failed
=
false
;
try
{
// This should throw an exception.
Context
context
(
system
,
integrator
,
platform
);
}
catch
(
exception
&
ex
)
{
failed
=
true
;
}
ASSERT
(
failed
);
// Now make both particles massless, which should work.
system
.
setParticleMass
(
1
,
0.0
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
300.0
);
integrator
.
step
(
1
);
State
state
=
context
.
getState
(
State
::
Velocities
);
ASSERT_EQUAL
(
0.0
,
state
.
getVelocities
()[
0
][
0
]);
}
void
testArgonBox
()
{
const
int
gridSize
=
8
;
const
double
mass
=
40.0
;
// Ar atomic mass
...
...
@@ -274,6 +305,7 @@ int main(int argc, char* argv[]) {
testSingleBond
();
testConstraints
();
testConstrainedClusters
();
testConstrainedMasslessParticles
();
testArgonBox
();
}
catch
(
const
exception
&
e
)
{
...
...
platforms/cuda/tests/TestCudaVerletIntegrator.cpp
View file @
855ece90
...
...
@@ -203,6 +203,37 @@ void testConstrainedClusters() {
}
}
void
testConstrainedMasslessParticles
()
{
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
system
.
addConstraint
(
0
,
1
,
1.5
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
positions
[
1
]
=
Vec3
(
1
,
0
,
0
);
VerletIntegrator
integrator
(
0.01
);
bool
failed
=
false
;
try
{
// This should throw an exception.
Context
context
(
system
,
integrator
,
platform
);
}
catch
(
exception
&
ex
)
{
failed
=
true
;
}
ASSERT
(
failed
);
// Now make both particles massless, which should work.
system
.
setParticleMass
(
1
,
0.0
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
300.0
);
integrator
.
step
(
1
);
State
state
=
context
.
getState
(
State
::
Velocities
);
ASSERT_EQUAL
(
0.0
,
state
.
getVelocities
()[
0
][
0
]);
}
int
main
(
int
argc
,
char
*
argv
[])
{
try
{
if
(
argc
>
1
)
...
...
@@ -210,6 +241,7 @@ int main(int argc, char* argv[]) {
testSingleBond
();
testConstraints
();
testConstrainedClusters
();
testConstrainedMasslessParticles
();
}
catch
(
const
exception
&
e
)
{
cout
<<
"exception: "
<<
e
.
what
()
<<
endl
;
...
...
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
View file @
855ece90
...
...
@@ -141,15 +141,21 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
// Record the set of constraints and how many constraints each atom is involved in.
int
numConstraints
=
system
.
getNumConstraints
();
vector
<
int
>
atom1
(
numConstraints
);
vector
<
int
>
atom2
(
numConstraints
);
vector
<
double
>
distance
(
numConstraints
);
vector
<
int
>
atom1
;
vector
<
int
>
atom2
;
vector
<
double
>
distance
;
vector
<
int
>
constraintCount
(
context
.
getNumAtoms
(),
0
);
for
(
int
i
=
0
;
i
<
numConstraints
;
i
++
)
{
system
.
getConstraintParameters
(
i
,
atom1
[
i
],
atom2
[
i
],
distance
[
i
]);
constraintCount
[
atom1
[
i
]]
++
;
constraintCount
[
atom2
[
i
]]
++
;
for
(
int
i
=
0
;
i
<
system
.
getNumConstraints
();
i
++
)
{
int
p1
,
p2
;
double
d
;
system
.
getConstraintParameters
(
i
,
p1
,
p2
,
d
);
if
(
system
.
getParticleMass
(
p1
)
!=
0
||
system
.
getParticleMass
(
p2
)
!=
0
)
{
atom1
.
push_back
(
p1
);
atom2
.
push_back
(
p2
);
distance
.
push_back
(
d
);
constraintCount
[
p1
]
++
;
constraintCount
[
p2
]
++
;
}
}
// Identify clusters of three atoms that can be treated with SETTLE. First, for every
...
...
platforms/opencl/tests/TestOpenCLBrownianIntegrator.cpp
View file @
855ece90
...
...
@@ -172,6 +172,37 @@ void testConstraints() {
}
}
void
testConstrainedMasslessParticles
()
{
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
system
.
addConstraint
(
0
,
1
,
1.5
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
positions
[
1
]
=
Vec3
(
1
,
0
,
0
);
BrownianIntegrator
integrator
(
300.0
,
2.0
,
0.01
);
bool
failed
=
false
;
try
{
// This should throw an exception.
Context
context
(
system
,
integrator
,
platform
);
}
catch
(
exception
&
ex
)
{
failed
=
true
;
}
ASSERT
(
failed
);
// Now make both particles massless, which should work.
system
.
setParticleMass
(
1
,
0.0
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
300.0
);
integrator
.
step
(
1
);
State
state
=
context
.
getState
(
State
::
Velocities
);
ASSERT_EQUAL
(
0.0
,
state
.
getVelocities
()[
0
][
0
]);
}
void
testRandomSeed
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
...
...
@@ -237,6 +268,7 @@ int main(int argc, char* argv[]) {
testSingleBond
();
testTemperature
();
testConstraints
();
testConstrainedMasslessParticles
();
testRandomSeed
();
}
catch
(
const
exception
&
e
)
{
...
...
platforms/opencl/tests/TestOpenCLCustomIntegrator.cpp
View file @
855ece90
...
...
@@ -233,6 +233,43 @@ void testVelocityConstraints() {
}
}
void
testConstrainedMasslessParticles
()
{
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
system
.
addConstraint
(
0
,
1
,
1.5
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
positions
[
1
]
=
Vec3
(
1
,
0
,
0
);
CustomIntegrator
integrator
(
0.002
);
integrator
.
addPerDofVariable
(
"oldx"
,
0
);
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"oldx"
,
"x"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
integrator
.
addConstrainPositions
();
integrator
.
addComputePerDof
(
"v"
,
"(x-oldx)/dt"
);
bool
failed
=
false
;
try
{
// This should throw an exception.
Context
context
(
system
,
integrator
,
platform
);
}
catch
(
exception
&
ex
)
{
failed
=
true
;
}
ASSERT
(
failed
);
// Now make both particles massless, which should work.
system
.
setParticleMass
(
1
,
0.0
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
300.0
);
integrator
.
step
(
1
);
State
state
=
context
.
getState
(
State
::
Velocities
|
State
::
Positions
);
ASSERT_EQUAL
(
0.0
,
state
.
getVelocities
()[
0
][
0
]);
}
/**
* Test an integrator with an AndersenThermostat to see if updateContextState()
* is being handled correctly.
...
...
@@ -724,6 +761,7 @@ int main(int argc, char* argv[]) {
testSingleBond
();
testConstraints
();
testVelocityConstraints
();
testConstrainedMasslessParticles
();
testWithThermostat
();
testMonteCarlo
();
testSum
();
...
...
platforms/opencl/tests/TestOpenCLLangevinIntegrator.cpp
View file @
855ece90
...
...
@@ -177,6 +177,37 @@ void testConstraints() {
}
}
void
testConstrainedMasslessParticles
()
{
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
system
.
addConstraint
(
0
,
1
,
1.5
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
positions
[
1
]
=
Vec3
(
1
,
0
,
0
);
LangevinIntegrator
integrator
(
300.0
,
2.0
,
0.01
);
bool
failed
=
false
;
try
{
// This should throw an exception.
Context
context
(
system
,
integrator
,
platform
);
}
catch
(
exception
&
ex
)
{
failed
=
true
;
}
ASSERT
(
failed
);
// Now make both particles massless, which should work.
system
.
setParticleMass
(
1
,
0.0
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
300.0
);
integrator
.
step
(
1
);
State
state
=
context
.
getState
(
State
::
Velocities
);
ASSERT_EQUAL
(
0.0
,
state
.
getVelocities
()[
0
][
0
]);
}
void
testRandomSeed
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
...
...
@@ -241,6 +272,7 @@ int main(int argc, char* argv[]) {
testSingleBond
();
testTemperature
();
testConstraints
();
testConstrainedMasslessParticles
();
testRandomSeed
();
}
catch
(
const
exception
&
e
)
{
...
...
platforms/opencl/tests/TestOpenCLVariableLangevinIntegrator.cpp
View file @
855ece90
...
...
@@ -172,6 +172,37 @@ void testConstraints() {
}
}
void
testConstrainedMasslessParticles
()
{
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
system
.
addConstraint
(
0
,
1
,
1.5
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
positions
[
1
]
=
Vec3
(
1
,
0
,
0
);
VariableLangevinIntegrator
integrator
(
300.0
,
2.0
,
0.01
);
bool
failed
=
false
;
try
{
// This should throw an exception.
Context
context
(
system
,
integrator
,
platform
);
}
catch
(
exception
&
ex
)
{
failed
=
true
;
}
ASSERT
(
failed
);
// Now make both particles massless, which should work.
system
.
setParticleMass
(
1
,
0.0
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
300.0
);
integrator
.
step
(
1
);
State
state
=
context
.
getState
(
State
::
Velocities
);
ASSERT_EQUAL
(
0.0
,
state
.
getVelocities
()[
0
][
0
]);
}
void
testRandomSeed
()
{
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
...
...
@@ -295,6 +326,7 @@ int main(int argc, char* argv[]) {
testSingleBond
();
testTemperature
();
testConstraints
();
testConstrainedMasslessParticles
();
testRandomSeed
();
testArgonBox
();
}
...
...
platforms/opencl/tests/TestOpenCLVariableVerletIntegrator.cpp
View file @
855ece90
...
...
@@ -210,6 +210,38 @@ void testConstrainedClusters() {
ASSERT
(
context
.
getState
(
State
::
Positions
).
getTime
()
>
0.1
);
}
void
testConstrainedMasslessParticles
()
{
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
system
.
addConstraint
(
0
,
1
,
1.5
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
positions
[
1
]
=
Vec3
(
1
,
0
,
0
);
VariableVerletIntegrator
integrator
(
0.01
);
bool
failed
=
false
;
try
{
// This should throw an exception.
Context
context
(
system
,
integrator
,
platform
);
}
catch
(
exception
&
ex
)
{
failed
=
true
;
}
ASSERT
(
failed
);
// Now make both particles massless, which should work.
system
.
setParticleMass
(
1
,
0.0
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
300.0
);
integrator
.
step
(
1
);
State
state
=
context
.
getState
(
State
::
Velocities
);
ASSERT_EQUAL
(
0.0
,
state
.
getVelocities
()[
0
][
0
]);
}
void
testArgonBox
()
{
const
int
gridSize
=
8
;
const
double
mass
=
40.0
;
// Ar atomic mass
...
...
@@ -273,6 +305,7 @@ int main(int argc, char* argv[]) {
testSingleBond
();
testConstraints
();
testConstrainedClusters
();
testConstrainedMasslessParticles
();
testArgonBox
();
}
catch
(
const
exception
&
e
)
{
...
...
platforms/opencl/tests/TestOpenCLVerletIntegrator.cpp
View file @
855ece90
...
...
@@ -201,6 +201,37 @@ void testConstrainedClusters() {
}
}
void
testConstrainedMasslessParticles
()
{
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
system
.
addConstraint
(
0
,
1
,
1.5
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
positions
[
1
]
=
Vec3
(
1
,
0
,
0
);
VerletIntegrator
integrator
(
0.01
);
bool
failed
=
false
;
try
{
// This should throw an exception.
Context
context
(
system
,
integrator
,
platform
);
}
catch
(
exception
&
ex
)
{
failed
=
true
;
}
ASSERT
(
failed
);
// Now make both particles massless, which should work.
system
.
setParticleMass
(
1
,
0.0
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setVelocitiesToTemperature
(
300.0
);
integrator
.
step
(
1
);
State
state
=
context
.
getState
(
State
::
Velocities
);
ASSERT_EQUAL
(
0.0
,
state
.
getVelocities
()[
0
][
0
]);
}
int
main
(
int
argc
,
char
*
argv
[])
{
try
{
if
(
argc
>
1
)
...
...
@@ -208,6 +239,7 @@ int main(int argc, char* argv[]) {
testSingleBond
();
testConstraints
();
testConstrainedClusters
();
testConstrainedMasslessParticles
();
}
catch
(
const
exception
&
e
)
{
cout
<<
"exception: "
<<
e
.
what
()
<<
endl
;
...
...
platforms/reference/include/ReferenceCCMAAlgorithm.h
View file @
855ece90
/* Portions copyright (c) 2006-20
09
Stanford University and Simbios.
/* Portions copyright (c) 2006-20
13
Stanford University and Simbios.
* Contributors: Pande Group
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -34,151 +34,89 @@
class
OPENMM_EXPORT
ReferenceCCMAAlgorithm
:
public
ReferenceConstraintAlgorithm
{
protected:
protected:
int
_maximumNumberOfIterations
;
RealOpenMM
_tolerance
;
int
_maximumNumberOfIterations
;
RealOpenMM
_tolerance
;
int
_numberOfConstraints
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>
_atomIndices
;
std
::
vector
<
RealOpenMM
>
_distance
;
int
_numberOfConstraints
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>
_atomIndices
;
std
::
vector
<
RealOpenMM
>
_distance
;
std
::
vector
<
OpenMM
::
RealVec
>
_r_ij
;
RealOpenMM
*
_d_ij2
;
RealOpenMM
*
_distanceTolerance
;
RealOpenMM
*
_reducedMasses
;
bool
_hasInitializedMasses
;
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
RealOpenMM
>
>
>
_matrix
;
std
::
vector
<
OpenMM
::
RealVec
>
_r_ij
;
RealOpenMM
*
_d_ij2
;
RealOpenMM
*
_distanceTolerance
;
RealOpenMM
*
_reducedMasses
;
bool
_hasInitializedMasses
;
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
RealOpenMM
>
>
>
_matrix
;
private:
private:
int
applyConstraints
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
void
applyConstraints
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
,
bool
constrainingVelocities
);
public:
class
AngleInfo
;
/**---------------------------------------------------------------------------------------
ReferenceCCMAAlgorithm constructor
@param numberOfAtoms number of atoms
@param numberOfConstraints number of constraints
@param atomIndices atom indices for contraints
@param distance distances for constraints
@param masses atom masses
@param angles angle force field terms
@param tolerance constraint tolerance
--------------------------------------------------------------------------------------- */
ReferenceCCMAAlgorithm
(
int
numberOfAtoms
,
int
numberOfConstraints
,
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
atomIndices
,
const
std
::
vector
<
RealOpenMM
>&
distance
,
std
::
vector
<
RealOpenMM
>&
masses
,
std
::
vector
<
AngleInfo
>&
angles
,
RealOpenMM
tolerance
);
/**---------------------------------------------------------------------------------------
Destructor
--------------------------------------------------------------------------------------- */
~
ReferenceCCMAAlgorithm
(
);
/**---------------------------------------------------------------------------------------
Get number of constraints
@return number of constraints
--------------------------------------------------------------------------------------- */
int
getNumberOfConstraints
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Get maximum number of iterations
@return maximum number of iterations
--------------------------------------------------------------------------------------- */
int
getMaximumNumberOfIterations
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set maximum number of iterations
@param maximumNumberOfIterations new maximum number of iterations
--------------------------------------------------------------------------------------- */
void
setMaximumNumberOfIterations
(
int
maximumNumberOfIterations
);
/**---------------------------------------------------------------------------------------
Get tolerance
@return tolerance
--------------------------------------------------------------------------------------- */
RealOpenMM
getTolerance
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set tolerance
@param tolerance new tolerance
--------------------------------------------------------------------------------------- */
void
setTolerance
(
RealOpenMM
tolerance
);
/**---------------------------------------------------------------------------------------
Apply CCMA algorithm
@param numberOfAtoms number of atoms
@param atomCoordinates atom coordinates
@param atomCoordinatesP atom coordinates prime
@param inverseMasses 1/mass
@return SimTKOpenMMCommon::DefaultReturn if converge; else
return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
int
apply
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
);
/**---------------------------------------------------------------------------------------
Apply constraint algorithm to velocities.
@param numberOfAtoms number of atoms
@param atomCoordinates atom coordinates
@param velocities atom velocities
@param inverseMasses 1/mass
@return SimTKOpenMMCommon::DefaultReturn if converge; else
return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
int
applyToVelocities
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
public:
class
AngleInfo
;
/**
* Create a ReferenceCCMAAlgorithm object.
*
* @param numberOfAtoms the number of atoms in the system
* @param numberOfConstraints the number of constraints
* @param atomIndices atom indices for contraints
* @param distance distances for constraints
* @param masses atom masses
* @param angles angle force field terms
* @param tolerance constraint tolerance
*/
ReferenceCCMAAlgorithm
(
int
numberOfAtoms
,
int
numberOfConstraints
,
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
atomIndices
,
const
std
::
vector
<
RealOpenMM
>&
distance
,
std
::
vector
<
RealOpenMM
>&
masses
,
std
::
vector
<
AngleInfo
>&
angles
,
RealOpenMM
tolerance
);
~
ReferenceCCMAAlgorithm
(
);
/**
* Get the number of constraints.
*/
int
getNumberOfConstraints
(
void
)
const
;
/**
* Get the maximum number of iterations to perform.
*/
int
getMaximumNumberOfIterations
(
void
)
const
;
/**
* Set the maximum number of iterations to perform.
*/
void
setMaximumNumberOfIterations
(
int
maximumNumberOfIterations
);
/**
* Get the constraint tolerance.
*/
RealOpenMM
getTolerance
(
void
)
const
;
/**
* Set the constraint tolerance.
*/
void
setTolerance
(
RealOpenMM
tolerance
);
/**
* Apply the constraint algorithm.
*
* @param atomCoordinates the original atom coordinates
* @param atomCoordinatesP the new atom coordinates
* @param inverseMasses 1/mass
*/
void
apply
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
);
/**
* Apply the constraint algorithm to velocities.
*
* @param atomCoordinates the atom coordinates
* @param atomCoordinatesP the velocities to modify
* @param inverseMasses 1/mass
*/
void
applyToVelocities
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
);
/**---------------------------------------------------------------------------------------
Report any violated constraints
@param numberOfAtoms number of atoms
@param atomCoordinates atom coordinates
@param message report
@return number of violated constraints
--------------------------------------------------------------------------------------- */
int
reportCCMA
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
stringstream
&
message
);
};
class
ReferenceCCMAAlgorithm
::
AngleInfo
...
...
platforms/reference/include/ReferenceConstraint.h
deleted
100644 → 0
View file @
471bea82
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
#ifndef __ReferenceConstraint_H__
#define __ReferenceConstraint_H__
// ---------------------------------------------------------------------------------------
class
ReferenceConstraint
{
private:
public:
/**---------------------------------------------------------------------------------------
Constructor
--------------------------------------------------------------------------------------- */
ReferenceConstraint
(
);
/**---------------------------------------------------------------------------------------
Destructor
--------------------------------------------------------------------------------------- */
~
ReferenceConstraint
(
);
};
class
ReferenceShakeConstraint
:
public
ReferenceConstraint
{
private:
// force heavy atom into index 0
int
_atomIndices
[
2
];
RealOpenMM
_inverseMasses
[
2
];
RealOpenMM
_constraintDistance
;
public:
/**---------------------------------------------------------------------------------------
Constructor
@param atomIndex1 atom index 1
@param atomIndex2 atom index 2
@param distance distance constraint
@param inverseMass1 inverseMass of atom 1
@param inverseMass2 inverseMass of atom 2
--------------------------------------------------------------------------------------- */
ReferenceShakeConstraint
(
int
atomIndex1
,
int
atomIndex2
,
RealOpenMM
distance
,
RealOpenMM
inverseMass1
,
RealOpenMM
inverseMass2
);
/**---------------------------------------------------------------------------------------
Destructor
--------------------------------------------------------------------------------------- */
~
ReferenceShakeConstraint
(
);
/**---------------------------------------------------------------------------------------
Get constraint distance
@return distance
--------------------------------------------------------------------------------------- */
RealOpenMM
getConstraintDistance
(
void
);
/**---------------------------------------------------------------------------------------
Get inverse mass of heavy atom
@return inverse mass
--------------------------------------------------------------------------------------- */
RealOpenMM
getHeavyAtomInverseMass
(
void
);
/**---------------------------------------------------------------------------------------
Get inverse mass of light atom
@return inverse mass
--------------------------------------------------------------------------------------- */
RealOpenMM
getLightAtomInverseMass
(
void
);
/**---------------------------------------------------------------------------------------
Get index of heavy atom
@return index
--------------------------------------------------------------------------------------- */
int
getHeavyAtomIndex
(
void
);
/**---------------------------------------------------------------------------------------
Get index of light atom
@return index
--------------------------------------------------------------------------------------- */
int
getLightAtomIndex
(
void
);
};
// ---------------------------------------------------------------------------------------
#endif // __ReferenceShakeConstraint_H__
platforms/reference/include/ReferenceConstraintAlgorithm.h
View file @
855ece90
/* Portions copyright (c) 2009 Stanford University and Simbios.
/* Portions copyright (c) 2009
-2013
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -36,54 +36,34 @@ public:
virtual
~
ReferenceConstraintAlgorithm
()
{};
/**---------------------------------------------------------------------------------------
Get the constraint tolerance
--------------------------------------------------------------------------------------- */
/**
* Get the constraint tolerance.
*/
virtual
RealOpenMM
getTolerance
()
const
=
0
;
/**---------------------------------------------------------------------------------------
Set the constraint tolerance
--------------------------------------------------------------------------------------- */
/**
* Set the constraint tolerance.
*/
virtual
void
setTolerance
(
RealOpenMM
tolerance
)
=
0
;
/**---------------------------------------------------------------------------------------
Apply constraint algorithm
@param numberOfAtoms number of atoms
@param atomCoordinates atom coordinates
@param atomCoordinatesP atom coordinates prime
@param inverseMasses 1/mass
@return SimTKOpenMMCommon::DefaultReturn if converge; else
return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
virtual
int
apply
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
/**
* Apply the constraint algorithm.
*
* @param atomCoordinates the original atom coordinates
* @param atomCoordinatesP the new atom coordinates
* @param inverseMasses 1/mass
*/
virtual
void
apply
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
)
=
0
;
/**---------------------------------------------------------------------------------------
Apply constraint algorithm to velocities.
@param numberOfAtoms number of atoms
@param atomCoordinates atom coordinates
@param velocities atom velocities
@param inverseMasses 1/mass
@return SimTKOpenMMCommon::DefaultReturn if converge; else
return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
virtual
int
applyToVelocities
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
/**
* Apply the constraint algorithm to velocities.
*
* @param atomCoordinates the atom coordinates
* @param atomCoordinatesP the velocities to modify
* @param inverseMasses 1/mass
*/
virtual
void
applyToVelocities
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
)
=
0
;
};
...
...
platforms/reference/include/ReferenceConstraints.h
0 → 100644
View file @
855ece90
#ifndef OPENMM_REFERENCECONSTRAINTS_H_
#define OPENMM_REFERENCECONSTRAINTS_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) 2013 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. *
* -------------------------------------------------------------------------- */
#include "ReferenceConstraintAlgorithm.h"
#include "ReferenceCCMAAlgorithm.h"
#include "ReferenceSETTLEAlgorithm.h"
#include "openmm/System.h"
namespace
OpenMM
{
/**
* This class uses multiple algorithms to apply constraints as efficiently as possible. It identifies clusters
* of three atoms that can be handled by SETTLE, and creates a ReferenceSETTLEAlgorithm object to handle them.
* It then creates a ReferenceCCMAAlgorithm object to handle any remaining constraints.
*/
class
OPENMM_EXPORT
ReferenceConstraints
:
public
ReferenceConstraintAlgorithm
{
public:
ReferenceConstraints
(
const
System
&
system
,
RealOpenMM
tolerance
);
~
ReferenceConstraints
();
/**
* Get the constraint tolerance.
*/
RealOpenMM
getTolerance
()
const
;
/**
* Set the constraint tolerance.
*/
void
setTolerance
(
RealOpenMM
tolerance
);
/**
* Apply the constraint algorithm.
*
* @param atomCoordinates the original atom coordinates
* @param atomCoordinatesP the new atom coordinates
* @param inverseMasses 1/mass
*/
void
apply
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
);
/**
* Apply the constraint algorithm to velocities.
*
* @param atomCoordinates the atom coordinates
* @param atomCoordinatesP the velocities to modify
* @param inverseMasses 1/mass
*/
void
applyToVelocities
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
);
private:
RealOpenMM
tolerance
;
ReferenceCCMAAlgorithm
*
ccma
;
ReferenceSETTLEAlgorithm
*
settle
;
};
}
// namespace OpenMM
#endif
/*OPENMM_REFERENCECONSTRAINTS_H_*/
platforms/reference/include/ReferenceCustomAngleIxn.h
View file @
855ece90
/* Portions copyright (c) 2010 Stanford University and Simbios.
/* Portions copyright (c) 2010
-2013
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -25,17 +25,20 @@
#define __ReferenceCustomAngleIxn_H__
#include "ReferenceBondIxn.h"
#include "lepton/Expression
Program
.h"
#include "lepton/
Compiled
Expression.h"
// ---------------------------------------------------------------------------------------
class
ReferenceCustomAngleIxn
:
public
ReferenceBondIxn
{
private:
Lepton
::
ExpressionProgram
energyExpression
;
Lepton
::
ExpressionProgram
forceExpression
;
std
::
vector
<
std
::
string
>
paramNames
;
std
::
map
<
std
::
string
,
double
>
globalParameters
;
Lepton
::
CompiledExpression
energyExpression
;
Lepton
::
CompiledExpression
forceExpression
;
std
::
vector
<
double
*>
energyParams
;
std
::
vector
<
double
*>
forceParams
;
double
*
energyTheta
;
double
*
forceTheta
;
int
numParameters
;
public:
...
...
@@ -45,7 +48,7 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
ReferenceCustomAngleIxn
(
const
Lepton
::
Expression
Program
&
energyExpression
,
const
Lepton
::
Expression
Program
&
forceExpression
,
ReferenceCustomAngleIxn
(
const
Lepton
::
Compiled
Expression
&
energyExpression
,
const
Lepton
::
Compiled
Expression
&
forceExpression
,
const
std
::
vector
<
std
::
string
>&
parameterNames
,
std
::
map
<
std
::
string
,
double
>
globalParameters
);
/**---------------------------------------------------------------------------------------
...
...
platforms/reference/include/ReferenceCustomBondIxn.h
View file @
855ece90
/* Portions copyright (c) 2009 Stanford University and Simbios.
/* Portions copyright (c) 2009
-2013
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -26,17 +26,20 @@
#define __ReferenceCustomBondIxn_H__
#include "ReferenceBondIxn.h"
#include "lepton/Expression
Program
.h"
#include "lepton/
Compiled
Expression.h"
// ---------------------------------------------------------------------------------------
class
ReferenceCustomBondIxn
:
public
ReferenceBondIxn
{
private:
Lepton
::
ExpressionProgram
energyExpression
;
Lepton
::
ExpressionProgram
forceExpression
;
std
::
vector
<
std
::
string
>
paramNames
;
std
::
map
<
std
::
string
,
double
>
globalParameters
;
Lepton
::
CompiledExpression
energyExpression
;
Lepton
::
CompiledExpression
forceExpression
;
std
::
vector
<
double
*>
energyParams
;
std
::
vector
<
double
*>
forceParams
;
double
*
energyR
;
double
*
forceR
;
int
numParameters
;
public:
...
...
@@ -46,7 +49,7 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
ReferenceCustomBondIxn
(
const
Lepton
::
Expression
Program
&
energyExpression
,
const
Lepton
::
Expression
Program
&
forceExpression
,
ReferenceCustomBondIxn
(
const
Lepton
::
Compiled
Expression
&
energyExpression
,
const
Lepton
::
Compiled
Expression
&
forceExpression
,
const
std
::
vector
<
std
::
string
>&
parameterNames
,
std
::
map
<
std
::
string
,
double
>
globalParameters
);
/**---------------------------------------------------------------------------------------
...
...
platforms/reference/include/ReferenceCustomExternalIxn.h
View file @
855ece90
/* Portions copyright (c) 2009 Stanford University and Simbios.
/* Portions copyright (c) 2009
-2013
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -26,19 +26,26 @@
#define __ReferenceCustomExternalIxn_H__
#include "ReferenceCustomExternalIxn.h"
#include "lepton/Expression
Program
.h"
#include "lepton/
Compiled
Expression.h"
// ---------------------------------------------------------------------------------------
class
ReferenceCustomExternalIxn
{
private:
Lepton
::
ExpressionProgram
energyExpression
;
Lepton
::
ExpressionProgram
forceExpressionX
;
Lepton
::
ExpressionProgram
forceExpressionY
;
Lepton
::
ExpressionProgram
forceExpressionZ
;
std
::
vector
<
std
::
string
>
paramNames
;
std
::
map
<
std
::
string
,
double
>
globalParameters
;
Lepton
::
CompiledExpression
energyExpression
;
Lepton
::
CompiledExpression
forceExpressionX
;
Lepton
::
CompiledExpression
forceExpressionY
;
Lepton
::
CompiledExpression
forceExpressionZ
;
std
::
vector
<
double
*>
energyParams
;
std
::
vector
<
double
*>
forceXParams
;
std
::
vector
<
double
*>
forceYParams
;
std
::
vector
<
double
*>
forceZParams
;
double
*
energyX
,
*
energyY
,
*
energyZ
;
double
*
forceXX
,
*
forceXY
,
*
forceXZ
;
double
*
forceYX
,
*
forceYY
,
*
forceYZ
;
double
*
forceZX
,
*
forceZY
,
*
forceZZ
;
int
numParameters
;
public:
...
...
@@ -48,8 +55,8 @@ class ReferenceCustomExternalIxn {
--------------------------------------------------------------------------------------- */
ReferenceCustomExternalIxn
(
const
Lepton
::
Expression
Program
&
energyExpression
,
const
Lepton
::
Expression
Program
&
forceExpressionX
,
const
Lepton
::
Expression
Program
&
forceExpressionY
,
const
Lepton
::
Expression
Program
&
forceExpressionZ
,
ReferenceCustomExternalIxn
(
const
Lepton
::
Compiled
Expression
&
energyExpression
,
const
Lepton
::
Compiled
Expression
&
forceExpressionX
,
const
Lepton
::
Compiled
Expression
&
forceExpressionY
,
const
Lepton
::
Compiled
Expression
&
forceExpressionZ
,
const
std
::
vector
<
std
::
string
>&
parameterNames
,
std
::
map
<
std
::
string
,
double
>
globalParameters
);
/**---------------------------------------------------------------------------------------
...
...
platforms/reference/include/ReferenceCustomNonbondedIxn.h
View file @
855ece90
/* Portions copyright (c) 2009 Stanford University and Simbios.
/* Portions copyright (c) 2009
-2013
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -27,7 +27,7 @@
#include "ReferencePairIxn.h"
#include "ReferenceNeighborList.h"
#include "lepton/Expression
Program
.h"
#include "lepton/
Compiled
Expression.h"
#include <map>
#include <set>
#include <utility>
...
...
@@ -45,10 +45,13 @@ class ReferenceCustomNonbondedIxn {
const
OpenMM
::
NeighborList
*
neighborList
;
RealOpenMM
periodicBoxSize
[
3
];
RealOpenMM
cutoffDistance
,
switchingDistance
;
Lepton
::
Expression
Program
energyExpression
;
Lepton
::
Expression
Program
forceExpression
;
Lepton
::
Compiled
Expression
energyExpression
;
Lepton
::
Compiled
Expression
forceExpression
;
std
::
vector
<
std
::
string
>
paramNames
;
std
::
vector
<
std
::
string
>
particleParamNames
;
std
::
vector
<
double
*>
energyParticleParams
;
std
::
vector
<
double
*>
forceParticleParams
;
double
*
energyR
;
double
*
forceR
;
std
::
vector
<
std
::
pair
<
std
::
set
<
int
>
,
std
::
set
<
int
>
>
>
interactionGroups
;
/**---------------------------------------------------------------------------------------
...
...
@@ -65,9 +68,8 @@ class ReferenceCustomNonbondedIxn {
--------------------------------------------------------------------------------------- */
void
calculateOneIxn
(
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
map
<
std
::
string
,
double
>&
variables
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
;
void
calculateOneIxn
(
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
);
public:
...
...
@@ -78,7 +80,7 @@ class ReferenceCustomNonbondedIxn {
--------------------------------------------------------------------------------------- */
ReferenceCustomNonbondedIxn
(
const
Lepton
::
Expression
Program
&
energyExpression
,
const
Lepton
::
Expression
Program
&
forceExpression
,
ReferenceCustomNonbondedIxn
(
const
Lepton
::
Compiled
Expression
&
energyExpression
,
const
Lepton
::
Compiled
Expression
&
forceExpression
,
const
std
::
vector
<
std
::
string
>&
parameterNames
);
/**---------------------------------------------------------------------------------------
...
...
@@ -153,7 +155,7 @@ class ReferenceCustomNonbondedIxn {
void
calculatePairIxn
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
RealOpenMM
*
fixedParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
;
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
);
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/include/ReferenceCustomTorsionIxn.h
View file @
855ece90
/* Portions copyright (c) 2010 Stanford University and Simbios.
/* Portions copyright (c) 2010
-2013
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -25,17 +25,20 @@
#define __ReferenceCustomTorsionIxn_H__
#include "ReferenceBondIxn.h"
#include "lepton/Expression
Program
.h"
#include "lepton/
Compiled
Expression.h"
// ---------------------------------------------------------------------------------------
class
ReferenceCustomTorsionIxn
:
public
ReferenceBondIxn
{
private:
Lepton
::
ExpressionProgram
energyExpression
;
Lepton
::
ExpressionProgram
forceExpression
;
std
::
vector
<
std
::
string
>
paramNames
;
std
::
map
<
std
::
string
,
double
>
globalParameters
;
Lepton
::
CompiledExpression
energyExpression
;
Lepton
::
CompiledExpression
forceExpression
;
std
::
vector
<
double
*>
energyParams
;
std
::
vector
<
double
*>
forceParams
;
double
*
energyTheta
;
double
*
forceTheta
;
int
numParameters
;
public:
...
...
@@ -45,7 +48,7 @@ class ReferenceCustomTorsionIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
ReferenceCustomTorsionIxn
(
const
Lepton
::
Expression
Program
&
energyExpression
,
const
Lepton
::
Expression
Program
&
forceExpression
,
ReferenceCustomTorsionIxn
(
const
Lepton
::
Compiled
Expression
&
energyExpression
,
const
Lepton
::
Compiled
Expression
&
forceExpression
,
const
std
::
vector
<
std
::
string
>&
parameterNames
,
std
::
map
<
std
::
string
,
double
>
globalParameters
);
/**---------------------------------------------------------------------------------------
...
...
platforms/reference/include/ReferenceForce.h
View file @
855ece90
/* Portions copyright (c) 2006 Stanford University and Simbios.
/* Portions copyright (c) 2006-2013 Stanford University and Simbios.
* Contributors: Pande Group
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -25,6 +24,7 @@
#ifndef __ReferenceForce_H__
#define __ReferenceForce_H__
#include "lepton/CompiledExpression.h"
#include "openmm/internal/windowsExport.h"
// ---------------------------------------------------------------------------------------
...
...
@@ -109,6 +109,18 @@ class OPENMM_EXPORT ReferenceForce {
static
void
getDeltaROnly
(
const
RealOpenMM
*
atomCoordinatesI
,
const
RealOpenMM
*
atomCoordinatesJ
,
RealOpenMM
*
deltaR
);
/**
* Get a pointer to the memory for setting a variable in a CompiledExpression. If the expression
* does not use the specified variable, return NULL.
*/
static
double
*
getVariablePointer
(
Lepton
::
CompiledExpression
&
expression
,
const
std
::
string
&
name
);
/**
* Set the value of a variable in a CompiledExpression, using the pointer that was returned by getVariablePointer().
*/
static
void
setVariable
(
double
*
pointer
,
double
value
);
};
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/include/ReferenceKernels.h
View file @
855ece90
...
...
@@ -36,6 +36,7 @@
#include "openmm/kernels.h"
#include "SimTKOpenMMRealType.h"
#include "ReferenceNeighborList.h"
#include "lepton/CompiledExpression.h"
#include "lepton/ExpressionProgram.h"
class
CpuObc
;
...
...
@@ -316,7 +317,7 @@ private:
int
numBonds
;
int
**
bondIndexArray
;
RealOpenMM
**
bondParamArray
;
Lepton
::
Expression
Program
energyExpression
,
forceExpression
;
Lepton
::
Compiled
Expression
energyExpression
,
forceExpression
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
};
...
...
@@ -392,7 +393,7 @@ private:
int
numAngles
;
int
**
angleIndexArray
;
RealOpenMM
**
angleParamArray
;
Lepton
::
Expression
Program
energyExpression
,
forceExpression
;
Lepton
::
Compiled
Expression
energyExpression
,
forceExpression
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
};
...
...
@@ -534,7 +535,7 @@ private:
int
numTorsions
;
int
**
torsionIndexArray
;
RealOpenMM
**
torsionParamArray
;
Lepton
::
Expression
Program
energyExpression
,
forceExpression
;
Lepton
::
Compiled
Expression
energyExpression
,
forceExpression
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
};
...
...
@@ -621,7 +622,7 @@ private:
CustomNonbondedForce
*
forceCopy
;
std
::
map
<
std
::
string
,
double
>
globalParamValues
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
Lepton
::
Expression
Program
energyExpression
,
forceExpression
;
Lepton
::
Compiled
Expression
energyExpression
,
forceExpression
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
std
::
vector
<
std
::
pair
<
std
::
set
<
int
>
,
std
::
set
<
int
>
>
>
interactionGroups
;
NonbondedMethod
nonbondedMethod
;
...
...
@@ -781,7 +782,7 @@ private:
int
numParticles
;
std
::
vector
<
int
>
particles
;
RealOpenMM
**
particleParamArray
;
Lepton
::
Expression
Program
energyExpression
,
forceExpressionX
,
forceExpressionY
,
forceExpressionZ
;
Lepton
::
Compiled
Expression
energyExpression
,
forceExpressionX
,
forceExpressionY
,
forceExpressionZ
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
};
...
...
Prev
1
2
3
4
5
6
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