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
41cd79a5
Commit
41cd79a5
authored
Feb 20, 2015
by
peastman
Browse files
Cleaned up formatting of AMOEBA reference code
parent
25a308e6
Changes
37
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
670 additions
and
670 deletions
+670
-670
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
+31
-31
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.h
.../reference/src/SimTKReference/AmoebaReferenceAngleForce.h
+23
-23
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceBondForce.cpp
...reference/src/SimTKReference/AmoebaReferenceBondForce.cpp
+11
-11
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceBondForce.h
...s/reference/src/SimTKReference/AmoebaReferenceBondForce.h
+13
-13
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceForce.cpp
...rms/reference/src/SimTKReference/AmoebaReferenceForce.cpp
+26
-26
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceForce.h
...forms/reference/src/SimTKReference/AmoebaReferenceForce.h
+16
-16
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceGeneralizedKirkwoodForce.cpp
...imTKReference/AmoebaReferenceGeneralizedKirkwoodForce.cpp
+46
-46
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceGeneralizedKirkwoodForce.h
.../SimTKReference/AmoebaReferenceGeneralizedKirkwoodForce.h
+25
-25
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceInPlaneAngleForce.cpp
...e/src/SimTKReference/AmoebaReferenceInPlaneAngleForce.cpp
+61
-61
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceInPlaneAngleForce.h
...nce/src/SimTKReference/AmoebaReferenceInPlaneAngleForce.h
+24
-24
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceMultipoleForce.cpp
...ence/src/SimTKReference/AmoebaReferenceMultipoleForce.cpp
+3
-3
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceMultipoleForce.h
...erence/src/SimTKReference/AmoebaReferenceMultipoleForce.h
+1
-1
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceOutOfPlaneBendForce.cpp
...src/SimTKReference/AmoebaReferenceOutOfPlaneBendForce.cpp
+40
-40
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceOutOfPlaneBendForce.h
...e/src/SimTKReference/AmoebaReferenceOutOfPlaneBendForce.h
+19
-19
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferencePiTorsionForce.cpp
...ence/src/SimTKReference/AmoebaReferencePiTorsionForce.cpp
+56
-56
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferencePiTorsionForce.h
...erence/src/SimTKReference/AmoebaReferencePiTorsionForce.h
+15
-15
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceStretchBendForce.cpp
...ce/src/SimTKReference/AmoebaReferenceStretchBendForce.cpp
+31
-31
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceStretchBendForce.h
...ence/src/SimTKReference/AmoebaReferenceStretchBendForce.h
+17
-17
No files found.
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
View file @
41cd79a5
This diff is collapsed.
Click to expand it.
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
View file @
41cd79a5
...
...
@@ -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 @
41cd79a5
...
...
@@ -46,11 +46,11 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
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 @
41cd79a5
...
...
@@ -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,12 +128,12 @@ 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
;
};
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceBondForce.cpp
View file @
41cd79a5
...
...
@@ -44,10 +44,10 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
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 @
41cd79a5
...
...
@@ -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,10 +95,10 @@ 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
;
};
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceForce.cpp
View file @
41cd79a5
...
...
@@ -37,8 +37,8 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
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
)
{
// ---------------------------------------------------------------------------------------
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceForce.h
View file @
41cd79a5
...
...
@@ -41,7 +41,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceForce
(
);
AmoebaReferenceForce
();
/**---------------------------------------------------------------------------------------
...
...
@@ -49,7 +49,7 @@ public:
--------------------------------------------------------------------------------------- */
~
AmoebaReferenceForce
(
);
~
AmoebaReferenceForce
();
/**---------------------------------------------------------------------------------------
...
...
@@ -62,8 +62,8 @@ public:
--------------------------------------------------------------------------------------- */
static
void
loadDeltaR
(
const
OpenMM
::
RealVec
&
xVector
,
const
OpenMM
::
RealVec
&
yVector
,
std
::
vector
<
RealOpenMM
>&
deltaR
);
static
void
loadDeltaR
(
const
OpenMM
::
RealVec
&
xVector
,
const
OpenMM
::
RealVec
&
yVector
,
std
::
vector
<
RealOpenMM
>&
deltaR
);
/**---------------------------------------------------------------------------------------
...
...
@@ -75,8 +75,8 @@ public:
--------------------------------------------------------------------------------------- */
static
RealOpenMM
getNormSquared3
(
const
std
::
vector
<
RealOpenMM
>&
inputVector
);
static
RealOpenMM
getNormSquared3
(
const
RealOpenMM
*
inputVector
);
static
RealOpenMM
getNormSquared3
(
const
std
::
vector
<
RealOpenMM
>&
inputVector
);
static
RealOpenMM
getNormSquared3
(
const
RealOpenMM
*
inputVector
);
/**---------------------------------------------------------------------------------------
...
...
@@ -88,8 +88,8 @@ public:
--------------------------------------------------------------------------------------- */
static
RealOpenMM
getNorm3
(
const
std
::
vector
<
RealOpenMM
>&
inputVector
);
static
RealOpenMM
getNorm3
(
const
RealOpenMM
*
inputVector
);
static
RealOpenMM
getNorm3
(
const
std
::
vector
<
RealOpenMM
>&
inputVector
);
static
RealOpenMM
getNorm3
(
const
RealOpenMM
*
inputVector
);
/**---------------------------------------------------------------------------------------
...
...
@@ -101,7 +101,7 @@ public:
--------------------------------------------------------------------------------------- */
static
RealOpenMM
normalizeVector3
(
RealOpenMM
*
inputVector
);
static
RealOpenMM
normalizeVector3
(
RealOpenMM
*
inputVector
);
/**---------------------------------------------------------------------------------------
...
...
@@ -114,10 +114,10 @@ public:
--------------------------------------------------------------------------------------- */
static
RealOpenMM
getDotProduct3
(
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
std
::
vector
<
RealOpenMM
>&
yVector
);
static
RealOpenMM
getDotProduct3
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
);
static
RealOpenMM
getDotProduct3
(
const
RealOpenMM
*
xVector
,
const
OpenMM
::
Vec3
&
yVector
);
static
RealOpenMM
getDotProduct3
(
unsigned
int
vectorOffset
,
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
RealOpenMM
*
yVector
);
static
RealOpenMM
getDotProduct3
(
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
std
::
vector
<
RealOpenMM
>&
yVector
);
static
RealOpenMM
getDotProduct3
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
);
static
RealOpenMM
getDotProduct3
(
const
RealOpenMM
*
xVector
,
const
OpenMM
::
Vec3
&
yVector
);
static
RealOpenMM
getDotProduct3
(
unsigned
int
vectorOffset
,
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
RealOpenMM
*
yVector
);
/**---------------------------------------------------------------------------------------
...
...
@@ -129,10 +129,10 @@ public:
--------------------------------------------------------------------------------------- */
static
void
getCrossProduct
(
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
std
::
vector
<
RealOpenMM
>&
yVector
,
std
::
vector
<
RealOpenMM
>&
zVector
);
static
void
getCrossProduct
(
const
std
::
vector
<
RealOpenMM
>&
xVector
,
const
std
::
vector
<
RealOpenMM
>&
yVector
,
std
::
vector
<
RealOpenMM
>&
zVector
);
static
void
getCrossProduct
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
,
RealOpenMM
*
zVector
);
static
void
getCrossProduct
(
const
RealOpenMM
*
xVector
,
const
RealOpenMM
*
yVector
,
RealOpenMM
*
zVector
);
};
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceGeneralizedKirkwoodForce.cpp
View file @
41cd79a5
...
...
@@ -26,7 +26,7 @@
using
std
::
vector
;
using
namespace
OpenMM
;
AmoebaReferenceGeneralizedKirkwoodForce
::
AmoebaReferenceGeneralizedKirkwoodForce
(
)
:
_numParticles
(
0
),
AmoebaReferenceGeneralizedKirkwoodForce
::
AmoebaReferenceGeneralizedKirkwoodForce
()
:
_numParticles
(
0
),
_includeCavityTerm
(
1
),
_directPolarization
(
0
),
_soluteDielectric
(
1.0
),
...
...
@@ -37,101 +37,101 @@ AmoebaReferenceGeneralizedKirkwoodForce::AmoebaReferenceGeneralizedKirkwoodForce
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setNumParticles
(
int
numParticles
){
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setNumParticles
(
int
numParticles
)
{
_numParticles
=
numParticles
;
}
int
AmoebaReferenceGeneralizedKirkwoodForce
::
getNumParticles
(
void
)
const
{
int
AmoebaReferenceGeneralizedKirkwoodForce
::
getNumParticles
()
const
{
return
_numParticles
;
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setIncludeCavityTerm
(
int
includeCavityTerm
){
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setIncludeCavityTerm
(
int
includeCavityTerm
)
{
_includeCavityTerm
=
includeCavityTerm
;
}
int
AmoebaReferenceGeneralizedKirkwoodForce
::
getIncludeCavityTerm
(
void
)
const
{
int
AmoebaReferenceGeneralizedKirkwoodForce
::
getIncludeCavityTerm
()
const
{
return
_includeCavityTerm
;
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setDirectPolarization
(
int
directPolarization
){
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setDirectPolarization
(
int
directPolarization
)
{
_directPolarization
=
directPolarization
;
}
int
AmoebaReferenceGeneralizedKirkwoodForce
::
getDirectPolarization
(
void
)
const
{
int
AmoebaReferenceGeneralizedKirkwoodForce
::
getDirectPolarization
()
const
{
return
_directPolarization
;
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setSoluteDielectric
(
RealOpenMM
soluteDielectric
){
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setSoluteDielectric
(
RealOpenMM
soluteDielectric
)
{
_soluteDielectric
=
soluteDielectric
;
}
RealOpenMM
AmoebaReferenceGeneralizedKirkwoodForce
::
getSoluteDielectric
(
void
)
const
{
RealOpenMM
AmoebaReferenceGeneralizedKirkwoodForce
::
getSoluteDielectric
()
const
{
return
_soluteDielectric
;
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setSolventDielectric
(
RealOpenMM
solventDielectric
){
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setSolventDielectric
(
RealOpenMM
solventDielectric
)
{
_solventDielectric
=
solventDielectric
;
}
RealOpenMM
AmoebaReferenceGeneralizedKirkwoodForce
::
getSolventDielectric
(
void
)
const
{
RealOpenMM
AmoebaReferenceGeneralizedKirkwoodForce
::
getSolventDielectric
()
const
{
return
_solventDielectric
;
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setDielectricOffset
(
RealOpenMM
dielectricOffset
){
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setDielectricOffset
(
RealOpenMM
dielectricOffset
)
{
_dielectricOffset
=
dielectricOffset
;
}
RealOpenMM
AmoebaReferenceGeneralizedKirkwoodForce
::
getDielectricOffset
(
void
)
const
{
RealOpenMM
AmoebaReferenceGeneralizedKirkwoodForce
::
getDielectricOffset
()
const
{
return
_dielectricOffset
;
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setProbeRadius
(
RealOpenMM
probeRadius
){
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setProbeRadius
(
RealOpenMM
probeRadius
)
{
_probeRadius
=
probeRadius
;
}
RealOpenMM
AmoebaReferenceGeneralizedKirkwoodForce
::
getProbeRadius
(
void
)
const
{
RealOpenMM
AmoebaReferenceGeneralizedKirkwoodForce
::
getProbeRadius
()
const
{
return
_probeRadius
;
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setSurfaceAreaFactor
(
RealOpenMM
surfaceAreaFactor
){
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setSurfaceAreaFactor
(
RealOpenMM
surfaceAreaFactor
)
{
_surfaceAreaFactor
=
surfaceAreaFactor
;
}
RealOpenMM
AmoebaReferenceGeneralizedKirkwoodForce
::
getSurfaceAreaFactor
(
void
)
const
{
RealOpenMM
AmoebaReferenceGeneralizedKirkwoodForce
::
getSurfaceAreaFactor
()
const
{
return
_surfaceAreaFactor
;
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setAtomicRadii
(
const
vector
<
RealOpenMM
>&
atomicRadii
){
_atomicRadii
.
resize
(
atomicRadii
.
size
()
);
copy
(
atomicRadii
.
begin
(),
atomicRadii
.
end
(),
_atomicRadii
.
begin
()
);
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setAtomicRadii
(
const
vector
<
RealOpenMM
>&
atomicRadii
)
{
_atomicRadii
.
resize
(
atomicRadii
.
size
());
copy
(
atomicRadii
.
begin
(),
atomicRadii
.
end
(),
_atomicRadii
.
begin
());
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
getAtomicRadii
(
vector
<
RealOpenMM
>&
atomicRadii
)
const
{
atomicRadii
.
resize
(
_atomicRadii
.
size
()
);
copy
(
_atomicRadii
.
begin
(),
_atomicRadii
.
end
(),
atomicRadii
.
begin
()
);
void
AmoebaReferenceGeneralizedKirkwoodForce
::
getAtomicRadii
(
vector
<
RealOpenMM
>&
atomicRadii
)
const
{
atomicRadii
.
resize
(
_atomicRadii
.
size
());
copy
(
_atomicRadii
.
begin
(),
_atomicRadii
.
end
(),
atomicRadii
.
begin
());
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setScaleFactors
(
const
vector
<
RealOpenMM
>&
scaleFactors
){
_scaleFactors
.
resize
(
scaleFactors
.
size
()
);
copy
(
scaleFactors
.
begin
(),
scaleFactors
.
end
(),
_scaleFactors
.
begin
()
);
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setScaleFactors
(
const
vector
<
RealOpenMM
>&
scaleFactors
)
{
_scaleFactors
.
resize
(
scaleFactors
.
size
());
copy
(
scaleFactors
.
begin
(),
scaleFactors
.
end
(),
_scaleFactors
.
begin
());
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
getScaleFactors
(
vector
<
RealOpenMM
>&
scaleFactors
)
const
{
scaleFactors
.
resize
(
_scaleFactors
.
size
()
);
copy
(
_scaleFactors
.
begin
(),
_scaleFactors
.
end
(),
scaleFactors
.
begin
()
);
void
AmoebaReferenceGeneralizedKirkwoodForce
::
getScaleFactors
(
vector
<
RealOpenMM
>&
scaleFactors
)
const
{
scaleFactors
.
resize
(
_scaleFactors
.
size
());
copy
(
_scaleFactors
.
begin
(),
_scaleFactors
.
end
(),
scaleFactors
.
begin
());
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setCharges
(
const
vector
<
RealOpenMM
>&
charges
){
_charges
.
resize
(
charges
.
size
()
);
copy
(
charges
.
begin
(),
charges
.
end
(),
_charges
.
begin
()
);
void
AmoebaReferenceGeneralizedKirkwoodForce
::
setCharges
(
const
vector
<
RealOpenMM
>&
charges
)
{
_charges
.
resize
(
charges
.
size
());
copy
(
charges
.
begin
(),
charges
.
end
(),
_charges
.
begin
());
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
getGrycukBornRadii
(
vector
<
RealOpenMM
>&
bornRadii
)
const
{
bornRadii
.
resize
(
_bornRadii
.
size
()
);
copy
(
_bornRadii
.
begin
(),
_bornRadii
.
end
(),
bornRadii
.
begin
()
);
void
AmoebaReferenceGeneralizedKirkwoodForce
::
getGrycukBornRadii
(
vector
<
RealOpenMM
>&
bornRadii
)
const
{
bornRadii
.
resize
(
_bornRadii
.
size
());
copy
(
_bornRadii
.
begin
(),
_bornRadii
.
end
(),
bornRadii
.
begin
());
}
void
AmoebaReferenceGeneralizedKirkwoodForce
::
calculateGrycukBornRadii
(
const
vector
<
RealVec
>&
particlePositions
)
{
void
AmoebaReferenceGeneralizedKirkwoodForce
::
calculateGrycukBornRadii
(
const
vector
<
RealVec
>&
particlePositions
)
{
const
RealOpenMM
zero
=
0.0
;
const
RealOpenMM
one
=
1.0
;
...
...
@@ -142,30 +142,30 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve
const
RealOpenMM
oneThird
=
1.0
/
3.0
;
const
RealOpenMM
bigRadius
=
1000.0
;
_bornRadii
.
resize
(
_numParticles
);
for
(
unsigned
int
ii
=
0
;
ii
<
_numParticles
;
ii
++
){
_bornRadii
.
resize
(
_numParticles
);
for
(
unsigned
int
ii
=
0
;
ii
<
_numParticles
;
ii
++
)
{
if
(
_atomicRadii
[
ii
]
<=
zero
){
if
(
_atomicRadii
[
ii
]
<=
zero
)
{
_bornRadii
[
ii
]
=
bigRadius
;
continue
;
}
RealOpenMM
bornSum
=
zero
;
for
(
unsigned
int
jj
=
0
;
jj
<
_numParticles
;
jj
++
){
for
(
unsigned
int
jj
=
0
;
jj
<
_numParticles
;
jj
++
)
{
if
(
ii
==
jj
||
_atomicRadii
[
jj
]
<
zero
)
continue
;
if
(
ii
==
jj
||
_atomicRadii
[
jj
]
<
zero
)
continue
;
RealOpenMM
xr
=
particlePositions
[
jj
][
0
]
-
particlePositions
[
ii
][
0
];
RealOpenMM
yr
=
particlePositions
[
jj
][
1
]
-
particlePositions
[
ii
][
1
];
RealOpenMM
zr
=
particlePositions
[
jj
][
2
]
-
particlePositions
[
ii
][
2
];
RealOpenMM
r2
=
xr
*
xr
+
yr
*
yr
+
zr
*
zr
;
RealOpenMM
r
=
SQRT
(
r2
);
RealOpenMM
r
=
SQRT
(
r2
);
RealOpenMM
sk
=
_atomicRadii
[
jj
]
*
_scaleFactors
[
jj
];
RealOpenMM
sk2
=
sk
*
sk
;
if
(
(
_atomicRadii
[
ii
]
+
r
)
<
sk
){
if
(
(
_atomicRadii
[
ii
]
+
r
)
<
sk
)
{
RealOpenMM
lik
=
_atomicRadii
[
ii
];
RealOpenMM
uik
=
sk
-
r
;
RealOpenMM
lik3
=
lik
*
lik
*
lik
;
...
...
@@ -175,9 +175,9 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve
RealOpenMM
uik
=
r
+
sk
;
RealOpenMM
lik
;
if
(
(
_atomicRadii
[
ii
]
+
r
)
<
sk
){
if
(
(
_atomicRadii
[
ii
]
+
r
)
<
sk
)
{
lik
=
sk
-
r
;
}
else
if
(
r
<
(
_atomicRadii
[
ii
]
+
sk
)
){
}
else
if
(
r
<
(
_atomicRadii
[
ii
]
+
sk
))
{
lik
=
_atomicRadii
[
ii
];
}
else
{
lik
=
r
-
sk
;
...
...
@@ -198,7 +198,7 @@ void AmoebaReferenceGeneralizedKirkwoodForce::calculateGrycukBornRadii( const ve
}
bornSum
=
one
/
(
_atomicRadii
[
ii
]
*
_atomicRadii
[
ii
]
*
_atomicRadii
[
ii
])
-
bornSum
;
_bornRadii
[
ii
]
=
(
bornSum
<=
zero
)
?
bigRadius
:
POW
(
bornSum
,
-
oneThird
);
_bornRadii
[
ii
]
=
(
bornSum
<=
zero
)
?
bigRadius
:
POW
(
bornSum
,
-
oneThird
);
}
return
;
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceGeneralizedKirkwoodForce.h
View file @
41cd79a5
...
...
@@ -41,13 +41,13 @@ public:
* Constructor
*
*/
AmoebaReferenceGeneralizedKirkwoodForce
(
);
AmoebaReferenceGeneralizedKirkwoodForce
();
/**
* Destructor
*
*/
~
AmoebaReferenceGeneralizedKirkwoodForce
(
){};
~
AmoebaReferenceGeneralizedKirkwoodForce
()
{};
/**
* Get number of particles
...
...
@@ -55,7 +55,7 @@ public:
* @return numParticles
*
*/
int
getNumParticles
(
void
)
const
;
int
getNumParticles
()
const
;
/**
* Set numParticles
...
...
@@ -63,7 +63,7 @@ public:
* @param numParticles
*
*/
void
setNumParticles
(
int
numParticles
);
void
setNumParticles
(
int
numParticles
);
/**
* Get includeCavityTerm flag
...
...
@@ -71,7 +71,7 @@ public:
* @return includeCavityTerm
*
*/
int
getIncludeCavityTerm
(
void
)
const
;
int
getIncludeCavityTerm
()
const
;
/**
* Set includeCavityTerm flag
...
...
@@ -79,7 +79,7 @@ public:
* @param includeCavityTerm flag indicating whether surface area term is to be included
*
*/
void
setIncludeCavityTerm
(
int
includeCavityTerm
);
void
setIncludeCavityTerm
(
int
includeCavityTerm
);
/**
* Get directPolarization flag
...
...
@@ -87,21 +87,21 @@ public:
* @return directPolarization
*
*/
int
getDirectPolarization
(
void
)
const
;
int
getDirectPolarization
()
const
;
/**
* Set directPolarization flag
*
* @param directPolarization nonzero if direct as opposed to mutual polarization
*/
void
setDirectPolarization
(
int
directPolarization
);
void
setDirectPolarization
(
int
directPolarization
);
/**
* Get solute dielectric
*
* @return soluteDielectric
*/
RealOpenMM
getSoluteDielectric
(
void
)
const
;
RealOpenMM
getSoluteDielectric
()
const
;
/**
* Set solute dielectric
...
...
@@ -109,7 +109,7 @@ public:
* @param soluteDielectric solute dielectric
*
*/
void
setSoluteDielectric
(
RealOpenMM
soluteDielectric
);
void
setSoluteDielectric
(
RealOpenMM
soluteDielectric
);
/**
* Get solvent dielectric
...
...
@@ -117,7 +117,7 @@ public:
* @return solventDielectric
*
*/
RealOpenMM
getSolventDielectric
(
void
)
const
;
RealOpenMM
getSolventDielectric
()
const
;
/**
* Set solvent dielectric
...
...
@@ -125,7 +125,7 @@ public:
* @param solventDielectric solvent dielectric
*
*/
void
setSolventDielectric
(
RealOpenMM
solventDielectric
);
void
setSolventDielectric
(
RealOpenMM
solventDielectric
);
/**
* Get dielectric offset
...
...
@@ -133,7 +133,7 @@ public:
* @return dielectricOffset
*
*/
RealOpenMM
getDielectricOffset
(
void
)
const
;
RealOpenMM
getDielectricOffset
()
const
;
/**
* Set dielectric offset
...
...
@@ -141,7 +141,7 @@ public:
* @param dielectricOffset dielectric offset
*
*/
void
setDielectricOffset
(
RealOpenMM
dielectricOffset
);
void
setDielectricOffset
(
RealOpenMM
dielectricOffset
);
/**
* Get probeRadius
...
...
@@ -149,7 +149,7 @@ public:
* @return probeRadius
*
*/
RealOpenMM
getProbeRadius
(
void
)
const
;
RealOpenMM
getProbeRadius
()
const
;
/**
* Set probe radius
...
...
@@ -157,7 +157,7 @@ public:
* @param probeRadius probe radiue
*
*/
void
setProbeRadius
(
RealOpenMM
probeRadius
);
void
setProbeRadius
(
RealOpenMM
probeRadius
);
/**
* Get surfaceAreaFactor
...
...
@@ -165,7 +165,7 @@ public:
* @return surfaceAreaFactor
*
*/
RealOpenMM
getSurfaceAreaFactor
(
void
)
const
;
RealOpenMM
getSurfaceAreaFactor
()
const
;
/**
* Set surface area factor
...
...
@@ -173,7 +173,7 @@ public:
* @param surfaceAreaFactor surface area factor
*
*/
void
setSurfaceAreaFactor
(
RealOpenMM
surfaceAreaFactor
);
void
setSurfaceAreaFactor
(
RealOpenMM
surfaceAreaFactor
);
/**
* Set atomic radii
...
...
@@ -181,7 +181,7 @@ public:
* @param atomicRadii input vector of atomic radii
*
*/
void
setAtomicRadii
(
const
vector
<
RealOpenMM
>&
atomicRadii
);
void
setAtomicRadii
(
const
vector
<
RealOpenMM
>&
atomicRadii
);
/**
* Get atomic radii
...
...
@@ -189,7 +189,7 @@ public:
* @param atomicRadii output vector of atomic radii
*
*/
void
getAtomicRadii
(
vector
<
RealOpenMM
>&
atomicRadii
)
const
;
void
getAtomicRadii
(
vector
<
RealOpenMM
>&
atomicRadii
)
const
;
/**
* Set scale factors
...
...
@@ -197,7 +197,7 @@ public:
* @param scaleFactors input vector of scale factors
*
*/
void
setScaleFactors
(
const
vector
<
RealOpenMM
>&
scaleFactors
);
void
setScaleFactors
(
const
vector
<
RealOpenMM
>&
scaleFactors
);
/**
* Get scale factors
...
...
@@ -205,7 +205,7 @@ public:
* @param scaleFactors output vector of scale factors
*
*/
void
getScaleFactors
(
vector
<
RealOpenMM
>&
scaleFactors
)
const
;
void
getScaleFactors
(
vector
<
RealOpenMM
>&
scaleFactors
)
const
;
/**
* Set charges
...
...
@@ -213,7 +213,7 @@ public:
* @param charges input vector of charges
*
*/
void
setCharges
(
const
vector
<
RealOpenMM
>&
charges
);
void
setCharges
(
const
vector
<
RealOpenMM
>&
charges
);
/**
* Calculate Grycuk Born radii
...
...
@@ -221,7 +221,7 @@ public:
* @param particlePositions particle positions
*
*/
void
calculateGrycukBornRadii
(
const
vector
<
RealVec
>&
particlePositions
);
void
calculateGrycukBornRadii
(
const
vector
<
RealVec
>&
particlePositions
);
/**
* Get Grycik Born radii (must have called calculateGrycukBornRadii())
...
...
@@ -229,7 +229,7 @@ public:
* @param bornRadii vector of Born radii
*
*/
void
getGrycukBornRadii
(
vector
<
RealOpenMM
>&
bornRadii
)
const
;
void
getGrycukBornRadii
(
vector
<
RealOpenMM
>&
bornRadii
)
const
;
private:
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceInPlaneAngleForce.cpp
View file @
41cd79a5
...
...
@@ -46,11 +46,11 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceInPlaneAngleForce
::
getPrefactorsGivenAngleCosine
(
RealOpenMM
cosine
,
RealOpenMM
AmoebaReferenceInPlaneAngleForce
::
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 AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real
// ---------------------------------------------------------------------------------------
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 AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real
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
;
...
...
@@ -114,12 +114,12 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::getPrefactorsGivenAngleCosine( Real
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceInPlaneAngleForce
::
calculateAngleIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
RealOpenMM
AmoebaReferenceInPlaneAngleForce
::
calculateAngleIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
const
RealVec
&
positionAtomC
,
const
RealVec
&
positionAtomD
,
RealOpenMM
angle
,
RealOpenMM
angleK
,
RealOpenMM
angleCubic
,
RealOpenMM
angleQuartic
,
RealOpenMM
anglePentic
,
RealOpenMM
angleSextic
,
RealVec
*
forces
)
const
{
RealVec
*
forces
)
const
{
// ---------------------------------------------------------------------------------------
...
...
@@ -140,80 +140,80 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p
enum
{
AD
,
BD
,
CD
,
T
,
AP
,
P
,
CP
,
M
,
APxM
,
CPxM
,
ADxBD
,
BDxCD
,
TxCD
,
ADxT
,
dBxAD
,
CDxdB
,
LastDeltaAtomIndex
};
std
::
vector
<
RealOpenMM
>
deltaR
[
LastDeltaAtomIndex
];
for
(
int
ii
=
0
;
ii
<
LastDeltaAtomIndex
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
LastDeltaAtomIndex
;
ii
++
)
{
deltaR
[
ii
].
resize
(
3
);
}
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomA
,
deltaR
[
AD
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomB
,
deltaR
[
BD
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomC
,
deltaR
[
CD
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomA
,
deltaR
[
AD
]);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomB
,
deltaR
[
BD
]);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomC
,
deltaR
[
CD
]);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AD
],
deltaR
[
CD
],
deltaR
[
T
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AD
],
deltaR
[
CD
],
deltaR
[
T
]);
RealOpenMM
rT2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
T
]
);
RealOpenMM
delta
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
T
],
deltaR
[
BD
]
)
/
rT2
;
RealOpenMM
rT2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
T
]);
RealOpenMM
delta
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
T
],
deltaR
[
BD
])
/
rT2
;
delta
*=
-
one
;
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
deltaR
[
P
][
ii
]
=
positionAtomB
[
ii
]
+
deltaR
[
T
][
ii
]
*
delta
;
deltaR
[
AP
][
ii
]
=
positionAtomA
[
ii
]
-
deltaR
[
P
][
ii
];
deltaR
[
CP
][
ii
]
=
positionAtomC
[
ii
]
-
deltaR
[
P
][
ii
];
}
RealOpenMM
rAp2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
AP
]
);
RealOpenMM
rCp2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
CP
]
);
if
(
rAp2
<=
zero
&&
rCp2
<=
zero
){
RealOpenMM
rAp2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
AP
]);
RealOpenMM
rCp2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
CP
]);
if
(
rAp2
<=
zero
&&
rCp2
<=
zero
)
{
return
zero
;
}
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CP
],
deltaR
[
AP
],
deltaR
[
M
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CP
],
deltaR
[
AP
],
deltaR
[
M
]);
RealOpenMM
rm
=
AmoebaReferenceForce
::
getNorm3
(
deltaR
[
M
]
);
if
(
rm
<
1.0e-06
){
RealOpenMM
rm
=
AmoebaReferenceForce
::
getNorm3
(
deltaR
[
M
]);
if
(
rm
<
1.0e-06
)
{
rm
=
1.0e-06
;
}
RealOpenMM
dot
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
AP
],
deltaR
[
CP
]
);
RealOpenMM
cosine
=
dot
/
SQRT
(
rAp2
*
rCp2
);
RealOpenMM
dot
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
AP
],
deltaR
[
CP
]);
RealOpenMM
cosine
=
dot
/
SQRT
(
rAp2
*
rCp2
);
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
/
(
rAp2
*
rm
);
RealOpenMM
termC
=
dEdR
/
(
rCp2
*
rm
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AP
],
deltaR
[
M
],
deltaR
[
APxM
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CP
],
deltaR
[
M
],
deltaR
[
CPxM
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AP
],
deltaR
[
M
],
deltaR
[
APxM
]);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CP
],
deltaR
[
M
],
deltaR
[
CPxM
]);
// forces will be gathered here
enum
{
dA
,
dB
,
dC
,
dD
,
LastDIndex
};
std
::
vector
<
RealOpenMM
>
forceTerm
[
LastDIndex
];
for
(
int
ii
=
0
;
ii
<
LastDIndex
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
LastDIndex
;
ii
++
)
{
forceTerm
[
ii
].
resize
(
3
);
}
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
forceTerm
[
dA
][
ii
]
=
deltaR
[
APxM
][
ii
]
*
termA
;
forceTerm
[
dC
][
ii
]
=
deltaR
[
CPxM
][
ii
]
*
termC
;
forceTerm
[
dB
][
ii
]
=
-
one
*
(
forceTerm
[
dA
][
ii
]
+
forceTerm
[
dC
][
ii
]
);
forceTerm
[
dB
][
ii
]
=
-
one
*
(
forceTerm
[
dA
][
ii
]
+
forceTerm
[
dC
][
ii
]);
}
RealOpenMM
pTrT2
=
AmoebaReferenceForce
::
getDotProduct3
(
forceTerm
[
dB
],
deltaR
[
T
]
);
RealOpenMM
pTrT2
=
AmoebaReferenceForce
::
getDotProduct3
(
forceTerm
[
dB
],
deltaR
[
T
]);
pTrT2
/=
rT2
;
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CD
],
forceTerm
[
dB
],
deltaR
[
CDxdB
]
);
AmoebaReferenceForce
::
getCrossProduct
(
forceTerm
[
dB
],
deltaR
[
AD
],
deltaR
[
dBxAD
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CD
],
forceTerm
[
dB
],
deltaR
[
CDxdB
]);
AmoebaReferenceForce
::
getCrossProduct
(
forceTerm
[
dB
],
deltaR
[
AD
],
deltaR
[
dBxAD
]);
if
(
FABS
(
pTrT2
)
>
1.0e-08
){
if
(
FABS
(
pTrT2
)
>
1.0e-08
)
{
RealOpenMM
delta2
=
delta
*
two
;
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
BD
],
deltaR
[
CD
],
deltaR
[
BDxCD
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
T
],
deltaR
[
CD
],
deltaR
[
TxCD
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AD
],
deltaR
[
BD
],
deltaR
[
ADxBD
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AD
],
deltaR
[
T
],
deltaR
[
ADxT
]
);
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
BD
],
deltaR
[
CD
],
deltaR
[
BDxCD
]);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
T
],
deltaR
[
CD
],
deltaR
[
TxCD
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AD
],
deltaR
[
BD
],
deltaR
[
ADxBD
]);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AD
],
deltaR
[
T
],
deltaR
[
ADxT
]
);
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
RealOpenMM
term
=
deltaR
[
BDxCD
][
ii
]
+
delta2
*
deltaR
[
TxCD
][
ii
];
forceTerm
[
dA
][
ii
]
+=
delta
*
deltaR
[
CDxdB
][
ii
]
+
term
*
pTrT2
;
...
...
@@ -221,21 +221,21 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p
term
=
deltaR
[
ADxBD
][
ii
]
+
delta2
*
deltaR
[
ADxT
][
ii
];
forceTerm
[
dC
][
ii
]
+=
delta
*
deltaR
[
dBxAD
][
ii
]
+
term
*
pTrT2
;
forceTerm
[
dD
][
ii
]
=
-
(
forceTerm
[
dA
][
ii
]
+
forceTerm
[
dB
][
ii
]
+
forceTerm
[
dC
][
ii
]
);
forceTerm
[
dD
][
ii
]
=
-
(
forceTerm
[
dA
][
ii
]
+
forceTerm
[
dB
][
ii
]
+
forceTerm
[
dC
][
ii
]);
}
}
else
{
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
forceTerm
[
dA
][
ii
]
+=
delta
*
deltaR
[
CDxdB
][
ii
];
forceTerm
[
dC
][
ii
]
+=
delta
*
deltaR
[
dBxAD
][
ii
];
forceTerm
[
dD
][
ii
]
=
-
(
forceTerm
[
dA
][
ii
]
+
forceTerm
[
dB
][
ii
]
+
forceTerm
[
dC
][
ii
]
);
forceTerm
[
dD
][
ii
]
=
-
(
forceTerm
[
dA
][
ii
]
+
forceTerm
[
dB
][
ii
]
+
forceTerm
[
dC
][
ii
]);
}
}
// accumulate forces
for
(
int
jj
=
0
;
jj
<
4
;
jj
++
){
for
(
int
jj
=
0
;
jj
<
4
;
jj
++
)
{
forces
[
jj
][
0
]
=
forceTerm
[
jj
][
0
];
forces
[
jj
][
1
]
=
forceTerm
[
jj
][
1
];
forces
[
jj
][
2
]
=
forceTerm
[
jj
][
2
];
...
...
@@ -245,7 +245,7 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateAngleIxn( const RealVec& p
}
RealOpenMM
AmoebaReferenceInPlaneAngleForce
::
calculateForceAndEnergy
(
int
numAngles
,
vector
<
RealVec
>&
posData
,
RealOpenMM
AmoebaReferenceInPlaneAngleForce
::
calculateForceAndEnergy
(
int
numAngles
,
vector
<
RealVec
>&
posData
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
const
std
::
vector
<
int
>&
particle3
,
...
...
@@ -266,12 +266,12 @@ RealOpenMM AmoebaReferenceInPlaneAngleForce::calculateForceAndEnergy( int numAng
RealOpenMM
idealAngle
=
angle
[
ii
];
RealOpenMM
angleK
=
kQuadratic
[
ii
];
RealVec
forces
[
4
];
energy
+=
calculateAngleIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
posData
[
particle4Index
],
idealAngle
,
angleK
,
angleCubic
,
angleQuartic
,
anglePentic
,
angleSextic
,
forces
);
energy
+=
calculateAngleIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
posData
[
particle4Index
],
idealAngle
,
angleK
,
angleCubic
,
angleQuartic
,
anglePentic
,
angleSextic
,
forces
);
// accumulate 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
];
forceData
[
particle3Index
][
jj
]
-=
forces
[
2
][
jj
];
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceInPlaneAngleForce.h
View file @
41cd79a5
...
...
@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceInPlaneAngleForce
(
){};
AmoebaReferenceInPlaneAngleForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~
AmoebaReferenceInPlaneAngleForce
(
){};
~
AmoebaReferenceInPlaneAngleForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -73,7 +73,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
,
...
...
@@ -84,7 +84,7 @@ public:
RealOpenMM
globalAngleQuartic
,
RealOpenMM
globalAnglePentic
,
RealOpenMM
globalAngleSextic
,
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
private:
...
...
@@ -106,10 +106,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
;
/**---------------------------------------------------------------------------------------
...
...
@@ -131,12 +131,12 @@ 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
,
const
OpenMM
::
RealVec
&
positionAtomD
,
RealOpenMM
angle
,
RealOpenMM
angleK
,
RealOpenMM
angleCubic
,
RealOpenMM
angleQuartic
,
RealOpenMM
anglePentic
,
RealOpenMM
angleSextic
,
OpenMM
::
RealVec
*
forces
)
const
;
OpenMM
::
RealVec
*
forces
)
const
;
};
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceMultipoleForce.cpp
View file @
41cd79a5
...
...
@@ -789,7 +789,7 @@ void AmoebaReferenceMultipoleForce::convergeInduceDipolesBySOR(const vector<Mult
// (2) iterations == max iterations or
// (3) convergence factor (spsilon) increases
while(!done) {
while
(!done) {
RealOpenMM epsilon = updateInducedDipoleFields(particleData, updateInducedDipoleField);
epsilon = _polarSOR*_debye*SQRT(epsilon/(static_cast<RealOpenMM>(_numParticles)));
...
...
@@ -1868,7 +1868,7 @@ void AmoebaReferenceMultipoleForce::calculateElectrostaticPotential(const vector
for (unsigned int ii = 0; ii < _numParticles; ii++) {
for (unsigned int jj = 0; jj < grid.size(); jj++) {
potential[jj] += calculateElectrostaticPotentialForParticleGridPoint(particleData[ii], grid[jj]
);
potential[jj] += calculateElectrostaticPotentialForParticleGridPoint(particleData[ii], grid[jj]);
}
}
...
...
@@ -4947,7 +4947,7 @@ void AmoebaReferencePmeMultipoleForce::calculateFixedMultipoleField(const vector
/**
* This is called from computeBsplines(). It calculates the spline coefficients for a single atom along a single axis.
*/
void AmoebaReferencePmeMultipoleForce::computeBSplinePoint(vector<RealOpenMM4>& thetai, RealOpenMM w
)
void AmoebaReferencePmeMultipoleForce::computeBSplinePoint(vector<RealOpenMM4>& thetai, RealOpenMM w)
{
RealOpenMM array[AMOEBA_PME_ORDER*AMOEBA_PME_ORDER];
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceMultipoleForce.h
View file @
41cd79a5
...
...
@@ -354,7 +354,7 @@ public:
* Destructor
*
*/
virtual
~
AmoebaReferenceMultipoleForce
(){};
virtual
~
AmoebaReferenceMultipoleForce
()
{};
/**
* Get nonbonded method.
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceOutOfPlaneBendForce.cpp
View file @
41cd79a5
...
...
@@ -48,12 +48,12 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceOutOfPlaneBendForce
::
calculateOutOfPlaneBendIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
RealOpenMM
AmoebaReferenceOutOfPlaneBendForce
::
calculateOutOfPlaneBendIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
const
RealVec
&
positionAtomC
,
const
RealVec
&
positionAtomD
,
RealOpenMM
angleK
,
RealOpenMM
angleCubic
,
RealOpenMM
angleQuartic
,
RealOpenMM
anglePentic
,
RealOpenMM
angleSextic
,
RealVec
*
forces
)
const
{
RealVec
*
forces
)
const
{
// ---------------------------------------------------------------------------------------
...
...
@@ -76,34 +76,34 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
// and various intermediate terms
std
::
vector
<
RealOpenMM
>
deltaR
[
LastDeltaIndex
];
for
(
int
ii
=
0
;
ii
<
LastDeltaIndex
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
LastDeltaIndex
;
ii
++
)
{
deltaR
[
ii
].
resize
(
3
);
}
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomB
,
positionAtomA
,
deltaR
[
AB
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomB
,
positionAtomC
,
deltaR
[
CB
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomB
,
positionAtomD
,
deltaR
[
DB
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomA
,
deltaR
[
AD
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomC
,
deltaR
[
CD
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomB
,
positionAtomA
,
deltaR
[
AB
]);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomB
,
positionAtomC
,
deltaR
[
CB
]);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomB
,
positionAtomD
,
deltaR
[
DB
]);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomA
,
deltaR
[
AD
]);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomC
,
deltaR
[
CD
]);
RealOpenMM
rDB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
DB
]
);
RealOpenMM
rAD2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
AD
]
);
RealOpenMM
rCD2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
CD
]
);
RealOpenMM
rDB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
DB
]);
RealOpenMM
rAD2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
AD
]);
RealOpenMM
rCD2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
CD
]);
std
::
vector
<
RealOpenMM
>
tempVector
(
3
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CB
],
deltaR
[
DB
],
tempVector
);
RealOpenMM
eE
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
AB
],
tempVector
);
RealOpenMM
dot
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
AD
],
deltaR
[
CD
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CB
],
deltaR
[
DB
],
tempVector
);
RealOpenMM
eE
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
AB
],
tempVector
);
RealOpenMM
dot
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
AD
],
deltaR
[
CD
]);
RealOpenMM
cc
=
rAD2
*
rCD2
-
dot
*
dot
;
if
(
rDB2
<=
zero
||
cc
==
zero
){
if
(
rDB2
<=
zero
||
cc
==
zero
)
{
return
zero
;
}
RealOpenMM
bkk2
=
rDB2
-
eE
*
eE
/
cc
;
RealOpenMM
cosine
=
SQRT
(
bkk2
/
rDB2
);
RealOpenMM
angle
;
if
(
cosine
>=
one
){
if
(
cosine
>=
one
)
{
angle
=
zero
;
}
else
if
(
cosine
<=
-
one
){
}
else
if
(
cosine
<=
-
one
)
{
angle
=
PI_M
;
}
else
{
angle
=
RADIAN
*
ACOS
(
cosine
);
...
...
@@ -122,7 +122,7 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
dEdDt
*=
angleK
*
dt
*
RADIAN
;
RealOpenMM
dEdCos
=
dEdDt
/
SQRT
(
cc
*
bkk2
);
if
(
eE
>
zero
){
if
(
eE
>
zero
)
{
dEdCos
*=
-
one
;
}
...
...
@@ -131,20 +131,20 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
std
::
vector
<
RealOpenMM
>
dccd
[
LastAtomIndex
];
std
::
vector
<
RealOpenMM
>
deed
[
LastAtomIndex
];
std
::
vector
<
RealOpenMM
>
subForce
[
LastAtomIndex
];
for
(
int
ii
=
0
;
ii
<
LastAtomIndex
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
LastAtomIndex
;
ii
++
)
{
dccd
[
ii
].
resize
(
3
);
deed
[
ii
].
resize
(
3
);
subForce
[
ii
].
resize
(
3
);
}
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
dccd
[
A
][
ii
]
=
(
deltaR
[
AD
][
ii
]
*
rCD2
-
deltaR
[
CD
][
ii
]
*
dot
)
*
term
;
dccd
[
C
][
ii
]
=
(
deltaR
[
CD
][
ii
]
*
rAD2
-
deltaR
[
AD
][
ii
]
*
dot
)
*
term
;
dccd
[
D
][
ii
]
=
-
one
*
(
dccd
[
A
][
ii
]
+
dccd
[
C
][
ii
]);
}
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
DB
],
deltaR
[
CB
],
deed
[
A
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AB
],
deltaR
[
DB
],
deed
[
C
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CB
],
deltaR
[
AB
],
deed
[
D
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
DB
],
deltaR
[
CB
],
deed
[
A
]);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AB
],
deltaR
[
DB
],
deed
[
C
]);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CB
],
deltaR
[
AB
],
deed
[
D
]);
term
=
eE
/
rDB2
;
deed
[
D
][
0
]
+=
deltaR
[
DB
][
0
]
*
term
;
...
...
@@ -156,23 +156,23 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
// forces
// calculate forces for atoms a, c, d
// the force for b is then -(
a+ c + d)
// the force for b is then -(a+ c + d)
for
(
int
jj
=
0
;
jj
<
LastAtomIndex
;
jj
++
){
for
(
int
jj
=
0
;
jj
<
LastAtomIndex
;
jj
++
)
{
// A, C, D
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
subForce
[
jj
][
ii
]
=
dEdCos
*
(
dccd
[
jj
][
ii
]
+
deed
[
jj
][
ii
]
);
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
subForce
[
jj
][
ii
]
=
dEdCos
*
(
dccd
[
jj
][
ii
]
+
deed
[
jj
][
ii
]);
}
if
(
jj
==
0
)
jj
++
;
// skip B
if
(
jj
==
0
)
jj
++
;
// skip B
// now compute B
if
(
jj
==
3
){
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
if
(
jj
==
3
)
{
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
subForce
[
1
][
ii
]
=
-
one
*
(
subForce
[
0
][
ii
]
+
subForce
[
2
][
ii
]
+
subForce
[
3
][
ii
]);
}
}
...
...
@@ -180,8 +180,8 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
// add in forces
for
(
int
jj
=
0
;
jj
<
LastAtomIndex
;
jj
++
){
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
for
(
int
jj
=
0
;
jj
<
LastAtomIndex
;
jj
++
)
{
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
forces
[
jj
][
ii
]
=
subForce
[
jj
][
ii
];
}
}
...
...
@@ -196,7 +196,7 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateOutOfPlaneBendIxn( const
return
energy
;
}
RealOpenMM
AmoebaReferenceOutOfPlaneBendForce
::
calculateForceAndEnergy
(
int
numOutOfPlaneBends
,
vector
<
RealVec
>&
posData
,
RealOpenMM
AmoebaReferenceOutOfPlaneBendForce
::
calculateForceAndEnergy
(
int
numOutOfPlaneBends
,
vector
<
RealVec
>&
posData
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
const
std
::
vector
<
int
>&
particle3
,
...
...
@@ -215,9 +215,9 @@ RealOpenMM AmoebaReferenceOutOfPlaneBendForce::calculateForceAndEnergy( int numO
int
particle4Index
=
particle4
[
ii
];
RealOpenMM
kAngle
=
kQuadratic
[
ii
];
RealVec
forces
[
4
];
energy
+=
calculateOutOfPlaneBendIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
posData
[
particle4Index
],
kAngle
,
angleCubic
,
angleQuartic
,
anglePentic
,
angleSextic
,
forces
);
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
energy
+=
calculateOutOfPlaneBendIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
posData
[
particle4Index
],
kAngle
,
angleCubic
,
angleQuartic
,
anglePentic
,
angleSextic
,
forces
);
for
(
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/AmoebaReferenceOutOfPlaneBendForce.h
View file @
41cd79a5
...
...
@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceOutOfPlaneBendForce
(
){};
AmoebaReferenceOutOfPlaneBendForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~
AmoebaReferenceOutOfPlaneBendForce
(
){};
~
AmoebaReferenceOutOfPlaneBendForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -72,7 +72,7 @@ public:
--------------------------------------------------------------------------------------- */
RealOpenMM
calculateForceAndEnergy
(
int
numOutOfPlaneBends
,
std
::
vector
<
OpenMM
::
RealVec
>&
posData
,
RealOpenMM
calculateForceAndEnergy
(
int
numOutOfPlaneBends
,
std
::
vector
<
OpenMM
::
RealVec
>&
posData
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
const
std
::
vector
<
int
>&
particle3
,
...
...
@@ -105,12 +105,12 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM
calculateOutOfPlaneBendIxn
(
const
OpenMM
::
RealVec
&
positionAtomA
,
const
OpenMM
::
RealVec
&
positionAtomB
,
RealOpenMM
calculateOutOfPlaneBendIxn
(
const
OpenMM
::
RealVec
&
positionAtomA
,
const
OpenMM
::
RealVec
&
positionAtomB
,
const
OpenMM
::
RealVec
&
positionAtomC
,
const
OpenMM
::
RealVec
&
positionAtomD
,
RealOpenMM
angleK
,
RealOpenMM
angleCubic
,
RealOpenMM
angleQuartic
,
RealOpenMM
anglePentic
,
RealOpenMM
angleSextic
,
OpenMM
::
RealVec
*
forces
)
const
;
OpenMM
::
RealVec
*
forces
)
const
;
};
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferencePiTorsionForce.cpp
View file @
41cd79a5
...
...
@@ -46,10 +46,10 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferencePiTorsionForce
::
calculatePiTorsionIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
RealOpenMM
AmoebaReferencePiTorsionForce
::
calculatePiTorsionIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
const
RealVec
&
positionAtomC
,
const
RealVec
&
positionAtomD
,
const
RealVec
&
positionAtomE
,
const
RealVec
&
positionAtomF
,
RealOpenMM
piTorsionK
,
RealVec
*
forces
)
const
{
RealOpenMM
piTorsionK
,
RealVec
*
forces
)
const
{
// ---------------------------------------------------------------------------------------
...
...
@@ -64,23 +64,23 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec&
enum
{
AD
,
BD
,
EC
,
FC
,
P
,
Q
,
CP
,
DC
,
QD
,
T
,
U
,
TU
,
DP
,
QC
,
dT
,
dU
,
dP
,
dQ
,
dC1
,
dC2
,
dD1
,
dD2
,
LastDeltaIndex
};
std
::
vector
<
RealOpenMM
>
deltaR
[
LastDeltaIndex
];
for
(
unsigned
int
ii
=
0
;
ii
<
LastDeltaIndex
;
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
LastDeltaIndex
;
ii
++
)
{
deltaR
[
ii
].
resize
(
3
);
}
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomA
,
deltaR
[
AD
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomB
,
deltaR
[
BD
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomC
,
positionAtomE
,
deltaR
[
EC
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomC
,
positionAtomF
,
deltaR
[
FC
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomA
,
deltaR
[
AD
]);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomD
,
positionAtomB
,
deltaR
[
BD
]);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomC
,
positionAtomE
,
deltaR
[
EC
]);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomC
,
positionAtomF
,
deltaR
[
FC
]);
enum
{
A
,
B
,
C
,
D
,
E
,
F
,
LastAtomIndex
};
std
::
vector
<
RealOpenMM
>
d
[
LastAtomIndex
];
for
(
unsigned
int
ii
=
0
;
ii
<
LastAtomIndex
;
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
LastAtomIndex
;
ii
++
)
{
d
[
ii
].
resize
(
3
);
}
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AD
],
deltaR
[
BD
],
deltaR
[
P
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
EC
],
deltaR
[
FC
],
deltaR
[
Q
]
);
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AD
],
deltaR
[
BD
],
deltaR
[
P
]);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
EC
],
deltaR
[
FC
],
deltaR
[
Q
]);
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
deltaR
[
CP
][
ii
]
=
-
deltaR
[
P
][
ii
];
deltaR
[
DC
][
ii
]
=
positionAtomD
[
ii
]
-
positionAtomC
[
ii
];
deltaR
[
QD
][
ii
]
=
deltaR
[
Q
][
ii
];
...
...
@@ -88,24 +88,24 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec&
deltaR
[
P
][
ii
]
+=
positionAtomC
[
ii
];
deltaR
[
Q
][
ii
]
+=
positionAtomD
[
ii
];
}
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CP
],
deltaR
[
DC
],
deltaR
[
T
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
DC
],
deltaR
[
QD
],
deltaR
[
U
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
T
],
deltaR
[
U
],
deltaR
[
TU
]
);
RealOpenMM
rT2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
T
]
);
RealOpenMM
rU2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
U
]
);
RealOpenMM
rTrU
=
SQRT
(
rT2
*
rU2
);
if
(
rTrU
<=
zero
){
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CP
],
deltaR
[
DC
],
deltaR
[
T
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
DC
],
deltaR
[
QD
],
deltaR
[
U
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
T
],
deltaR
[
U
],
deltaR
[
TU
]);
RealOpenMM
rT2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
T
]);
RealOpenMM
rU2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
U
]);
RealOpenMM
rTrU
=
SQRT
(
rT2
*
rU2
);
if
(
rTrU
<=
zero
)
{
return
zero
;
}
RealOpenMM
rDC
=
AmoebaReferenceForce
::
getNorm3
(
deltaR
[
DC
]
);
RealOpenMM
rDC
=
AmoebaReferenceForce
::
getNorm3
(
deltaR
[
DC
]);
RealOpenMM
cosine
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
T
],
deltaR
[
U
]
);
RealOpenMM
cosine
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
T
],
deltaR
[
U
]);
cosine
/=
rTrU
;
RealOpenMM
sine
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
DC
],
deltaR
[
TU
]
);
sine
/=
(
rDC
*
rTrU
);
RealOpenMM
sine
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
DC
],
deltaR
[
TU
]);
sine
/=
(
rDC
*
rTrU
);
RealOpenMM
cosine2
=
cosine
*
cosine
-
sine
*
sine
;
RealOpenMM
sine2
=
two
*
cosine
*
sine
;
...
...
@@ -115,37 +115,37 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec&
RealOpenMM
dedphi
=
piTorsionK
*
dphi2
;
for
(
unsigned
int
ii
=
0
;
ii
<
3
;
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
deltaR
[
DP
][
ii
]
=
positionAtomD
[
ii
]
-
deltaR
[
P
][
ii
];
deltaR
[
QC
][
ii
]
=
deltaR
[
Q
][
ii
]
-
positionAtomC
[
ii
];
}
RealOpenMM
factorT
=
dedphi
/
(
rDC
*
rT2
);
RealOpenMM
factorU
=
-
dedphi
/
(
rDC
*
rU2
);
RealOpenMM
factorT
=
dedphi
/
(
rDC
*
rT2
);
RealOpenMM
factorU
=
-
dedphi
/
(
rDC
*
rU2
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
T
],
deltaR
[
DC
],
deltaR
[
dT
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
U
],
deltaR
[
DC
],
deltaR
[
dU
]
);
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
T
],
deltaR
[
DC
],
deltaR
[
dT
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
U
],
deltaR
[
DC
],
deltaR
[
dU
]
);
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
deltaR
[
dT
][
ii
]
*=
factorT
;
deltaR
[
dU
][
ii
]
*=
factorU
;
}
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dT
],
deltaR
[
DC
],
deltaR
[
dP
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dU
],
deltaR
[
DC
],
deltaR
[
dQ
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dT
],
deltaR
[
DC
],
deltaR
[
dP
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dU
],
deltaR
[
DC
],
deltaR
[
dQ
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
DP
],
deltaR
[
dT
],
deltaR
[
dC1
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dU
],
deltaR
[
QD
],
deltaR
[
dC2
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
DP
],
deltaR
[
dT
],
deltaR
[
dC1
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dU
],
deltaR
[
QD
],
deltaR
[
dC2
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dT
],
deltaR
[
CP
],
deltaR
[
dD1
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
QC
],
deltaR
[
dU
],
deltaR
[
dD2
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dT
],
deltaR
[
CP
],
deltaR
[
dD1
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
QC
],
deltaR
[
dU
],
deltaR
[
dD2
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
BD
],
deltaR
[
dP
],
d
[
A
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dP
],
deltaR
[
AD
],
d
[
B
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
BD
],
deltaR
[
dP
],
d
[
A
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dP
],
deltaR
[
AD
],
d
[
B
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
FC
],
deltaR
[
dQ
],
d
[
E
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dQ
],
deltaR
[
EC
],
d
[
F
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
FC
],
deltaR
[
dQ
],
d
[
E
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
dQ
],
deltaR
[
EC
],
d
[
F
]
);
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
d
[
C
][
ii
]
=
deltaR
[
dC1
][
ii
]
+
deltaR
[
dC2
][
ii
]
+
deltaR
[
dP
][
ii
]
-
d
[
E
][
ii
]
-
d
[
F
][
ii
];
d
[
D
][
ii
]
=
deltaR
[
dD1
][
ii
]
+
deltaR
[
dD2
][
ii
]
+
deltaR
[
dQ
][
ii
]
-
d
[
A
][
ii
]
-
d
[
B
][
ii
];
}
...
...
@@ -186,7 +186,7 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculatePiTorsionIxn( const RealVec&
}
RealOpenMM
AmoebaReferencePiTorsionForce
::
calculateForceAndEnergy
(
int
numPiTorsions
,
vector
<
RealVec
>&
posData
,
RealOpenMM
AmoebaReferencePiTorsionForce
::
calculateForceAndEnergy
(
int
numPiTorsions
,
vector
<
RealVec
>&
posData
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
const
std
::
vector
<
int
>&
particle3
,
...
...
@@ -194,7 +194,7 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculateForceAndEnergy( int numPiTors
const
std
::
vector
<
int
>&
particle5
,
const
std
::
vector
<
int
>&
particle6
,
const
std
::
vector
<
RealOpenMM
>&
kTorsion
,
vector
<
RealVec
>&
forceData
)
const
{
vector
<
RealVec
>&
forceData
)
const
{
RealOpenMM
energy
=
0.0
;
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
numPiTorsions
);
ii
++
)
{
...
...
@@ -206,13 +206,13 @@ RealOpenMM AmoebaReferencePiTorsionForce::calculateForceAndEnergy( int numPiTors
int
particle6Index
=
particle6
[
ii
];
RealVec
forces
[
6
];
energy
+=
calculatePiTorsionIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
energy
+=
calculatePiTorsionIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
posData
[
particle4Index
],
posData
[
particle5Index
],
posData
[
particle6Index
],
kTorsion
[
ii
],
forces
);
kTorsion
[
ii
],
forces
);
// accumulate 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
];
forceData
[
particle3Index
][
jj
]
-=
forces
[
2
][
jj
];
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferencePiTorsionForce.h
View file @
41cd79a5
...
...
@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferencePiTorsionForce
(
){};
AmoebaReferencePiTorsionForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~
AmoebaReferencePiTorsionForce
(
){};
~
AmoebaReferencePiTorsionForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -72,7 +72,7 @@ public:
--------------------------------------------------------------------------------------- */
RealOpenMM
calculateForceAndEnergy
(
int
numPiTorsions
,
std
::
vector
<
OpenMM
::
RealVec
>&
posData
,
RealOpenMM
calculateForceAndEnergy
(
int
numPiTorsions
,
std
::
vector
<
OpenMM
::
RealVec
>&
posData
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
const
std
::
vector
<
int
>&
particle3
,
...
...
@@ -80,7 +80,7 @@ public:
const
std
::
vector
<
int
>&
particle5
,
const
std
::
vector
<
int
>&
particle6
,
const
std
::
vector
<
RealOpenMM
>&
kTorsion
,
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
private:
...
...
@@ -102,10 +102,10 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM
calculatePiTorsionIxn
(
const
OpenMM
::
RealVec
&
positionAtomA
,
const
OpenMM
::
RealVec
&
positionAtomB
,
RealOpenMM
calculatePiTorsionIxn
(
const
OpenMM
::
RealVec
&
positionAtomA
,
const
OpenMM
::
RealVec
&
positionAtomB
,
const
OpenMM
::
RealVec
&
positionAtomC
,
const
OpenMM
::
RealVec
&
positionAtomD
,
const
OpenMM
::
RealVec
&
positionAtomE
,
const
OpenMM
::
RealVec
&
positionAtomF
,
RealOpenMM
kTorsion
,
OpenMM
::
RealVec
*
forces
)
const
;
RealOpenMM
kTorsion
,
OpenMM
::
RealVec
*
forces
)
const
;
};
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceStretchBendForce.cpp
View file @
41cd79a5
...
...
@@ -49,11 +49,11 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReferenceStretchBendForce
::
calculateStretchBendIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
RealOpenMM
AmoebaReferenceStretchBendForce
::
calculateStretchBendIxn
(
const
RealVec
&
positionAtomA
,
const
RealVec
&
positionAtomB
,
const
RealVec
&
positionAtomC
,
RealOpenMM
lengthAB
,
RealOpenMM
lengthCB
,
RealOpenMM
idealAngle
,
RealOpenMM
k1Parameter
,
RealOpenMM
k2Parameter
,
RealVec
*
forces
)
const
{
RealOpenMM
k2Parameter
,
RealVec
*
forces
)
const
{
// ---------------------------------------------------------------------------------------
...
...
@@ -73,28 +73,28 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
// and various intermediate terms
std
::
vector
<
RealOpenMM
>
deltaR
[
LastDeltaIndex
];
for
(
unsigned
int
ii
=
0
;
ii
<
LastDeltaIndex
;
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
LastDeltaIndex
;
ii
++
)
{
deltaR
[
ii
].
resize
(
3
);
}
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomB
,
positionAtomA
,
deltaR
[
AB
]
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomB
,
positionAtomC
,
deltaR
[
CB
]
);
RealOpenMM
rAB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
AB
]
);
RealOpenMM
rAB
=
SQRT
(
rAB2
);
RealOpenMM
rCB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
CB
]
);
RealOpenMM
rCB
=
SQRT
(
rCB2
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CB
],
deltaR
[
AB
],
deltaR
[
CBxAB
]
);
RealOpenMM
rP
=
AmoebaReferenceForce
::
getNorm3
(
deltaR
[
CBxAB
]
);
if
(
rP
<=
zero
){
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomB
,
positionAtomA
,
deltaR
[
AB
]);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomB
,
positionAtomC
,
deltaR
[
CB
]);
RealOpenMM
rAB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
AB
]);
RealOpenMM
rAB
=
SQRT
(
rAB2
);
RealOpenMM
rCB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
CB
]);
RealOpenMM
rCB
=
SQRT
(
rCB2
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CB
],
deltaR
[
AB
],
deltaR
[
CBxAB
]);
RealOpenMM
rP
=
AmoebaReferenceForce
::
getNorm3
(
deltaR
[
CBxAB
]);
if
(
rP
<=
zero
)
{
return
zero
;
}
RealOpenMM
dot
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
CB
],
deltaR
[
AB
]
);
RealOpenMM
dot
=
AmoebaReferenceForce
::
getDotProduct3
(
deltaR
[
CB
],
deltaR
[
AB
]);
RealOpenMM
cosine
=
dot
/
(
rAB
*
rCB
);
RealOpenMM
angle
;
if
(
cosine
>=
one
){
if
(
cosine
>=
one
)
{
angle
=
zero
;
}
else
if
(
cosine
<=
-
one
){
}
else
if
(
cosine
<=
-
one
)
{
angle
=
PI_M
;
}
else
{
angle
=
RADIAN
*
ACOS
(
cosine
);
...
...
@@ -105,9 +105,9 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
// P = CBxAB
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AB
],
deltaR
[
CBxAB
],
deltaR
[
ABxP
]
);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CB
],
deltaR
[
CBxAB
],
deltaR
[
CBxP
]
);
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
){
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
AB
],
deltaR
[
CBxAB
],
deltaR
[
ABxP
]);
AmoebaReferenceForce
::
getCrossProduct
(
deltaR
[
CB
],
deltaR
[
CBxAB
],
deltaR
[
CBxP
]);
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
deltaR
[
ABxP
][
ii
]
*=
termA
;
deltaR
[
CBxP
][
ii
]
*=
termC
;
}
...
...
@@ -123,22 +123,22 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
// forces
// calculate forces for atoms a, b, c
// the force for b is then -(
a + c)
// the force for b is then -(a + c)
std
::
vector
<
RealOpenMM
>
subForce
[
LastAtomIndex
];
for
(
int
ii
=
0
;
ii
<
LastAtomIndex
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
LastAtomIndex
;
ii
++
)
{
subForce
[
ii
].
resize
(
3
);
}
RealOpenMM
dt
=
angle
-
idealAngle
*
RADIAN
;
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
)
{
subForce
[
A
][
jj
]
=
k1Parameter
*
dt
*
termA
*
deltaR
[
AB
][
jj
]
+
drkk
*
deltaR
[
ABxP
][
jj
];
subForce
[
C
][
jj
]
=
k2Parameter
*
dt
*
termC
*
deltaR
[
CB
][
jj
]
+
drkk
*
deltaR
[
CBxP
][
jj
];
subForce
[
B
][
jj
]
=
-
(
subForce
[
A
][
jj
]
+
subForce
[
C
][
jj
]
);
subForce
[
B
][
jj
]
=
-
(
subForce
[
A
][
jj
]
+
subForce
[
C
][
jj
]);
}
// add in forces
for
(
int
jj
=
0
;
jj
<
LastAtomIndex
;
jj
++
){
for
(
int
jj
=
0
;
jj
<
LastAtomIndex
;
jj
++
)
{
forces
[
jj
][
0
]
=
subForce
[
jj
][
0
];
forces
[
jj
][
1
]
=
subForce
[
jj
][
1
];
forces
[
jj
][
2
]
=
subForce
[
jj
][
2
];
...
...
@@ -149,7 +149,7 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateStretchBendIxn( const RealV
return
dt
*
drkk
;
}
RealOpenMM
AmoebaReferenceStretchBendForce
::
calculateForceAndEnergy
(
int
numStretchBends
,
vector
<
RealVec
>&
posData
,
RealOpenMM
AmoebaReferenceStretchBendForce
::
calculateForceAndEnergy
(
int
numStretchBends
,
vector
<
RealVec
>&
posData
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
const
std
::
vector
<
int
>&
particle3
,
...
...
@@ -170,11 +170,11 @@ RealOpenMM AmoebaReferenceStretchBendForce::calculateForceAndEnergy( int numStre
RealOpenMM
angleK1
=
k1Quadratic
[
ii
];
RealOpenMM
angleK2
=
k2Quadratic
[
ii
];
RealVec
forces
[
3
];
energy
+=
calculateStretchBendIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
abLength
,
cbLength
,
idealAngle
,
angleK1
,
angleK2
,
forces
);
energy
+=
calculateStretchBendIxn
(
posData
[
particle1Index
],
posData
[
particle2Index
],
posData
[
particle3Index
],
abLength
,
cbLength
,
idealAngle
,
angleK1
,
angleK2
,
forces
);
// accumulate 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
];
forceData
[
particle3Index
][
jj
]
-=
forces
[
2
][
jj
];
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceStretchBendForce.h
View file @
41cd79a5
...
...
@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReferenceStretchBendForce
(
){};
AmoebaReferenceStretchBendForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -48,7 +48,7 @@ public:
--------------------------------------------------------------------------------------- */
~
AmoebaReferenceStretchBendForce
(
){};
~
AmoebaReferenceStretchBendForce
()
{};
/**---------------------------------------------------------------------------------------
...
...
@@ -70,7 +70,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
,
...
...
@@ -79,7 +79,7 @@ public:
const
std
::
vector
<
RealOpenMM
>&
angle
,
const
std
::
vector
<
RealOpenMM
>&
k1Quadratic
,
const
std
::
vector
<
RealOpenMM
>&
k2Quadratic
,
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
private:
...
...
@@ -102,11 +102,11 @@ private:
--------------------------------------------------------------------------------------- */
RealOpenMM
calculateStretchBendIxn
(
const
OpenMM
::
RealVec
&
positionAtomA
,
const
OpenMM
::
RealVec
&
positionAtomB
,
RealOpenMM
calculateStretchBendIxn
(
const
OpenMM
::
RealVec
&
positionAtomA
,
const
OpenMM
::
RealVec
&
positionAtomB
,
const
OpenMM
::
RealVec
&
positionAtomC
,
RealOpenMM
lengthAB
,
RealOpenMM
lengthCB
,
RealOpenMM
idealAngle
,
RealOpenMM
k1Parameter
,
RealOpenMM
k2Parameter
,
OpenMM
::
RealVec
*
forces
)
const
;
RealOpenMM
k2Parameter
,
OpenMM
::
RealVec
*
forces
)
const
;
};
...
...
Prev
1
2
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