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
c6ebf6e2
Commit
c6ebf6e2
authored
Sep 28, 2012
by
Peter Eastman
Browse files
Removed the word "harmonic" from lots of places it didn't belong, including class and method names
parent
58b094ce
Changes
62
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
408 additions
and
408 deletions
+408
-408
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoebaAngleForce.cpp
...eba/platforms/cuda-old/tests/TestCudaAmoebaAngleForce.cpp
+24
-24
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoebaBondForce.cpp
...oeba/platforms/cuda-old/tests/TestCudaAmoebaBondForce.cpp
+26
-26
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoebaGeneralizedKirkwoodForce.cpp
...cuda-old/tests/TestCudaAmoebaGeneralizedKirkwoodForce.cpp
+10
-10
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoebaInPlaneAngleForce.cpp
...tforms/cuda-old/tests/TestCudaAmoebaInPlaneAngleForce.cpp
+25
-25
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoebaMultipoleForce.cpp
...platforms/cuda-old/tests/TestCudaAmoebaMultipoleForce.cpp
+34
-34
plugins/amoeba/platforms/cuda/CMakeLists.txt
plugins/amoeba/platforms/cuda/CMakeLists.txt
+4
-4
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernelFactory.cpp
...ins/amoeba/platforms/cuda/src/AmoebaCudaKernelFactory.cpp
+9
-9
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
+37
-37
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.h
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.h
+18
-18
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaAngleForce.cpp
.../amoeba/platforms/cuda/tests/TestCudaAmoebaAngleForce.cpp
+24
-24
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaBondForce.cpp
...s/amoeba/platforms/cuda/tests/TestCudaAmoebaBondForce.cpp
+26
-26
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaGeneralizedKirkwoodForce.cpp
...rms/cuda/tests/TestCudaAmoebaGeneralizedKirkwoodForce.cpp
+10
-10
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaInPlaneAngleForce.cpp
.../platforms/cuda/tests/TestCudaAmoebaInPlaneAngleForce.cpp
+25
-25
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaMultipoleForce.cpp
...eba/platforms/cuda/tests/TestCudaAmoebaMultipoleForce.cpp
+34
-34
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernelFactory.cpp
.../platforms/reference/src/AmoebaReferenceKernelFactory.cpp
+9
-9
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
...amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
+38
-38
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
...s/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
+28
-28
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.cpp
...eference/src/SimTKReference/AmoebaReferenceAngleForce.cpp
+7
-7
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.h
.../reference/src/SimTKReference/AmoebaReferenceAngleForce.h
+12
-12
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceBondForce.cpp
...reference/src/SimTKReference/AmoebaReferenceBondForce.cpp
+8
-8
No files found.
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoeba
Harmonic
AngleForce.cpp
→
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoebaAngleForce.cpp
View file @
c6ebf6e2
...
...
@@ -30,7 +30,7 @@
* -------------------------------------------------------------------------- */
/**
* This tests the Cuda implementation of CudaAmoeba
Harmonic
AngleForce.
* This tests the Cuda implementation of CudaAmoebaAngleForce.
*/
#include "openmm/internal/AssertionUtilities.h"
...
...
@@ -119,22 +119,22 @@ static void getPrefactorsGivenAngleCosine( double cosine, double idealAngle, dou
return
;
}
static
void
computeAmoeba
Harmonic
AngleForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
Amoeba
Harmonic
AngleForce
&
amoeba
Harmonic
AngleForce
,
static
void
computeAmoebaAngleForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
AmoebaAngleForce
&
amoebaAngleForce
,
std
::
vector
<
Vec3
>&
forces
,
double
*
energy
,
FILE
*
log
)
{
int
particle1
,
particle2
,
particle3
;
double
idealAngle
;
double
quadraticK
;
amoeba
Harmonic
AngleForce
.
getAngleParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
idealAngle
,
quadraticK
);
amoebaAngleForce
.
getAngleParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
idealAngle
,
quadraticK
);
double
cubicK
=
amoeba
Harmonic
AngleForce
.
getAmoebaGlobal
Harmonic
AngleCubic
();
double
quarticK
=
amoeba
Harmonic
AngleForce
.
getAmoebaGlobal
Harmonic
AngleQuartic
();
double
penticK
=
amoeba
Harmonic
AngleForce
.
getAmoebaGlobal
Harmonic
AnglePentic
();
double
sexticK
=
amoeba
Harmonic
AngleForce
.
getAmoebaGlobal
Harmonic
AngleSextic
();
double
cubicK
=
amoebaAngleForce
.
getAmoebaGlobalAngleCubic
();
double
quarticK
=
amoebaAngleForce
.
getAmoebaGlobalAngleQuartic
();
double
penticK
=
amoebaAngleForce
.
getAmoebaGlobalAnglePentic
();
double
sexticK
=
amoebaAngleForce
.
getAmoebaGlobalAngleSextic
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
AngleForce: bond %d [%d %d %d] ang=%10.3f k=%10.3f [%10.3e %10.3e %10.3e %10.3e]
\n
"
,
(
void
)
fprintf
(
log
,
"computeAmoebaAngleForce: bond %d [%d %d %d] ang=%10.3f k=%10.3f [%10.3e %10.3e %10.3e %10.3e]
\n
"
,
bondIndex
,
particle1
,
particle2
,
particle3
,
idealAngle
,
quadraticK
,
cubicK
,
quarticK
,
penticK
,
sexticK
);
(
void
)
fflush
(
log
);
}
...
...
@@ -201,7 +201,7 @@ static void computeAmoebaHarmonicAngleForce(int bondIndex, std::vector<Vec3>& p
*
energy
+=
energyTerm
;
}
static
void
computeAmoeba
Harmonic
AngleForces
(
Context
&
context
,
Amoeba
Harmonic
AngleForce
&
amoeba
Harmonic
AngleForce
,
static
void
computeAmoebaAngleForces
(
Context
&
context
,
AmoebaAngleForce
&
amoebaAngleForce
,
std
::
vector
<
Vec3
>&
expectedForces
,
double
*
expectedEnergy
,
FILE
*
log
)
{
// get positions and zero forces
...
...
@@ -217,13 +217,13 @@ static void computeAmoebaHarmonicAngleForces( Context& context, AmoebaHarmonicAn
// calculates forces/energy
*
expectedEnergy
=
0.0
;
for
(
int
ii
=
0
;
ii
<
amoeba
Harmonic
AngleForce
.
getNumAngles
();
ii
++
){
computeAmoeba
Harmonic
AngleForce
(
ii
,
positions
,
amoeba
Harmonic
AngleForce
,
expectedForces
,
expectedEnergy
,
log
);
for
(
int
ii
=
0
;
ii
<
amoebaAngleForce
.
getNumAngles
();
ii
++
){
computeAmoebaAngleForce
(
ii
,
positions
,
amoebaAngleForce
,
expectedForces
,
expectedEnergy
,
log
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
AngleForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
(
void
)
fprintf
(
log
,
"computeAmoebaAngleForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%14.7e %14.7e %14.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
]
);
}
...
...
@@ -235,19 +235,19 @@ static void computeAmoebaHarmonicAngleForces( Context& context, AmoebaHarmonicAn
}
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
Amoeba
Harmonic
AngleForce
&
amoeba
Harmonic
AngleForce
,
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
AmoebaAngleForce
&
amoebaAngleForce
,
double
tolerance
,
const
std
::
string
&
idString
,
FILE
*
log
)
{
std
::
vector
<
Vec3
>
expectedForces
;
double
expectedEnergy
;
computeAmoeba
Harmonic
AngleForces
(
context
,
amoeba
Harmonic
AngleForce
,
expectedForces
,
&
expectedEnergy
,
log
);
computeAmoebaAngleForces
(
context
,
amoebaAngleForce
,
expectedForces
,
&
expectedEnergy
,
log
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
AngleForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
(
void
)
fprintf
(
log
,
"computeAmoebaAngleForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%14.7e %14.7e %14.7e] [%14.7e %14.7e %14.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
],
forces
[
ii
][
0
],
forces
[
ii
][
1
],
forces
[
ii
][
2
]
);
...
...
@@ -272,7 +272,7 @@ void testOneAngle( FILE* log ) {
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
Amoeba
Harmonic
AngleForce
*
amoeba
Harmonic
AngleForce
=
new
Amoeba
Harmonic
AngleForce
();
AmoebaAngleForce
*
amoebaAngleForce
=
new
AmoebaAngleForce
();
double
angle
=
100.0
;
double
quadraticK
=
1.0
;
...
...
@@ -280,14 +280,14 @@ void testOneAngle( FILE* log ) {
double
quarticK
=
1.0e-02
;
double
penticK
=
1.0e-03
;
double
sexticK
=
1.0e-04
;
amoeba
Harmonic
AngleForce
->
addAngle
(
0
,
1
,
2
,
angle
,
quadraticK
);
amoebaAngleForce
->
addAngle
(
0
,
1
,
2
,
angle
,
quadraticK
);
amoeba
Harmonic
AngleForce
->
setAmoebaGlobal
Harmonic
AngleCubic
(
cubicK
);
amoeba
Harmonic
AngleForce
->
setAmoebaGlobal
Harmonic
AngleQuartic
(
quarticK
);
amoeba
Harmonic
AngleForce
->
setAmoebaGlobal
Harmonic
AnglePentic
(
penticK
);
amoeba
Harmonic
AngleForce
->
setAmoebaGlobal
Harmonic
AngleSextic
(
sexticK
);
amoebaAngleForce
->
setAmoebaGlobalAngleCubic
(
cubicK
);
amoebaAngleForce
->
setAmoebaGlobalAngleQuartic
(
quarticK
);
amoebaAngleForce
->
setAmoebaGlobalAnglePentic
(
penticK
);
amoebaAngleForce
->
setAmoebaGlobalAngleSextic
(
sexticK
);
system
.
addForce
(
amoeba
Harmonic
AngleForce
);
system
.
addForce
(
amoebaAngleForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"Cuda"
));
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -297,14 +297,14 @@ void testOneAngle( FILE* log ) {
positions
[
2
]
=
Vec3
(
0
,
0
,
1
);
context
.
setPositions
(
positions
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoeba
Harmonic
AngleForce
,
TOL
,
"testOneAngle"
,
log
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaAngleForce
,
TOL
,
"testOneAngle"
,
log
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[]
)
{
try
{
std
::
cout
<<
"TestCudaAmoeba
Harmonic
AngleForce running test..."
<<
std
::
endl
;
std
::
cout
<<
"TestCudaAmoebaAngleForce running test..."
<<
std
::
endl
;
registerAmoebaCudaKernelFactories
();
FILE
*
log
=
NULL
;
testOneAngle
(
log
);
...
...
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoeba
Harmonic
BondForce.cpp
→
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoebaBondForce.cpp
View file @
c6ebf6e2
...
...
@@ -30,7 +30,7 @@
* -------------------------------------------------------------------------- */
/**
* This tests the Cuda implementation of
Harmonic
BondForce.
* This tests the Cuda implementation of
Amoeba
BondForce.
*/
#include "openmm/internal/AssertionUtilities.h"
...
...
@@ -46,15 +46,15 @@
using
namespace
OpenMM
;
const
double
TOL
=
1e-5
;
static
void
computeAmoeba
Harmonic
BondForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
Amoeba
Harmonic
BondForce
&
amoeba
Harmonic
BondForce
,
static
void
computeAmoebaBondForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
AmoebaBondForce
&
amoebaBondForce
,
std
::
vector
<
Vec3
>&
forces
,
double
*
energy
)
{
int
particle1
,
particle2
;
double
bondLength
;
double
quadraticK
;
double
cubicK
=
amoeba
Harmonic
BondForce
.
getAmoebaGlobal
Harmonic
BondCubic
();
double
quarticK
=
amoeba
Harmonic
BondForce
.
getAmoebaGlobal
Harmonic
BondQuartic
();
amoeba
Harmonic
BondForce
.
getBondParameters
(
bondIndex
,
particle1
,
particle2
,
bondLength
,
quadraticK
);
double
cubicK
=
amoebaBondForce
.
getAmoebaGlobalBondCubic
();
double
quarticK
=
amoebaBondForce
.
getAmoebaGlobalBondQuartic
();
amoebaBondForce
.
getBondParameters
(
bondIndex
,
particle1
,
particle2
,
bondLength
,
quadraticK
);
double
deltaR
[
3
];
double
r2
=
0.0
;
...
...
@@ -82,7 +82,7 @@ static void computeAmoebaHarmonicBondForce(int bondIndex, std::vector<Vec3>& po
}
static
void
computeAmoeba
Harmonic
BondForces
(
Context
&
context
,
Amoeba
Harmonic
BondForce
&
amoeba
Harmonic
BondForce
,
static
void
computeAmoebaBondForces
(
Context
&
context
,
AmoebaBondForce
&
amoebaBondForce
,
std
::
vector
<
Vec3
>&
expectedForces
,
double
*
expectedEnergy
,
FILE
*
log
)
{
// get positions and zero forces
...
...
@@ -98,13 +98,13 @@ static void computeAmoebaHarmonicBondForces( Context& context, AmoebaHarmonicBon
// calculates forces/energy
*
expectedEnergy
=
0.0
;
for
(
int
ii
=
0
;
ii
<
amoeba
Harmonic
BondForce
.
getNumBonds
();
ii
++
){
computeAmoeba
Harmonic
BondForce
(
ii
,
positions
,
amoeba
Harmonic
BondForce
,
expectedForces
,
expectedEnergy
);
for
(
int
ii
=
0
;
ii
<
amoebaBondForce
.
getNumBonds
();
ii
++
){
computeAmoebaBondForce
(
ii
,
positions
,
amoebaBondForce
,
expectedForces
,
expectedEnergy
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
BondForces: expected energy=%15.7e
\n
"
,
*
expectedEnergy
);
(
void
)
fprintf
(
log
,
"computeAmoebaBondForces: expected energy=%15.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%15.7e %15.7e %15.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
]
);
}
...
...
@@ -115,18 +115,18 @@ static void computeAmoebaHarmonicBondForces( Context& context, AmoebaHarmonicBon
}
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
Amoeba
Harmonic
BondForce
&
amoeba
Harmonic
BondForce
,
double
tolerance
,
const
std
::
string
&
idString
,
FILE
*
log
)
{
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
AmoebaBondForce
&
amoebaBondForce
,
double
tolerance
,
const
std
::
string
&
idString
,
FILE
*
log
)
{
std
::
vector
<
Vec3
>
expectedForces
;
double
expectedEnergy
;
computeAmoeba
Harmonic
BondForces
(
context
,
amoeba
Harmonic
BondForce
,
expectedForces
,
&
expectedEnergy
,
NULL
);
computeAmoebaBondForces
(
context
,
amoebaBondForce
,
expectedForces
,
&
expectedEnergy
,
NULL
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
BondForces: expected energy=%15.7e %15.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
(
void
)
fprintf
(
log
,
"computeAmoebaBondForces: expected energy=%15.7e %15.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%15.7e %15.7e %15.7e] [%15.7e %15.7e %15.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
],
forces
[
ii
][
0
],
forces
[
ii
][
1
],
forces
[
ii
][
2
]
);
...
...
@@ -150,17 +150,17 @@ void testOneBond( FILE* log ) {
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
double
bondLength
=
1.5
;
double
quadraticK
=
1.0
;
double
cubicK
=
2.0
;
double
quarticicK
=
3.0
;
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
cubicK
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
quarticicK
);
amoeba
Harmonic
BondForce
->
addBond
(
0
,
1
,
bondLength
,
quadraticK
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
cubicK
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
quarticicK
);
amoebaBondForce
->
addBond
(
0
,
1
,
bondLength
,
quadraticK
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
system
.
addForce
(
amoebaBondForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"Cuda"
));
std
::
vector
<
Vec3
>
positions
(
2
);
...
...
@@ -168,7 +168,7 @@ void testOneBond( FILE* log ) {
positions
[
1
]
=
Vec3
(
0
,
0
,
0
);
context
.
setPositions
(
positions
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoeba
Harmonic
BondForce
,
TOL
,
"testOneBond"
,
log
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaBondForce
,
TOL
,
"testOneBond"
,
log
);
}
void
testTwoBond
(
FILE
*
log
)
{
...
...
@@ -182,18 +182,18 @@ void testTwoBond( FILE* log ) {
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
double
bondLength
=
1.5
;
double
quadraticK
=
1.0
;
double
cubicK
=
2.0
;
double
quarticicK
=
3.0
;
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
cubicK
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
quarticicK
);
amoeba
Harmonic
BondForce
->
addBond
(
0
,
1
,
bondLength
,
quadraticK
);
amoeba
Harmonic
BondForce
->
addBond
(
1
,
2
,
bondLength
,
quadraticK
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
cubicK
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
quarticicK
);
amoebaBondForce
->
addBond
(
0
,
1
,
bondLength
,
quadraticK
);
amoebaBondForce
->
addBond
(
1
,
2
,
bondLength
,
quadraticK
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
system
.
addForce
(
amoebaBondForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"Cuda"
));
//Context context(system, integrator, platform );
std
::
vector
<
Vec3
>
positions
(
3
);
...
...
@@ -203,13 +203,13 @@ void testTwoBond( FILE* log ) {
positions
[
2
]
=
Vec3
(
1
,
0
,
1
);
context
.
setPositions
(
positions
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoeba
Harmonic
BondForce
,
TOL
,
"testTwoBond"
,
log
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaBondForce
,
TOL
,
"testTwoBond"
,
log
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[]
)
{
try
{
std
::
cout
<<
"TestCudaAmoeba
Harmonic
BondForce running test..."
<<
std
::
endl
;
std
::
cout
<<
"TestCudaAmoebaBondForce running test..."
<<
std
::
endl
;
registerAmoebaCudaKernelFactories
();
FILE
*
log
=
NULL
;
testTwoBond
(
log
);
...
...
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoebaGeneralizedKirkwoodForce.cpp
View file @
c6ebf6e2
...
...
@@ -277,20 +277,20 @@ static void setupAndGetForcesEnergyMultipoleAmmonia( AmoebaMultipoleForce::Polar
// 1-2 bonds needed
/*
Amoeba
Harmonic
BondForce*
a
moeba
Harmonic
BondForce = new Amoeba
Harmonic
BondForce();
AmoebaBondForce*
A
moebaBondForce = new AmoebaBondForce();
// addBond: particle1, particle2, length, quadraticK
a
moeba
Harmonic
BondForce->addBond( 0, 1, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->addBond( 0, 2, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->addBond( 0, 3, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->addBond( 0, 1, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->addBond( 0, 2, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->addBond( 0, 3, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->addBond( 4, 5, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->addBond( 4, 6, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->addBond( 4, 7, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->setAmoebaGlobal
Harmonic
BondCubic( -2.5500000e+01 );
a
moeba
Harmonic
BondForce->setAmoebaGlobal
Harmonic
BondQuartic( 3.7931250e+02 );
system.addForce(
a
moeba
Harmonic
BondForce);
A
moebaBondForce->addBond( 4, 5, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->addBond( 4, 6, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->addBond( 4, 7, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->setAmoebaGlobalBondCubic( -2.5500000e+01 );
A
moebaBondForce->setAmoebaGlobalBondQuartic( 3.7931250e+02 );
system.addForce(
A
moebaBondForce);
*/
std::vector<Vec3> positions(numberOfParticles);
...
...
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoeba
Harmonic
InPlaneAngleForce.cpp
→
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoebaInPlaneAngleForce.cpp
View file @
c6ebf6e2
...
...
@@ -30,7 +30,7 @@
* -------------------------------------------------------------------------- */
/**
* This tests the Cuda implementation of
Cuda
Amoeba
Harmonic
InPlaneAngleForce.
* This tests the Cuda implementation of AmoebaInPlaneAngleForce.
*/
#include "openmm/internal/AssertionUtilities.h"
...
...
@@ -120,22 +120,22 @@ static void getPrefactorsGivenInPlaneAngleCosine( double cosine, double idealInP
return
;
}
static
void
computeAmoeba
Harmonic
InPlaneAngleForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
Amoeba
Harmonic
InPlaneAngleForce
&
amoeba
Harmonic
InPlaneAngleForce
,
static
void
computeAmoebaInPlaneAngleForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
AmoebaInPlaneAngleForce
&
amoebaInPlaneAngleForce
,
std
::
vector
<
Vec3
>&
forces
,
double
*
energy
,
FILE
*
log
)
{
int
particle1
,
particle2
,
particle3
,
particle4
;
double
idealInPlaneAngle
;
double
quadraticK
;
amoeba
Harmonic
InPlaneAngleForce
.
getAngleParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
idealInPlaneAngle
,
quadraticK
);
amoebaInPlaneAngleForce
.
getAngleParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
idealInPlaneAngle
,
quadraticK
);
double
cubicK
=
amoeba
Harmonic
InPlaneAngleForce
.
getAmoebaGlobal
Harmonic
InPlaneAngleCubic
();
double
quarticK
=
amoeba
Harmonic
InPlaneAngleForce
.
getAmoebaGlobal
Harmonic
InPlaneAngleQuartic
();
double
penticK
=
amoeba
Harmonic
InPlaneAngleForce
.
getAmoebaGlobal
Harmonic
InPlaneAnglePentic
();
double
sexticK
=
amoeba
Harmonic
InPlaneAngleForce
.
getAmoebaGlobal
Harmonic
InPlaneAngleSextic
();
double
cubicK
=
amoebaInPlaneAngleForce
.
getAmoebaGlobalInPlaneAngleCubic
();
double
quarticK
=
amoebaInPlaneAngleForce
.
getAmoebaGlobalInPlaneAngleQuartic
();
double
penticK
=
amoebaInPlaneAngleForce
.
getAmoebaGlobalInPlaneAnglePentic
();
double
sexticK
=
amoebaInPlaneAngleForce
.
getAmoebaGlobalInPlaneAngleSextic
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
InPlaneAngleForce: bond %d [%d %d %d %d] ang=%10.3f k=%10.3f [%10.3e %10.3e %10.3e %10.3e]
\n
"
,
(
void
)
fprintf
(
log
,
"computeAmoebaInPlaneAngleForce: bond %d [%d %d %d %d] ang=%10.3f k=%10.3f [%10.3e %10.3e %10.3e %10.3e]
\n
"
,
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
idealInPlaneAngle
,
quadraticK
,
cubicK
,
quarticK
,
penticK
,
sexticK
);
(
void
)
fflush
(
log
);
}
...
...
@@ -182,7 +182,7 @@ static void computeAmoebaHarmonicInPlaneAngleForce(int bondIndex, std::vector<V
if
(
rAp2
<=
0.0
&&
rCp2
<=
0.0
){
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
InPlaneAngleForce: rAp2 or rCp2 <= 0.0
\n
"
);
(
void
)
fprintf
(
log
,
"computeAmoebaInPlaneAngleForce: rAp2 or rCp2 <= 0.0
\n
"
);
(
void
)
fflush
(
log
);
}
#endif
...
...
@@ -278,7 +278,7 @@ static void computeAmoebaHarmonicInPlaneAngleForce(int bondIndex, std::vector<V
}
static
void
computeAmoeba
Harmonic
InPlaneAngleForces
(
Context
&
context
,
Amoeba
Harmonic
InPlaneAngleForce
&
amoeba
Harmonic
InPlaneAngleForce
,
static
void
computeAmoebaInPlaneAngleForces
(
Context
&
context
,
AmoebaInPlaneAngleForce
&
amoebaInPlaneAngleForce
,
std
::
vector
<
Vec3
>&
expectedForces
,
double
*
expectedEnergy
,
FILE
*
log
)
{
// get positions and zero forces
...
...
@@ -294,13 +294,13 @@ static void computeAmoebaHarmonicInPlaneAngleForces( Context& context, AmoebaHar
// calculates forces/energy
*
expectedEnergy
=
0.0
;
for
(
int
ii
=
0
;
ii
<
amoeba
Harmonic
InPlaneAngleForce
.
getNumAngles
();
ii
++
){
computeAmoeba
Harmonic
InPlaneAngleForce
(
ii
,
positions
,
amoeba
Harmonic
InPlaneAngleForce
,
expectedForces
,
expectedEnergy
,
log
);
for
(
int
ii
=
0
;
ii
<
amoebaInPlaneAngleForce
.
getNumAngles
();
ii
++
){
computeAmoebaInPlaneAngleForce
(
ii
,
positions
,
amoebaInPlaneAngleForce
,
expectedForces
,
expectedEnergy
,
log
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
InPlaneAngleForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
(
void
)
fprintf
(
log
,
"computeAmoebaInPlaneAngleForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%14.7e %14.7e %14.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
]
);
}
...
...
@@ -311,19 +311,19 @@ static void computeAmoebaHarmonicInPlaneAngleForces( Context& context, AmoebaHar
}
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
Amoeba
Harmonic
InPlaneAngleForce
&
amoeba
Harmonic
InPlaneAngleForce
,
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
AmoebaInPlaneAngleForce
&
amoebaInPlaneAngleForce
,
double
tolerance
,
const
std
::
string
&
idString
,
FILE
*
log
)
{
std
::
vector
<
Vec3
>
expectedForces
;
double
expectedEnergy
;
computeAmoeba
Harmonic
InPlaneAngleForces
(
context
,
amoeba
Harmonic
InPlaneAngleForce
,
expectedForces
,
&
expectedEnergy
,
log
);
computeAmoebaInPlaneAngleForces
(
context
,
amoebaInPlaneAngleForce
,
expectedForces
,
&
expectedEnergy
,
log
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
InPlaneAngleForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
(
void
)
fprintf
(
log
,
"computeAmoebaInPlaneAngleForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%14.7e %14.7e %14.7e] [%14.7e %14.7e %14.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
],
forces
[
ii
][
0
],
forces
[
ii
][
1
],
forces
[
ii
][
2
]
);
...
...
@@ -348,7 +348,7 @@ void testOneAngle( FILE* log ) {
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
Amoeba
Harmonic
InPlaneAngleForce
*
amoeba
Harmonic
InPlaneAngleForce
=
new
Amoeba
Harmonic
InPlaneAngleForce
();
AmoebaInPlaneAngleForce
*
amoebaInPlaneAngleForce
=
new
AmoebaInPlaneAngleForce
();
double
angle
=
65.0
;
double
quadraticK
=
1.0
;
...
...
@@ -356,14 +356,14 @@ void testOneAngle( FILE* log ) {
double
quarticK
=
0.0e-02
;
double
penticK
=
0.0e-03
;
double
sexticK
=
0.0e-04
;
amoeba
Harmonic
InPlaneAngleForce
->
addAngle
(
0
,
1
,
2
,
3
,
angle
,
quadraticK
);
amoebaInPlaneAngleForce
->
addAngle
(
0
,
1
,
2
,
3
,
angle
,
quadraticK
);
amoeba
Harmonic
InPlaneAngleForce
->
setAmoebaGlobal
Harmonic
InPlaneAngleCubic
(
cubicK
);
amoeba
Harmonic
InPlaneAngleForce
->
setAmoebaGlobal
Harmonic
InPlaneAngleQuartic
(
quarticK
);
amoeba
Harmonic
InPlaneAngleForce
->
setAmoebaGlobal
Harmonic
InPlaneAnglePentic
(
penticK
);
amoeba
Harmonic
InPlaneAngleForce
->
setAmoebaGlobal
Harmonic
InPlaneAngleSextic
(
sexticK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAngleCubic
(
cubicK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAngleQuartic
(
quarticK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAnglePentic
(
penticK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAngleSextic
(
sexticK
);
system
.
addForce
(
amoeba
Harmonic
InPlaneAngleForce
);
system
.
addForce
(
amoebaInPlaneAngleForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"Cuda"
));
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -374,14 +374,14 @@ void testOneAngle( FILE* log ) {
positions
[
3
]
=
Vec3
(
1
,
1
,
1
);
context
.
setPositions
(
positions
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoeba
Harmonic
InPlaneAngleForce
,
TOL
,
"testOneInPlaneAngle"
,
log
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaInPlaneAngleForce
,
TOL
,
"testOneInPlaneAngle"
,
log
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[]
)
{
try
{
std
::
cout
<<
"TestCudaAmoeba
Harmonic
InPlaneAngleForce running test..."
<<
std
::
endl
;
std
::
cout
<<
"TestCudaAmoebaInPlaneAngleForce running test..."
<<
std
::
endl
;
registerAmoebaCudaKernelFactories
();
FILE
*
log
=
NULL
;
testOneAngle
(
NULL
);
...
...
plugins/amoeba/platforms/cuda-old/tests/TestCudaAmoebaMultipoleForce.cpp
View file @
c6ebf6e2
...
...
@@ -274,20 +274,20 @@ static void setupAndGetForcesEnergyMultipoleAmmonia( AmoebaMultipoleForce::Nonbo
// 1-2 bonds needed
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
// addBond: particle1, particle2, length, quadraticK
amoeba
Harmonic
BondForce
->
addBond
(
0
,
1
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
0
,
2
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
0
,
3
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
0
,
1
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
0
,
2
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
0
,
3
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
4
,
5
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
4
,
6
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
4
,
7
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
-
2.5500000e+01
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
amoebaBondForce
->
addBond
(
4
,
5
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
4
,
6
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
4
,
7
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
-
2.5500000e+01
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoebaBondForce
);
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -611,18 +611,18 @@ static void setupAndGetForcesEnergyMultipoleWater( AmoebaMultipoleForce::Nonbond
// 1-2 bonds needed
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
// addBond: particle1, particle2, length, quadraticK
for
(
unsigned
int
jj
=
0
;
jj
<
numberOfParticles
;
jj
+=
3
){
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
}
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
-
2.5500000e+01
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
-
2.5500000e+01
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoebaBondForce
);
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -836,18 +836,18 @@ static void testQuadrupoleValidation( FILE* log ){
}
*/
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
// addBond: particle1, particle2, length, quadraticK
for
(
unsigned
int
jj
=
0
;
jj
<
numberOfParticles
;
jj
+=
3
){
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
}
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
-
2.5500000e+01
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
-
2.5500000e+01
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoebaBondForce
);
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -1089,18 +1089,18 @@ static void setupAndGetForcesEnergyMultipoleIonsAndWater( AmoebaMultipoleForce::
// 1-2 bonds needed
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
// addBond: particle1, particle2, length, quadraticK
for
(
unsigned
int
jj
=
2
;
jj
<
numberOfParticles
;
jj
+=
3
){
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
}
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
-
2.5500000e+01
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
-
2.5500000e+01
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoebaBondForce
);
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -1321,18 +1321,18 @@ static void setupAndGetForcesEnergyMultipoleLargeWater( AmoebaMultipoleForce::No
// 1-2 bonds needed
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
// addBond: particle1, particle2, length, quadraticK
for
(
unsigned
int
jj
=
0
;
jj
<
numberOfParticles
;
jj
+=
3
){
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
}
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
0.0
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
0.0
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
0.0
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
0.0
);
system
.
addForce
(
amoebaBondForce
);
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
plugins/amoeba/platforms/cuda/CMakeLists.txt
View file @
c6ebf6e2
...
...
@@ -75,9 +75,9 @@ FOREACH(subdir ${OPENMM_SOURCE_SUBDIRS})
ENDFOREACH
(
subdir
)
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_CURRENT_SOURCE_DIR
}
/src
)
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_SOURCE_DIR
}
/platforms/cuda
2
/include
)
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_SOURCE_DIR
}
/platforms/cuda
2
/src
)
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_BINARY_DIR
}
/platforms/cuda
2
/src
)
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_SOURCE_DIR
}
/platforms/cuda/include
)
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_SOURCE_DIR
}
/platforms/cuda/src
)
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_BINARY_DIR
}
/platforms/cuda/src
)
# Set variables needed for encoding kernel sources into a C++ class
...
...
@@ -95,7 +95,7 @@ INCLUDE_DIRECTORIES(${CUDA_TOOLKIT_INCLUDE})
FILE
(
GLOB CUDA_KERNELS
${
CUDA_SOURCE_DIR
}
/kernels/*.cu
)
ADD_CUSTOM_COMMAND
(
OUTPUT
${
CUDA_KERNELS_CPP
}
${
CUDA_KERNELS_H
}
COMMAND
${
CMAKE_COMMAND
}
ARGS -D CUDA_SOURCE_DIR=
${
CUDA_SOURCE_DIR
}
-D CUDA_KERNELS_CPP=
${
CUDA_KERNELS_CPP
}
-D CUDA_KERNELS_H=
${
CUDA_KERNELS_H
}
-D CUDA_SOURCE_CLASS=
${
CUDA_SOURCE_CLASS
}
-P
${
CMAKE_SOURCE_DIR
}
/platforms/cuda
2
/EncodeCUDAFiles.cmake
ARGS -D CUDA_SOURCE_DIR=
${
CUDA_SOURCE_DIR
}
-D CUDA_KERNELS_CPP=
${
CUDA_KERNELS_CPP
}
-D CUDA_KERNELS_H=
${
CUDA_KERNELS_H
}
-D CUDA_SOURCE_CLASS=
${
CUDA_SOURCE_CLASS
}
-P
${
CMAKE_SOURCE_DIR
}
/platforms/cuda/EncodeCUDAFiles.cmake
DEPENDS
${
CUDA_KERNELS
}
)
SET_SOURCE_FILES_PROPERTIES
(
${
CUDA_KERNELS_CPP
}
${
CUDA_KERNELS_H
}
PROPERTIES GENERATED TRUE
)
...
...
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernelFactory.cpp
View file @
c6ebf6e2
...
...
@@ -40,9 +40,9 @@ extern "C" OPENMM_EXPORT void registerKernelFactories() {
try
{
Platform
&
platform
=
Platform
::
getPlatformByName
(
"CUDA"
);
AmoebaCudaKernelFactory
*
factory
=
new
AmoebaCudaKernelFactory
();
platform
.
registerKernelFactory
(
CalcAmoeba
Harmonic
BondForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoeba
Harmonic
AngleForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaBondForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaAngleForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaInPlaneAngleForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaPiTorsionForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaStretchBendForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaOutOfPlaneBendForceKernel
::
Name
(),
factory
);
...
...
@@ -71,14 +71,14 @@ KernelImpl* AmoebaCudaKernelFactory::createKernelImpl(std::string name, const Pl
CudaPlatform
::
PlatformData
&
data
=
*
static_cast
<
CudaPlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
CudaContext
&
cu
=
*
data
.
contexts
[
0
];
if
(
name
==
CalcAmoeba
Harmonic
BondForceKernel
::
Name
())
return
new
CudaCalcAmoeba
Harmonic
BondForceKernel
(
name
,
platform
,
cu
,
context
.
getSystem
());
if
(
name
==
CalcAmoebaBondForceKernel
::
Name
())
return
new
CudaCalcAmoebaBondForceKernel
(
name
,
platform
,
cu
,
context
.
getSystem
());
if
(
name
==
CalcAmoeba
Harmonic
AngleForceKernel
::
Name
())
return
new
CudaCalcAmoeba
Harmonic
AngleForceKernel
(
name
,
platform
,
cu
,
context
.
getSystem
());
if
(
name
==
CalcAmoebaAngleForceKernel
::
Name
())
return
new
CudaCalcAmoebaAngleForceKernel
(
name
,
platform
,
cu
,
context
.
getSystem
());
if
(
name
==
CalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
Name
())
return
new
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
(
name
,
platform
,
cu
,
context
.
getSystem
());
if
(
name
==
CalcAmoebaInPlaneAngleForceKernel
::
Name
())
return
new
CudaCalcAmoebaInPlaneAngleForceKernel
(
name
,
platform
,
cu
,
context
.
getSystem
());
if
(
name
==
CalcAmoebaPiTorsionForceKernel
::
Name
())
return
new
CudaCalcAmoebaPiTorsionForceKernel
(
name
,
platform
,
cu
,
context
.
getSystem
());
...
...
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
View file @
c6ebf6e2
...
...
@@ -54,12 +54,12 @@ using namespace std;
}
/* -------------------------------------------------------------------------- *
* Amoeba
HarmonicBond
*
*
Amoeba
BondForce
*
* -------------------------------------------------------------------------- */
class
CudaCalcAmoeba
Harmonic
BondForceKernel
::
ForceInfo
:
public
CudaForceInfo
{
class
CudaCalcAmoebaBondForceKernel
::
ForceInfo
:
public
CudaForceInfo
{
public:
ForceInfo
(
const
Amoeba
Harmonic
BondForce
&
force
)
:
force
(
force
)
{
ForceInfo
(
const
AmoebaBondForce
&
force
)
:
force
(
force
)
{
}
int
getNumParticleGroups
()
{
return
force
.
getNumBonds
();
...
...
@@ -80,20 +80,20 @@ public:
return
(
length1
==
length2
&&
k1
==
k2
);
}
private:
const
Amoeba
Harmonic
BondForce
&
force
;
const
AmoebaBondForce
&
force
;
};
CudaCalcAmoeba
Harmonic
BondForceKernel
::
CudaCalcAmoeba
Harmonic
BondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
)
:
CalcAmoeba
Harmonic
BondForceKernel
(
name
,
platform
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
CudaCalcAmoebaBondForceKernel
::
CudaCalcAmoebaBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
)
:
CalcAmoebaBondForceKernel
(
name
,
platform
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
}
CudaCalcAmoeba
Harmonic
BondForceKernel
::~
CudaCalcAmoeba
Harmonic
BondForceKernel
()
{
CudaCalcAmoebaBondForceKernel
::~
CudaCalcAmoebaBondForceKernel
()
{
cu
.
setAsCurrent
();
if
(
params
!=
NULL
)
delete
params
;
}
void
CudaCalcAmoeba
Harmonic
BondForceKernel
::
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
BondForce
&
force
)
{
void
CudaCalcAmoebaBondForceKernel
::
initialize
(
const
System
&
system
,
const
AmoebaBondForce
&
force
)
{
cu
.
setAsCurrent
();
int
numContexts
=
cu
.
getPlatformData
().
contexts
.
size
();
int
startIndex
=
cu
.
getContextIndex
()
*
force
.
getNumBonds
()
/
numContexts
;
...
...
@@ -113,23 +113,23 @@ void CudaCalcAmoebaHarmonicBondForceKernel::initialize(const System& system, con
map
<
string
,
string
>
replacements
;
replacements
[
"COMPUTE_FORCE"
]
=
CudaAmoebaKernelSources
::
amoebaBondForce
;
replacements
[
"PARAMS"
]
=
cu
.
getBondedUtilities
().
addArgument
(
params
->
getDevicePointer
(),
"float2"
);
replacements
[
"CUBIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobal
Harmonic
BondCubic
());
replacements
[
"QUARTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobal
Harmonic
BondQuartic
());
replacements
[
"CUBIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobalBondCubic
());
replacements
[
"QUARTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobalBondQuartic
());
cu
.
getBondedUtilities
().
addInteraction
(
atoms
,
cu
.
replaceStrings
(
CudaKernelSources
::
bondForce
,
replacements
),
force
.
getForceGroup
());
cu
.
addForce
(
new
ForceInfo
(
force
));
}
double
CudaCalcAmoeba
Harmonic
BondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
CudaCalcAmoebaBondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
return
0.0
;
}
/* -------------------------------------------------------------------------- *
* Amoeba
HarmonicAngle
*
*
Amoeba
AngleForce
*
* -------------------------------------------------------------------------- */
class
CudaCalcAmoeba
Harmonic
AngleForceKernel
::
ForceInfo
:
public
CudaForceInfo
{
class
CudaCalcAmoebaAngleForceKernel
::
ForceInfo
:
public
CudaForceInfo
{
public:
ForceInfo
(
const
Amoeba
Harmonic
AngleForce
&
force
)
:
force
(
force
)
{
ForceInfo
(
const
AmoebaAngleForce
&
force
)
:
force
(
force
)
{
}
int
getNumParticleGroups
()
{
return
force
.
getNumAngles
();
...
...
@@ -151,20 +151,20 @@ public:
return
(
angle1
==
angle2
&&
k1
==
k2
);
}
private:
const
Amoeba
Harmonic
AngleForce
&
force
;
const
AmoebaAngleForce
&
force
;
};
CudaCalcAmoeba
Harmonic
AngleForceKernel
::
CudaCalcAmoeba
Harmonic
AngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
)
:
CalcAmoeba
Harmonic
AngleForceKernel
(
name
,
platform
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
CudaCalcAmoebaAngleForceKernel
::
CudaCalcAmoebaAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
)
:
CalcAmoebaAngleForceKernel
(
name
,
platform
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
}
CudaCalcAmoeba
Harmonic
AngleForceKernel
::~
CudaCalcAmoeba
Harmonic
AngleForceKernel
()
{
CudaCalcAmoebaAngleForceKernel
::~
CudaCalcAmoebaAngleForceKernel
()
{
cu
.
setAsCurrent
();
if
(
params
!=
NULL
)
delete
params
;
}
void
CudaCalcAmoeba
Harmonic
AngleForceKernel
::
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
AngleForce
&
force
)
{
void
CudaCalcAmoebaAngleForceKernel
::
initialize
(
const
System
&
system
,
const
AmoebaAngleForce
&
force
)
{
cu
.
setAsCurrent
();
int
numContexts
=
cu
.
getPlatformData
().
contexts
.
size
();
int
startIndex
=
cu
.
getContextIndex
()
*
force
.
getNumAngles
()
/
numContexts
;
...
...
@@ -184,26 +184,26 @@ void CudaCalcAmoebaHarmonicAngleForceKernel::initialize(const System& system, co
map
<
string
,
string
>
replacements
;
replacements
[
"COMPUTE_FORCE"
]
=
CudaAmoebaKernelSources
::
amoebaAngleForce
;
replacements
[
"PARAMS"
]
=
cu
.
getBondedUtilities
().
addArgument
(
params
->
getDevicePointer
(),
"float2"
);
replacements
[
"CUBIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobal
Harmonic
AngleCubic
());
replacements
[
"QUARTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobal
Harmonic
AngleQuartic
());
replacements
[
"PENTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobal
Harmonic
AnglePentic
());
replacements
[
"SEXTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobal
Harmonic
AngleSextic
());
replacements
[
"CUBIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobalAngleCubic
());
replacements
[
"QUARTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobalAngleQuartic
());
replacements
[
"PENTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobalAnglePentic
());
replacements
[
"SEXTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobalAngleSextic
());
replacements
[
"RAD_TO_DEG"
]
=
cu
.
doubleToString
(
180
/
M_PI
);
cu
.
getBondedUtilities
().
addInteraction
(
atoms
,
cu
.
replaceStrings
(
CudaKernelSources
::
angleForce
,
replacements
),
force
.
getForceGroup
());
cu
.
addForce
(
new
ForceInfo
(
force
));
}
double
CudaCalcAmoeba
Harmonic
AngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
CudaCalcAmoebaAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
return
0.0
;
}
/* -------------------------------------------------------------------------- *
* Amoeba
Harmonic
InPlaneAngle *
*
AmoebaInPlaneAngle
Force
*
* -------------------------------------------------------------------------- */
class
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
ForceInfo
:
public
CudaForceInfo
{
class
CudaCalcAmoebaInPlaneAngleForceKernel
::
ForceInfo
:
public
CudaForceInfo
{
public:
ForceInfo
(
const
Amoeba
Harmonic
InPlaneAngleForce
&
force
)
:
force
(
force
)
{
ForceInfo
(
const
AmoebaInPlaneAngleForce
&
force
)
:
force
(
force
)
{
}
int
getNumParticleGroups
()
{
return
force
.
getNumAngles
();
...
...
@@ -226,20 +226,20 @@ public:
return
(
angle1
==
angle2
&&
k1
==
k2
);
}
private:
const
Amoeba
Harmonic
InPlaneAngleForce
&
force
;
const
AmoebaInPlaneAngleForce
&
force
;
};
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
)
:
CalcAmoeba
Harmonic
InPlaneAngleForceKernel
(
name
,
platform
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
CudaCalcAmoebaInPlaneAngleForceKernel
::
CudaCalcAmoebaInPlaneAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
)
:
CalcAmoebaInPlaneAngleForceKernel
(
name
,
platform
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
}
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
::~
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
()
{
CudaCalcAmoebaInPlaneAngleForceKernel
::~
CudaCalcAmoebaInPlaneAngleForceKernel
()
{
cu
.
setAsCurrent
();
if
(
params
!=
NULL
)
delete
params
;
}
void
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
InPlaneAngleForce
&
force
)
{
void
CudaCalcAmoebaInPlaneAngleForceKernel
::
initialize
(
const
System
&
system
,
const
AmoebaInPlaneAngleForce
&
force
)
{
cu
.
setAsCurrent
();
int
numContexts
=
cu
.
getPlatformData
().
contexts
.
size
();
int
startIndex
=
cu
.
getContextIndex
()
*
force
.
getNumAngles
()
/
numContexts
;
...
...
@@ -258,16 +258,16 @@ void CudaCalcAmoebaHarmonicInPlaneAngleForceKernel::initialize(const System& sys
params
->
upload
(
paramVector
);
map
<
string
,
string
>
replacements
;
replacements
[
"PARAMS"
]
=
cu
.
getBondedUtilities
().
addArgument
(
params
->
getDevicePointer
(),
"float2"
);
replacements
[
"CUBIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobal
Harmonic
InPlaneAngleCubic
());
replacements
[
"QUARTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobal
Harmonic
InPlaneAngleQuartic
());
replacements
[
"PENTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobal
Harmonic
InPlaneAnglePentic
());
replacements
[
"SEXTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobal
Harmonic
InPlaneAngleSextic
());
replacements
[
"CUBIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobalInPlaneAngleCubic
());
replacements
[
"QUARTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobalInPlaneAngleQuartic
());
replacements
[
"PENTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobalInPlaneAnglePentic
());
replacements
[
"SEXTIC_K"
]
=
cu
.
doubleToString
(
force
.
getAmoebaGlobalInPlaneAngleSextic
());
replacements
[
"RAD_TO_DEG"
]
=
cu
.
doubleToString
(
180
/
M_PI
);
cu
.
getBondedUtilities
().
addInteraction
(
atoms
,
cu
.
replaceStrings
(
CudaAmoebaKernelSources
::
amoebaInPlaneForce
,
replacements
),
force
.
getForceGroup
());
cu
.
addForce
(
new
ForceInfo
(
force
));
}
double
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
CudaCalcAmoebaInPlaneAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
return
0.0
;
}
...
...
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.h
View file @
c6ebf6e2
...
...
@@ -40,22 +40,22 @@ namespace OpenMM {
class
CudaCalcAmoebaGeneralizedKirkwoodForceKernel
;
/**
* This kernel is invoked by Amoeba
Harmonic
BondForce to calculate the forces acting on the system and the energy of the system.
* This kernel is invoked by AmoebaBondForce to calculate the forces acting on the system and the energy of the system.
*/
class
CudaCalcAmoeba
Harmonic
BondForceKernel
:
public
CalcAmoeba
Harmonic
BondForceKernel
{
class
CudaCalcAmoebaBondForceKernel
:
public
CalcAmoebaBondForceKernel
{
public:
CudaCalcAmoeba
Harmonic
BondForceKernel
(
std
::
string
name
,
CudaCalcAmoebaBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
);
~
CudaCalcAmoeba
Harmonic
BondForceKernel
();
~
CudaCalcAmoebaBondForceKernel
();
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
* @param force the Amoeba
Harmonic
BondForce this kernel will be used for
* @param force the AmoebaBondForce this kernel will be used for
*/
void
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
BondForce
&
force
);
void
initialize
(
const
System
&
system
,
const
AmoebaBondForce
&
force
);
/**
* Execute the kernel to calculate the forces and/or energy.
*
...
...
@@ -74,19 +74,19 @@ private:
};
/**
* This kernel is invoked by Amoeba
Harmonic
AngleForce to calculate the forces acting on the system and the energy of the system.
* This kernel is invoked by AmoebaAngleForce to calculate the forces acting on the system and the energy of the system.
*/
class
CudaCalcAmoeba
Harmonic
AngleForceKernel
:
public
CalcAmoeba
Harmonic
AngleForceKernel
{
class
CudaCalcAmoebaAngleForceKernel
:
public
CalcAmoebaAngleForceKernel
{
public:
CudaCalcAmoeba
Harmonic
AngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
);
~
CudaCalcAmoeba
Harmonic
AngleForceKernel
();
CudaCalcAmoebaAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
);
~
CudaCalcAmoebaAngleForceKernel
();
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
* @param force the Amoeba
Harmonic
AngleForce this kernel will be used for
* @param force the AmoebaAngleForce this kernel will be used for
*/
void
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
AngleForce
&
force
);
void
initialize
(
const
System
&
system
,
const
AmoebaAngleForce
&
force
);
/**
* Execute the kernel to calculate the forces and/or energy.
*
...
...
@@ -105,19 +105,19 @@ private:
};
/**
* This kernel is invoked by Amoeba
Harmonic
InPlaneAngleForce to calculate the forces acting on the system and the energy of the system.
* This kernel is invoked by AmoebaInPlaneAngleForce to calculate the forces acting on the system and the energy of the system.
*/
class
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
:
public
CalcAmoeba
Harmonic
InPlaneAngleForceKernel
{
class
CudaCalcAmoebaInPlaneAngleForceKernel
:
public
CalcAmoebaInPlaneAngleForceKernel
{
public:
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
);
~
CudaCalcAmoeba
Harmonic
InPlaneAngleForceKernel
();
CudaCalcAmoebaInPlaneAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
System
&
system
);
~
CudaCalcAmoebaInPlaneAngleForceKernel
();
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
* @param force the Amoeba
Harmonic
InPlaneAngleForce this kernel will be used for
* @param force the AmoebaInPlaneAngleForce this kernel will be used for
*/
void
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
InPlaneAngleForce
&
force
);
void
initialize
(
const
System
&
system
,
const
AmoebaInPlaneAngleForce
&
force
);
/**
* Execute the kernel to calculate the forces and/or energy.
*
...
...
plugins/amoeba/platforms/cuda/tests/TestCudaAmoeba
Harmonic
AngleForce.cpp
→
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaAngleForce.cpp
View file @
c6ebf6e2
...
...
@@ -30,7 +30,7 @@
* -------------------------------------------------------------------------- */
/**
* This tests the CUDA implementation of CudaAmoeba
Harmonic
AngleForce.
* This tests the CUDA implementation of CudaAmoebaAngleForce.
*/
#include "openmm/internal/AssertionUtilities.h"
...
...
@@ -120,22 +120,22 @@ static void getPrefactorsGivenAngleCosine( double cosine, double idealAngle, dou
return
;
}
static
void
computeAmoeba
Harmonic
AngleForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
Amoeba
Harmonic
AngleForce
&
amoeba
Harmonic
AngleForce
,
static
void
computeAmoebaAngleForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
AmoebaAngleForce
&
amoebaAngleForce
,
std
::
vector
<
Vec3
>&
forces
,
double
*
energy
,
FILE
*
log
)
{
int
particle1
,
particle2
,
particle3
;
double
idealAngle
;
double
quadraticK
;
amoeba
Harmonic
AngleForce
.
getAngleParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
idealAngle
,
quadraticK
);
amoebaAngleForce
.
getAngleParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
idealAngle
,
quadraticK
);
double
cubicK
=
amoeba
Harmonic
AngleForce
.
getAmoebaGlobal
Harmonic
AngleCubic
();
double
quarticK
=
amoeba
Harmonic
AngleForce
.
getAmoebaGlobal
Harmonic
AngleQuartic
();
double
penticK
=
amoeba
Harmonic
AngleForce
.
getAmoebaGlobal
Harmonic
AnglePentic
();
double
sexticK
=
amoeba
Harmonic
AngleForce
.
getAmoebaGlobal
Harmonic
AngleSextic
();
double
cubicK
=
amoebaAngleForce
.
getAmoebaGlobalAngleCubic
();
double
quarticK
=
amoebaAngleForce
.
getAmoebaGlobalAngleQuartic
();
double
penticK
=
amoebaAngleForce
.
getAmoebaGlobalAnglePentic
();
double
sexticK
=
amoebaAngleForce
.
getAmoebaGlobalAngleSextic
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
AngleForce: bond %d [%d %d %d] ang=%10.3f k=%10.3f [%10.3e %10.3e %10.3e %10.3e]
\n
"
,
(
void
)
fprintf
(
log
,
"computeAmoebaAngleForce: bond %d [%d %d %d] ang=%10.3f k=%10.3f [%10.3e %10.3e %10.3e %10.3e]
\n
"
,
bondIndex
,
particle1
,
particle2
,
particle3
,
idealAngle
,
quadraticK
,
cubicK
,
quarticK
,
penticK
,
sexticK
);
(
void
)
fflush
(
log
);
}
...
...
@@ -202,7 +202,7 @@ static void computeAmoebaHarmonicAngleForce(int bondIndex, std::vector<Vec3>& p
*
energy
+=
energyTerm
;
}
static
void
computeAmoeba
Harmonic
AngleForces
(
Context
&
context
,
Amoeba
Harmonic
AngleForce
&
amoeba
Harmonic
AngleForce
,
static
void
computeAmoebaAngleForces
(
Context
&
context
,
AmoebaAngleForce
&
amoebaAngleForce
,
std
::
vector
<
Vec3
>&
expectedForces
,
double
*
expectedEnergy
,
FILE
*
log
)
{
// get positions and zero forces
...
...
@@ -218,13 +218,13 @@ static void computeAmoebaHarmonicAngleForces( Context& context, AmoebaHarmonicAn
// calculates forces/energy
*
expectedEnergy
=
0.0
;
for
(
int
ii
=
0
;
ii
<
amoeba
Harmonic
AngleForce
.
getNumAngles
();
ii
++
){
computeAmoeba
Harmonic
AngleForce
(
ii
,
positions
,
amoeba
Harmonic
AngleForce
,
expectedForces
,
expectedEnergy
,
log
);
for
(
int
ii
=
0
;
ii
<
amoebaAngleForce
.
getNumAngles
();
ii
++
){
computeAmoebaAngleForce
(
ii
,
positions
,
amoebaAngleForce
,
expectedForces
,
expectedEnergy
,
log
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
AngleForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
(
void
)
fprintf
(
log
,
"computeAmoebaAngleForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%14.7e %14.7e %14.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
]
);
}
...
...
@@ -236,19 +236,19 @@ static void computeAmoebaHarmonicAngleForces( Context& context, AmoebaHarmonicAn
}
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
Amoeba
Harmonic
AngleForce
&
amoeba
Harmonic
AngleForce
,
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
AmoebaAngleForce
&
amoebaAngleForce
,
double
tolerance
,
const
std
::
string
&
idString
,
FILE
*
log
)
{
std
::
vector
<
Vec3
>
expectedForces
;
double
expectedEnergy
;
computeAmoeba
Harmonic
AngleForces
(
context
,
amoeba
Harmonic
AngleForce
,
expectedForces
,
&
expectedEnergy
,
log
);
computeAmoebaAngleForces
(
context
,
amoebaAngleForce
,
expectedForces
,
&
expectedEnergy
,
log
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
AngleForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
(
void
)
fprintf
(
log
,
"computeAmoebaAngleForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%14.7e %14.7e %14.7e] [%14.7e %14.7e %14.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
],
forces
[
ii
][
0
],
forces
[
ii
][
1
],
forces
[
ii
][
2
]
);
...
...
@@ -273,7 +273,7 @@ void testOneAngle( FILE* log ) {
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
Amoeba
Harmonic
AngleForce
*
amoeba
Harmonic
AngleForce
=
new
Amoeba
Harmonic
AngleForce
();
AmoebaAngleForce
*
amoebaAngleForce
=
new
AmoebaAngleForce
();
double
angle
=
100.0
;
double
quadraticK
=
1.0
;
...
...
@@ -281,14 +281,14 @@ void testOneAngle( FILE* log ) {
double
quarticK
=
1.0e-02
;
double
penticK
=
1.0e-03
;
double
sexticK
=
1.0e-04
;
amoeba
Harmonic
AngleForce
->
addAngle
(
0
,
1
,
2
,
angle
,
quadraticK
);
amoebaAngleForce
->
addAngle
(
0
,
1
,
2
,
angle
,
quadraticK
);
amoeba
Harmonic
AngleForce
->
setAmoebaGlobal
Harmonic
AngleCubic
(
cubicK
);
amoeba
Harmonic
AngleForce
->
setAmoebaGlobal
Harmonic
AngleQuartic
(
quarticK
);
amoeba
Harmonic
AngleForce
->
setAmoebaGlobal
Harmonic
AnglePentic
(
penticK
);
amoeba
Harmonic
AngleForce
->
setAmoebaGlobal
Harmonic
AngleSextic
(
sexticK
);
amoebaAngleForce
->
setAmoebaGlobalAngleCubic
(
cubicK
);
amoebaAngleForce
->
setAmoebaGlobalAngleQuartic
(
quarticK
);
amoebaAngleForce
->
setAmoebaGlobalAnglePentic
(
penticK
);
amoebaAngleForce
->
setAmoebaGlobalAngleSextic
(
sexticK
);
system
.
addForce
(
amoeba
Harmonic
AngleForce
);
system
.
addForce
(
amoebaAngleForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"CUDA"
));
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -298,14 +298,14 @@ void testOneAngle( FILE* log ) {
positions
[
2
]
=
Vec3
(
0
,
0
,
1
);
context
.
setPositions
(
positions
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoeba
Harmonic
AngleForce
,
TOL
,
"testOneAngle"
,
log
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaAngleForce
,
TOL
,
"testOneAngle"
,
log
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[]
)
{
try
{
std
::
cout
<<
"TestCudaAmoeba
Harmonic
AngleForce running test..."
<<
std
::
endl
;
std
::
cout
<<
"TestCudaAmoebaAngleForce running test..."
<<
std
::
endl
;
registerAmoebaCudaKernelFactories
();
FILE
*
log
=
NULL
;
testOneAngle
(
log
);
...
...
plugins/amoeba/platforms/cuda/tests/TestCudaAmoeba
Harmonic
BondForce.cpp
→
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaBondForce.cpp
View file @
c6ebf6e2
...
...
@@ -30,7 +30,7 @@
* -------------------------------------------------------------------------- */
/**
* This tests the Cuda implementation of
Harmonic
BondForce.
* This tests the Cuda implementation of
Amoeba
BondForce.
*/
#include "openmm/internal/AssertionUtilities.h"
...
...
@@ -47,15 +47,15 @@ using namespace OpenMM;
extern
"C"
void
registerAmoebaCudaKernelFactories
();
const
double
TOL
=
1e-5
;
static
void
computeAmoeba
Harmonic
BondForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
Amoeba
Harmonic
BondForce
&
amoeba
Harmonic
BondForce
,
static
void
computeAmoebaBondForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
AmoebaBondForce
&
amoebaBondForce
,
std
::
vector
<
Vec3
>&
forces
,
double
*
energy
)
{
int
particle1
,
particle2
;
double
bondLength
;
double
quadraticK
;
double
cubicK
=
amoeba
Harmonic
BondForce
.
getAmoebaGlobal
Harmonic
BondCubic
();
double
quarticK
=
amoeba
Harmonic
BondForce
.
getAmoebaGlobal
Harmonic
BondQuartic
();
amoeba
Harmonic
BondForce
.
getBondParameters
(
bondIndex
,
particle1
,
particle2
,
bondLength
,
quadraticK
);
double
cubicK
=
amoebaBondForce
.
getAmoebaGlobalBondCubic
();
double
quarticK
=
amoebaBondForce
.
getAmoebaGlobalBondQuartic
();
amoebaBondForce
.
getBondParameters
(
bondIndex
,
particle1
,
particle2
,
bondLength
,
quadraticK
);
double
deltaR
[
3
];
double
r2
=
0.0
;
...
...
@@ -83,7 +83,7 @@ static void computeAmoebaHarmonicBondForce(int bondIndex, std::vector<Vec3>& po
}
static
void
computeAmoeba
Harmonic
BondForces
(
Context
&
context
,
Amoeba
Harmonic
BondForce
&
amoeba
Harmonic
BondForce
,
static
void
computeAmoebaBondForces
(
Context
&
context
,
AmoebaBondForce
&
amoebaBondForce
,
std
::
vector
<
Vec3
>&
expectedForces
,
double
*
expectedEnergy
,
FILE
*
log
)
{
// get positions and zero forces
...
...
@@ -99,13 +99,13 @@ static void computeAmoebaHarmonicBondForces( Context& context, AmoebaHarmonicBon
// calculates forces/energy
*
expectedEnergy
=
0.0
;
for
(
int
ii
=
0
;
ii
<
amoeba
Harmonic
BondForce
.
getNumBonds
();
ii
++
){
computeAmoeba
Harmonic
BondForce
(
ii
,
positions
,
amoeba
Harmonic
BondForce
,
expectedForces
,
expectedEnergy
);
for
(
int
ii
=
0
;
ii
<
amoebaBondForce
.
getNumBonds
();
ii
++
){
computeAmoebaBondForce
(
ii
,
positions
,
amoebaBondForce
,
expectedForces
,
expectedEnergy
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
BondForces: expected energy=%15.7e
\n
"
,
*
expectedEnergy
);
(
void
)
fprintf
(
log
,
"computeAmoebaBondForces: expected energy=%15.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%15.7e %15.7e %15.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
]
);
}
...
...
@@ -116,18 +116,18 @@ static void computeAmoebaHarmonicBondForces( Context& context, AmoebaHarmonicBon
}
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
Amoeba
Harmonic
BondForce
&
amoeba
Harmonic
BondForce
,
double
tolerance
,
const
std
::
string
&
idString
,
FILE
*
log
)
{
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
AmoebaBondForce
&
amoebaBondForce
,
double
tolerance
,
const
std
::
string
&
idString
,
FILE
*
log
)
{
std
::
vector
<
Vec3
>
expectedForces
;
double
expectedEnergy
;
computeAmoeba
Harmonic
BondForces
(
context
,
amoeba
Harmonic
BondForce
,
expectedForces
,
&
expectedEnergy
,
NULL
);
computeAmoebaBondForces
(
context
,
amoebaBondForce
,
expectedForces
,
&
expectedEnergy
,
NULL
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
BondForces: expected energy=%15.7e %15.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
(
void
)
fprintf
(
log
,
"computeAmoebaBondForces: expected energy=%15.7e %15.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%15.7e %15.7e %15.7e] [%15.7e %15.7e %15.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
],
forces
[
ii
][
0
],
forces
[
ii
][
1
],
forces
[
ii
][
2
]
);
...
...
@@ -151,17 +151,17 @@ void testOneBond( FILE* log ) {
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
double
bondLength
=
1.5
;
double
quadraticK
=
1.0
;
double
cubicK
=
2.0
;
double
quarticicK
=
3.0
;
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
cubicK
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
quarticicK
);
amoeba
Harmonic
BondForce
->
addBond
(
0
,
1
,
bondLength
,
quadraticK
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
cubicK
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
quarticicK
);
amoebaBondForce
->
addBond
(
0
,
1
,
bondLength
,
quadraticK
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
system
.
addForce
(
amoebaBondForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"CUDA"
));
std
::
vector
<
Vec3
>
positions
(
2
);
...
...
@@ -169,7 +169,7 @@ void testOneBond( FILE* log ) {
positions
[
1
]
=
Vec3
(
0
,
0
,
0
);
context
.
setPositions
(
positions
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoeba
Harmonic
BondForce
,
TOL
,
"testOneBond"
,
log
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaBondForce
,
TOL
,
"testOneBond"
,
log
);
}
void
testTwoBond
(
FILE
*
log
)
{
...
...
@@ -182,18 +182,18 @@ void testTwoBond( FILE* log ) {
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
double
bondLength
=
1.5
;
double
quadraticK
=
1.0
;
double
cubicK
=
2.0
;
double
quarticicK
=
3.0
;
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
cubicK
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
quarticicK
);
amoeba
Harmonic
BondForce
->
addBond
(
0
,
1
,
bondLength
,
quadraticK
);
amoeba
Harmonic
BondForce
->
addBond
(
1
,
2
,
bondLength
,
quadraticK
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
cubicK
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
quarticicK
);
amoebaBondForce
->
addBond
(
0
,
1
,
bondLength
,
quadraticK
);
amoebaBondForce
->
addBond
(
1
,
2
,
bondLength
,
quadraticK
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
system
.
addForce
(
amoebaBondForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"CUDA"
));
//Context context(system, integrator, platform );
std
::
vector
<
Vec3
>
positions
(
3
);
...
...
@@ -203,13 +203,13 @@ void testTwoBond( FILE* log ) {
positions
[
2
]
=
Vec3
(
1
,
0
,
1
);
context
.
setPositions
(
positions
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoeba
Harmonic
BondForce
,
TOL
,
"testTwoBond"
,
log
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaBondForce
,
TOL
,
"testTwoBond"
,
log
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[]
)
{
try
{
std
::
cout
<<
"TestCudaAmoeba
Harmonic
BondForce running test..."
<<
std
::
endl
;
std
::
cout
<<
"TestCudaAmoebaBondForce running test..."
<<
std
::
endl
;
registerAmoebaCudaKernelFactories
();
FILE
*
log
=
NULL
;
testTwoBond
(
log
);
...
...
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaGeneralizedKirkwoodForce.cpp
View file @
c6ebf6e2
...
...
@@ -278,20 +278,20 @@ static void setupAndGetForcesEnergyMultipoleAmmonia( AmoebaMultipoleForce::Polar
// 1-2 bonds needed
/*
Amoeba
Harmonic
BondForce*
a
moeba
Harmonic
BondForce = new Amoeba
Harmonic
BondForce();
AmoebaBondForce*
A
moebaBondForce = new AmoebaBondForce();
// addBond: particle1, particle2, length, quadraticK
a
moeba
Harmonic
BondForce->addBond( 0, 1, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->addBond( 0, 2, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->addBond( 0, 3, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->addBond( 0, 1, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->addBond( 0, 2, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->addBond( 0, 3, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->addBond( 4, 5, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->addBond( 4, 6, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->addBond( 4, 7, 0.0000000e+00, 0.0000000e+00 );
a
moeba
Harmonic
BondForce->setAmoebaGlobal
Harmonic
BondCubic( -2.5500000e+01 );
a
moeba
Harmonic
BondForce->setAmoebaGlobal
Harmonic
BondQuartic( 3.7931250e+02 );
system.addForce(
a
moeba
Harmonic
BondForce);
A
moebaBondForce->addBond( 4, 5, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->addBond( 4, 6, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->addBond( 4, 7, 0.0000000e+00, 0.0000000e+00 );
A
moebaBondForce->setAmoebaGlobalBondCubic( -2.5500000e+01 );
A
moebaBondForce->setAmoebaGlobalBondQuartic( 3.7931250e+02 );
system.addForce(
A
moebaBondForce);
*/
std::vector<Vec3> positions(numberOfParticles);
...
...
plugins/amoeba/platforms/cuda/tests/TestCudaAmoeba
Harmonic
InPlaneAngleForce.cpp
→
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaInPlaneAngleForce.cpp
View file @
c6ebf6e2
...
...
@@ -30,7 +30,7 @@
* -------------------------------------------------------------------------- */
/**
* This tests the CUDA implementation of
Cuda
Amoeba
Harmonic
InPlaneAngleForce.
* This tests the CUDA implementation of AmoebaInPlaneAngleForce.
*/
#include "openmm/internal/AssertionUtilities.h"
...
...
@@ -121,22 +121,22 @@ static void getPrefactorsGivenInPlaneAngleCosine( double cosine, double idealInP
return
;
}
static
void
computeAmoeba
Harmonic
InPlaneAngleForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
Amoeba
Harmonic
InPlaneAngleForce
&
amoeba
Harmonic
InPlaneAngleForce
,
static
void
computeAmoebaInPlaneAngleForce
(
int
bondIndex
,
std
::
vector
<
Vec3
>&
positions
,
AmoebaInPlaneAngleForce
&
amoebaInPlaneAngleForce
,
std
::
vector
<
Vec3
>&
forces
,
double
*
energy
,
FILE
*
log
)
{
int
particle1
,
particle2
,
particle3
,
particle4
;
double
idealInPlaneAngle
;
double
quadraticK
;
amoeba
Harmonic
InPlaneAngleForce
.
getAngleParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
idealInPlaneAngle
,
quadraticK
);
amoebaInPlaneAngleForce
.
getAngleParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
idealInPlaneAngle
,
quadraticK
);
double
cubicK
=
amoeba
Harmonic
InPlaneAngleForce
.
getAmoebaGlobal
Harmonic
InPlaneAngleCubic
();
double
quarticK
=
amoeba
Harmonic
InPlaneAngleForce
.
getAmoebaGlobal
Harmonic
InPlaneAngleQuartic
();
double
penticK
=
amoeba
Harmonic
InPlaneAngleForce
.
getAmoebaGlobal
Harmonic
InPlaneAnglePentic
();
double
sexticK
=
amoeba
Harmonic
InPlaneAngleForce
.
getAmoebaGlobal
Harmonic
InPlaneAngleSextic
();
double
cubicK
=
amoebaInPlaneAngleForce
.
getAmoebaGlobalInPlaneAngleCubic
();
double
quarticK
=
amoebaInPlaneAngleForce
.
getAmoebaGlobalInPlaneAngleQuartic
();
double
penticK
=
amoebaInPlaneAngleForce
.
getAmoebaGlobalInPlaneAnglePentic
();
double
sexticK
=
amoebaInPlaneAngleForce
.
getAmoebaGlobalInPlaneAngleSextic
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
InPlaneAngleForce: bond %d [%d %d %d %d] ang=%10.3f k=%10.3f [%10.3e %10.3e %10.3e %10.3e]
\n
"
,
(
void
)
fprintf
(
log
,
"computeAmoebaInPlaneAngleForce: bond %d [%d %d %d %d] ang=%10.3f k=%10.3f [%10.3e %10.3e %10.3e %10.3e]
\n
"
,
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
idealInPlaneAngle
,
quadraticK
,
cubicK
,
quarticK
,
penticK
,
sexticK
);
(
void
)
fflush
(
log
);
}
...
...
@@ -183,7 +183,7 @@ static void computeAmoebaHarmonicInPlaneAngleForce(int bondIndex, std::vector<V
if
(
rAp2
<=
0.0
&&
rCp2
<=
0.0
){
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
InPlaneAngleForce: rAp2 or rCp2 <= 0.0
\n
"
);
(
void
)
fprintf
(
log
,
"computeAmoebaInPlaneAngleForce: rAp2 or rCp2 <= 0.0
\n
"
);
(
void
)
fflush
(
log
);
}
#endif
...
...
@@ -279,7 +279,7 @@ static void computeAmoebaHarmonicInPlaneAngleForce(int bondIndex, std::vector<V
}
static
void
computeAmoeba
Harmonic
InPlaneAngleForces
(
Context
&
context
,
Amoeba
Harmonic
InPlaneAngleForce
&
amoeba
Harmonic
InPlaneAngleForce
,
static
void
computeAmoebaInPlaneAngleForces
(
Context
&
context
,
AmoebaInPlaneAngleForce
&
amoebaInPlaneAngleForce
,
std
::
vector
<
Vec3
>&
expectedForces
,
double
*
expectedEnergy
,
FILE
*
log
)
{
// get positions and zero forces
...
...
@@ -295,13 +295,13 @@ static void computeAmoebaHarmonicInPlaneAngleForces( Context& context, AmoebaHar
// calculates forces/energy
*
expectedEnergy
=
0.0
;
for
(
int
ii
=
0
;
ii
<
amoeba
Harmonic
InPlaneAngleForce
.
getNumAngles
();
ii
++
){
computeAmoeba
Harmonic
InPlaneAngleForce
(
ii
,
positions
,
amoeba
Harmonic
InPlaneAngleForce
,
expectedForces
,
expectedEnergy
,
log
);
for
(
int
ii
=
0
;
ii
<
amoebaInPlaneAngleForce
.
getNumAngles
();
ii
++
){
computeAmoebaInPlaneAngleForce
(
ii
,
positions
,
amoebaInPlaneAngleForce
,
expectedForces
,
expectedEnergy
,
log
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
InPlaneAngleForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
(
void
)
fprintf
(
log
,
"computeAmoebaInPlaneAngleForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%14.7e %14.7e %14.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
]
);
}
...
...
@@ -312,19 +312,19 @@ static void computeAmoebaHarmonicInPlaneAngleForces( Context& context, AmoebaHar
}
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
Amoeba
Harmonic
InPlaneAngleForce
&
amoeba
Harmonic
InPlaneAngleForce
,
void
compareWithExpectedForceAndEnergy
(
Context
&
context
,
AmoebaInPlaneAngleForce
&
amoebaInPlaneAngleForce
,
double
tolerance
,
const
std
::
string
&
idString
,
FILE
*
log
)
{
std
::
vector
<
Vec3
>
expectedForces
;
double
expectedEnergy
;
computeAmoeba
Harmonic
InPlaneAngleForces
(
context
,
amoeba
Harmonic
InPlaneAngleForce
,
expectedForces
,
&
expectedEnergy
,
log
);
computeAmoebaInPlaneAngleForces
(
context
,
amoebaInPlaneAngleForce
,
expectedForces
,
&
expectedEnergy
,
log
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoeba
Harmonic
InPlaneAngleForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
(
void
)
fprintf
(
log
,
"computeAmoebaInPlaneAngleForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
(
void
)
fprintf
(
log
,
"%6u [%14.7e %14.7e %14.7e] [%14.7e %14.7e %14.7e]
\n
"
,
ii
,
expectedForces
[
ii
][
0
],
expectedForces
[
ii
][
1
],
expectedForces
[
ii
][
2
],
forces
[
ii
][
0
],
forces
[
ii
][
1
],
forces
[
ii
][
2
]
);
...
...
@@ -349,7 +349,7 @@ void testOneAngle( FILE* log ) {
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
Amoeba
Harmonic
InPlaneAngleForce
*
amoeba
Harmonic
InPlaneAngleForce
=
new
Amoeba
Harmonic
InPlaneAngleForce
();
AmoebaInPlaneAngleForce
*
amoebaInPlaneAngleForce
=
new
AmoebaInPlaneAngleForce
();
double
angle
=
65.0
;
double
quadraticK
=
1.0
;
...
...
@@ -357,14 +357,14 @@ void testOneAngle( FILE* log ) {
double
quarticK
=
0.0e-02
;
double
penticK
=
0.0e-03
;
double
sexticK
=
0.0e-04
;
amoeba
Harmonic
InPlaneAngleForce
->
addAngle
(
0
,
1
,
2
,
3
,
angle
,
quadraticK
);
amoebaInPlaneAngleForce
->
addAngle
(
0
,
1
,
2
,
3
,
angle
,
quadraticK
);
amoeba
Harmonic
InPlaneAngleForce
->
setAmoebaGlobal
Harmonic
InPlaneAngleCubic
(
cubicK
);
amoeba
Harmonic
InPlaneAngleForce
->
setAmoebaGlobal
Harmonic
InPlaneAngleQuartic
(
quarticK
);
amoeba
Harmonic
InPlaneAngleForce
->
setAmoebaGlobal
Harmonic
InPlaneAnglePentic
(
penticK
);
amoeba
Harmonic
InPlaneAngleForce
->
setAmoebaGlobal
Harmonic
InPlaneAngleSextic
(
sexticK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAngleCubic
(
cubicK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAngleQuartic
(
quarticK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAnglePentic
(
penticK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAngleSextic
(
sexticK
);
system
.
addForce
(
amoeba
Harmonic
InPlaneAngleForce
);
system
.
addForce
(
amoebaInPlaneAngleForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"CUDA"
));
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -375,14 +375,14 @@ void testOneAngle( FILE* log ) {
positions
[
3
]
=
Vec3
(
1
,
1
,
1
);
context
.
setPositions
(
positions
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoeba
Harmonic
InPlaneAngleForce
,
TOL
,
"testOneInPlaneAngle"
,
log
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaInPlaneAngleForce
,
TOL
,
"testOneInPlaneAngle"
,
log
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[]
)
{
try
{
std
::
cout
<<
"TestCudaAmoeba
Harmonic
InPlaneAngleForce running test..."
<<
std
::
endl
;
std
::
cout
<<
"TestCudaAmoebaInPlaneAngleForce running test..."
<<
std
::
endl
;
registerAmoebaCudaKernelFactories
();
FILE
*
log
=
NULL
;
testOneAngle
(
NULL
);
...
...
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaMultipoleForce.cpp
View file @
c6ebf6e2
...
...
@@ -275,20 +275,20 @@ static void setupAndGetForcesEnergyMultipoleAmmonia( AmoebaMultipoleForce::Nonbo
// 1-2 bonds needed
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
// addBond: particle1, particle2, length, quadraticK
amoeba
Harmonic
BondForce
->
addBond
(
0
,
1
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
0
,
2
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
0
,
3
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
0
,
1
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
0
,
2
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
0
,
3
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
4
,
5
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
4
,
6
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
4
,
7
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
-
2.5500000e+01
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
amoebaBondForce
->
addBond
(
4
,
5
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
4
,
6
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
4
,
7
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
-
2.5500000e+01
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoebaBondForce
);
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -612,18 +612,18 @@ static void setupAndGetForcesEnergyMultipoleWater( AmoebaMultipoleForce::Nonbond
// 1-2 bonds needed
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
// addBond: particle1, particle2, length, quadraticK
for
(
unsigned
int
jj
=
0
;
jj
<
numberOfParticles
;
jj
+=
3
){
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
}
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
-
2.5500000e+01
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
-
2.5500000e+01
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoebaBondForce
);
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -837,18 +837,18 @@ static void testQuadrupoleValidation( FILE* log ){
}
*/
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
// addBond: particle1, particle2, length, quadraticK
for
(
unsigned
int
jj
=
0
;
jj
<
numberOfParticles
;
jj
+=
3
){
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
}
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
-
2.5500000e+01
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
-
2.5500000e+01
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoebaBondForce
);
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -1090,18 +1090,18 @@ static void setupAndGetForcesEnergyMultipoleIonsAndWater( AmoebaMultipoleForce::
// 1-2 bonds needed
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
// addBond: particle1, particle2, length, quadraticK
for
(
unsigned
int
jj
=
2
;
jj
<
numberOfParticles
;
jj
+=
3
){
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
}
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
-
2.5500000e+01
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
-
2.5500000e+01
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
3.7931250e+02
);
system
.
addForce
(
amoebaBondForce
);
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
@@ -1322,18 +1322,18 @@ static void setupAndGetForcesEnergyMultipoleLargeWater( AmoebaMultipoleForce::No
// 1-2 bonds needed
Amoeba
Harmonic
BondForce
*
amoeba
Harmonic
BondForce
=
new
Amoeba
Harmonic
BondForce
();
AmoebaBondForce
*
amoebaBondForce
=
new
AmoebaBondForce
();
// addBond: particle1, particle2, length, quadraticK
for
(
unsigned
int
jj
=
0
;
jj
<
numberOfParticles
;
jj
+=
3
){
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoeba
Harmonic
BondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
1
,
0.0000000e+00
,
0.0000000e+00
);
amoebaBondForce
->
addBond
(
jj
,
jj
+
2
,
0.0000000e+00
,
0.0000000e+00
);
}
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondCubic
(
0.0
);
amoeba
Harmonic
BondForce
->
setAmoebaGlobal
Harmonic
BondQuartic
(
0.0
);
system
.
addForce
(
amoeba
Harmonic
BondForce
);
amoebaBondForce
->
setAmoebaGlobalBondCubic
(
0.0
);
amoebaBondForce
->
setAmoebaGlobalBondQuartic
(
0.0
);
system
.
addForce
(
amoebaBondForce
);
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
...
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernelFactory.cpp
View file @
c6ebf6e2
...
...
@@ -52,9 +52,9 @@ extern "C" void initAmoebaReferenceKernels() {
AmoebaReferenceKernelFactory
*
factory
=
new
AmoebaReferenceKernelFactory
();
platform
.
registerKernelFactory
(
CalcAmoeba
Harmonic
BondForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoeba
Harmonic
AngleForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaBondForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaAngleForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaInPlaneAngleForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaPiTorsionForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaStretchBendForceKernel
::
Name
(),
factory
);
platform
.
registerKernelFactory
(
CalcAmoebaOutOfPlaneBendForceKernel
::
Name
(),
factory
);
...
...
@@ -74,14 +74,14 @@ KernelImpl* AmoebaReferenceKernelFactory::createKernelImpl(std::string name, con
// create AmoebaReferenceData object if contextToAmoebaDataMap does not contain
// key equal to current context
if
(
name
==
CalcAmoeba
Harmonic
BondForceKernel
::
Name
())
return
new
ReferenceCalcAmoeba
Harmonic
BondForceKernel
(
name
,
platform
,
context
.
getSystem
());
if
(
name
==
CalcAmoebaBondForceKernel
::
Name
())
return
new
ReferenceCalcAmoebaBondForceKernel
(
name
,
platform
,
context
.
getSystem
());
if
(
name
==
CalcAmoeba
Harmonic
AngleForceKernel
::
Name
())
return
new
ReferenceCalcAmoeba
Harmonic
AngleForceKernel
(
name
,
platform
,
context
.
getSystem
());
if
(
name
==
CalcAmoebaAngleForceKernel
::
Name
())
return
new
ReferenceCalcAmoebaAngleForceKernel
(
name
,
platform
,
context
.
getSystem
());
if
(
name
==
CalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
Name
())
return
new
ReferenceCalcAmoeba
Harmonic
InPlaneAngleForceKernel
(
name
,
platform
,
context
.
getSystem
());
if
(
name
==
CalcAmoebaInPlaneAngleForceKernel
::
Name
())
return
new
ReferenceCalcAmoebaInPlaneAngleForceKernel
(
name
,
platform
,
context
.
getSystem
());
if
(
name
==
CalcAmoebaPiTorsionForceKernel
::
Name
())
return
new
ReferenceCalcAmoebaPiTorsionForceKernel
(
name
,
platform
,
context
.
getSystem
());
...
...
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
View file @
c6ebf6e2
...
...
@@ -25,9 +25,9 @@
* -------------------------------------------------------------------------- */
#include "AmoebaReferenceKernels.h"
#include "AmoebaReference
Harmonic
BondForce.h"
#include "AmoebaReference
Harmonic
AngleForce.h"
#include "AmoebaReference
Harmonic
InPlaneAngleForce.h"
#include "AmoebaReferenceBondForce.h"
#include "AmoebaReferenceAngleForce.h"
#include "AmoebaReferenceInPlaneAngleForce.h"
#include "AmoebaReferencePiTorsionForce.h"
#include "AmoebaReferenceStretchBendForce.h"
#include "AmoebaReferenceOutOfPlaneBendForce.h"
...
...
@@ -72,14 +72,14 @@ static RealVec& extractBoxSize(ContextImpl& context) {
// ***************************************************************************
ReferenceCalcAmoeba
Harmonic
BondForceKernel
::
ReferenceCalcAmoeba
Harmonic
BondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
)
:
CalcAmoeba
Harmonic
BondForceKernel
(
name
,
platform
),
system
(
system
)
{
ReferenceCalcAmoebaBondForceKernel
::
ReferenceCalcAmoebaBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
)
:
CalcAmoebaBondForceKernel
(
name
,
platform
),
system
(
system
)
{
}
ReferenceCalcAmoeba
Harmonic
BondForceKernel
::~
ReferenceCalcAmoeba
Harmonic
BondForceKernel
()
{
ReferenceCalcAmoebaBondForceKernel
::~
ReferenceCalcAmoebaBondForceKernel
()
{
}
void
ReferenceCalcAmoeba
Harmonic
BondForceKernel
::
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
BondForce
&
force
)
{
void
ReferenceCalcAmoebaBondForceKernel
::
initialize
(
const
System
&
system
,
const
AmoebaBondForce
&
force
)
{
numBonds
=
force
.
getNumBonds
();
for
(
int
ii
=
0
;
ii
<
numBonds
;
ii
++
)
{
...
...
@@ -93,30 +93,30 @@ void ReferenceCalcAmoebaHarmonicBondForceKernel::initialize(const System& system
length
.
push_back
(
static_cast
<
RealOpenMM
>
(
lengthValue
)
);
kQuadratic
.
push_back
(
static_cast
<
RealOpenMM
>
(
kValue
)
);
}
global
Harmonic
BondCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobal
Harmonic
BondCubic
());
global
Harmonic
BondQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobal
Harmonic
BondQuartic
());
globalBondCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalBondCubic
());
globalBondQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalBondQuartic
());
}
double
ReferenceCalcAmoeba
Harmonic
BondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcAmoebaBondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReference
Harmonic
BondForce
amoebaReference
Harmonic
BondForce
;
RealOpenMM
energy
=
amoebaReference
Harmonic
BondForce
.
calculateForceAndEnergy
(
numBonds
,
posData
,
particle1
,
particle2
,
length
,
kQuadratic
,
global
Harmonic
BondCubic
,
global
Harmonic
BondQuartic
,
AmoebaReferenceBondForce
amoebaReferenceBondForce
;
RealOpenMM
energy
=
amoebaReferenceBondForce
.
calculateForceAndEnergy
(
numBonds
,
posData
,
particle1
,
particle2
,
length
,
kQuadratic
,
globalBondCubic
,
globalBondQuartic
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
// ***************************************************************************
ReferenceCalcAmoeba
Harmonic
AngleForceKernel
::
ReferenceCalcAmoeba
Harmonic
AngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
)
:
CalcAmoeba
Harmonic
AngleForceKernel
(
name
,
platform
),
system
(
system
)
{
ReferenceCalcAmoebaAngleForceKernel
::
ReferenceCalcAmoebaAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
)
:
CalcAmoebaAngleForceKernel
(
name
,
platform
),
system
(
system
)
{
}
ReferenceCalcAmoeba
Harmonic
AngleForceKernel
::~
ReferenceCalcAmoeba
Harmonic
AngleForceKernel
()
{
ReferenceCalcAmoebaAngleForceKernel
::~
ReferenceCalcAmoebaAngleForceKernel
()
{
}
void
ReferenceCalcAmoeba
Harmonic
AngleForceKernel
::
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
AngleForce
&
force
)
{
void
ReferenceCalcAmoebaAngleForceKernel
::
initialize
(
const
System
&
system
,
const
AmoebaAngleForce
&
force
)
{
numAngles
=
force
.
getNumAngles
();
...
...
@@ -130,29 +130,29 @@ void ReferenceCalcAmoebaHarmonicAngleForceKernel::initialize(const System& syste
angle
.
push_back
(
static_cast
<
RealOpenMM
>
(
angleValue
)
);
kQuadratic
.
push_back
(
static_cast
<
RealOpenMM
>
(
k
)
);
}
global
Harmonic
AngleCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobal
Harmonic
AngleCubic
());
global
Harmonic
AngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobal
Harmonic
AngleQuartic
());
global
Harmonic
AnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobal
Harmonic
AnglePentic
());
global
Harmonic
AngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobal
Harmonic
AngleSextic
());
globalAngleCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAngleCubic
());
globalAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAngleQuartic
());
globalAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAnglePentic
());
globalAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAngleSextic
());
}
double
ReferenceCalcAmoeba
Harmonic
AngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcAmoebaAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReference
Harmonic
AngleForce
amoebaReference
Harmonic
AngleForce
;
RealOpenMM
energy
=
amoebaReference
Harmonic
AngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
angle
,
kQuadratic
,
global
Harmonic
AngleCubic
,
global
Harmonic
AngleQuartic
,
global
Harmonic
AnglePentic
,
global
Harmonic
AngleSextic
,
forceData
);
AmoebaReferenceAngleForce
amoebaReferenceAngleForce
;
RealOpenMM
energy
=
amoebaReferenceAngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
angle
,
kQuadratic
,
globalAngleCubic
,
globalAngleQuartic
,
globalAnglePentic
,
globalAngleSextic
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
ReferenceCalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
ReferenceCalcAmoeba
Harmonic
InPlaneAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
)
:
CalcAmoeba
Harmonic
InPlaneAngleForceKernel
(
name
,
platform
),
system
(
system
)
{
ReferenceCalcAmoebaInPlaneAngleForceKernel
::
ReferenceCalcAmoebaInPlaneAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
)
:
CalcAmoebaInPlaneAngleForceKernel
(
name
,
platform
),
system
(
system
)
{
}
ReferenceCalcAmoeba
Harmonic
InPlaneAngleForceKernel
::~
ReferenceCalcAmoeba
Harmonic
InPlaneAngleForceKernel
()
{
ReferenceCalcAmoebaInPlaneAngleForceKernel
::~
ReferenceCalcAmoebaInPlaneAngleForceKernel
()
{
}
void
ReferenceCalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
InPlaneAngleForce
&
force
)
{
void
ReferenceCalcAmoebaInPlaneAngleForceKernel
::
initialize
(
const
System
&
system
,
const
AmoebaInPlaneAngleForce
&
force
)
{
numAngles
=
force
.
getNumAngles
();
for
(
int
ii
=
0
;
ii
<
numAngles
;
ii
++
)
{
...
...
@@ -166,20 +166,20 @@ void ReferenceCalcAmoebaHarmonicInPlaneAngleForceKernel::initialize(const System
angle
.
push_back
(
static_cast
<
RealOpenMM
>
(
angleValue
)
);
kQuadratic
.
push_back
(
static_cast
<
RealOpenMM
>
(
k
)
);
}
global
Harmonic
InPlaneAngleCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobal
Harmonic
InPlaneAngleCubic
());
global
Harmonic
InPlaneAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobal
Harmonic
InPlaneAngleQuartic
());
global
Harmonic
InPlaneAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobal
Harmonic
InPlaneAnglePentic
());
global
Harmonic
InPlaneAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobal
Harmonic
InPlaneAngleSextic
());
globalInPlaneAngleCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAngleCubic
());
globalInPlaneAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAngleQuartic
());
globalInPlaneAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAnglePentic
());
globalInPlaneAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAngleSextic
());
}
double
ReferenceCalcAmoeba
Harmonic
InPlaneAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcAmoebaInPlaneAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReference
Harmonic
InPlaneAngleForce
amoebaReference
Harmonic
InPlaneAngleForce
;
RealOpenMM
energy
=
amoebaReference
Harmonic
InPlaneAngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
angle
,
kQuadratic
,
global
Harmonic
InPlaneAngleCubic
,
global
Harmonic
InPlaneAngleQuartic
,
global
Harmonic
InPlaneAnglePentic
,
global
Harmonic
InPlaneAngleSextic
,
forceData
);
AmoebaReferenceInPlaneAngleForce
amoebaReferenceInPlaneAngleForce
;
RealOpenMM
energy
=
amoebaReferenceInPlaneAngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
angle
,
kQuadratic
,
globalInPlaneAngleCubic
,
globalInPlaneAngleQuartic
,
globalInPlaneAnglePentic
,
globalInPlaneAngleSextic
,
forceData
);
return
static_cast
<
double
>
(
energy
);
}
...
...
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
View file @
c6ebf6e2
...
...
@@ -35,21 +35,21 @@
namespace
OpenMM
{
/**
* This kernel is invoked by Amoeba
Harmonic
BondForce to calculate the forces acting on the system and the energy of the system.
* This kernel is invoked by AmoebaBondForce to calculate the forces acting on the system and the energy of the system.
*/
class
ReferenceCalcAmoeba
Harmonic
BondForceKernel
:
public
CalcAmoeba
Harmonic
BondForceKernel
{
class
ReferenceCalcAmoebaBondForceKernel
:
public
CalcAmoebaBondForceKernel
{
public:
ReferenceCalcAmoeba
Harmonic
BondForceKernel
(
std
::
string
name
,
ReferenceCalcAmoebaBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
);
~
ReferenceCalcAmoeba
Harmonic
BondForceKernel
();
~
ReferenceCalcAmoebaBondForceKernel
();
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
* @param force the Amoeba
Harmonic
BondForce this kernel will be used for
* @param force the AmoebaBondForce this kernel will be used for
*/
void
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
BondForce
&
force
);
void
initialize
(
const
System
&
system
,
const
AmoebaBondForce
&
force
);
/**
* Execute the kernel to calculate the forces and/or energy.
*
...
...
@@ -65,25 +65,25 @@ private:
std
::
vector
<
int
>
particle2
;
std
::
vector
<
RealOpenMM
>
length
;
std
::
vector
<
RealOpenMM
>
kQuadratic
;
RealOpenMM
global
Harmonic
BondCubic
;
RealOpenMM
global
Harmonic
BondQuartic
;
RealOpenMM
globalBondCubic
;
RealOpenMM
globalBondQuartic
;
System
&
system
;
};
/**
* This kernel is invoked by Amoeba
Harmonic
AngleForce to calculate the forces acting on the system and the energy of the system.
* This kernel is invoked by AmoebaAngleForce to calculate the forces acting on the system and the energy of the system.
*/
class
ReferenceCalcAmoeba
Harmonic
AngleForceKernel
:
public
CalcAmoeba
Harmonic
AngleForceKernel
{
class
ReferenceCalcAmoebaAngleForceKernel
:
public
CalcAmoebaAngleForceKernel
{
public:
ReferenceCalcAmoeba
Harmonic
AngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
);
~
ReferenceCalcAmoeba
Harmonic
AngleForceKernel
();
ReferenceCalcAmoebaAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
);
~
ReferenceCalcAmoebaAngleForceKernel
();
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
* @param force the Amoeba
Harmonic
AngleForce this kernel will be used for
* @param force the AmoebaAngleForce this kernel will be used for
*/
void
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
AngleForce
&
force
);
void
initialize
(
const
System
&
system
,
const
AmoebaAngleForce
&
force
);
/**
* Execute the kernel to calculate the forces and/or energy.
*
...
...
@@ -100,27 +100,27 @@ private:
std
::
vector
<
int
>
particle3
;
std
::
vector
<
RealOpenMM
>
angle
;
std
::
vector
<
RealOpenMM
>
kQuadratic
;
RealOpenMM
global
Harmonic
AngleCubic
;
RealOpenMM
global
Harmonic
AngleQuartic
;
RealOpenMM
global
Harmonic
AnglePentic
;
RealOpenMM
global
Harmonic
AngleSextic
;
RealOpenMM
globalAngleCubic
;
RealOpenMM
globalAngleQuartic
;
RealOpenMM
globalAnglePentic
;
RealOpenMM
globalAngleSextic
;
System
&
system
;
};
/**
* This kernel is invoked by Amoeba
Harmonic
InPlaneAngleForce to calculate the forces acting on the system and the energy of the system.
* This kernel is invoked by AmoebaInPlaneAngleForce to calculate the forces acting on the system and the energy of the system.
*/
class
ReferenceCalcAmoeba
Harmonic
InPlaneAngleForceKernel
:
public
CalcAmoeba
Harmonic
InPlaneAngleForceKernel
{
class
ReferenceCalcAmoebaInPlaneAngleForceKernel
:
public
CalcAmoebaInPlaneAngleForceKernel
{
public:
ReferenceCalcAmoeba
Harmonic
InPlaneAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
);
~
ReferenceCalcAmoeba
Harmonic
InPlaneAngleForceKernel
();
ReferenceCalcAmoebaInPlaneAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
System
&
system
);
~
ReferenceCalcAmoebaInPlaneAngleForceKernel
();
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
* @param force the Amoeba
Harmonic
InPlaneAngleForce this kernel will be used for
* @param force the AmoebaInPlaneAngleForce this kernel will be used for
*/
void
initialize
(
const
System
&
system
,
const
Amoeba
Harmonic
InPlaneAngleForce
&
force
);
void
initialize
(
const
System
&
system
,
const
AmoebaInPlaneAngleForce
&
force
);
/**
* Execute the kernel to calculate the forces and/or energy.
*
...
...
@@ -138,10 +138,10 @@ private:
std
::
vector
<
int
>
particle4
;
std
::
vector
<
RealOpenMM
>
angle
;
std
::
vector
<
RealOpenMM
>
kQuadratic
;
RealOpenMM
global
Harmonic
InPlaneAngleCubic
;
RealOpenMM
global
Harmonic
InPlaneAngleQuartic
;
RealOpenMM
global
Harmonic
InPlaneAnglePentic
;
RealOpenMM
global
Harmonic
InPlaneAngleSextic
;
RealOpenMM
globalInPlaneAngleCubic
;
RealOpenMM
globalInPlaneAngleQuartic
;
RealOpenMM
globalInPlaneAnglePentic
;
RealOpenMM
globalInPlaneAngleSextic
;
System
&
system
;
};
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReference
Harmonic
AngleForce.cpp
→
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.cpp
View file @
c6ebf6e2
...
...
@@ -23,7 +23,7 @@
*/
#include "AmoebaReferenceForce.h"
#include "AmoebaReference
Harmonic
AngleForce.h"
#include "AmoebaReferenceAngleForce.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
...
...
@@ -46,7 +46,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReference
Harmonic
AngleForce
::
getPrefactorsGivenAngleCosine
(
RealOpenMM
cosine
,
RealOpenMM
AmoebaReferenceAngleForce
::
getPrefactorsGivenAngleCosine
(
RealOpenMM
cosine
,
RealOpenMM
idealAngle
,
RealOpenMM
angleK
,
RealOpenMM
angleCubic
,
RealOpenMM
angleQuartic
,
RealOpenMM
anglePentic
,
RealOpenMM
angleSextic
,
...
...
@@ -62,7 +62,7 @@ RealOpenMM AmoebaReferenceHarmonicAngleForce::getPrefactorsGivenAngleCosine( Rea
static
const
RealOpenMM
five
=
5.0
;
static
const
RealOpenMM
six
=
6.0
;
// static const std::string methodName = "AmoebaReference
Harmonic
AngleForce::getPrefactorsGivenAngleCosine";
// static const std::string methodName = "AmoebaReferenceAngleForce::getPrefactorsGivenAngleCosine";
// ---------------------------------------------------------------------------------------
...
...
@@ -96,7 +96,7 @@ RealOpenMM AmoebaReferenceHarmonicAngleForce::getPrefactorsGivenAngleCosine( Rea
/**---------------------------------------------------------------------------------------
Calculate Amoeba
harmonic
angle ixn (force and energy)
Calculate Amoeba angle ixn (force and energy)
@param positionAtomA Cartesian coordinates of atom A
@param positionAtomB Cartesian coordinates of atom B
...
...
@@ -113,7 +113,7 @@ RealOpenMM AmoebaReferenceHarmonicAngleForce::getPrefactorsGivenAngleCosine( Rea
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReference
Harmonic
AngleForce
::
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
,
...
...
@@ -122,7 +122,7 @@ RealOpenMM AmoebaReferenceHarmonicAngleForce::calculateAngleIxn( const RealVec&
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "AmoebaReference
Harmonic
AngleForce::calculate
HarmonicForce
";
//static const std::string methodName = "AmoebaReferenceAngleForce::calculate
AngleIxn
";
static
const
RealOpenMM
zero
=
0.0
;
static
const
RealOpenMM
one
=
1.0
;
...
...
@@ -183,7 +183,7 @@ RealOpenMM AmoebaReferenceHarmonicAngleForce::calculateAngleIxn( const RealVec&
return
energy
;
}
RealOpenMM
AmoebaReference
Harmonic
AngleForce
::
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
,
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReference
Harmonic
AngleForce.h
→
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.h
View file @
c6ebf6e2
...
...
@@ -22,15 +22,15 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __AmoebaReference
Harmonic
AngleForce_H__
#define __AmoebaReference
Harmonic
AngleForce_H__
#ifndef __AmoebaReferenceAngleForce_H__
#define __AmoebaReferenceAngleForce_H__
#include "SimTKUtilities/RealVec.h"
#include <vector>
// ---------------------------------------------------------------------------------------
class
AmoebaReference
Harmonic
AngleForce
{
class
AmoebaReferenceAngleForce
{
public:
...
...
@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
AmoebaReference
Harmonic
AngleForce
(
){};
AmoebaReferenceAngleForce
(
){};
/**---------------------------------------------------------------------------------------
...
...
@@ -48,11 +48,11 @@ public:
--------------------------------------------------------------------------------------- */
~
AmoebaReference
Harmonic
AngleForce
(
){};
~
AmoebaReferenceAngleForce
(
){};
/**---------------------------------------------------------------------------------------
Calculate Amoeba
harmonic
angle ixns (force and energy)
Calculate Amoeba angle ixns (force and energy)
@param numBonds number of angles
@param posData particle positions
...
...
@@ -78,10 +78,10 @@ public:
const
std
::
vector
<
int
>&
particle3
,
const
std
::
vector
<
RealOpenMM
>&
angle
,
const
std
::
vector
<
RealOpenMM
>&
kQuadratic
,
RealOpenMM
global
Harmonic
AngleCubic
,
RealOpenMM
global
Harmonic
AngleQuartic
,
RealOpenMM
global
Harmonic
AnglePentic
,
RealOpenMM
global
Harmonic
AngleSextic
,
RealOpenMM
globalAngleCubic
,
RealOpenMM
globalAngleQuartic
,
RealOpenMM
globalAnglePentic
,
RealOpenMM
globalAngleSextic
,
std
::
vector
<
OpenMM
::
RealVec
>&
forceData
)
const
;
private:
...
...
@@ -111,7 +111,7 @@ private:
/**---------------------------------------------------------------------------------------
Calculate Amoeba
harmonic
angle ixn (force and energy)
Calculate Amoeba angle ixn (force and energy)
@param positionAtomA Cartesian coordinates of atom A
@param positionAtomB Cartesian coordinates of atom B
...
...
@@ -139,4 +139,4 @@ private:
// ---------------------------------------------------------------------------------------
#endif // _AmoebaReference
Harmonic
AngleForce___
#endif // _AmoebaReferenceAngleForce___
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReference
Harmonic
BondForce.cpp
→
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceBondForce.cpp
View file @
c6ebf6e2
...
...
@@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "AmoebaReference
Harmonic
BondForce.h"
#include "AmoebaReferenceBondForce.h"
#include "AmoebaReferenceForce.h"
using
std
::
vector
;
...
...
@@ -30,7 +30,7 @@ using OpenMM::RealVec;
/**---------------------------------------------------------------------------------------
Calculate Amoeba
harmonic
bond ixn (force and energy)
Calculate Amoeba bond ixn (force and energy)
@param positionAtomA Cartesian coordinates of atom A
@param positionAtomB Cartesian coordinates of atom B
...
...
@@ -44,14 +44,14 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
RealOpenMM
AmoebaReference
Harmonic
BondForce
::
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
{
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "AmoebaReference
Harmonic
BondForce::calculate
HarmonicForce
";
//static const std::string methodName = "AmoebaReferenceBondForce::calculate
BondIxn
";
static
const
RealOpenMM
zero
=
0.0
;
static
const
RealOpenMM
one
=
1.0
;
...
...
@@ -88,14 +88,14 @@ RealOpenMM AmoebaReferenceHarmonicBondForce::calculateBondIxn( const RealVec& po
return
energy
;
}
RealOpenMM
AmoebaReference
Harmonic
BondForce
::
calculateForceAndEnergy
(
int
numBonds
,
RealOpenMM
AmoebaReferenceBondForce
::
calculateForceAndEnergy
(
int
numBonds
,
vector
<
RealVec
>&
particlePositions
,
const
std
::
vector
<
int
>&
particle1
,
const
std
::
vector
<
int
>&
particle2
,
const
std
::
vector
<
RealOpenMM
>&
length
,
const
std
::
vector
<
RealOpenMM
>&
kQuadratic
,
RealOpenMM
global
Harmonic
BondCubic
,
RealOpenMM
global
Harmonic
BondQuartic
,
RealOpenMM
globalBondCubic
,
RealOpenMM
globalBondQuartic
,
vector
<
RealVec
>&
forceData
)
const
{
RealOpenMM
energy
=
0.0
;
for
(
int
ii
=
0
;
ii
<
numBonds
;
ii
++
){
...
...
@@ -106,7 +106,7 @@ RealOpenMM AmoebaReferenceHarmonicBondForce::calculateForceAndEnergy( int numBon
RealVec
forces
[
2
];
energy
+=
calculateBondIxn
(
particlePositions
[
particle1Index
],
particlePositions
[
particle2Index
],
bondLength
,
bondK
,
global
Harmonic
BondCubic
,
global
Harmonic
BondQuartic
,
bondLength
,
bondK
,
globalBondCubic
,
globalBondQuartic
,
forces
);
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
...
...
Prev
1
2
3
4
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