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
162d69a2
Commit
162d69a2
authored
Feb 20, 2015
by
peastman
Browse files
Merge pull request #827 from peastman/reference
Lots of cleanup to reference platform
parents
2379b982
c44c956d
Changes
150
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
365 additions
and
365 deletions
+365
-365
plugins/amoeba/openmmapi/include/openmm/AmoebaAngleForce.h
plugins/amoeba/openmmapi/include/openmm/AmoebaAngleForce.h
+4
-4
plugins/amoeba/openmmapi/include/openmm/AmoebaBondForce.h
plugins/amoeba/openmmapi/include/openmm/AmoebaBondForce.h
+2
-2
plugins/amoeba/openmmapi/include/openmm/AmoebaGeneralizedKirkwoodForce.h
...openmmapi/include/openmm/AmoebaGeneralizedKirkwoodForce.h
+1
-1
plugins/amoeba/openmmapi/include/openmm/AmoebaInPlaneAngleForce.h
...amoeba/openmmapi/include/openmm/AmoebaInPlaneAngleForce.h
+4
-4
plugins/amoeba/openmmapi/include/openmm/internal/AmoebaMultipoleForceImpl.h
...nmmapi/include/openmm/internal/AmoebaMultipoleForceImpl.h
+1
-1
plugins/amoeba/openmmapi/src/AmoebaAngleForce.cpp
plugins/amoeba/openmmapi/src/AmoebaAngleForce.cpp
+4
-4
plugins/amoeba/openmmapi/src/AmoebaBondForce.cpp
plugins/amoeba/openmmapi/src/AmoebaBondForce.cpp
+2
-2
plugins/amoeba/openmmapi/src/AmoebaInPlaneAngleForce.cpp
plugins/amoeba/openmmapi/src/AmoebaInPlaneAngleForce.cpp
+4
-4
plugins/amoeba/openmmapi/src/AmoebaMultipoleForce.cpp
plugins/amoeba/openmmapi/src/AmoebaMultipoleForce.cpp
+5
-5
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
+1
-1
plugins/amoeba/openmmapi/src/AmoebaOutOfPlaneBendForce.cpp
plugins/amoeba/openmmapi/src/AmoebaOutOfPlaneBendForce.cpp
+4
-4
plugins/amoeba/openmmapi/src/AmoebaVdwForce.cpp
plugins/amoeba/openmmapi/src/AmoebaVdwForce.cpp
+2
-2
plugins/amoeba/openmmapi/src/AmoebaWcaDispersionForce.cpp
plugins/amoeba/openmmapi/src/AmoebaWcaDispersionForce.cpp
+8
-8
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
...amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
+198
-198
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
...s/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
+14
-14
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.cpp
...eference/src/SimTKReference/AmoebaReferenceAngleForce.cpp
+32
-32
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.h
.../reference/src/SimTKReference/AmoebaReferenceAngleForce.h
+25
-25
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceBondForce.cpp
...reference/src/SimTKReference/AmoebaReferenceBondForce.cpp
+12
-12
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceBondForce.h
...s/reference/src/SimTKReference/AmoebaReferenceBondForce.h
+15
-15
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceForce.cpp
...rms/reference/src/SimTKReference/AmoebaReferenceForce.cpp
+27
-27
No files found.
plugins/amoeba/openmmapi/include/openmm/AmoebaAngleForce.h
View file @
162d69a2
...
...
@@ -77,7 +77,7 @@ public:
*
* @return global cubicK term
*/
double
getAmoebaGlobalAngleCubic
(
void
)
const
;
double
getAmoebaGlobalAngleCubic
()
const
;
/**
* Set the global quartic term
...
...
@@ -91,7 +91,7 @@ public:
*
* @return global quartic term
*/
double
getAmoebaGlobalAngleQuartic
(
void
)
const
;
double
getAmoebaGlobalAngleQuartic
()
const
;
/**
* Set the global pentic term
...
...
@@ -105,7 +105,7 @@ public:
*
* @return global penticK term
*/
double
getAmoebaGlobalAnglePentic
(
void
)
const
;
double
getAmoebaGlobalAnglePentic
()
const
;
/**
* Set the global sextic term
...
...
@@ -119,7 +119,7 @@ public:
*
* @return global sextic term
*/
double
getAmoebaGlobalAngleSextic
(
void
)
const
;
double
getAmoebaGlobalAngleSextic
()
const
;
/**
* Add an angle term to the force field.
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaBondForce.h
View file @
162d69a2
...
...
@@ -78,7 +78,7 @@ public:
*
* @return global cubicK term
*/
double
getAmoebaGlobalBondCubic
(
void
)
const
;
double
getAmoebaGlobalBondCubic
()
const
;
/**
* Set the global quartic term
...
...
@@ -92,7 +92,7 @@ public:
*
* @return global quartic term
*/
double
getAmoebaGlobalBondQuartic
(
void
)
const
;
double
getAmoebaGlobalBondQuartic
()
const
;
/**
* Add a bond term to the force field.
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaGeneralizedKirkwoodForce.h
View file @
162d69a2
...
...
@@ -127,7 +127,7 @@ public:
/**
* Get the flag signaling whether the cavity term should be included
*/
int
getIncludeCavityTerm
(
)
const
;
int
getIncludeCavityTerm
()
const
;
/**
* Set the flag signaling whether the cavity term should be included
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaInPlaneAngleForce.h
View file @
162d69a2
...
...
@@ -77,7 +77,7 @@ public:
*
* @return global cubicK term
*/
double
getAmoebaGlobalInPlaneAngleCubic
(
void
)
const
;
double
getAmoebaGlobalInPlaneAngleCubic
()
const
;
/**
* Set the global quartic term
...
...
@@ -91,7 +91,7 @@ public:
*
* @return global quartic term
*/
double
getAmoebaGlobalInPlaneAngleQuartic
(
void
)
const
;
double
getAmoebaGlobalInPlaneAngleQuartic
()
const
;
/**
* Set the global pentic term
...
...
@@ -105,7 +105,7 @@ public:
*
* @return global penticK term
*/
double
getAmoebaGlobalInPlaneAnglePentic
(
void
)
const
;
double
getAmoebaGlobalInPlaneAnglePentic
()
const
;
/**
* Set the global sextic term
...
...
@@ -119,7 +119,7 @@ public:
*
* @return global sextic term
*/
double
getAmoebaGlobalInPlaneAngleSextic
(
void
)
const
;
double
getAmoebaGlobalInPlaneAngleSextic
()
const
;
/**
* Add an angle term to the force field.
...
...
plugins/amoeba/openmmapi/include/openmm/internal/AmoebaMultipoleForceImpl.h
View file @
162d69a2
...
...
@@ -97,7 +97,7 @@ private:
static
int
CovalentDegrees
[
AmoebaMultipoleForce
::
CovalentEnd
];
static
bool
initializedCovalentDegrees
;
static
const
int
*
getCovalentDegrees
(
void
);
static
const
int
*
getCovalentDegrees
();
};
}
// namespace OpenMM
...
...
plugins/amoeba/openmmapi/src/AmoebaAngleForce.cpp
View file @
162d69a2
...
...
@@ -63,7 +63,7 @@ void AmoebaAngleForce::setAngleParameters(int index, int particle1, int particle
angles
[
index
].
quadraticK
=
quadraticK
;
}
double
AmoebaAngleForce
::
getAmoebaGlobalAngleCubic
(
void
)
const
{
double
AmoebaAngleForce
::
getAmoebaGlobalAngleCubic
()
const
{
return
_globalCubicK
;
}
...
...
@@ -71,7 +71,7 @@ void AmoebaAngleForce::setAmoebaGlobalAngleCubic(double cubicK ) {
_globalCubicK
=
cubicK
;
}
double
AmoebaAngleForce
::
getAmoebaGlobalAngleQuartic
(
void
)
const
{
double
AmoebaAngleForce
::
getAmoebaGlobalAngleQuartic
()
const
{
return
_globalQuarticK
;
}
...
...
@@ -79,7 +79,7 @@ void AmoebaAngleForce::setAmoebaGlobalAngleQuartic(double quarticK ) {
_globalQuarticK
=
quarticK
;
}
double
AmoebaAngleForce
::
getAmoebaGlobalAnglePentic
(
void
)
const
{
double
AmoebaAngleForce
::
getAmoebaGlobalAnglePentic
()
const
{
return
_globalPenticK
;
}
...
...
@@ -87,7 +87,7 @@ void AmoebaAngleForce::setAmoebaGlobalAnglePentic(double penticK ) {
_globalPenticK
=
penticK
;
}
double
AmoebaAngleForce
::
getAmoebaGlobalAngleSextic
(
void
)
const
{
double
AmoebaAngleForce
::
getAmoebaGlobalAngleSextic
()
const
{
return
_globalSexticK
;
}
...
...
plugins/amoeba/openmmapi/src/AmoebaBondForce.cpp
View file @
162d69a2
...
...
@@ -67,11 +67,11 @@ void AmoebaBondForce::setAmoebaGlobalBondQuartic(double quarticK ) {
_globalQuarticK
=
quarticK
;
}
double
AmoebaBondForce
::
getAmoebaGlobalBondCubic
(
void
)
const
{
double
AmoebaBondForce
::
getAmoebaGlobalBondCubic
()
const
{
return
_globalCubicK
;
}
double
AmoebaBondForce
::
getAmoebaGlobalBondQuartic
(
void
)
const
{
double
AmoebaBondForce
::
getAmoebaGlobalBondQuartic
()
const
{
return
_globalQuarticK
;
}
...
...
plugins/amoeba/openmmapi/src/AmoebaInPlaneAngleForce.cpp
View file @
162d69a2
...
...
@@ -73,11 +73,11 @@ void AmoebaInPlaneAngleForce::setAmoebaGlobalInPlaneAngleQuartic(double quarticK
_globalQuarticK
=
quarticK
;
}
double
AmoebaInPlaneAngleForce
::
getAmoebaGlobalInPlaneAngleCubic
(
void
)
const
{
double
AmoebaInPlaneAngleForce
::
getAmoebaGlobalInPlaneAngleCubic
()
const
{
return
_globalCubicK
;
}
double
AmoebaInPlaneAngleForce
::
getAmoebaGlobalInPlaneAngleQuartic
(
void
)
const
{
double
AmoebaInPlaneAngleForce
::
getAmoebaGlobalInPlaneAngleQuartic
()
const
{
return
_globalQuarticK
;
}
...
...
@@ -89,11 +89,11 @@ void AmoebaInPlaneAngleForce::setAmoebaGlobalInPlaneAngleSextic(double quarticK
_globalSexticK
=
quarticK
;
}
double
AmoebaInPlaneAngleForce
::
getAmoebaGlobalInPlaneAnglePentic
(
void
)
const
{
double
AmoebaInPlaneAngleForce
::
getAmoebaGlobalInPlaneAnglePentic
()
const
{
return
_globalPenticK
;
}
double
AmoebaInPlaneAngleForce
::
getAmoebaGlobalInPlaneAngleSextic
(
void
)
const
{
double
AmoebaInPlaneAngleForce
::
getAmoebaGlobalInPlaneAngleSextic
()
const
{
return
_globalSexticK
;
}
...
...
plugins/amoeba/openmmapi/src/AmoebaMultipoleForce.cpp
View file @
162d69a2
...
...
@@ -45,7 +45,7 @@ AmoebaMultipoleForce::AmoebaMultipoleForce() : nonbondedMethod(NoCutoff), polari
pmeGridDimension
[
0
]
=
pmeGridDimension
[
1
]
=
pmeGridDimension
[
2
];
}
AmoebaMultipoleForce
::
NonbondedMethod
AmoebaMultipoleForce
::
getNonbondedMethod
(
void
)
const
{
AmoebaMultipoleForce
::
NonbondedMethod
AmoebaMultipoleForce
::
getNonbondedMethod
()
const
{
return
nonbondedMethod
;
}
...
...
@@ -53,7 +53,7 @@ void AmoebaMultipoleForce::setNonbondedMethod( AmoebaMultipoleForce::NonbondedMe
nonbondedMethod
=
method
;
}
AmoebaMultipoleForce
::
PolarizationType
AmoebaMultipoleForce
::
getPolarizationType
(
void
)
const
{
AmoebaMultipoleForce
::
PolarizationType
AmoebaMultipoleForce
::
getPolarizationType
()
const
{
return
polarizationType
;
}
...
...
@@ -77,7 +77,7 @@ void AmoebaMultipoleForce::setAEwald(double inputAewald ) {
aewald
=
inputAewald
;
}
int
AmoebaMultipoleForce
::
getPmeBSplineOrder
(
void
)
const
{
int
AmoebaMultipoleForce
::
getPmeBSplineOrder
()
const
{
return
pmeBSplineOrder
;
}
...
...
@@ -103,7 +103,7 @@ void AmoebaMultipoleForce::setPmeGridDimensions( const std::vector<int>& gridDim
return
;
}
int
AmoebaMultipoleForce
::
getMutualInducedMaxIterations
(
void
)
const
{
int
AmoebaMultipoleForce
::
getMutualInducedMaxIterations
()
const
{
return
mutualInducedMaxIterations
;
}
...
...
@@ -111,7 +111,7 @@ void AmoebaMultipoleForce::setMutualInducedMaxIterations( int inputMutualInduced
mutualInducedMaxIterations
=
inputMutualInducedMaxIterations
;
}
double
AmoebaMultipoleForce
::
getMutualInducedTargetEpsilon
(
void
)
const
{
double
AmoebaMultipoleForce
::
getMutualInducedTargetEpsilon
()
const
{
return
mutualInducedTargetEpsilon
;
}
...
...
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
View file @
162d69a2
...
...
@@ -138,7 +138,7 @@ std::vector<std::string> AmoebaMultipoleForceImpl::getKernelNames() {
return
names
;
}
const
int
*
AmoebaMultipoleForceImpl
::
getCovalentDegrees
(
void
)
{
const
int
*
AmoebaMultipoleForceImpl
::
getCovalentDegrees
()
{
if
(
!
initializedCovalentDegrees
){
initializedCovalentDegrees
=
true
;
CovalentDegrees
[
AmoebaMultipoleForce
::
Covalent12
]
=
1
;
...
...
plugins/amoeba/openmmapi/src/AmoebaOutOfPlaneBendForce.cpp
View file @
162d69a2
...
...
@@ -44,7 +44,7 @@ AmoebaOutOfPlaneBendForce::AmoebaOutOfPlaneBendForce() {
}
double
AmoebaOutOfPlaneBendForce
::
getAmoebaGlobalOutOfPlaneBendCubic
(
void
)
const
{
double
AmoebaOutOfPlaneBendForce
::
getAmoebaGlobalOutOfPlaneBendCubic
()
const
{
return
_globalCubicK
;
}
...
...
@@ -52,7 +52,7 @@ void AmoebaOutOfPlaneBendForce::setAmoebaGlobalOutOfPlaneBendCubic(double cubicK
_globalCubicK
=
cubicK
;
}
double
AmoebaOutOfPlaneBendForce
::
getAmoebaGlobalOutOfPlaneBendQuartic
(
void
)
const
{
double
AmoebaOutOfPlaneBendForce
::
getAmoebaGlobalOutOfPlaneBendQuartic
()
const
{
return
_globalQuarticK
;
}
...
...
@@ -60,7 +60,7 @@ void AmoebaOutOfPlaneBendForce::setAmoebaGlobalOutOfPlaneBendQuartic(double quar
_globalQuarticK
=
quarticK
;
}
double
AmoebaOutOfPlaneBendForce
::
getAmoebaGlobalOutOfPlaneBendPentic
(
void
)
const
{
double
AmoebaOutOfPlaneBendForce
::
getAmoebaGlobalOutOfPlaneBendPentic
()
const
{
return
_globalPenticK
;
}
...
...
@@ -68,7 +68,7 @@ void AmoebaOutOfPlaneBendForce::setAmoebaGlobalOutOfPlaneBendPentic(double penti
_globalPenticK
=
penticK
;
}
double
AmoebaOutOfPlaneBendForce
::
getAmoebaGlobalOutOfPlaneBendSextic
(
void
)
const
{
double
AmoebaOutOfPlaneBendForce
::
getAmoebaGlobalOutOfPlaneBendSextic
()
const
{
return
_globalSexticK
;
}
...
...
plugins/amoeba/openmmapi/src/AmoebaVdwForce.cpp
View file @
162d69a2
...
...
@@ -66,7 +66,7 @@ void AmoebaVdwForce::setSigmaCombiningRule( const std::string& inputSigmaCombini
sigmaCombiningRule
=
inputSigmaCombiningRule
;
}
const
std
::
string
&
AmoebaVdwForce
::
getSigmaCombiningRule
(
void
)
const
{
const
std
::
string
&
AmoebaVdwForce
::
getSigmaCombiningRule
()
const
{
return
sigmaCombiningRule
;
}
...
...
@@ -74,7 +74,7 @@ void AmoebaVdwForce::setEpsilonCombiningRule( const std::string& inputEpsilonCom
epsilonCombiningRule
=
inputEpsilonCombiningRule
;
}
const
std
::
string
&
AmoebaVdwForce
::
getEpsilonCombiningRule
(
void
)
const
{
const
std
::
string
&
AmoebaVdwForce
::
getEpsilonCombiningRule
()
const
{
return
epsilonCombiningRule
;
}
...
...
plugins/amoeba/openmmapi/src/AmoebaWcaDispersionForce.cpp
View file @
162d69a2
...
...
@@ -63,35 +63,35 @@ void AmoebaWcaDispersionForce::setParticleParameters(int particleIndex, double r
parameters
[
particleIndex
].
epsilon
=
epsilon
;
}
double
AmoebaWcaDispersionForce
::
getEpso
(
void
)
const
{
double
AmoebaWcaDispersionForce
::
getEpso
()
const
{
return
epso
;
}
double
AmoebaWcaDispersionForce
::
getEpsh
(
void
)
const
{
double
AmoebaWcaDispersionForce
::
getEpsh
()
const
{
return
epsh
;
}
double
AmoebaWcaDispersionForce
::
getRmino
(
void
)
const
{
double
AmoebaWcaDispersionForce
::
getRmino
()
const
{
return
rmino
;
}
double
AmoebaWcaDispersionForce
::
getRminh
(
void
)
const
{
double
AmoebaWcaDispersionForce
::
getRminh
()
const
{
return
rminh
;
}
double
AmoebaWcaDispersionForce
::
getAwater
(
void
)
const
{
double
AmoebaWcaDispersionForce
::
getAwater
()
const
{
return
awater
;
}
double
AmoebaWcaDispersionForce
::
getShctd
(
void
)
const
{
double
AmoebaWcaDispersionForce
::
getShctd
()
const
{
return
shctd
;
}
double
AmoebaWcaDispersionForce
::
getDispoff
(
void
)
const
{
double
AmoebaWcaDispersionForce
::
getDispoff
()
const
{
return
dispoff
;
}
double
AmoebaWcaDispersionForce
::
getSlevy
(
void
)
const
{
double
AmoebaWcaDispersionForce
::
getSlevy
()
const
{
return
slevy
;
}
...
...
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
View file @
162d69a2
...
...
@@ -91,16 +91,16 @@ ReferenceCalcAmoebaBondForceKernel::~ReferenceCalcAmoebaBondForceKernel() {
void
ReferenceCalcAmoebaBondForceKernel
::
initialize
(
const
System
&
system
,
const
AmoebaBondForce
&
force
)
{
numBonds
=
force
.
getNumBonds
();
for
(
int
ii
=
0
;
ii
<
numBonds
;
ii
++
)
{
for
(
int
ii
=
0
;
ii
<
numBonds
;
ii
++
)
{
int
particle1Index
,
particle2Index
;
double
lengthValue
,
kValue
;
force
.
getBondParameters
(
ii
,
particle1Index
,
particle2Index
,
lengthValue
,
kValue
);
force
.
getBondParameters
(
ii
,
particle1Index
,
particle2Index
,
lengthValue
,
kValue
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
length
.
push_back
(
static_cast
<
RealOpenMM
>
(
lengthValue
)
);
kQuadratic
.
push_back
(
static_cast
<
RealOpenMM
>
(
kValue
)
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
length
.
push_back
(
static_cast
<
RealOpenMM
>
(
lengthValue
)
);
kQuadratic
.
push_back
(
static_cast
<
RealOpenMM
>
(
kValue
)
);
}
globalBondCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalBondCubic
());
globalBondQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalBondQuartic
());
...
...
@@ -110,9 +110,9 @@ double ReferenceCalcAmoebaBondForceKernel::execute(ContextImpl& context, bool in
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceBondForce
amoebaReferenceBondForce
;
RealOpenMM
energy
=
amoebaReferenceBondForce
.
calculateForceAndEnergy
(
numBonds
,
posData
,
particle1
,
particle2
,
length
,
kQuadratic
,
RealOpenMM
energy
=
amoebaReferenceBondForce
.
calculateForceAndEnergy
(
numBonds
,
posData
,
particle1
,
particle2
,
length
,
kQuadratic
,
globalBondCubic
,
globalBondQuartic
,
forceData
);
forceData
);
return
static_cast
<
double
>
(
energy
);
}
...
...
@@ -150,11 +150,11 @@ void ReferenceCalcAmoebaAngleForceKernel::initialize(const System& system, const
int
particle1Index
,
particle2Index
,
particle3Index
;
double
angleValue
,
k
;
force
.
getAngleParameters
(
ii
,
particle1Index
,
particle2Index
,
particle3Index
,
angleValue
,
k
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
angle
.
push_back
(
static_cast
<
RealOpenMM
>
(
angleValue
)
);
kQuadratic
.
push_back
(
static_cast
<
RealOpenMM
>
(
k
)
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
angle
.
push_back
(
static_cast
<
RealOpenMM
>
(
angleValue
)
);
kQuadratic
.
push_back
(
static_cast
<
RealOpenMM
>
(
k
));
}
globalAngleCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAngleCubic
());
globalAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAngleQuartic
());
...
...
@@ -166,8 +166,8 @@ double ReferenceCalcAmoebaAngleForceKernel::execute(ContextImpl& context, bool i
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceAngleForce
amoebaReferenceAngleForce
;
RealOpenMM
energy
=
amoebaReferenceAngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
angle
,
kQuadratic
,
globalAngleCubic
,
globalAngleQuartic
,
globalAnglePentic
,
globalAngleSextic
,
forceData
);
RealOpenMM
energy
=
amoebaReferenceAngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
angle
,
kQuadratic
,
globalAngleCubic
,
globalAngleQuartic
,
globalAnglePentic
,
globalAngleSextic
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
...
...
@@ -202,12 +202,12 @@ void ReferenceCalcAmoebaInPlaneAngleForceKernel::initialize(const System& system
int
particle1Index
,
particle2Index
,
particle3Index
,
particle4Index
;
double
angleValue
,
k
;
force
.
getAngleParameters
(
ii
,
particle1Index
,
particle2Index
,
particle3Index
,
particle4Index
,
angleValue
,
k
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
particle4
.
push_back
(
particle4Index
);
angle
.
push_back
(
static_cast
<
RealOpenMM
>
(
angleValue
)
);
kQuadratic
.
push_back
(
static_cast
<
RealOpenMM
>
(
k
)
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
particle4
.
push_back
(
particle4Index
);
angle
.
push_back
(
static_cast
<
RealOpenMM
>
(
angleValue
)
);
kQuadratic
.
push_back
(
static_cast
<
RealOpenMM
>
(
k
)
);
}
globalInPlaneAngleCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAngleCubic
());
globalInPlaneAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAngleQuartic
());
...
...
@@ -220,9 +220,9 @@ double ReferenceCalcAmoebaInPlaneAngleForceKernel::execute(ContextImpl& context,
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceInPlaneAngleForce
amoebaReferenceInPlaneAngleForce
;
RealOpenMM
energy
=
amoebaReferenceInPlaneAngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
RealOpenMM
energy
=
amoebaReferenceInPlaneAngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
angle
,
kQuadratic
,
globalInPlaneAngleCubic
,
globalInPlaneAngleQuartic
,
globalInPlaneAnglePentic
,
globalInPlaneAngleSextic
,
forceData
);
globalInPlaneAnglePentic
,
globalInPlaneAngleSextic
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
...
...
@@ -257,14 +257,14 @@ void ReferenceCalcAmoebaPiTorsionForceKernel::initialize(const System& system, c
int
particle1Index
,
particle2Index
,
particle3Index
,
particle4Index
,
particle5Index
,
particle6Index
;
double
kTorsionParameter
;
force
.
getPiTorsionParameters
(
ii
,
particle1Index
,
particle2Index
,
particle3Index
,
particle4Index
,
particle5Index
,
particle6Index
,
kTorsionParameter
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
particle4
.
push_back
(
particle4Index
);
particle5
.
push_back
(
particle5Index
);
particle6
.
push_back
(
particle6Index
);
kTorsion
.
push_back
(
static_cast
<
RealOpenMM
>
(
kTorsionParameter
)
);
force
.
getPiTorsionParameters
(
ii
,
particle1Index
,
particle2Index
,
particle3Index
,
particle4Index
,
particle5Index
,
particle6Index
,
kTorsionParameter
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
particle4
.
push_back
(
particle4Index
);
particle5
.
push_back
(
particle5Index
);
particle6
.
push_back
(
particle6Index
);
kTorsion
.
push_back
(
static_cast
<
RealOpenMM
>
(
kTorsionParameter
));
}
}
...
...
@@ -272,9 +272,9 @@ double ReferenceCalcAmoebaPiTorsionForceKernel::execute(ContextImpl& context, bo
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferencePiTorsionForce
amoebaReferencePiTorsionForce
;
RealOpenMM
energy
=
amoebaReferencePiTorsionForce
.
calculateForceAndEnergy
(
numPiTorsions
,
posData
,
particle1
,
particle2
,
RealOpenMM
energy
=
amoebaReferencePiTorsionForce
.
calculateForceAndEnergy
(
numPiTorsions
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle6
,
kTorsion
,
forceData
);
kTorsion
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
...
...
@@ -305,18 +305,18 @@ ReferenceCalcAmoebaStretchBendForceKernel::~ReferenceCalcAmoebaStretchBendForceK
void
ReferenceCalcAmoebaStretchBendForceKernel
::
initialize
(
const
System
&
system
,
const
AmoebaStretchBendForce
&
force
)
{
numStretchBends
=
force
.
getNumStretchBends
();
for
(
int
ii
=
0
;
ii
<
numStretchBends
;
ii
++
)
{
for
(
int
ii
=
0
;
ii
<
numStretchBends
;
ii
++
)
{
int
particle1Index
,
particle2Index
,
particle3Index
;
double
lengthAB
,
lengthCB
,
angle
,
k1
,
k2
;
force
.
getStretchBendParameters
(
ii
,
particle1Index
,
particle2Index
,
particle3Index
,
lengthAB
,
lengthCB
,
angle
,
k1
,
k2
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
lengthABParameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
lengthAB
)
);
lengthCBParameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
lengthCB
)
);
angleParameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
angle
)
);
k1Parameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
k1
)
);
k2Parameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
k2
)
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
lengthABParameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
lengthAB
));
lengthCBParameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
lengthCB
));
angleParameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
angle
));
k1Parameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
k1
));
k2Parameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
k2
));
}
}
...
...
@@ -324,9 +324,9 @@ double ReferenceCalcAmoebaStretchBendForceKernel::execute(ContextImpl& context,
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceStretchBendForce
amoebaReferenceStretchBendForce
;
RealOpenMM
energy
=
amoebaReferenceStretchBendForce
.
calculateForceAndEnergy
(
numStretchBends
,
posData
,
particle1
,
particle2
,
particle3
,
RealOpenMM
energy
=
amoebaReferenceStretchBendForce
.
calculateForceAndEnergy
(
numStretchBends
,
posData
,
particle1
,
particle2
,
particle3
,
lengthABParameters
,
lengthCBParameters
,
angleParameters
,
k1Parameters
,
k2Parameters
,
forceData
);
k2Parameters
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
...
...
@@ -366,16 +366,16 @@ void ReferenceCalcAmoebaOutOfPlaneBendForceKernel::initialize(const System& syst
double
k
;
force
.
getOutOfPlaneBendParameters
(
ii
,
particle1Index
,
particle2Index
,
particle3Index
,
particle4Index
,
k
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
particle4
.
push_back
(
particle4Index
);
kParameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
k
)
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
particle4
.
push_back
(
particle4Index
);
kParameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
k
));
}
globalOutOfPlaneBendAngleCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendCubic
());
globalOutOfPlaneBendAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendQuartic
());
globalOutOfPlaneBendAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendPentic
());
globalOutOfPlaneBendAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendSextic
());
globalOutOfPlaneBendAngleCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendCubic
());
globalOutOfPlaneBendAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendQuartic
());
globalOutOfPlaneBendAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendPentic
());
globalOutOfPlaneBendAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendSextic
());
}
...
...
@@ -383,13 +383,13 @@ double ReferenceCalcAmoebaOutOfPlaneBendForceKernel::execute(ContextImpl& contex
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceOutOfPlaneBendForce
amoebaReferenceOutOfPlaneBendForce
;
RealOpenMM
energy
=
amoebaReferenceOutOfPlaneBendForce
.
calculateForceAndEnergy
(
numOutOfPlaneBends
,
posData
,
RealOpenMM
energy
=
amoebaReferenceOutOfPlaneBendForce
.
calculateForceAndEnergy
(
numOutOfPlaneBends
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
kParameters
,
globalOutOfPlaneBendAngleCubic
,
globalOutOfPlaneBendAngleQuartic
,
globalOutOfPlaneBendAnglePentic
,
globalOutOfPlaneBendAngleSextic
,
forceData
);
globalOutOfPlaneBendAngleSextic
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
...
...
@@ -426,13 +426,13 @@ void ReferenceCalcAmoebaTorsionTorsionForceKernel::initialize(const System& syst
int
particle1Index
,
particle2Index
,
particle3Index
,
particle4Index
,
particle5Index
,
chiralCheckAtomIndex
,
gridIndex
;
force
.
getTorsionTorsionParameters
(
ii
,
particle1Index
,
particle2Index
,
particle3Index
,
particle4Index
,
particle5Index
,
chiralCheckAtomIndex
,
gridIndex
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
particle4
.
push_back
(
particle4Index
);
particle5
.
push_back
(
particle5Index
);
chiralCheckAtom
.
push_back
(
chiralCheckAtomIndex
);
gridIndices
.
push_back
(
gridIndex
);
particle1
.
push_back
(
particle1Index
);
particle2
.
push_back
(
particle2Index
);
particle3
.
push_back
(
particle3Index
);
particle4
.
push_back
(
particle4Index
);
particle5
.
push_back
(
particle5Index
);
chiralCheckAtom
.
push_back
(
chiralCheckAtomIndex
);
gridIndices
.
push_back
(
gridIndex
);
}
// torsion-torsion grids
...
...
@@ -441,25 +441,25 @@ void ReferenceCalcAmoebaTorsionTorsionForceKernel::initialize(const System& syst
torsionTorsionGrids
.
resize
(
numTorsionTorsionGrids
);
for
(
int
ii
=
0
;
ii
<
numTorsionTorsionGrids
;
ii
++
)
{
const
TorsionTorsionGrid
grid
=
force
.
getTorsionTorsionGrid
(
ii
);
torsionTorsionGrids
[
ii
].
resize
(
grid
.
size
()
);
const
TorsionTorsionGrid
grid
=
force
.
getTorsionTorsionGrid
(
ii
);
torsionTorsionGrids
[
ii
].
resize
(
grid
.
size
());
// check if grid needs to be reordered: x-angle should be 'slow' index
TorsionTorsionGrid
reorderedGrid
;
int
reorder
=
0
;
if
(
grid
[
0
][
0
][
0
]
!=
grid
[
0
][
1
][
0
]
){
AmoebaTorsionTorsionForceImpl
::
reorderGrid
(
grid
,
reorderedGrid
);
if
(
grid
[
0
][
0
][
0
]
!=
grid
[
0
][
1
][
0
])
{
AmoebaTorsionTorsionForceImpl
::
reorderGrid
(
grid
,
reorderedGrid
);
reorder
=
1
;
}
for
(
unsigned
int
kk
=
0
;
kk
<
grid
.
size
();
kk
++
)
{
torsionTorsionGrids
[
ii
][
kk
].
resize
(
grid
[
kk
].
size
()
);
torsionTorsionGrids
[
ii
][
kk
].
resize
(
grid
[
kk
].
size
());
for
(
unsigned
int
jj
=
0
;
jj
<
grid
[
kk
].
size
();
jj
++
)
{
torsionTorsionGrids
[
ii
][
kk
][
jj
].
resize
(
grid
[
kk
][
jj
].
size
()
);
if
(
reorder
){
torsionTorsionGrids
[
ii
][
kk
][
jj
].
resize
(
grid
[
kk
][
jj
].
size
());
if
(
reorder
)
{
for
(
unsigned
int
ll
=
0
;
ll
<
grid
[
ll
][
jj
].
size
();
ll
++
)
{
torsionTorsionGrids
[
ii
][
kk
][
jj
][
ll
]
=
static_cast
<
RealOpenMM
>
(
reorderedGrid
[
kk
][
jj
][
ll
]);
}
...
...
@@ -478,9 +478,9 @@ double ReferenceCalcAmoebaTorsionTorsionForceKernel::execute(ContextImpl& contex
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceTorsionTorsionForce
amoebaReferenceTorsionTorsionForce
;
RealOpenMM
energy
=
amoebaReferenceTorsionTorsionForce
.
calculateForceAndEnergy
(
numTorsionTorsions
,
posData
,
RealOpenMM
energy
=
amoebaReferenceTorsionTorsionForce
.
calculateForceAndEnergy
(
numTorsionTorsions
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
chiralCheckAtom
,
gridIndices
,
torsionTorsionGrids
,
forceData
);
chiralCheckAtom
,
gridIndices
,
torsionTorsionGrids
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
...
...
@@ -517,7 +517,7 @@ void ReferenceCalcAmoebaMultipoleForceKernel::initialize(const System& system, c
int
quadrupoleIndex
=
0
;
int
maxCovalentRange
=
0
;
double
totalCharge
=
0.0
;
for
(
int
ii
=
0
;
ii
<
numMultipoles
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
numMultipoles
;
ii
++
)
{
// multipoles
...
...
@@ -526,7 +526,7 @@ void ReferenceCalcAmoebaMultipoleForceKernel::initialize(const System& system, c
std
::
vector
<
double
>
dipolesD
;
std
::
vector
<
double
>
quadrupolesD
;
force
.
getMultipoleParameters
(
ii
,
charge
,
dipolesD
,
quadrupolesD
,
axisType
,
multipoleAtomZ
,
multipoleAtomX
,
multipoleAtomY
,
tholeD
,
dampingFactorD
,
polarityD
);
tholeD
,
dampingFactorD
,
polarityD
);
totalCharge
+=
charge
;
axisTypes
[
ii
]
=
axisType
;
...
...
@@ -556,13 +556,13 @@ void ReferenceCalcAmoebaMultipoleForceKernel::initialize(const System& system, c
// covalent info
std
::
vector
<
std
::
vector
<
int
>
>
covalentLists
;
force
.
getCovalentMaps
(
ii
,
covalentLists
);
force
.
getCovalentMaps
(
ii
,
covalentLists
);
multipoleAtomCovalentInfo
[
ii
]
=
covalentLists
;
}
polarizationType
=
force
.
getPolarizationType
();
if
(
polarizationType
==
AmoebaMultipoleForce
::
Mutual
){
if
(
polarizationType
==
AmoebaMultipoleForce
::
Mutual
)
{
mutualInducedMaxIterations
=
force
.
getMutualInducedMaxIterations
();
mutualInducedTargetEpsilon
=
force
.
getMutualInducedTargetEpsilon
();
}
...
...
@@ -570,7 +570,7 @@ void ReferenceCalcAmoebaMultipoleForceKernel::initialize(const System& system, c
// PME
nonbondedMethod
=
force
.
getNonbondedMethod
();
if
(
nonbondedMethod
==
AmoebaMultipoleForce
::
PME
){
if
(
nonbondedMethod
==
AmoebaMultipoleForce
::
PME
)
{
usePme
=
true
;
alphaEwald
=
force
.
getAEwald
();
cutoffDistance
=
force
.
getCutoffDistance
();
...
...
@@ -591,7 +591,7 @@ void ReferenceCalcAmoebaMultipoleForceKernel::initialize(const System& system, c
return
;
}
AmoebaReferenceMultipoleForce
*
ReferenceCalcAmoebaMultipoleForceKernel
::
setupAmoebaReferenceMultipoleForce
(
ContextImpl
&
context
)
AmoebaReferenceMultipoleForce
*
ReferenceCalcAmoebaMultipoleForceKernel
::
setupAmoebaReferenceMultipoleForce
(
ContextImpl
&
context
)
{
// amoebaReferenceMultipoleForce is set to AmoebaReferenceGeneralizedKirkwoodForce if AmoebaGeneralizedKirkwoodForce is present
...
...
@@ -609,66 +609,66 @@ AmoebaReferenceMultipoleForce* ReferenceCalcAmoebaMultipoleForceKernel::setupAmo
}
AmoebaReferenceMultipoleForce
*
amoebaReferenceMultipoleForce
=
NULL
;
if
(
gkKernel
){
if
(
gkKernel
)
{
// amoebaReferenceGeneralizedKirkwoodForce is deleted in AmoebaReferenceGeneralizedKirkwoodMultipoleForce
// destructor
AmoebaReferenceGeneralizedKirkwoodForce
*
amoebaReferenceGeneralizedKirkwoodForce
=
new
AmoebaReferenceGeneralizedKirkwoodForce
();
amoebaReferenceGeneralizedKirkwoodForce
->
setNumParticles
(
gkKernel
->
getNumParticles
()
);
amoebaReferenceGeneralizedKirkwoodForce
->
setSoluteDielectric
(
gkKernel
->
getSoluteDielectric
()
);
amoebaReferenceGeneralizedKirkwoodForce
->
setSolventDielectric
(
gkKernel
->
getSolventDielectric
()
);
amoebaReferenceGeneralizedKirkwoodForce
->
setDielectricOffset
(
gkKernel
->
getDielectricOffset
()
);
amoebaReferenceGeneralizedKirkwoodForce
->
setProbeRadius
(
gkKernel
->
getProbeRadius
()
);
amoebaReferenceGeneralizedKirkwoodForce
->
setSurfaceAreaFactor
(
gkKernel
->
getSurfaceAreaFactor
()
);
amoebaReferenceGeneralizedKirkwoodForce
->
setIncludeCavityTerm
(
gkKernel
->
getIncludeCavityTerm
()
);
amoebaReferenceGeneralizedKirkwoodForce
->
setDirectPolarization
(
gkKernel
->
getDirectPolarization
()
);
amoebaReferenceGeneralizedKirkwoodForce
->
setNumParticles
(
gkKernel
->
getNumParticles
());
amoebaReferenceGeneralizedKirkwoodForce
->
setSoluteDielectric
(
gkKernel
->
getSoluteDielectric
());
amoebaReferenceGeneralizedKirkwoodForce
->
setSolventDielectric
(
gkKernel
->
getSolventDielectric
());
amoebaReferenceGeneralizedKirkwoodForce
->
setDielectricOffset
(
gkKernel
->
getDielectricOffset
());
amoebaReferenceGeneralizedKirkwoodForce
->
setProbeRadius
(
gkKernel
->
getProbeRadius
());
amoebaReferenceGeneralizedKirkwoodForce
->
setSurfaceAreaFactor
(
gkKernel
->
getSurfaceAreaFactor
());
amoebaReferenceGeneralizedKirkwoodForce
->
setIncludeCavityTerm
(
gkKernel
->
getIncludeCavityTerm
());
amoebaReferenceGeneralizedKirkwoodForce
->
setDirectPolarization
(
gkKernel
->
getDirectPolarization
());
vector
<
RealOpenMM
>
parameters
;
gkKernel
->
getAtomicRadii
(
parameters
);
amoebaReferenceGeneralizedKirkwoodForce
->
setAtomicRadii
(
parameters
);
gkKernel
->
getAtomicRadii
(
parameters
);
amoebaReferenceGeneralizedKirkwoodForce
->
setAtomicRadii
(
parameters
);
gkKernel
->
getScaleFactors
(
parameters
);
amoebaReferenceGeneralizedKirkwoodForce
->
setScaleFactors
(
parameters
);
gkKernel
->
getScaleFactors
(
parameters
);
amoebaReferenceGeneralizedKirkwoodForce
->
setScaleFactors
(
parameters
);
gkKernel
->
getCharges
(
parameters
);
amoebaReferenceGeneralizedKirkwoodForce
->
setCharges
(
parameters
);
gkKernel
->
getCharges
(
parameters
);
amoebaReferenceGeneralizedKirkwoodForce
->
setCharges
(
parameters
);
// calculate Grycuk Born radii
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
amoebaReferenceGeneralizedKirkwoodForce
->
calculateGrycukBornRadii
(
posData
);
amoebaReferenceGeneralizedKirkwoodForce
->
calculateGrycukBornRadii
(
posData
);
amoebaReferenceMultipoleForce
=
new
AmoebaReferenceGeneralizedKirkwoodMultipoleForce
(
amoebaReferenceGeneralizedKirkwoodForce
);
amoebaReferenceMultipoleForce
=
new
AmoebaReferenceGeneralizedKirkwoodMultipoleForce
(
amoebaReferenceGeneralizedKirkwoodForce
);
}
else
if
(
usePme
)
{
}
else
if
(
usePme
)
{
AmoebaReferencePmeMultipoleForce
*
amoebaReferencePmeMultipoleForce
=
new
AmoebaReferencePmeMultipoleForce
(
);
amoebaReferencePmeMultipoleForce
->
setAlphaEwald
(
alphaEwald
);
amoebaReferencePmeMultipoleForce
->
setCutoffDistance
(
cutoffDistance
);
amoebaReferencePmeMultipoleForce
->
setPmeGridDimensions
(
pmeGridDimension
);
AmoebaReferencePmeMultipoleForce
*
amoebaReferencePmeMultipoleForce
=
new
AmoebaReferencePmeMultipoleForce
();
amoebaReferencePmeMultipoleForce
->
setAlphaEwald
(
alphaEwald
);
amoebaReferencePmeMultipoleForce
->
setCutoffDistance
(
cutoffDistance
);
amoebaReferencePmeMultipoleForce
->
setPmeGridDimensions
(
pmeGridDimension
);
RealVec
*
boxVectors
=
extractBoxVectors
(
context
);
double
minAllowedSize
=
1.999999
*
cutoffDistance
;
if
(
boxVectors
[
0
][
0
]
<
minAllowedSize
||
boxVectors
[
1
][
1
]
<
minAllowedSize
||
boxVectors
[
2
][
2
]
<
minAllowedSize
){
if
(
boxVectors
[
0
][
0
]
<
minAllowedSize
||
boxVectors
[
1
][
1
]
<
minAllowedSize
||
boxVectors
[
2
][
2
]
<
minAllowedSize
)
{
throw
OpenMMException
(
"The periodic box size has decreased to less than twice the nonbonded cutoff."
);
}
amoebaReferencePmeMultipoleForce
->
setPeriodicBoxSize
(
boxVectors
);
amoebaReferenceMultipoleForce
=
static_cast
<
AmoebaReferenceMultipoleForce
*>
(
amoebaReferencePmeMultipoleForce
);
}
else
{
amoebaReferenceMultipoleForce
=
new
AmoebaReferenceMultipoleForce
(
AmoebaReferenceMultipoleForce
::
NoCutoff
);
amoebaReferenceMultipoleForce
=
new
AmoebaReferenceMultipoleForce
(
AmoebaReferenceMultipoleForce
::
NoCutoff
);
}
// set polarization type
if
(
polarizationType
==
AmoebaMultipoleForce
::
Mutual
){
amoebaReferenceMultipoleForce
->
setPolarizationType
(
AmoebaReferenceMultipoleForce
::
Mutual
);
amoebaReferenceMultipoleForce
->
setMutualInducedDipoleTargetEpsilon
(
mutualInducedTargetEpsilon
);
amoebaReferenceMultipoleForce
->
setMaximumMutualInducedDipoleIterations
(
mutualInducedMaxIterations
);
}
else
if
(
polarizationType
==
AmoebaMultipoleForce
::
Direct
){
amoebaReferenceMultipoleForce
->
setPolarizationType
(
AmoebaReferenceMultipoleForce
::
Direct
);
if
(
polarizationType
==
AmoebaMultipoleForce
::
Mutual
)
{
amoebaReferenceMultipoleForce
->
setPolarizationType
(
AmoebaReferenceMultipoleForce
::
Mutual
);
amoebaReferenceMultipoleForce
->
setMutualInducedDipoleTargetEpsilon
(
mutualInducedTargetEpsilon
);
amoebaReferenceMultipoleForce
->
setMaximumMutualInducedDipoleIterations
(
mutualInducedMaxIterations
);
}
else
if
(
polarizationType
==
AmoebaMultipoleForce
::
Direct
)
{
amoebaReferenceMultipoleForce
->
setPolarizationType
(
AmoebaReferenceMultipoleForce
::
Direct
);
}
else
{
throw
OpenMMException
(
"Polarization type not recognzied."
);
throw
OpenMMException
(
"Polarization type not recognzied."
);
}
return
amoebaReferenceMultipoleForce
;
...
...
@@ -677,11 +677,11 @@ AmoebaReferenceMultipoleForce* ReferenceCalcAmoebaMultipoleForceKernel::setupAmo
double
ReferenceCalcAmoebaMultipoleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
AmoebaReferenceMultipoleForce
*
amoebaReferenceMultipoleForce
=
setupAmoebaReferenceMultipoleForce
(
context
);
AmoebaReferenceMultipoleForce
*
amoebaReferenceMultipoleForce
=
setupAmoebaReferenceMultipoleForce
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
amoebaReferenceMultipoleForce
->
calculateForceAndEnergy
(
posData
,
charges
,
dipoles
,
quadrupoles
,
tholes
,
RealOpenMM
energy
=
amoebaReferenceMultipoleForce
->
calculateForceAndEnergy
(
posData
,
charges
,
dipoles
,
quadrupoles
,
tholes
,
dampingFactors
,
polarity
,
axisTypes
,
multipoleAtomZs
,
multipoleAtomXs
,
multipoleAtomYs
,
multipoleAtomCovalentInfo
,
forceData
);
...
...
@@ -697,7 +697,7 @@ void ReferenceCalcAmoebaMultipoleForceKernel::getInducedDipoles(ContextImpl& con
// Create an AmoebaReferenceMultipoleForce to do the calculation.
AmoebaReferenceMultipoleForce
*
amoebaReferenceMultipoleForce
=
setupAmoebaReferenceMultipoleForce
(
context
);
AmoebaReferenceMultipoleForce
*
amoebaReferenceMultipoleForce
=
setupAmoebaReferenceMultipoleForce
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
// Retrieve the induced dipoles.
...
...
@@ -711,44 +711,44 @@ void ReferenceCalcAmoebaMultipoleForceKernel::getInducedDipoles(ContextImpl& con
}
void
ReferenceCalcAmoebaMultipoleForceKernel
::
getElectrostaticPotential
(
ContextImpl
&
context
,
const
std
::
vector
<
Vec3
>&
inputGrid
,
std
::
vector
<
double
>&
outputElectrostaticPotential
){
std
::
vector
<
double
>&
outputElectrostaticPotential
)
{
AmoebaReferenceMultipoleForce
*
amoebaReferenceMultipoleForce
=
setupAmoebaReferenceMultipoleForce
(
context
);
AmoebaReferenceMultipoleForce
*
amoebaReferenceMultipoleForce
=
setupAmoebaReferenceMultipoleForce
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>
grid
(
inputGrid
.
size
()
);
vector
<
RealOpenMM
>
potential
(
inputGrid
.
size
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
inputGrid
.
size
();
ii
++
){
vector
<
RealVec
>
grid
(
inputGrid
.
size
());
vector
<
RealOpenMM
>
potential
(
inputGrid
.
size
());
for
(
unsigned
int
ii
=
0
;
ii
<
inputGrid
.
size
();
ii
++
)
{
grid
[
ii
]
=
inputGrid
[
ii
];
}
amoebaReferenceMultipoleForce
->
calculateElectrostaticPotential
(
posData
,
charges
,
dipoles
,
quadrupoles
,
tholes
,
amoebaReferenceMultipoleForce
->
calculateElectrostaticPotential
(
posData
,
charges
,
dipoles
,
quadrupoles
,
tholes
,
dampingFactors
,
polarity
,
axisTypes
,
multipoleAtomZs
,
multipoleAtomXs
,
multipoleAtomYs
,
multipoleAtomCovalentInfo
,
grid
,
potential
);
multipoleAtomCovalentInfo
,
grid
,
potential
);
outputElectrostaticPotential
.
resize
(
inputGrid
.
size
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
inputGrid
.
size
();
ii
++
){
outputElectrostaticPotential
.
resize
(
inputGrid
.
size
());
for
(
unsigned
int
ii
=
0
;
ii
<
inputGrid
.
size
();
ii
++
)
{
outputElectrostaticPotential
[
ii
]
=
potential
[
ii
];
}
delete
amoebaReferenceMultipoleForce
;
}
void
ReferenceCalcAmoebaMultipoleForceKernel
::
getSystemMultipoleMoments
(
ContextImpl
&
context
,
std
::
vector
<
double
>&
outputMultipoleMoments
){
void
ReferenceCalcAmoebaMultipoleForceKernel
::
getSystemMultipoleMoments
(
ContextImpl
&
context
,
std
::
vector
<
double
>&
outputMultipoleMoments
)
{
// retrieve masses
const
System
&
system
=
context
.
getSystem
();
vector
<
RealOpenMM
>
masses
;
for
(
int
i
=
0
;
i
<
system
.
getNumParticles
();
++
i
)
{
masses
.
push_back
(
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
))
);
masses
.
push_back
(
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
)));
}
AmoebaReferenceMultipoleForce
*
amoebaReferenceMultipoleForce
=
setupAmoebaReferenceMultipoleForce
(
context
);
AmoebaReferenceMultipoleForce
*
amoebaReferenceMultipoleForce
=
setupAmoebaReferenceMultipoleForce
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
amoebaReferenceMultipoleForce
->
calculateAmoebaSystemMultipoleMoments
(
masses
,
posData
,
charges
,
dipoles
,
quadrupoles
,
tholes
,
amoebaReferenceMultipoleForce
->
calculateAmoebaSystemMultipoleMoments
(
masses
,
posData
,
charges
,
dipoles
,
quadrupoles
,
tholes
,
dampingFactors
,
polarity
,
axisTypes
,
multipoleAtomZs
,
multipoleAtomXs
,
multipoleAtomYs
,
multipoleAtomCovalentInfo
,
outputMultipoleMoments
);
multipoleAtomCovalentInfo
,
outputMultipoleMoments
);
delete
amoebaReferenceMultipoleForce
;
}
...
...
@@ -801,51 +801,51 @@ ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::ReferenceCalcAmoebaGeneralize
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::~
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
()
{
}
int
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getNumParticles
(
void
)
const
{
int
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getNumParticles
()
const
{
return
numParticles
;
}
int
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getIncludeCavityTerm
(
void
)
const
{
int
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getIncludeCavityTerm
()
const
{
return
includeCavityTerm
;
}
int
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getDirectPolarization
(
void
)
const
{
int
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getDirectPolarization
()
const
{
return
directPolarization
;
}
RealOpenMM
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getSoluteDielectric
(
void
)
const
{
RealOpenMM
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getSoluteDielectric
()
const
{
return
soluteDielectric
;
}
RealOpenMM
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getSolventDielectric
(
void
)
const
{
RealOpenMM
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getSolventDielectric
()
const
{
return
solventDielectric
;
}
RealOpenMM
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getDielectricOffset
(
void
)
const
{
RealOpenMM
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getDielectricOffset
()
const
{
return
dielectricOffset
;
}
RealOpenMM
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getProbeRadius
(
void
)
const
{
RealOpenMM
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getProbeRadius
()
const
{
return
probeRadius
;
}
RealOpenMM
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getSurfaceAreaFactor
(
void
)
const
{
RealOpenMM
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getSurfaceAreaFactor
()
const
{
return
surfaceAreaFactor
;
}
void
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getAtomicRadii
(
vector
<
RealOpenMM
>&
outputAtomicRadii
)
const
{
outputAtomicRadii
.
resize
(
atomicRadii
.
size
()
);
copy
(
atomicRadii
.
begin
(),
atomicRadii
.
end
(),
outputAtomicRadii
.
begin
()
);
void
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getAtomicRadii
(
vector
<
RealOpenMM
>&
outputAtomicRadii
)
const
{
outputAtomicRadii
.
resize
(
atomicRadii
.
size
());
copy
(
atomicRadii
.
begin
(),
atomicRadii
.
end
(),
outputAtomicRadii
.
begin
());
}
void
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getScaleFactors
(
vector
<
RealOpenMM
>&
outputScaleFactors
)
const
{
outputScaleFactors
.
resize
(
scaleFactors
.
size
()
);
copy
(
scaleFactors
.
begin
(),
scaleFactors
.
end
(),
outputScaleFactors
.
begin
()
);
void
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getScaleFactors
(
vector
<
RealOpenMM
>&
outputScaleFactors
)
const
{
outputScaleFactors
.
resize
(
scaleFactors
.
size
());
copy
(
scaleFactors
.
begin
(),
scaleFactors
.
end
(),
outputScaleFactors
.
begin
());
}
void
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getCharges
(
vector
<
RealOpenMM
>&
outputCharges
)
const
{
outputCharges
.
resize
(
charges
.
size
()
);
copy
(
charges
.
begin
(),
charges
.
end
(),
outputCharges
.
begin
()
);
void
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
getCharges
(
vector
<
RealOpenMM
>&
outputCharges
)
const
{
outputCharges
.
resize
(
charges
.
size
());
copy
(
charges
.
begin
(),
charges
.
end
(),
outputCharges
.
begin
());
}
void
ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel
::
initialize
(
const
System
&
system
,
const
AmoebaGeneralizedKirkwoodForce
&
force
)
{
...
...
@@ -861,37 +861,37 @@ void ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel::initialize(const System&
throw
OpenMMException
(
"AmoebaGeneralizedKirkwoodForce requires the System to also contain an AmoebaMultipoleForce."
);
}
if
(
amoebaMultipoleForce
->
getNonbondedMethod
()
!=
AmoebaMultipoleForce
::
NoCutoff
)
{
if
(
amoebaMultipoleForce
->
getNonbondedMethod
()
!=
AmoebaMultipoleForce
::
NoCutoff
)
{
throw
OpenMMException
(
"AmoebaGeneralizedKirkwoodForce requires the AmoebaMultipoleForce use the NoCutoff nonbonded method."
);
}
numParticles
=
system
.
getNumParticles
();
for
(
int
ii
=
0
;
ii
<
numParticles
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
numParticles
;
ii
++
)
{
double
particleCharge
,
particleRadius
,
scalingFactor
;
force
.
getParticleParameters
(
ii
,
particleCharge
,
particleRadius
,
scalingFactor
);
atomicRadii
.
push_back
(
static_cast
<
RealOpenMM
>
(
particleRadius
)
);
scaleFactors
.
push_back
(
static_cast
<
RealOpenMM
>
(
scalingFactor
)
);
charges
.
push_back
(
static_cast
<
RealOpenMM
>
(
particleCharge
)
);
atomicRadii
.
push_back
(
static_cast
<
RealOpenMM
>
(
particleRadius
)
);
scaleFactors
.
push_back
(
static_cast
<
RealOpenMM
>
(
scalingFactor
)
);
charges
.
push_back
(
static_cast
<
RealOpenMM
>
(
particleCharge
)
);
// Make sure the charge matches the one specified by the AmoebaMultipoleForce.
double
charge2
,
thole
,
damping
,
polarity
;
int
axisType
,
atomX
,
atomY
,
atomZ
;
vector
<
double
>
dipole
,
quadrupole
;
amoebaMultipoleForce
->
getMultipoleParameters
(
ii
,
charge2
,
dipole
,
quadrupole
,
axisType
,
atomZ
,
atomX
,
atomY
,
thole
,
damping
,
polarity
);
if
(
particleCharge
!=
charge2
){
amoebaMultipoleForce
->
getMultipoleParameters
(
ii
,
charge2
,
dipole
,
quadrupole
,
axisType
,
atomZ
,
atomX
,
atomY
,
thole
,
damping
,
polarity
);
if
(
particleCharge
!=
charge2
)
{
throw
OpenMMException
(
"AmoebaGeneralizedKirkwoodForce and AmoebaMultipoleForce must specify the same charge for every atom."
);
}
}
includeCavityTerm
=
force
.
getIncludeCavityTerm
();
soluteDielectric
=
static_cast
<
RealOpenMM
>
(
force
.
getSoluteDielectric
()
);
solventDielectric
=
static_cast
<
RealOpenMM
>
(
force
.
getSolventDielectric
()
);
dielectricOffset
=
static_cast
<
RealOpenMM
>
(
0.009
);
probeRadius
=
static_cast
<
RealOpenMM
>
(
force
.
getProbeRadius
()
),
surfaceAreaFactor
=
static_cast
<
RealOpenMM
>
(
force
.
getSurfaceAreaFactor
()
);
soluteDielectric
=
static_cast
<
RealOpenMM
>
(
force
.
getSoluteDielectric
());
solventDielectric
=
static_cast
<
RealOpenMM
>
(
force
.
getSolventDielectric
());
dielectricOffset
=
static_cast
<
RealOpenMM
>
(
0.009
);
probeRadius
=
static_cast
<
RealOpenMM
>
(
force
.
getProbeRadius
()),
surfaceAreaFactor
=
static_cast
<
RealOpenMM
>
(
force
.
getSurfaceAreaFactor
());
directPolarization
=
amoebaMultipoleForce
->
getPolarizationType
()
==
AmoebaMultipoleForce
::
Direct
?
1
:
0
;
}
...
...
@@ -924,7 +924,7 @@ ReferenceCalcAmoebaVdwForceKernel::ReferenceCalcAmoebaVdwForceKernel(std::string
}
ReferenceCalcAmoebaVdwForceKernel
::~
ReferenceCalcAmoebaVdwForceKernel
()
{
if
(
neighborList
){
if
(
neighborList
)
{
delete
neighborList
;
}
}
...
...
@@ -935,28 +935,28 @@ void ReferenceCalcAmoebaVdwForceKernel::initialize(const System& system, const A
numParticles
=
system
.
getNumParticles
();
indexIVs
.
resize
(
numParticles
);
allExclusions
.
resize
(
numParticles
);
sigmas
.
resize
(
numParticles
);
epsilons
.
resize
(
numParticles
);
reductions
.
resize
(
numParticles
);
indexIVs
.
resize
(
numParticles
);
allExclusions
.
resize
(
numParticles
);
sigmas
.
resize
(
numParticles
);
epsilons
.
resize
(
numParticles
);
reductions
.
resize
(
numParticles
);
for
(
int
ii
=
0
;
ii
<
numParticles
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
numParticles
;
ii
++
)
{
int
indexIV
;
double
sigma
,
epsilon
,
reduction
;
std
::
vector
<
int
>
exclusions
;
force
.
getParticleParameters
(
ii
,
indexIV
,
sigma
,
epsilon
,
reduction
);
force
.
getParticleExclusions
(
ii
,
exclusions
);
for
(
unsigned
int
jj
=
0
;
jj
<
exclusions
.
size
();
jj
++
){
allExclusions
[
ii
].
insert
(
exclusions
[
jj
]
);
force
.
getParticleParameters
(
ii
,
indexIV
,
sigma
,
epsilon
,
reduction
);
force
.
getParticleExclusions
(
ii
,
exclusions
);
for
(
unsigned
int
jj
=
0
;
jj
<
exclusions
.
size
();
jj
++
)
{
allExclusions
[
ii
].
insert
(
exclusions
[
jj
]);
}
indexIVs
[
ii
]
=
indexIV
;
sigmas
[
ii
]
=
static_cast
<
RealOpenMM
>
(
sigma
);
epsilons
[
ii
]
=
static_cast
<
RealOpenMM
>
(
epsilon
);
reductions
[
ii
]
=
static_cast
<
RealOpenMM
>
(
reduction
);
sigmas
[
ii
]
=
static_cast
<
RealOpenMM
>
(
sigma
);
epsilons
[
ii
]
=
static_cast
<
RealOpenMM
>
(
epsilon
);
reductions
[
ii
]
=
static_cast
<
RealOpenMM
>
(
reduction
);
}
sigmaCombiningRule
=
force
.
getSigmaCombiningRule
();
epsilonCombiningRule
=
force
.
getEpsilonCombiningRule
();
...
...
@@ -972,27 +972,27 @@ double ReferenceCalcAmoebaVdwForceKernel::execute(ContextImpl& context, bool inc
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceVdwForce
vdwForce
(
sigmaCombiningRule
,
epsilonCombiningRule
);
AmoebaReferenceVdwForce
vdwForce
(
sigmaCombiningRule
,
epsilonCombiningRule
);
RealOpenMM
energy
;
if
(
useCutoff
){
vdwForce
.
setCutoff
(
cutoff
);
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
allExclusions
,
extractBoxVectors
(
context
),
usePBC
,
cutoff
,
0.0
);
if
(
usePBC
){
vdwForce
.
setNonbondedMethod
(
AmoebaReferenceVdwForce
::
CutoffPeriodic
);
if
(
useCutoff
)
{
vdwForce
.
setCutoff
(
cutoff
);
computeNeighborListVoxelHash
(
*
neighborList
,
numParticles
,
posData
,
allExclusions
,
extractBoxVectors
(
context
),
usePBC
,
cutoff
,
0.0
);
if
(
usePBC
)
{
vdwForce
.
setNonbondedMethod
(
AmoebaReferenceVdwForce
::
CutoffPeriodic
);
RealVec
*
boxVectors
=
extractBoxVectors
(
context
);
double
minAllowedSize
=
1.999999
*
cutoff
;
if
(
boxVectors
[
0
][
0
]
<
minAllowedSize
||
boxVectors
[
1
][
1
]
<
minAllowedSize
||
boxVectors
[
2
][
2
]
<
minAllowedSize
){
if
(
boxVectors
[
0
][
0
]
<
minAllowedSize
||
boxVectors
[
1
][
1
]
<
minAllowedSize
||
boxVectors
[
2
][
2
]
<
minAllowedSize
)
{
throw
OpenMMException
(
"The periodic box size has decreased to less than twice the cutoff."
);
}
vdwForce
.
setPeriodicBox
(
boxVectors
);
energy
=
vdwForce
.
calculateForceAndEnergy
(
numParticles
,
posData
,
indexIVs
,
sigmas
,
epsilons
,
reductions
,
*
neighborList
,
forceData
);
energy
=
vdwForce
.
calculateForceAndEnergy
(
numParticles
,
posData
,
indexIVs
,
sigmas
,
epsilons
,
reductions
,
*
neighborList
,
forceData
);
energy
+=
dispersionCoefficient
/
(
boxVectors
[
0
][
0
]
*
boxVectors
[
1
][
1
]
*
boxVectors
[
2
][
2
]);
}
else
{
vdwForce
.
setNonbondedMethod
(
AmoebaReferenceVdwForce
::
CutoffNonPeriodic
);
vdwForce
.
setNonbondedMethod
(
AmoebaReferenceVdwForce
::
CutoffNonPeriodic
);
}
}
else
{
vdwForce
.
setNonbondedMethod
(
AmoebaReferenceVdwForce
::
NoCutoff
);
energy
=
vdwForce
.
calculateForceAndEnergy
(
numParticles
,
posData
,
indexIVs
,
sigmas
,
epsilons
,
reductions
,
allExclusions
,
forceData
);
vdwForce
.
setNonbondedMethod
(
AmoebaReferenceVdwForce
::
NoCutoff
);
energy
=
vdwForce
.
calculateForceAndEnergy
(
numParticles
,
posData
,
indexIVs
,
sigmas
,
epsilons
,
reductions
,
allExclusions
,
forceData
);
}
return
static_cast
<
double
>
(
energy
);
}
...
...
@@ -1032,32 +1032,32 @@ void ReferenceCalcAmoebaWcaDispersionForceKernel::initialize(const System& syste
numParticles
=
system
.
getNumParticles
();
radii
.
resize
(
numParticles
);
epsilons
.
resize
(
numParticles
);
for
(
int
ii
=
0
;
ii
<
numParticles
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
numParticles
;
ii
++
)
{
double
radius
,
epsilon
;
force
.
getParticleParameters
(
ii
,
radius
,
epsilon
);
force
.
getParticleParameters
(
ii
,
radius
,
epsilon
);
radii
[
ii
]
=
static_cast
<
RealOpenMM
>
(
radius
);
epsilons
[
ii
]
=
static_cast
<
RealOpenMM
>
(
epsilon
);
radii
[
ii
]
=
static_cast
<
RealOpenMM
>
(
radius
);
epsilons
[
ii
]
=
static_cast
<
RealOpenMM
>
(
epsilon
);
}
totalMaximumDispersionEnergy
=
static_cast
<
RealOpenMM
>
(
AmoebaWcaDispersionForceImpl
::
getTotalMaximumDispersionEnergy
(
force
)
);
totalMaximumDispersionEnergy
=
static_cast
<
RealOpenMM
>
(
AmoebaWcaDispersionForceImpl
::
getTotalMaximumDispersionEnergy
(
force
)
);
epso
=
static_cast
<
RealOpenMM
>
(
force
.
getEpso
()
);
epsh
=
static_cast
<
RealOpenMM
>
(
force
.
getEpsh
()
);
rmino
=
static_cast
<
RealOpenMM
>
(
force
.
getRmino
()
);
rminh
=
static_cast
<
RealOpenMM
>
(
force
.
getRminh
()
);
awater
=
static_cast
<
RealOpenMM
>
(
force
.
getAwater
()
);
shctd
=
static_cast
<
RealOpenMM
>
(
force
.
getShctd
()
);
dispoff
=
static_cast
<
RealOpenMM
>
(
force
.
getDispoff
());
slevy
=
static_cast
<
RealOpenMM
>
(
force
.
getSlevy
()
);
epso
=
static_cast
<
RealOpenMM
>
(
force
.
getEpso
()
);
epsh
=
static_cast
<
RealOpenMM
>
(
force
.
getEpsh
()
);
rmino
=
static_cast
<
RealOpenMM
>
(
force
.
getRmino
()
);
rminh
=
static_cast
<
RealOpenMM
>
(
force
.
getRminh
()
);
awater
=
static_cast
<
RealOpenMM
>
(
force
.
getAwater
());
shctd
=
static_cast
<
RealOpenMM
>
(
force
.
getShctd
()
);
dispoff
=
static_cast
<
RealOpenMM
>
(
force
.
getDispoff
());
slevy
=
static_cast
<
RealOpenMM
>
(
force
.
getSlevy
()
);
}
double
ReferenceCalcAmoebaWcaDispersionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceWcaDispersionForce
amoebaReferenceWcaDispersionForce
(
epso
,
epsh
,
rmino
,
rminh
,
awater
,
shctd
,
dispoff
,
slevy
);
RealOpenMM
energy
=
amoebaReferenceWcaDispersionForce
.
calculateForceAndEnergy
(
numParticles
,
posData
,
radii
,
epsilons
,
totalMaximumDispersionEnergy
,
forceData
);
AmoebaReferenceWcaDispersionForce
amoebaReferenceWcaDispersionForce
(
epso
,
epsh
,
rmino
,
rminh
,
awater
,
shctd
,
dispoff
,
slevy
);
RealOpenMM
energy
=
amoebaReferenceWcaDispersionForce
.
calculateForceAndEnergy
(
numParticles
,
posData
,
radii
,
epsilons
,
totalMaximumDispersionEnergy
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
...
...
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
View file @
162d69a2
...
...
@@ -357,7 +357,7 @@ public:
*
* @return pointer to initialized instance of AmoebaReferenceMultipoleForce
*/
AmoebaReferenceMultipoleForce
*
setupAmoebaReferenceMultipoleForce
(
ContextImpl
&
context
);
AmoebaReferenceMultipoleForce
*
setupAmoebaReferenceMultipoleForce
(
ContextImpl
&
context
);
/**
* Execute the kernel to calculate the forces and/or energy.
*
...
...
@@ -382,7 +382,7 @@ public:
* @param outputElectrostaticPotential output potential
*/
void
getElectrostaticPotential
(
ContextImpl
&
context
,
const
std
::
vector
<
Vec3
>&
inputGrid
,
std
::
vector
<
double
>&
outputElectrostaticPotential
);
std
::
vector
<
double
>&
outputElectrostaticPotential
);
/**
* Get the system multipole moments.
...
...
@@ -393,7 +393,7 @@ public:
dipole_x, dipole_y, dipole_z,
quadrupole_xx, quadrupole_xy, quadrupole_xz,
quadrupole_yx, quadrupole_yy, quadrupole_yz,
quadrupole_zx, quadrupole_zy, quadrupole_zz
)
quadrupole_zx, quadrupole_zy, quadrupole_zz)
*/
void
getSystemMultipoleMoments
(
ContextImpl
&
context
,
std
::
vector
<
double
>&
outputMultipoleMoments
);
/**
...
...
@@ -555,14 +555,14 @@ public:
*
* @return includeCavityTerm
*/
int
getIncludeCavityTerm
(
void
)
const
;
int
getIncludeCavityTerm
()
const
;
/**
* Get the number of particles.
*
* @return number of particles
*/
int
getNumParticles
(
void
)
const
;
int
getNumParticles
()
const
;
/**
* Get Direct Polarization flag.
...
...
@@ -570,7 +570,7 @@ public:
* @return directPolarization
*
*/
int
getDirectPolarization
(
void
)
const
;
int
getDirectPolarization
()
const
;
/**
* Get the solute dielectric.
...
...
@@ -578,7 +578,7 @@ public:
* @return soluteDielectric
*
*/
RealOpenMM
getSoluteDielectric
(
void
)
const
;
RealOpenMM
getSoluteDielectric
()
const
;
/**
* Get the solvent dielectric.
...
...
@@ -586,7 +586,7 @@ public:
* @return solventDielectric
*
*/
RealOpenMM
getSolventDielectric
(
void
)
const
;
RealOpenMM
getSolventDielectric
()
const
;
/**
* Get the dielectric offset.
...
...
@@ -594,7 +594,7 @@ public:
* @return dielectricOffset
*
*/
RealOpenMM
getDielectricOffset
(
void
)
const
;
RealOpenMM
getDielectricOffset
()
const
;
/**
* Get the probe radius.
...
...
@@ -602,7 +602,7 @@ public:
* @return probeRadius
*
*/
RealOpenMM
getProbeRadius
(
void
)
const
;
RealOpenMM
getProbeRadius
()
const
;
/**
* Get the surface area factor.
...
...
@@ -610,7 +610,7 @@ public:
* @return surfaceAreaFactor
*
*/
RealOpenMM
getSurfaceAreaFactor
(
void
)
const
;
RealOpenMM
getSurfaceAreaFactor
()
const
;
/**
* Get the vector of particle radii.
...
...
@@ -618,7 +618,7 @@ public:
* @param atomicRadii vector of atomic radii
*
*/
void
getAtomicRadii
(
std
::
vector
<
RealOpenMM
>&
atomicRadii
)
const
;
void
getAtomicRadii
(
std
::
vector
<
RealOpenMM
>&
atomicRadii
)
const
;
/**
* Get the vector of scale factors.
...
...
@@ -626,7 +626,7 @@ public:
* @param scaleFactors vector of scale factors
*
*/
void
getScaleFactors
(
std
::
vector
<
RealOpenMM
>&
scaleFactors
)
const
;
void
getScaleFactors
(
std
::
vector
<
RealOpenMM
>&
scaleFactors
)
const
;
/**
* Get the vector of charges.
...
...
@@ -634,7 +634,7 @@ public:
* @param charges vector of charges
*
*/
void
getCharges
(
std
::
vector
<
RealOpenMM
>&
charges
)
const
;
void
getCharges
(
std
::
vector
<
RealOpenMM
>&
charges
)
const
;
/**
* Copy changed parameters over to a context.
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.cpp
View file @
162d69a2
...
...
@@ -26,7 +26,7 @@
#include "AmoebaReferenceAngleForce.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
using
namespace
OpenMM
;
/**---------------------------------------------------------------------------------------
...
...
@@ -46,11 +46,11 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceAngleForce
::
getPrefactorsGivenAngleCosine
(
RealOpenMM
cosine
,
RealOpenMM
AmoebaReferenceAngleForce
::
getPrefactorsGivenAngleCosine
(
RealOpenMM
cosine
,
RealOpenMM
idealAngle
,
RealOpenMM
angleK
,
RealOpenMM
angleCubic
,
RealOpenMM
angleQuartic
,
RealOpenMM
anglePentic
,
RealOpenMM
angleSextic
,
RealOpenMM
*
dEdR
)
const
{
RealOpenMM
*
dEdR
)
const
{
// ---------------------------------------------------------------------------------------
...
...
@@ -67,9 +67,9 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM
// ---------------------------------------------------------------------------------------
RealOpenMM
angle
;
if
(
cosine
>=
one
){
if
(
cosine
>=
one
)
{
angle
=
zero
;
}
else
if
(
cosine
<=
-
one
){
}
else
if
(
cosine
<=
-
one
)
{
angle
=
RADIAN
*
PI_M
;
}
else
{
angle
=
RADIAN
*
ACOS
(
cosine
);
...
...
@@ -79,10 +79,10 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM
RealOpenMM
deltaIdeal3
=
deltaIdeal
*
deltaIdeal2
;
RealOpenMM
deltaIdeal4
=
deltaIdeal2
*
deltaIdeal2
;
*
dEdR
=
(
two
+
three
*
angleCubic
*
deltaIdeal
+
*
dEdR
=
(
two
+
three
*
angleCubic
*
deltaIdeal
+
four
*
angleQuartic
*
deltaIdeal2
+
five
*
anglePentic
*
deltaIdeal3
+
six
*
angleSextic
*
deltaIdeal4
);
six
*
angleSextic
*
deltaIdeal4
);
*
dEdR
*=
RADIAN
*
angleK
*
deltaIdeal
;
...
...
@@ -113,12 +113,12 @@ RealOpenMM AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine( RealOpenMM
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceAngleForce
::
calculateAngleIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
RealOpenMM
AmoebaReferenceAngleForce
::
calculateAngleIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
const
RealVec
&
positionAtomC
,
RealOpenMM
angle
,
RealOpenMM
angleK
,
RealOpenMM
angleCubic
,
RealOpenMM
angleQuartic
,
RealOpenMM
anglePentic
,
RealOpenMM
angleSextic
,
RealVec
*
forces
)
const
{
RealVec
*
forces
)
const
{
// ---------------------------------------------------------------------------------------
...
...
@@ -132,30 +132,30 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
// ---------------------------------------------------------------------------------------
std
::
vector
<
RealOpenMM
>
deltaR
[
2
];
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomA
,
positionAtomB
,
deltaR
[
0
]
);
RealOpenMM
rAB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
0
]
);
RealOpenMM
rAB
=
SQRT
(
rAB2
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomA
,
positionAtomB
,
deltaR
[
0
]);
RealOpenMM
rAB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
0
]);
RealOpenMM
rAB
=
SQRT
(
rAB2
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomC
,
positionAtomB
,
deltaR
[
1
]
);
RealOpenMM
rCB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
1
]
);
RealOpenMM
rCB
=
SQRT
(
rCB2
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomC
,
positionAtomB
,
deltaR
[
1
]);
RealOpenMM
rCB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
1
]);
RealOpenMM
rCB
=
SQRT
(
rCB2
);
if
(
rAB
<=
zero
||
rCB
<=
zero
){
if
(
rAB
<=
zero
||
rCB
<=
zero
)
{
return
zero
;
}
std
::
vector
<
RealOpenMM
>
pVector
(
3
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
0
],
deltaR
[
1
],
pVector
);
RealOpenMM
rp
=
AmoebaReferenceForce
::
getNorm3
(
pVector
);
if
(
rp
<
1.0e-06
){
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
0
],
deltaR
[
1
],
pVector
);
RealOpenMM
rp
=
AmoebaReferenceForce
::
getNorm3
(
pVector
);
if
(
rp
<
1.0e-06
)
{
rp
=
1.0e-06
;
}
RealOpenMM
dot
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
0
],
deltaR
[
1
]
);
RealOpenMM
dot
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
0
],
deltaR
[
1
]);
RealOpenMM
cosine
=
dot
/
(
rAB
*
rCB
);
RealOpenMM
dEdR
;
RealOpenMM
energy
=
getPrefactorsGivenAngleCosine
(
cosine
,
angle
,
angleK
,
angleCubic
,
angleQuartic
,
anglePentic
,
angleSextic
,
&
dEdR
);
RealOpenMM
energy
=
getPrefactorsGivenAngleCosine
(
cosine
,
angle
,
angleK
,
angleCubic
,
angleQuartic
,
anglePentic
,
angleSextic
,
&
dEdR
);
RealOpenMM
termA
=
dEdR
/
(
rAB2
*
rp
);
RealOpenMM
termC
=
-
dEdR
/
(
rCB2
*
rp
);
...
...
@@ -164,9 +164,9 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
deltaCrossP
[
0
].
resize
(
3
);
deltaCrossP
[
1
].
resize
(
3
);
deltaCrossP
[
2
].
resize
(
3
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
0
],
pVector
,
deltaCrossP
[
0
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
1
],
pVector
,
deltaCrossP
[
2
]
);
for
(
unsigned
int
ii
=
0
;
ii
<
3
;
ii
++
){
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
0
],
pVector
,
deltaCrossP
[
0
]);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
1
],
pVector
,
deltaCrossP
[
2
]);
for
(
unsigned
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
deltaCrossP
[
0
][
ii
]
*=
termA
;
deltaCrossP
[
2
][
ii
]
*=
termC
;
deltaCrossP
[
1
][
ii
]
=
-
1.0
f
*
(
deltaCrossP
[
0
][
ii
]
+
deltaCrossP
[
2
][
ii
]);
...
...
@@ -174,7 +174,7 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
// accumulate forces
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
)
{
forces
[
jj
][
0
]
=
deltaCrossP
[
jj
][
0
];
forces
[
jj
][
1
]
=
deltaCrossP
[
jj
][
1
];
forces
[
jj
][
2
]
=
deltaCrossP
[
jj
][
2
];
...
...
@@ -183,7 +183,7 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn( const RealVec& position
return
energy
;
}
RealOpenMM
AmoebaReferenceAngleForce
::
calculateForceAndEnergy
(
int
numAngles
,
vector
<
RealVec
>&
posData
,
RealOpenMM
AmoebaReferenceAngleForce
::
calculateForceAndEnergy
(
int
numAngles
,
vector
<
RealVec
>&
posData
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
const
std
::
vector
<
int
>&
particle3
,
...
...
@@ -202,10 +202,10 @@ RealOpenMM AmoebaReferenceAngleForce::calculateForceAndEnergy( int numAngles, ve
RealOpenMM
idealAngle
=
angle
[
ii
];
RealOpenMM
angleK
=
kQuadratic
[
ii
];
RealVec
forces
[
3
];
energy
+=
calculateAngleIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
idealAngle
,
angleK
,
angleCubic
,
angleQuartic
,
anglePentic
,
angleSextic
,
forces
);
energy
+=
calculateAngleIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
idealAngle
,
angleK
,
angleCubic
,
angleQuartic
,
anglePentic
,
angleSextic
,
forces
);
for
(
unsigned
int
jj
=
0
;
jj
<
3
;
jj
++
){
for
(
unsigned
int
jj
=
0
;
jj
<
3
;
jj
++
)
{
forceData
[
particle1Index
][
jj
]
+=
forces
[
0
][
jj
];
forceData
[
particle2Index
][
jj
]
+=
forces
[
1
][
jj
];
forceData
[
particle3Index
][
jj
]
+=
forces
[
2
][
jj
];
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.h
View file @
162d69a2
...
...
@@ -28,7 +28,7 @@
#include "RealVec.h"
#include <vector>
// ---------------------------------------------------------------------------------------
namespace
OpenMM
{
class
AmoebaReferenceAngleForce
{
...
...
@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceAngleForce
(
){};
AmoebaReferenceAngleForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~
AmoebaReferenceAngleForce
(
){};
~
AmoebaReferenceAngleForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -72,7 +72,7 @@ public:
--------------------------------------------------------------------------------------- */
RealOpenMM
calculateForceAndEnergy
(
int
numAngles
,
std
::
vector
<
OpenMM
::
RealVec
>&
posData
,
RealOpenMM
calculateForceAndEnergy
(
int
numAngles
,
std
::
vector
<
OpenMM
::
RealVec
>&
posData
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
const
std
::
vector
<
int
>&
particle3
,
...
...
@@ -82,7 +82,7 @@ public:
RealOpenMM
globalAngleQuartic
,
RealOpenMM
globalAnglePentic
,
RealOpenMM
globalAngleSextic
,
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
private:
...
...
@@ -104,10 +104,10 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM
getPrefactorsGivenAngleCosine
(
RealOpenMM
cosine
,
RealOpenMM
idealAngle
,
RealOpenMM
angleK
,
RealOpenMM
getPrefactorsGivenAngleCosine
(
RealOpenMM
cosine
,
RealOpenMM
idealAngle
,
RealOpenMM
angleK
,
RealOpenMM
angleCubic
,
RealOpenMM
angleQuartic
,
RealOpenMM
anglePentic
,
RealOpenMM
angleSextic
,
RealOpenMM
*
dEdR
)
const
;
RealOpenMM
*
dEdR
)
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -128,15 +128,15 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM
calculateAngleIxn
(
const
OpenMM
::
RealVec
&
positionAtomA
,
const
OpenMM
::
RealVec
&
positionAtomB
,
RealOpenMM
calculateAngleIxn
(
const
OpenMM
::
RealVec
&
positionAtomA
,
const
OpenMM
::
RealVec
&
positionAtomB
,
const
OpenMM
::
RealVec
&
positionAtomC
,
RealOpenMM
angle
,
RealOpenMM
angleK
,
RealOpenMM
angleCubic
,
RealOpenMM
angleQuartic
,
RealOpenMM
anglePentic
,
RealOpenMM
angleSextic
,
OpenMM
::
RealVec
*
forces
)
const
;
OpenMM
::
RealVec
*
forces
)
const
;
};
//
---------------------------------------------------------------------------------------
}
//
namespace OpenMM
#endif // _AmoebaReferenceAngleForce___
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceBondForce.cpp
View file @
162d69a2
...
...
@@ -26,7 +26,7 @@
#include "AmoebaReferenceForce.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
using
namespace
OpenMM
;
/**---------------------------------------------------------------------------------------
...
...
@@ -44,10 +44,10 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceBondForce
::
calculateBondIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
RealOpenMM
AmoebaReferenceBondForce
::
calculateBondIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
RealOpenMM
bondLength
,
RealOpenMM
bondK
,
RealOpenMM
bondCubic
,
RealOpenMM
bondQuartic
,
RealVec
*
forces
)
const
{
RealVec
*
forces
)
const
{
// ---------------------------------------------------------------------------------------
...
...
@@ -63,8 +63,8 @@ RealOpenMM AmoebaReferenceBondForce::calculateBondIxn( const RealVec& positionAt
// get deltaR, R2, and R between 2 atoms
std
::
vector
<
RealOpenMM
>
deltaR
;
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomA
,
positionAtomB
,
deltaR
);
RealOpenMM
r
=
AmoebaReferenceForce
::
getNorm3
(
deltaR
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomA
,
positionAtomB
,
deltaR
);
RealOpenMM
r
=
AmoebaReferenceForce
::
getNorm3
(
deltaR
);
// deltaIdeal = r - r_0
...
...
@@ -84,11 +84,11 @@ RealOpenMM AmoebaReferenceBondForce::calculateBondIxn( const RealVec& positionAt
forces
[
1
][
1
]
=
dEdR
*
deltaR
[
1
];
forces
[
1
][
2
]
=
dEdR
*
deltaR
[
2
];
RealOpenMM
energy
=
bondK
*
deltaIdeal2
*
(
one
+
bondCubic
*
deltaIdeal
+
bondQuartic
*
deltaIdeal2
);
RealOpenMM
energy
=
bondK
*
deltaIdeal2
*
(
one
+
bondCubic
*
deltaIdeal
+
bondQuartic
*
deltaIdeal2
);
return
energy
;
}
RealOpenMM
AmoebaReferenceBondForce
::
calculateForceAndEnergy
(
int
numBonds
,
RealOpenMM
AmoebaReferenceBondForce
::
calculateForceAndEnergy
(
int
numBonds
,
vector
<
RealVec
>&
particlePositions
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
...
...
@@ -96,20 +96,20 @@ RealOpenMM AmoebaReferenceBondForce::calculateForceAndEnergy( int numBonds,
const
std
::
vector
<
RealOpenMM
>&
kQuadratic
,
RealOpenMM
globalBondCubic
,
RealOpenMM
globalBondQuartic
,
vector
<
RealVec
>&
forceData
)
const
{
vector
<
RealVec
>&
forceData
)
const
{
RealOpenMM
energy
=
0.0
;
for
(
int
ii
=
0
;
ii
<
numBonds
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
numBonds
;
ii
++
)
{
int
particle1Index
=
particle1
[
ii
];
int
particle2Index
=
particle2
[
ii
];
RealOpenMM
bondLength
=
length
[
ii
];
RealOpenMM
bondK
=
kQuadratic
[
ii
];
RealVec
forces
[
2
];
energy
+=
calculateBondIxn
(
particlePositions
[
particle1Index
],
particlePositions
[
particle2Index
],
energy
+=
calculateBondIxn
(
particlePositions
[
particle1Index
],
particlePositions
[
particle2Index
],
bondLength
,
bondK
,
globalBondCubic
,
globalBondQuartic
,
forces
);
forces
);
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
)
{
forceData
[
particle1Index
][
jj
]
+=
forces
[
0
][
jj
];
forceData
[
particle2Index
][
jj
]
+=
forces
[
1
][
jj
];
}
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceBondForce.h
View file @
162d69a2
...
...
@@ -28,7 +28,7 @@
#include "RealVec.h"
#include <vector>
// ---------------------------------------------------------------------------------------
namespace
OpenMM
{
class
AmoebaReferenceBondForce
{
...
...
@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceBondForce
(
){};
AmoebaReferenceBondForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~
AmoebaReferenceBondForce
(
){};
~
AmoebaReferenceBondForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -69,13 +69,13 @@ public:
--------------------------------------------------------------------------------------- */
RealOpenMM
calculateForceAndEnergy
(
int
numBonds
,
std
::
vector
<
OpenMM
::
RealVec
>&
posData
,
RealOpenMM
calculateForceAndEnergy
(
int
numBonds
,
std
::
vector
<
OpenMM
::
RealVec
>&
posData
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
const
std
::
vector
<
RealOpenMM
>&
bondLength
,
const
std
::
vector
<
RealOpenMM
>&
bondK
,
RealOpenMM
bondCubic
,
RealOpenMM
bondQuartic
,
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
private:
...
...
@@ -95,13 +95,13 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM
calculateBondIxn
(
const
OpenMM
::
RealVec
&
positionAtomA
,
const
OpenMM
::
RealVec
&
positionAtomB
,
RealOpenMM
calculateBondIxn
(
const
OpenMM
::
RealVec
&
positionAtomA
,
const
OpenMM
::
RealVec
&
positionAtomB
,
RealOpenMM
bondLength
,
RealOpenMM
bondK
,
RealOpenMM
bondCubic
,
RealOpenMM
bondQuartic
,
OpenMM
::
RealVec
*
forces
)
const
;
OpenMM
::
RealVec
*
forces
)
const
;
};
//
---------------------------------------------------------------------------------------
}
//
namespace OpenMM
#endif // _AmoebaReferenceBondForce___
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceForce.cpp
View file @
162d69a2
...
...
@@ -25,7 +25,7 @@
#include "AmoebaReferenceForce.h"
#include <vector>
using
OpenMM
::
RealVec
;
using
namespace
OpenMM
;
/**---------------------------------------------------------------------------------------
...
...
@@ -37,8 +37,8 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
void
AmoebaReferenceForce
::
loadDeltaR
(
const
RealVec
&
xVector
,
const
RealVec
&
yVector
,
std
::
vector
<
RealOpenMM
>&
deltaR
){
void
AmoebaReferenceForce
::
loadDeltaR
(
const
RealVec
&
xVector
,
const
RealVec
&
yVector
,
std
::
vector
<
RealOpenMM
>&
deltaR
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -48,9 +48,9 @@ void AmoebaReferenceForce::loadDeltaR( const RealVec& xVector, const RealVec& yV
// ---------------------------------------------------------------------------------------
deltaR
.
resize
(
0
);
deltaR
.
push_back
(
yVector
[
0
]
-
xVector
[
0
]
);
deltaR
.
push_back
(
yVector
[
1
]
-
xVector
[
1
]
);
deltaR
.
push_back
(
yVector
[
2
]
-
xVector
[
2
]
);
deltaR
.
push_back
(
yVector
[
0
]
-
xVector
[
0
]);
deltaR
.
push_back
(
yVector
[
1
]
-
xVector
[
1
]);
deltaR
.
push_back
(
yVector
[
2
]
-
xVector
[
2
]);
}
/**---------------------------------------------------------------------------------------
...
...
@@ -63,7 +63,7 @@ void AmoebaReferenceForce::loadDeltaR( const RealVec& xVector, const RealVec& yV
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceForce
::
getNormSquared3
(
const
std
::
vector
<
RealOpenMM
>&
inputVector
){
RealOpenMM
AmoebaReferenceForce
::
getNormSquared3
(
const
std
::
vector
<
RealOpenMM
>&
inputVector
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -73,7 +73,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const std::vector<RealOpenMM>&
// get 3 norm
return
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]
);
return
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]);
}
/**---------------------------------------------------------------------------------------
...
...
@@ -86,7 +86,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const std::vector<RealOpenMM>&
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceForce
::
getNormSquared3
(
const
RealOpenMM
*
inputVector
){
RealOpenMM
AmoebaReferenceForce
::
getNormSquared3
(
const
RealOpenMM
*
inputVector
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -96,7 +96,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const RealOpenMM* inputVector
// get 3 norm
return
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]
);
return
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]);
}
/**---------------------------------------------------------------------------------------
...
...
@@ -109,7 +109,7 @@ RealOpenMM AmoebaReferenceForce::getNormSquared3( const RealOpenMM* inputVector
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceForce
::
getNorm3
(
const
std
::
vector
<
RealOpenMM
>&
inputVector
){
RealOpenMM
AmoebaReferenceForce
::
getNorm3
(
const
std
::
vector
<
RealOpenMM
>&
inputVector
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -119,10 +119,10 @@ RealOpenMM AmoebaReferenceForce::getNorm3( const std::vector<RealOpenMM>& inputV
// get 3 norm
return
SQRT
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]
);
return
SQRT
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]);
}
RealOpenMM
AmoebaReferenceForce
::
getNorm3
(
const
RealOpenMM
*
inputVector
){
RealOpenMM
AmoebaReferenceForce
::
getNorm3
(
const
RealOpenMM
*
inputVector
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -132,10 +132,10 @@ RealOpenMM AmoebaReferenceForce::getNorm3( const RealOpenMM* inputVector ){
// get 3 norm
return
SQRT
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]
);
return
SQRT
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]);
}
RealOpenMM
AmoebaReferenceForce
::
normalizeVector3
(
RealOpenMM
*
inputVector
){
RealOpenMM
AmoebaReferenceForce
::
normalizeVector3
(
RealOpenMM
*
inputVector
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -143,8 +143,8 @@ RealOpenMM AmoebaReferenceForce::normalizeVector3( RealOpenMM* inputVector ){
// ---------------------------------------------------------------------------------------
RealOpenMM
norm
=
SQRT
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]
);
if
(
norm
>
0.0
){
RealOpenMM
norm
=
SQRT
(
inputVector
[
0
]
*
inputVector
[
0
]
+
inputVector
[
1
]
*
inputVector
[
1
]
+
inputVector
[
2
]
*
inputVector
[
2
]);
if
(
norm
>
0.0
)
{
RealOpenMM
normI
=
1.0
/
norm
;
inputVector
[
0
]
*=
normI
;
inputVector
[
1
]
*=
normI
;
...
...
@@ -165,7 +165,7 @@ RealOpenMM AmoebaReferenceForce::normalizeVector3( RealOpenMM* inputVector ){
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceForce
::
getDotProduct3
(
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
std
::
vector
<
RealOpenMM
>&
yVector
){
RealOpenMM
AmoebaReferenceForce
::
getDotProduct3
(
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
std
::
vector
<
RealOpenMM
>&
yVector
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -189,7 +189,7 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( const std::vector<RealOpenMM>&
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceForce
::
getDotProduct3
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
){
RealOpenMM
AmoebaReferenceForce
::
getDotProduct3
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -202,7 +202,7 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( const RealOpenMM* xVector, cons
return
xVector
[
0
]
*
yVector
[
0
]
+
xVector
[
1
]
*
yVector
[
1
]
+
xVector
[
2
]
*
yVector
[
2
];
}
RealOpenMM
AmoebaReferenceForce
::
getDotProduct3
(
const
RealOpenMM
*
xVector
,
const
OpenMM
::
Vec3
&
yVector
){
RealOpenMM
AmoebaReferenceForce
::
getDotProduct3
(
const
RealOpenMM
*
xVector
,
const
OpenMM
::
Vec3
&
yVector
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -227,7 +227,7 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( const RealOpenMM* xVector, cons
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceForce
::
getDotProduct3
(
unsigned
int
vectorOffset
,
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
RealOpenMM
*
yVector
){
RealOpenMM
AmoebaReferenceForce
::
getDotProduct3
(
unsigned
int
vectorOffset
,
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
RealOpenMM
*
yVector
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -250,9 +250,9 @@ RealOpenMM AmoebaReferenceForce::getDotProduct3( unsigned int vectorOffset, cons
--------------------------------------------------------------------------------------- */
void
AmoebaReferenceForce
::
getCrossProduct
(
const
std
::
vector
<
RealOpenMM
>&
xVector
,
void
AmoebaReferenceForce
::
getCrossProduct
(
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
std
::
vector
<
RealOpenMM
>&
yVector
,
std
::
vector
<
RealOpenMM
>&
zVector
){
std
::
vector
<
RealOpenMM
>&
zVector
)
{
// ---------------------------------------------------------------------------------------
...
...
@@ -277,9 +277,9 @@ void AmoebaReferenceForce::getCrossProduct( const std::vector<RealOpenMM>& xVect
--------------------------------------------------------------------------------------- */
void
AmoebaReferenceForce
::
getCrossProduct
(
const
RealOpenMM
*
xVector
,
void
AmoebaReferenceForce
::
getCrossProduct
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
,
RealOpenMM
*
zVector
){
RealOpenMM
*
zVector
)
{
// ---------------------------------------------------------------------------------------
...
...
Prev
1
2
3
4
5
6
7
8
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