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
0b1f03db
Commit
0b1f03db
authored
Jul 11, 2016
by
peastman
Browse files
Use CompiledExpressionSet for reference CustomGBForce
parent
f54a0079
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
183 additions
and
192 deletions
+183
-192
platforms/reference/include/ReferenceCustomGBIxn.h
platforms/reference/include/ReferenceCustomGBIxn.h
+29
-41
platforms/reference/include/ReferenceKernels.h
platforms/reference/include/ReferenceKernels.h
+6
-7
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+14
-14
platforms/reference/src/SimTKReference/ReferenceCustomGBIxn.cpp
...rms/reference/src/SimTKReference/ReferenceCustomGBIxn.cpp
+134
-130
No files found.
platforms/reference/include/ReferenceCustomGBIxn.h
View file @
0b1f03db
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#define __ReferenceCustomGBIxn_H__
#define __ReferenceCustomGBIxn_H__
#include "ReferenceNeighborList.h"
#include "ReferenceNeighborList.h"
#include "
lepton/
Expression
Program
.h"
#include "
openmm/internal/Compiled
Expression
Set
.h"
#include "openmm/CustomGBForce.h"
#include "openmm/CustomGBForce.h"
#include <map>
#include <map>
#include <set>
#include <set>
...
@@ -43,18 +43,20 @@ class ReferenceCustomGBIxn {
...
@@ -43,18 +43,20 @@ class ReferenceCustomGBIxn {
const
OpenMM
::
NeighborList
*
neighborList
;
const
OpenMM
::
NeighborList
*
neighborList
;
OpenMM
::
RealVec
periodicBoxVectors
[
3
];
OpenMM
::
RealVec
periodicBoxVectors
[
3
];
RealOpenMM
cutoffDistance
;
RealOpenMM
cutoffDistance
;
std
::
vector
<
Lepton
::
ExpressionProgram
>
valueE
xpression
s
;
CompiledExpressionSet
e
xpression
Set
;
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
value
Deriv
Expressions
;
std
::
vector
<
Lepton
::
Compiled
Expression
>
valueExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
value
Gradient
Expressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
value
Deriv
Expressions
;
std
::
vector
<
std
::
string
>
valueName
s
;
std
::
vector
<
std
::
vector
<
Lepton
::
CompiledExpression
>
>
valueGradientExpression
s
;
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>
valueTypes
;
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>
valueTypes
;
std
::
vector
<
Lepton
::
ExpressionProgram
>
energyExpressions
;
std
::
vector
<
Lepton
::
CompiledExpression
>
energyExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
ExpressionProgram
>
>
energyDerivExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
CompiledExpression
>
>
energyDerivExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
ExpressionProgram
>
>
energyGradientExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
CompiledExpression
>
>
energyGradientExpressions
;
std
::
vector
<
std
::
string
>
paramNames
;
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>
energyTypes
;
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>
energyTypes
;
std
::
vector
<
std
::
string
>
particleParamNames
;
std
::
vector
<
int
>
paramIndex
;
std
::
vector
<
std
::
string
>
particleValueNames
;
std
::
vector
<
int
>
valueIndex
;
std
::
vector
<
int
>
particleParamIndex
;
std
::
vector
<
int
>
particleValueIndex
;
int
rIndex
,
xIndex
,
yIndex
,
zIndex
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -64,13 +66,12 @@ class ReferenceCustomGBIxn {
...
@@ -64,13 +66,12 @@ class ReferenceCustomGBIxn {
@param numAtoms number of atoms
@param numAtoms number of atoms
@param atomCoordinates atom coordinates
@param atomCoordinates atom coordinates
@param values the vector to store computed values into
@param values the vector to store computed values into
@param globalParameters the values of global parameters
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param atomParameters atomParameters[atomIndex][paramterIndex]
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateSingleParticleValue
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
void
calculateSingleParticleValue
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
RealOpenMM
**
atomParameters
)
const
;
RealOpenMM
**
atomParameters
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -81,7 +82,6 @@ class ReferenceCustomGBIxn {
...
@@ -81,7 +82,6 @@ class ReferenceCustomGBIxn {
@param atomCoordinates atom coordinates
@param atomCoordinates atom coordinates
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param values the vector to store computed values into
@param values the vector to store computed values into
@param globalParameters the values of global parameters
@param exclusions exclusions[i] is the set of excluded indices for atom i
@param exclusions exclusions[i] is the set of excluded indices for atom i
@param useExclusions specifies whether to use exclusions
@param useExclusions specifies whether to use exclusions
...
@@ -89,8 +89,7 @@ class ReferenceCustomGBIxn {
...
@@ -89,8 +89,7 @@ class ReferenceCustomGBIxn {
void
calculateParticlePairValue
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
void
calculateParticlePairValue
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
bool
useExclusions
);
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
bool
useExclusions
)
const
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -101,14 +100,12 @@ class ReferenceCustomGBIxn {
...
@@ -101,14 +100,12 @@ class ReferenceCustomGBIxn {
@param atom2 the index of the second atom in the pair
@param atom2 the index of the second atom in the pair
@param atomCoordinates atom coordinates
@param atomCoordinates atom coordinates
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param globalParameters the values of global parameters
@param values the vector to store computed values into
@param values the vector to store computed values into
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateOnePairValue
(
int
index
,
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
void
calculateOnePairValue
(
int
index
,
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
);
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
)
const
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -118,7 +115,6 @@ class ReferenceCustomGBIxn {
...
@@ -118,7 +115,6 @@ class ReferenceCustomGBIxn {
@param numAtoms number of atoms
@param numAtoms number of atoms
@param atomCoordinates atom coordinates
@param atomCoordinates atom coordinates
@param values the vector containing computed values
@param values the vector containing computed values
@param globalParameters the values of global parameters
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param forces forces on atoms are added to this
@param forces forces on atoms are added to this
@param totalEnergy the energy contribution is added to this
@param totalEnergy the energy contribution is added to this
...
@@ -127,8 +123,8 @@ class ReferenceCustomGBIxn {
...
@@ -127,8 +123,8 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateSingleParticleEnergyTerm
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
const
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
void
calculateSingleParticleEnergyTerm
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
const
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
RealOpenMM
**
atomParameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
**
atomParameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
dEdV
)
const
;
RealOpenMM
*
totalEnergy
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
dEdV
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -139,7 +135,6 @@ class ReferenceCustomGBIxn {
...
@@ -139,7 +135,6 @@ class ReferenceCustomGBIxn {
@param atomCoordinates atom coordinates
@param atomCoordinates atom coordinates
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param values the vector containing computed values
@param values the vector containing computed values
@param globalParameters the values of global parameters
@param exclusions exclusions[i] is the set of excluded indices for atom i
@param exclusions exclusions[i] is the set of excluded indices for atom i
@param useExclusions specifies whether to use exclusions
@param useExclusions specifies whether to use exclusions
@param forces forces on atoms are added to this
@param forces forces on atoms are added to this
...
@@ -150,9 +145,8 @@ class ReferenceCustomGBIxn {
...
@@ -150,9 +145,8 @@ class ReferenceCustomGBIxn {
void
calculateParticlePairEnergyTerm
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
void
calculateParticlePairEnergyTerm
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
const
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
const
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
bool
useExclusions
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
bool
useExclusions
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
dEdV
)
const
;
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
dEdV
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -163,7 +157,6 @@ class ReferenceCustomGBIxn {
...
@@ -163,7 +157,6 @@ class ReferenceCustomGBIxn {
@param atom2 the index of the second atom in the pair
@param atom2 the index of the second atom in the pair
@param atomCoordinates atom coordinates
@param atomCoordinates atom coordinates
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param globalParameters the values of global parameters
@param values the vector containing computed values
@param values the vector containing computed values
@param forces forces on atoms are added to this
@param forces forces on atoms are added to this
@param totalEnergy the energy contribution is added to this
@param totalEnergy the energy contribution is added to this
...
@@ -172,9 +165,8 @@ class ReferenceCustomGBIxn {
...
@@ -172,9 +165,8 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateOnePairEnergyTerm
(
int
index
,
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
void
calculateOnePairEnergyTerm
(
int
index
,
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
const
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
const
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
dEdV
)
const
;
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
dEdV
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -184,7 +176,6 @@ class ReferenceCustomGBIxn {
...
@@ -184,7 +176,6 @@ class ReferenceCustomGBIxn {
@param atomCoordinates atom coordinates
@param atomCoordinates atom coordinates
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param values the vector containing computed values
@param values the vector containing computed values
@param globalParameters the values of global parameters
@param exclusions exclusions[i] is the set of excluded indices for atom i
@param exclusions exclusions[i] is the set of excluded indices for atom i
@param forces forces on atoms are added to this
@param forces forces on atoms are added to this
@param dEdV the derivative of energy with respect to computed values is stored in this
@param dEdV the derivative of energy with respect to computed values is stored in this
...
@@ -193,9 +184,8 @@ class ReferenceCustomGBIxn {
...
@@ -193,9 +184,8 @@ class ReferenceCustomGBIxn {
void
calculateChainRuleForces
(
int
numAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
void
calculateChainRuleForces
(
int
numAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
const
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
const
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
dEdV
)
const
;
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
dEdV
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -205,7 +195,6 @@ class ReferenceCustomGBIxn {
...
@@ -205,7 +195,6 @@ class ReferenceCustomGBIxn {
@param atom2 the index of the second atom in the pair
@param atom2 the index of the second atom in the pair
@param atomCoordinates atom coordinates
@param atomCoordinates atom coordinates
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param atomParameters atomParameters[atomIndex][paramterIndex]
@param globalParameters the values of global parameters
@param values the vector containing computed values
@param values the vector containing computed values
@param forces forces on atoms are added to this
@param forces forces on atoms are added to this
@param dEdV the derivative of energy with respect to computed values is stored in this
@param dEdV the derivative of energy with respect to computed values is stored in this
...
@@ -214,10 +203,9 @@ class ReferenceCustomGBIxn {
...
@@ -214,10 +203,9 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateOnePairChainRule
(
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
void
calculateOnePairChainRule
(
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
const
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
const
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
values
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
dEdV
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>&
dEdV
,
bool
isExcluded
)
const
;
bool
isExcluded
);
public:
public:
...
@@ -227,14 +215,14 @@ class ReferenceCustomGBIxn {
...
@@ -227,14 +215,14 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
ReferenceCustomGBIxn
(
const
std
::
vector
<
Lepton
::
Expression
Program
>&
valueExpressions
,
ReferenceCustomGBIxn
(
const
std
::
vector
<
Lepton
::
Compiled
Expression
>&
valueExpressions
,
const
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
valueDerivExpressions
,
const
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
valueDerivExpressions
,
const
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
valueGradientExpressions
,
const
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
valueGradientExpressions
,
const
std
::
vector
<
std
::
string
>&
valueNames
,
const
std
::
vector
<
std
::
string
>&
valueNames
,
const
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>&
valueTypes
,
const
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>&
valueTypes
,
const
std
::
vector
<
Lepton
::
Expression
Program
>&
energyExpressions
,
const
std
::
vector
<
Lepton
::
Compiled
Expression
>&
energyExpressions
,
const
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
energyDerivExpressions
,
const
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
energyDerivExpressions
,
const
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
energyGradientExpressions
,
const
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
energyGradientExpressions
,
const
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>&
energyTypes
,
const
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>&
energyTypes
,
const
std
::
vector
<
std
::
string
>&
parameterNames
);
const
std
::
vector
<
std
::
string
>&
parameterNames
);
...
@@ -284,7 +272,7 @@ class ReferenceCustomGBIxn {
...
@@ -284,7 +272,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateIxn
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
void
calculateIxn
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
);
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/include/ReferenceKernels.h
View file @
0b1f03db
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
#include "ReferenceNeighborList.h"
#include "ReferenceNeighborList.h"
#include "lepton/CompiledExpression.h"
#include "lepton/CompiledExpression.h"
#include "lepton/CustomFunction.h"
#include "lepton/CustomFunction.h"
#include "lepton/ExpressionProgram.h"
namespace
OpenMM
{
namespace
OpenMM
{
...
@@ -739,13 +738,13 @@ private:
...
@@ -739,13 +738,13 @@ private:
RealOpenMM
nonbondedCutoff
;
RealOpenMM
nonbondedCutoff
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
std
::
vector
<
std
::
string
>
particleParameterNames
,
globalParameterNames
,
valueNames
;
std
::
vector
<
std
::
string
>
particleParameterNames
,
globalParameterNames
,
valueNames
;
std
::
vector
<
Lepton
::
Expression
Program
>
valueExpressions
;
std
::
vector
<
Lepton
::
Compiled
Expression
>
valueExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
valueDerivExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
valueDerivExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
valueGradientExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
valueGradientExpressions
;
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>
valueTypes
;
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>
valueTypes
;
std
::
vector
<
Lepton
::
Expression
Program
>
energyExpressions
;
std
::
vector
<
Lepton
::
Compiled
Expression
>
energyExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
energyDerivExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
energyDerivExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
energyGradientExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
energyGradientExpressions
;
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>
energyTypes
;
std
::
vector
<
OpenMM
::
CustomGBForce
::
ComputationType
>
energyTypes
;
NonbondedMethod
nonbondedMethod
;
NonbondedMethod
nonbondedMethod
;
NeighborList
*
neighborList
;
NeighborList
*
neighborList
;
...
...
platforms/reference/src/ReferenceKernels.cpp
View file @
0b1f03db
...
@@ -1376,19 +1376,19 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu
...
@@ -1376,19 +1376,19 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu
CustomGBForce
::
ComputationType
type
;
CustomGBForce
::
ComputationType
type
;
force
.
getComputedValueParameters
(
i
,
name
,
expression
,
type
);
force
.
getComputedValueParameters
(
i
,
name
,
expression
,
type
);
Lepton
::
ParsedExpression
ex
=
Lepton
::
Parser
::
parse
(
expression
,
functions
).
optimize
();
Lepton
::
ParsedExpression
ex
=
Lepton
::
Parser
::
parse
(
expression
,
functions
).
optimize
();
valueExpressions
.
push_back
(
ex
.
create
Program
());
valueExpressions
.
push_back
(
ex
.
create
CompiledExpression
());
valueTypes
.
push_back
(
type
);
valueTypes
.
push_back
(
type
);
valueNames
.
push_back
(
name
);
valueNames
.
push_back
(
name
);
if
(
i
==
0
)
{
if
(
i
==
0
)
{
valueDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"r"
).
optimize
().
create
Program
());
valueDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"r"
).
optimize
().
create
CompiledExpression
());
validateVariables
(
ex
.
getRootNode
(),
pairVariables
);
validateVariables
(
ex
.
getRootNode
(),
pairVariables
);
}
}
else
{
else
{
valueGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"x"
).
optimize
().
create
Program
());
valueGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"x"
).
optimize
().
create
CompiledExpression
());
valueGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"y"
).
optimize
().
create
Program
());
valueGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"y"
).
optimize
().
create
CompiledExpression
());
valueGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"z"
).
optimize
().
create
Program
());
valueGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"z"
).
optimize
().
create
CompiledExpression
());
for
(
int
j
=
0
;
j
<
i
;
j
++
)
for
(
int
j
=
0
;
j
<
i
;
j
++
)
valueDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
valueNames
[
j
]).
optimize
().
create
Program
());
valueDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
valueNames
[
j
]).
optimize
().
create
CompiledExpression
());
validateVariables
(
ex
.
getRootNode
(),
particleVariables
);
validateVariables
(
ex
.
getRootNode
(),
particleVariables
);
}
}
particleVariables
.
insert
(
name
);
particleVariables
.
insert
(
name
);
...
@@ -1405,21 +1405,21 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu
...
@@ -1405,21 +1405,21 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu
CustomGBForce
::
ComputationType
type
;
CustomGBForce
::
ComputationType
type
;
force
.
getEnergyTermParameters
(
i
,
expression
,
type
);
force
.
getEnergyTermParameters
(
i
,
expression
,
type
);
Lepton
::
ParsedExpression
ex
=
Lepton
::
Parser
::
parse
(
expression
,
functions
).
optimize
();
Lepton
::
ParsedExpression
ex
=
Lepton
::
Parser
::
parse
(
expression
,
functions
).
optimize
();
energyExpressions
.
push_back
(
ex
.
create
Program
());
energyExpressions
.
push_back
(
ex
.
create
CompiledExpression
());
energyTypes
.
push_back
(
type
);
energyTypes
.
push_back
(
type
);
if
(
type
!=
CustomGBForce
::
SingleParticle
)
if
(
type
!=
CustomGBForce
::
SingleParticle
)
energyDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"r"
).
optimize
().
create
Program
());
energyDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"r"
).
optimize
().
create
CompiledExpression
());
for
(
int
j
=
0
;
j
<
force
.
getNumComputedValues
();
j
++
)
{
for
(
int
j
=
0
;
j
<
force
.
getNumComputedValues
();
j
++
)
{
if
(
type
==
CustomGBForce
::
SingleParticle
)
{
if
(
type
==
CustomGBForce
::
SingleParticle
)
{
energyDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
valueNames
[
j
]).
optimize
().
create
Program
());
energyDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
valueNames
[
j
]).
optimize
().
create
CompiledExpression
());
energyGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"x"
).
optimize
().
create
Program
());
energyGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"x"
).
optimize
().
create
CompiledExpression
());
energyGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"y"
).
optimize
().
create
Program
());
energyGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"y"
).
optimize
().
create
CompiledExpression
());
energyGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"z"
).
optimize
().
create
Program
());
energyGradientExpressions
[
i
].
push_back
(
ex
.
differentiate
(
"z"
).
optimize
().
create
CompiledExpression
());
validateVariables
(
ex
.
getRootNode
(),
particleVariables
);
validateVariables
(
ex
.
getRootNode
(),
particleVariables
);
}
}
else
{
else
{
energyDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
valueNames
[
j
]
+
"1"
).
optimize
().
create
Program
());
energyDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
valueNames
[
j
]
+
"1"
).
optimize
().
create
CompiledExpression
());
energyDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
valueNames
[
j
]
+
"2"
).
optimize
().
create
Program
());
energyDerivExpressions
[
i
].
push_back
(
ex
.
differentiate
(
valueNames
[
j
]
+
"2"
).
optimize
().
create
CompiledExpression
());
validateVariables
(
ex
.
getRootNode
(),
pairVariables
);
validateVariables
(
ex
.
getRootNode
(),
pairVariables
);
}
}
}
}
...
...
platforms/reference/src/SimTKReference/ReferenceCustomGBIxn.cpp
View file @
0b1f03db
This diff is collapsed.
Click to expand it.
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