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
a783b996
"plugins/rpmd/vscode:/vscode.git/clone" did not exist on "a24385093409749f137426cf1b05f9de7b79e76f"
Commit
a783b996
authored
Jan 13, 2017
by
peastman
Browse files
Eliminated RealOpenMM type
parent
9500f3af
Changes
148
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
171 additions
and
172 deletions
+171
-172
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceWcaDispersionForce.h
...ce/src/SimTKReference/AmoebaReferenceWcaDispersionForce.h
+18
-19
plugins/drude/platforms/reference/src/ReferenceDrudeKernels.cpp
...s/drude/platforms/reference/src/ReferenceDrudeKernels.cpp
+99
-99
plugins/drude/platforms/reference/src/ReferenceDrudeKernels.h
...ins/drude/platforms/reference/src/ReferenceDrudeKernels.h
+1
-1
plugins/rpmd/platforms/cuda/tests/TestCudaRpmd.cpp
plugins/rpmd/platforms/cuda/tests/TestCudaRpmd.cpp
+1
-1
plugins/rpmd/platforms/opencl/tests/TestOpenCLRpmd.cpp
plugins/rpmd/platforms/opencl/tests/TestOpenCLRpmd.cpp
+2
-2
plugins/rpmd/platforms/reference/src/ReferenceRpmdKernels.cpp
...ins/rpmd/platforms/reference/src/ReferenceRpmdKernels.cpp
+43
-43
plugins/rpmd/platforms/reference/src/ReferenceRpmdKernels.h
plugins/rpmd/platforms/reference/src/ReferenceRpmdKernels.h
+6
-6
plugins/rpmd/platforms/reference/tests/TestReferenceRpmd.cpp
plugins/rpmd/platforms/reference/tests/TestReferenceRpmd.cpp
+1
-1
No files found.
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceWcaDispersionForce.h
View file @
a783b996
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
#ifndef __AmoebaReferenceWcaDispersionForce_H__
#ifndef __AmoebaReferenceWcaDispersionForce_H__
#define __AmoebaReferenceWcaDispersionForce_H__
#define __AmoebaReferenceWcaDispersionForce_H__
#include "RealVec.h"
#include "openmm/Vec3.h"
#include "openmm/Vec3.h"
#include <string>
#include <string>
#include <vector>
#include <vector>
...
@@ -51,8 +50,8 @@ public:
...
@@ -51,8 +50,8 @@ public:
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
AmoebaReferenceWcaDispersionForce
(
RealOpenMM
epso
,
RealOpenMM
epsh
,
RealOpenMM
rmino
,
RealOpenMM
rminh
,
AmoebaReferenceWcaDispersionForce
(
double
epso
,
double
epsh
,
double
rmino
,
double
rminh
,
RealOpenMM
awater
,
RealOpenMM
shctd
,
RealOpenMM
dispoff
,
RealOpenMM
slevy
);
double
awater
,
double
shctd
,
double
dispoff
,
double
slevy
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -77,20 +76,20 @@ public:
...
@@ -77,20 +76,20 @@ public:
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
RealOpenMM
calculateForceAndEnergy
(
int
numParticles
,
const
std
::
vector
<
OpenMM
::
Real
Vec
>&
particlePositions
,
double
calculateForceAndEnergy
(
int
numParticles
,
const
std
::
vector
<
OpenMM
::
Vec
3
>&
particlePositions
,
const
std
::
vector
<
RealOpenMM
>&
radii
,
const
std
::
vector
<
double
>&
radii
,
const
std
::
vector
<
RealOpenMM
>&
epsilons
,
const
std
::
vector
<
double
>&
epsilons
,
RealOpenMM
totalMaximumDispersionEnergy
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
forces
)
const
;
double
totalMaximumDispersionEnergy
,
std
::
vector
<
OpenMM
::
Vec
3
>&
forces
)
const
;
private:
private:
RealOpenMM
_epso
;
double
_epso
;
RealOpenMM
_epsh
;
double
_epsh
;
RealOpenMM
_rmino
;
double
_rmino
;
RealOpenMM
_rminh
;
double
_rminh
;
RealOpenMM
_awater
;
double
_awater
;
RealOpenMM
_shctd
;
double
_shctd
;
RealOpenMM
_dispoff
;
double
_dispoff
;
RealOpenMM
_slevy
;
double
_slevy
;
enum
{
EMIXO
,
RMIXO
,
RMIXO7
,
AO
,
EMIXH
,
RMIXH
,
RMIXH7
,
AH
,
LastIntermediateValueIndex
};
enum
{
EMIXO
,
RMIXO
,
RMIXO7
,
AO
,
EMIXH
,
RMIXH
,
RMIXH7
,
AH
,
LastIntermediateValueIndex
};
...
@@ -109,10 +108,10 @@ private:
...
@@ -109,10 +108,10 @@ private:
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
RealOpenMM
calculatePairIxn
(
RealOpenMM
radiusI
,
RealOpenMM
radiusJ
,
double
calculatePairIxn
(
double
radiusI
,
double
radiusJ
,
const
OpenMM
::
Real
Vec
&
particleIPosition
,
const
OpenMM
::
Real
Vec
&
particleJPosition
,
const
OpenMM
::
Vec
3
&
particleIPosition
,
const
OpenMM
::
Vec
3
&
particleJPosition
,
const
RealOpenMM
*
const
intermediateValues
,
const
double
*
const
intermediateValues
,
Vec3
&
force
)
const
;
Vec3
&
force
)
const
;
};
};
...
...
plugins/drude/platforms/reference/src/ReferenceDrudeKernels.cpp
View file @
a783b996
...
@@ -41,19 +41,19 @@
...
@@ -41,19 +41,19 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
static
vector
<
Real
Vec
>&
extractPositions
(
ContextImpl
&
context
)
{
static
vector
<
Vec
3
>&
extractPositions
(
ContextImpl
&
context
)
{
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
return
*
((
vector
<
Real
Vec
>*
)
data
->
positions
);
return
*
((
vector
<
Vec
3
>*
)
data
->
positions
);
}
}
static
vector
<
Real
Vec
>&
extractVelocities
(
ContextImpl
&
context
)
{
static
vector
<
Vec
3
>&
extractVelocities
(
ContextImpl
&
context
)
{
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
return
*
((
vector
<
Real
Vec
>*
)
data
->
velocities
);
return
*
((
vector
<
Vec
3
>*
)
data
->
velocities
);
}
}
static
vector
<
Real
Vec
>&
extractForces
(
ContextImpl
&
context
)
{
static
vector
<
Vec
3
>&
extractForces
(
ContextImpl
&
context
)
{
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
return
*
((
vector
<
Real
Vec
>*
)
data
->
forces
);
return
*
((
vector
<
Vec
3
>*
)
data
->
forces
);
}
}
static
ReferenceConstraints
&
extractConstraints
(
ContextImpl
&
context
)
{
static
ReferenceConstraints
&
extractConstraints
(
ContextImpl
&
context
)
{
...
@@ -64,13 +64,13 @@ static ReferenceConstraints& extractConstraints(ContextImpl& context) {
...
@@ -64,13 +64,13 @@ static ReferenceConstraints& extractConstraints(ContextImpl& context) {
static
double
computeShiftedKineticEnergy
(
ContextImpl
&
context
,
vector
<
double
>&
inverseMasses
,
double
timeShift
)
{
static
double
computeShiftedKineticEnergy
(
ContextImpl
&
context
,
vector
<
double
>&
inverseMasses
,
double
timeShift
)
{
const
System
&
system
=
context
.
getSystem
();
const
System
&
system
=
context
.
getSystem
();
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
vector
<
Real
Vec
>&
posData
=
extractPositions
(
context
);
vector
<
Vec
3
>&
posData
=
extractPositions
(
context
);
vector
<
Real
Vec
>&
velData
=
extractVelocities
(
context
);
vector
<
Vec
3
>&
velData
=
extractVelocities
(
context
);
vector
<
Real
Vec
>&
forceData
=
extractForces
(
context
);
vector
<
Vec
3
>&
forceData
=
extractForces
(
context
);
// Compute the shifted velocities.
// Compute the shifted velocities.
vector
<
Real
Vec
>
shiftedVel
(
numParticles
);
vector
<
Vec
3
>
shiftedVel
(
numParticles
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
if
(
inverseMasses
[
i
]
>
0
)
if
(
inverseMasses
[
i
]
>
0
)
shiftedVel
[
i
]
=
velData
[
i
]
+
forceData
[
i
]
*
(
timeShift
*
inverseMasses
[
i
]);
shiftedVel
[
i
]
=
velData
[
i
]
+
forceData
[
i
]
*
(
timeShift
*
inverseMasses
[
i
]);
...
@@ -119,8 +119,8 @@ void ReferenceCalcDrudeForceKernel::initialize(const System& system, const Drude
...
@@ -119,8 +119,8 @@ void ReferenceCalcDrudeForceKernel::initialize(const System& system, const Drude
}
}
double
ReferenceCalcDrudeForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcDrudeForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
vector
<
Real
Vec
>&
pos
=
extractPositions
(
context
);
vector
<
Vec
3
>&
pos
=
extractPositions
(
context
);
vector
<
Real
Vec
>&
force
=
extractForces
(
context
);
vector
<
Vec
3
>&
force
=
extractForces
(
context
);
int
numParticles
=
particle
.
size
();
int
numParticles
=
particle
.
size
();
double
energy
=
0
;
double
energy
=
0
;
...
@@ -133,17 +133,17 @@ double ReferenceCalcDrudeForceKernel::execute(ContextImpl& context, bool include
...
@@ -133,17 +133,17 @@ double ReferenceCalcDrudeForceKernel::execute(ContextImpl& context, bool include
int
p3
=
particle3
[
i
];
int
p3
=
particle3
[
i
];
int
p4
=
particle4
[
i
];
int
p4
=
particle4
[
i
];
RealOpenMM
a1
=
(
p2
==
-
1
?
1
:
aniso12
[
i
]);
double
a1
=
(
p2
==
-
1
?
1
:
aniso12
[
i
]);
RealOpenMM
a2
=
(
p3
==
-
1
||
p4
==
-
1
?
1
:
aniso34
[
i
]);
double
a2
=
(
p3
==
-
1
||
p4
==
-
1
?
1
:
aniso34
[
i
]);
RealOpenMM
a3
=
3
-
a1
-
a2
;
double
a3
=
3
-
a1
-
a2
;
RealOpenMM
k3
=
ONE_4PI_EPS0
*
charge
[
i
]
*
charge
[
i
]
/
(
polarizability
[
i
]
*
a3
);
double
k3
=
ONE_4PI_EPS0
*
charge
[
i
]
*
charge
[
i
]
/
(
polarizability
[
i
]
*
a3
);
RealOpenMM
k1
=
ONE_4PI_EPS0
*
charge
[
i
]
*
charge
[
i
]
/
(
polarizability
[
i
]
*
a1
)
-
k3
;
double
k1
=
ONE_4PI_EPS0
*
charge
[
i
]
*
charge
[
i
]
/
(
polarizability
[
i
]
*
a1
)
-
k3
;
RealOpenMM
k2
=
ONE_4PI_EPS0
*
charge
[
i
]
*
charge
[
i
]
/
(
polarizability
[
i
]
*
a2
)
-
k3
;
double
k2
=
ONE_4PI_EPS0
*
charge
[
i
]
*
charge
[
i
]
/
(
polarizability
[
i
]
*
a2
)
-
k3
;
// Compute the isotropic force.
// Compute the isotropic force.
Real
Vec
delta
=
pos
[
p
]
-
pos
[
p1
];
Vec
3
delta
=
pos
[
p
]
-
pos
[
p1
];
RealOpenMM
r2
=
delta
.
dot
(
delta
);
double
r2
=
delta
.
dot
(
delta
);
energy
+=
0.5
*
k3
*
r2
;
energy
+=
0.5
*
k3
*
r2
;
force
[
p
]
-=
delta
*
k3
;
force
[
p
]
-=
delta
*
k3
;
force
[
p1
]
+=
delta
*
k3
;
force
[
p1
]
+=
delta
*
k3
;
...
@@ -151,13 +151,13 @@ double ReferenceCalcDrudeForceKernel::execute(ContextImpl& context, bool include
...
@@ -151,13 +151,13 @@ double ReferenceCalcDrudeForceKernel::execute(ContextImpl& context, bool include
// Compute the first anisotropic force.
// Compute the first anisotropic force.
if
(
p2
!=
-
1
)
{
if
(
p2
!=
-
1
)
{
Real
Vec
dir
=
pos
[
p1
]
-
pos
[
p2
];
Vec
3
dir
=
pos
[
p1
]
-
pos
[
p2
];
RealOpenMM
invDist
=
1.0
/
sqrt
(
dir
.
dot
(
dir
));
double
invDist
=
1.0
/
sqrt
(
dir
.
dot
(
dir
));
dir
*=
invDist
;
dir
*=
invDist
;
RealOpenMM
rprime
=
dir
.
dot
(
delta
);
double
rprime
=
dir
.
dot
(
delta
);
energy
+=
0.5
*
k1
*
rprime
*
rprime
;
energy
+=
0.5
*
k1
*
rprime
*
rprime
;
Real
Vec
f1
=
dir
*
(
k1
*
rprime
);
Vec
3
f1
=
dir
*
(
k1
*
rprime
);
Real
Vec
f2
=
(
delta
-
dir
*
rprime
)
*
(
k1
*
rprime
*
invDist
);
Vec
3
f2
=
(
delta
-
dir
*
rprime
)
*
(
k1
*
rprime
*
invDist
);
force
[
p
]
-=
f1
;
force
[
p
]
-=
f1
;
force
[
p1
]
+=
f1
-
f2
;
force
[
p1
]
+=
f1
-
f2
;
force
[
p2
]
+=
f2
;
force
[
p2
]
+=
f2
;
...
@@ -166,13 +166,13 @@ double ReferenceCalcDrudeForceKernel::execute(ContextImpl& context, bool include
...
@@ -166,13 +166,13 @@ double ReferenceCalcDrudeForceKernel::execute(ContextImpl& context, bool include
// Compute the second anisotropic force.
// Compute the second anisotropic force.
if
(
p3
!=
-
1
&&
p4
!=
-
1
)
{
if
(
p3
!=
-
1
&&
p4
!=
-
1
)
{
Real
Vec
dir
=
pos
[
p3
]
-
pos
[
p4
];
Vec
3
dir
=
pos
[
p3
]
-
pos
[
p4
];
RealOpenMM
invDist
=
1.0
/
sqrt
(
dir
.
dot
(
dir
));
double
invDist
=
1.0
/
sqrt
(
dir
.
dot
(
dir
));
dir
*=
invDist
;
dir
*=
invDist
;
RealOpenMM
rprime
=
dir
.
dot
(
delta
);
double
rprime
=
dir
.
dot
(
delta
);
energy
+=
0.5
*
k2
*
rprime
*
rprime
;
energy
+=
0.5
*
k2
*
rprime
*
rprime
;
Real
Vec
f1
=
dir
*
(
k2
*
rprime
);
Vec
3
f1
=
dir
*
(
k2
*
rprime
);
Real
Vec
f2
=
(
delta
-
dir
*
rprime
)
*
(
k2
*
rprime
*
invDist
);
Vec
3
f2
=
(
delta
-
dir
*
rprime
)
*
(
k2
*
rprime
*
invDist
);
force
[
p
]
-=
f1
;
force
[
p
]
-=
f1
;
force
[
p1
]
+=
f1
;
force
[
p1
]
+=
f1
;
force
[
p3
]
-=
f2
;
force
[
p3
]
-=
f2
;
...
@@ -188,18 +188,18 @@ double ReferenceCalcDrudeForceKernel::execute(ContextImpl& context, bool include
...
@@ -188,18 +188,18 @@ double ReferenceCalcDrudeForceKernel::execute(ContextImpl& context, bool include
int
dipole2
=
pair2
[
i
];
int
dipole2
=
pair2
[
i
];
int
dipole1Particles
[]
=
{
particle
[
dipole1
],
particle1
[
dipole1
]};
int
dipole1Particles
[]
=
{
particle
[
dipole1
],
particle1
[
dipole1
]};
int
dipole2Particles
[]
=
{
particle
[
dipole2
],
particle1
[
dipole2
]};
int
dipole2Particles
[]
=
{
particle
[
dipole2
],
particle1
[
dipole2
]};
RealOpenMM
uscale
=
pairThole
[
i
]
/
pow
(
polarizability
[
dipole1
]
*
polarizability
[
dipole2
],
1.0
/
6.0
);
double
uscale
=
pairThole
[
i
]
/
pow
(
polarizability
[
dipole1
]
*
polarizability
[
dipole2
],
1.0
/
6.0
);
for
(
int
j
=
0
;
j
<
2
;
j
++
)
for
(
int
j
=
0
;
j
<
2
;
j
++
)
for
(
int
k
=
0
;
k
<
2
;
k
++
)
{
for
(
int
k
=
0
;
k
<
2
;
k
++
)
{
int
p1
=
dipole1Particles
[
j
];
int
p1
=
dipole1Particles
[
j
];
int
p2
=
dipole2Particles
[
k
];
int
p2
=
dipole2Particles
[
k
];
RealOpenMM
chargeProduct
=
charge
[
dipole1
]
*
charge
[
dipole2
]
*
(
j
==
k
?
1
:
-
1
);
double
chargeProduct
=
charge
[
dipole1
]
*
charge
[
dipole2
]
*
(
j
==
k
?
1
:
-
1
);
Real
Vec
delta
=
pos
[
p1
]
-
pos
[
p2
];
Vec
3
delta
=
pos
[
p1
]
-
pos
[
p2
];
RealOpenMM
r
=
sqrt
(
delta
.
dot
(
delta
));
double
r
=
sqrt
(
delta
.
dot
(
delta
));
RealOpenMM
u
=
r
*
uscale
;
double
u
=
r
*
uscale
;
RealOpenMM
screening
=
1.0
-
(
1.0
+
0.5
*
u
)
*
exp
(
-
u
);
double
screening
=
1.0
-
(
1.0
+
0.5
*
u
)
*
exp
(
-
u
);
energy
+=
ONE_4PI_EPS0
*
chargeProduct
*
screening
/
r
;
energy
+=
ONE_4PI_EPS0
*
chargeProduct
*
screening
/
r
;
Real
Vec
f
=
delta
*
(
ONE_4PI_EPS0
*
chargeProduct
/
(
r
*
r
))
*
(
screening
/
r
-
0.5
*
(
1
+
u
)
*
exp
(
-
u
)
*
uscale
);
Vec
3
f
=
delta
*
(
ONE_4PI_EPS0
*
chargeProduct
/
(
r
*
r
))
*
(
screening
/
r
-
0.5
*
(
1
+
u
)
*
exp
(
-
u
)
*
uscale
);
force
[
p1
]
+=
f
;
force
[
p1
]
+=
f
;
force
[
p2
]
-=
f
;
force
[
p2
]
-=
f
;
}
}
...
@@ -257,21 +257,21 @@ void ReferenceIntegrateDrudeLangevinStepKernel::initialize(const System& system,
...
@@ -257,21 +257,21 @@ void ReferenceIntegrateDrudeLangevinStepKernel::initialize(const System& system,
}
}
void
ReferenceIntegrateDrudeLangevinStepKernel
::
execute
(
ContextImpl
&
context
,
const
DrudeLangevinIntegrator
&
integrator
)
{
void
ReferenceIntegrateDrudeLangevinStepKernel
::
execute
(
ContextImpl
&
context
,
const
DrudeLangevinIntegrator
&
integrator
)
{
vector
<
Real
Vec
>&
pos
=
extractPositions
(
context
);
vector
<
Vec
3
>&
pos
=
extractPositions
(
context
);
vector
<
Real
Vec
>&
vel
=
extractVelocities
(
context
);
vector
<
Vec
3
>&
vel
=
extractVelocities
(
context
);
vector
<
Real
Vec
>&
force
=
extractForces
(
context
);
vector
<
Vec
3
>&
force
=
extractForces
(
context
);
// Update velocities of ordinary particles.
// Update velocities of ordinary particles.
const
RealOpenMM
vscale
=
exp
(
-
integrator
.
getStepSize
()
*
integrator
.
getFriction
());
const
double
vscale
=
exp
(
-
integrator
.
getStepSize
()
*
integrator
.
getFriction
());
const
RealOpenMM
fscale
=
(
1
-
vscale
)
/
integrator
.
getFriction
();
const
double
fscale
=
(
1
-
vscale
)
/
integrator
.
getFriction
();
const
RealOpenMM
kT
=
BOLTZ
*
integrator
.
getTemperature
();
const
double
kT
=
BOLTZ
*
integrator
.
getTemperature
();
const
RealOpenMM
noisescale
=
sqrt
(
2
*
kT
*
integrator
.
getFriction
())
*
sqrt
(
0.5
*
(
1
-
vscale
*
vscale
)
/
integrator
.
getFriction
());
const
double
noisescale
=
sqrt
(
2
*
kT
*
integrator
.
getFriction
())
*
sqrt
(
0.5
*
(
1
-
vscale
*
vscale
)
/
integrator
.
getFriction
());
for
(
int
i
=
0
;
i
<
(
int
)
normalParticles
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
normalParticles
.
size
();
i
++
)
{
int
index
=
normalParticles
[
i
];
int
index
=
normalParticles
[
i
];
RealOpenMM
invMass
=
particleInvMass
[
index
];
double
invMass
=
particleInvMass
[
index
];
if
(
invMass
!=
0.0
)
{
if
(
invMass
!=
0.0
)
{
RealOpenMM
sqrtInvMass
=
sqrt
(
invMass
);
double
sqrtInvMass
=
sqrt
(
invMass
);
for
(
int
j
=
0
;
j
<
3
;
j
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
vel
[
index
][
j
]
=
vscale
*
vel
[
index
][
j
]
+
fscale
*
invMass
*
force
[
index
][
j
]
+
noisescale
*
sqrtInvMass
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
();
vel
[
index
][
j
]
=
vscale
*
vel
[
index
][
j
]
+
fscale
*
invMass
*
force
[
index
][
j
]
+
noisescale
*
sqrtInvMass
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
();
}
}
...
@@ -279,21 +279,21 @@ void ReferenceIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, co
...
@@ -279,21 +279,21 @@ void ReferenceIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, co
// Update velocities of Drude particle pairs.
// Update velocities of Drude particle pairs.
const
RealOpenMM
vscaleDrude
=
exp
(
-
integrator
.
getStepSize
()
*
integrator
.
getDrudeFriction
());
const
double
vscaleDrude
=
exp
(
-
integrator
.
getStepSize
()
*
integrator
.
getDrudeFriction
());
const
RealOpenMM
fscaleDrude
=
(
1
-
vscaleDrude
)
/
integrator
.
getDrudeFriction
();
const
double
fscaleDrude
=
(
1
-
vscaleDrude
)
/
integrator
.
getDrudeFriction
();
const
RealOpenMM
kTDrude
=
BOLTZ
*
integrator
.
getDrudeTemperature
();
const
double
kTDrude
=
BOLTZ
*
integrator
.
getDrudeTemperature
();
const
RealOpenMM
noisescaleDrude
=
sqrt
(
2
*
kTDrude
*
integrator
.
getDrudeFriction
())
*
sqrt
(
0.5
*
(
1
-
vscaleDrude
*
vscaleDrude
)
/
integrator
.
getDrudeFriction
());
const
double
noisescaleDrude
=
sqrt
(
2
*
kTDrude
*
integrator
.
getDrudeFriction
())
*
sqrt
(
0.5
*
(
1
-
vscaleDrude
*
vscaleDrude
)
/
integrator
.
getDrudeFriction
());
for
(
int
i
=
0
;
i
<
(
int
)
pairParticles
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
pairParticles
.
size
();
i
++
)
{
int
p1
=
pairParticles
[
i
].
first
;
int
p1
=
pairParticles
[
i
].
first
;
int
p2
=
pairParticles
[
i
].
second
;
int
p2
=
pairParticles
[
i
].
second
;
RealOpenMM
mass1fract
=
pairInvTotalMass
[
i
]
/
particleInvMass
[
p1
];
double
mass1fract
=
pairInvTotalMass
[
i
]
/
particleInvMass
[
p1
];
RealOpenMM
mass2fract
=
pairInvTotalMass
[
i
]
/
particleInvMass
[
p2
];
double
mass2fract
=
pairInvTotalMass
[
i
]
/
particleInvMass
[
p2
];
RealOpenMM
sqrtInvTotalMass
=
sqrt
(
pairInvTotalMass
[
i
]);
double
sqrtInvTotalMass
=
sqrt
(
pairInvTotalMass
[
i
]);
RealOpenMM
sqrtInvReducedMass
=
sqrt
(
pairInvReducedMass
[
i
]);
double
sqrtInvReducedMass
=
sqrt
(
pairInvReducedMass
[
i
]);
Real
Vec
cmVel
=
vel
[
p1
]
*
mass1fract
+
vel
[
p2
]
*
mass2fract
;
Vec
3
cmVel
=
vel
[
p1
]
*
mass1fract
+
vel
[
p2
]
*
mass2fract
;
Real
Vec
relVel
=
vel
[
p2
]
-
vel
[
p1
];
Vec
3
relVel
=
vel
[
p2
]
-
vel
[
p1
];
Real
Vec
cmForce
=
force
[
p1
]
+
force
[
p2
];
Vec
3
cmForce
=
force
[
p1
]
+
force
[
p2
];
Real
Vec
relForce
=
force
[
p2
]
*
mass1fract
-
force
[
p1
]
*
mass2fract
;
Vec
3
relForce
=
force
[
p2
]
*
mass1fract
-
force
[
p1
]
*
mass2fract
;
for
(
int
j
=
0
;
j
<
3
;
j
++
)
{
for
(
int
j
=
0
;
j
<
3
;
j
++
)
{
cmVel
[
j
]
=
vscale
*
cmVel
[
j
]
+
fscale
*
pairInvTotalMass
[
i
]
*
cmForce
[
j
]
+
noisescale
*
sqrtInvTotalMass
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
();
cmVel
[
j
]
=
vscale
*
cmVel
[
j
]
+
fscale
*
pairInvTotalMass
[
i
]
*
cmForce
[
j
]
+
noisescale
*
sqrtInvTotalMass
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
();
relVel
[
j
]
=
vscaleDrude
*
relVel
[
j
]
+
fscaleDrude
*
pairInvReducedMass
[
i
]
*
relForce
[
j
]
+
noisescaleDrude
*
sqrtInvReducedMass
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
();
relVel
[
j
]
=
vscaleDrude
*
relVel
[
j
]
+
fscaleDrude
*
pairInvReducedMass
[
i
]
*
relForce
[
j
]
+
noisescaleDrude
*
sqrtInvReducedMass
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
();
...
@@ -305,8 +305,8 @@ void ReferenceIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, co
...
@@ -305,8 +305,8 @@ void ReferenceIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, co
// Update the particle positions.
// Update the particle positions.
int
numParticles
=
particleInvMass
.
size
();
int
numParticles
=
particleInvMass
.
size
();
vector
<
Real
Vec
>
xPrime
(
numParticles
);
vector
<
Vec
3
>
xPrime
(
numParticles
);
RealOpenMM
dt
=
integrator
.
getStepSize
();
double
dt
=
integrator
.
getStepSize
();
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
if
(
particleInvMass
[
i
]
!=
0.0
)
if
(
particleInvMass
[
i
]
!=
0.0
)
xPrime
[
i
]
=
pos
[
i
]
+
vel
[
i
]
*
dt
;
xPrime
[
i
]
=
pos
[
i
]
+
vel
[
i
]
*
dt
;
...
@@ -317,7 +317,7 @@ void ReferenceIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, co
...
@@ -317,7 +317,7 @@ void ReferenceIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, co
// Record the constrained positions and velocities.
// Record the constrained positions and velocities.
RealOpenMM
dtInv
=
1.0
/
dt
;
double
dtInv
=
1.0
/
dt
;
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
{
if
(
particleInvMass
[
i
]
!=
0.0
)
{
if
(
particleInvMass
[
i
]
!=
0.0
)
{
vel
[
i
]
=
(
xPrime
[
i
]
-
pos
[
i
])
*
dtInv
;
vel
[
i
]
=
(
xPrime
[
i
]
-
pos
[
i
])
*
dtInv
;
...
@@ -327,31 +327,31 @@ void ReferenceIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, co
...
@@ -327,31 +327,31 @@ void ReferenceIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, co
// Apply hard wall constraints.
// Apply hard wall constraints.
const
RealOpenMM
maxDrudeDistance
=
integrator
.
getMaxDrudeDistance
();
const
double
maxDrudeDistance
=
integrator
.
getMaxDrudeDistance
();
if
(
maxDrudeDistance
>
0
)
{
if
(
maxDrudeDistance
>
0
)
{
const
RealOpenMM
hardwallscaleDrude
=
sqrt
(
kTDrude
);
const
double
hardwallscaleDrude
=
sqrt
(
kTDrude
);
for
(
int
i
=
0
;
i
<
(
int
)
pairParticles
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
pairParticles
.
size
();
i
++
)
{
int
p1
=
pairParticles
[
i
].
first
;
int
p1
=
pairParticles
[
i
].
first
;
int
p2
=
pairParticles
[
i
].
second
;
int
p2
=
pairParticles
[
i
].
second
;
Real
Vec
delta
=
pos
[
p1
]
-
pos
[
p2
];
Vec
3
delta
=
pos
[
p1
]
-
pos
[
p2
];
RealOpenMM
r
=
sqrt
(
delta
.
dot
(
delta
));
double
r
=
sqrt
(
delta
.
dot
(
delta
));
RealOpenMM
rInv
=
1
/
r
;
double
rInv
=
1
/
r
;
if
(
rInv
*
maxDrudeDistance
<
1.0
)
{
if
(
rInv
*
maxDrudeDistance
<
1.0
)
{
// The constraint has been violated, so make the inter-particle distance "bounce"
// The constraint has been violated, so make the inter-particle distance "bounce"
// off the hard wall.
// off the hard wall.
if
(
rInv
*
maxDrudeDistance
<
0.5
)
if
(
rInv
*
maxDrudeDistance
<
0.5
)
throw
OpenMMException
(
"Drude particle moved too far beyond hard wall constraint"
);
throw
OpenMMException
(
"Drude particle moved too far beyond hard wall constraint"
);
Real
Vec
bondDir
=
delta
*
rInv
;
Vec
3
bondDir
=
delta
*
rInv
;
Real
Vec
vel1
=
vel
[
p1
];
Vec
3
vel1
=
vel
[
p1
];
Real
Vec
vel2
=
vel
[
p2
];
Vec
3
vel2
=
vel
[
p2
];
RealOpenMM
mass1
=
particleMass
[
p1
];
double
mass1
=
particleMass
[
p1
];
RealOpenMM
mass2
=
particleMass
[
p2
];
double
mass2
=
particleMass
[
p2
];
RealOpenMM
deltaR
=
r
-
maxDrudeDistance
;
double
deltaR
=
r
-
maxDrudeDistance
;
RealOpenMM
deltaT
=
dt
;
double
deltaT
=
dt
;
RealOpenMM
dotvr1
=
vel1
.
dot
(
bondDir
);
double
dotvr1
=
vel1
.
dot
(
bondDir
);
Real
Vec
vb1
=
bondDir
*
dotvr1
;
Vec
3
vb1
=
bondDir
*
dotvr1
;
Real
Vec
vp1
=
vel1
-
vb1
;
Vec
3
vp1
=
vel1
-
vb1
;
if
(
mass2
==
0
)
{
if
(
mass2
==
0
)
{
// The parent particle is massless, so move only the Drude particle.
// The parent particle is massless, so move only the Drude particle.
...
@@ -360,29 +360,29 @@ void ReferenceIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, co
...
@@ -360,29 +360,29 @@ void ReferenceIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, co
if
(
deltaT
>
dt
)
if
(
deltaT
>
dt
)
deltaT
=
dt
;
deltaT
=
dt
;
dotvr1
=
-
dotvr1
*
hardwallscaleDrude
/
(
abs
(
dotvr1
)
*
sqrt
(
mass1
));
dotvr1
=
-
dotvr1
*
hardwallscaleDrude
/
(
abs
(
dotvr1
)
*
sqrt
(
mass1
));
RealOpenMM
dr
=
-
deltaR
+
deltaT
*
dotvr1
;
double
dr
=
-
deltaR
+
deltaT
*
dotvr1
;
pos
[
p1
]
+=
bondDir
*
dr
;
pos
[
p1
]
+=
bondDir
*
dr
;
vel
[
p1
]
=
vp1
+
bondDir
*
dotvr1
;
vel
[
p1
]
=
vp1
+
bondDir
*
dotvr1
;
}
}
else
{
else
{
// Move both particles.
// Move both particles.
RealOpenMM
invTotalMass
=
pairInvTotalMass
[
i
];
double
invTotalMass
=
pairInvTotalMass
[
i
];
RealOpenMM
dotvr2
=
vel2
.
dot
(
bondDir
);
double
dotvr2
=
vel2
.
dot
(
bondDir
);
Real
Vec
vb2
=
bondDir
*
dotvr2
;
Vec
3
vb2
=
bondDir
*
dotvr2
;
Real
Vec
vp2
=
vel2
-
vb2
;
Vec
3
vp2
=
vel2
-
vb2
;
RealOpenMM
vbCMass
=
(
mass1
*
dotvr1
+
mass2
*
dotvr2
)
*
invTotalMass
;
double
vbCMass
=
(
mass1
*
dotvr1
+
mass2
*
dotvr2
)
*
invTotalMass
;
dotvr1
-=
vbCMass
;
dotvr1
-=
vbCMass
;
dotvr2
-=
vbCMass
;
dotvr2
-=
vbCMass
;
if
(
dotvr1
!=
dotvr2
)
if
(
dotvr1
!=
dotvr2
)
deltaT
=
deltaR
/
abs
(
dotvr1
-
dotvr2
);
deltaT
=
deltaR
/
abs
(
dotvr1
-
dotvr2
);
if
(
deltaT
>
dt
)
if
(
deltaT
>
dt
)
deltaT
=
dt
;
deltaT
=
dt
;
RealOpenMM
vBond
=
hardwallscaleDrude
/
sqrt
(
mass1
);
double
vBond
=
hardwallscaleDrude
/
sqrt
(
mass1
);
dotvr1
=
-
dotvr1
*
vBond
*
mass2
*
invTotalMass
/
abs
(
dotvr1
);
dotvr1
=
-
dotvr1
*
vBond
*
mass2
*
invTotalMass
/
abs
(
dotvr1
);
dotvr2
=
-
dotvr2
*
vBond
*
mass1
*
invTotalMass
/
abs
(
dotvr2
);
dotvr2
=
-
dotvr2
*
vBond
*
mass1
*
invTotalMass
/
abs
(
dotvr2
);
RealOpenMM
dr1
=
-
deltaR
*
mass2
*
invTotalMass
+
deltaT
*
dotvr1
;
double
dr1
=
-
deltaR
*
mass2
*
invTotalMass
+
deltaT
*
dotvr1
;
RealOpenMM
dr2
=
deltaR
*
mass1
*
invTotalMass
+
deltaT
*
dotvr2
;
double
dr2
=
deltaR
*
mass1
*
invTotalMass
+
deltaT
*
dotvr2
;
dotvr1
+=
vbCMass
;
dotvr1
+=
vbCMass
;
dotvr2
+=
vbCMass
;
dotvr2
+=
vbCMass
;
pos
[
p1
]
+=
bondDir
*
dr1
;
pos
[
p1
]
+=
bondDir
*
dr1
;
...
@@ -419,7 +419,7 @@ void ReferenceIntegrateDrudeSCFStepKernel::initialize(const System& system, cons
...
@@ -419,7 +419,7 @@ void ReferenceIntegrateDrudeSCFStepKernel::initialize(const System& system, cons
// Record particle masses.
// Record particle masses.
vector
<
RealOpenMM
>
particleMass
;
vector
<
double
>
particleMass
;
for
(
int
i
=
0
;
i
<
system
.
getNumParticles
();
i
++
)
{
for
(
int
i
=
0
;
i
<
system
.
getNumParticles
();
i
++
)
{
double
mass
=
system
.
getParticleMass
(
i
);
double
mass
=
system
.
getParticleMass
(
i
);
particleMass
.
push_back
(
mass
);
particleMass
.
push_back
(
mass
);
...
@@ -433,20 +433,20 @@ void ReferenceIntegrateDrudeSCFStepKernel::initialize(const System& system, cons
...
@@ -433,20 +433,20 @@ void ReferenceIntegrateDrudeSCFStepKernel::initialize(const System& system, cons
throw
OpenMMException
(
"DrudeSCFIntegrator: Failed to allocate memory"
);
throw
OpenMMException
(
"DrudeSCFIntegrator: Failed to allocate memory"
);
lbfgs_parameter_init
(
&
minimizerParams
);
lbfgs_parameter_init
(
&
minimizerParams
);
minimizerParams
.
linesearch
=
LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE
;
minimizerParams
.
linesearch
=
LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE
;
if
(
sizeof
(
RealOpenMM
)
<
8
)
if
(
sizeof
(
double
)
<
8
)
minimizerParams
.
xtol
=
1e-7
;
minimizerParams
.
xtol
=
1e-7
;
}
}
void
ReferenceIntegrateDrudeSCFStepKernel
::
execute
(
ContextImpl
&
context
,
const
DrudeSCFIntegrator
&
integrator
)
{
void
ReferenceIntegrateDrudeSCFStepKernel
::
execute
(
ContextImpl
&
context
,
const
DrudeSCFIntegrator
&
integrator
)
{
vector
<
Real
Vec
>&
pos
=
extractPositions
(
context
);
vector
<
Vec
3
>&
pos
=
extractPositions
(
context
);
vector
<
Real
Vec
>&
vel
=
extractVelocities
(
context
);
vector
<
Vec
3
>&
vel
=
extractVelocities
(
context
);
vector
<
Real
Vec
>&
force
=
extractForces
(
context
);
vector
<
Vec
3
>&
force
=
extractForces
(
context
);
// Update the positions and velocities.
// Update the positions and velocities.
int
numParticles
=
particleInvMass
.
size
();
int
numParticles
=
particleInvMass
.
size
();
vector
<
Real
Vec
>
xPrime
(
numParticles
);
vector
<
Vec
3
>
xPrime
(
numParticles
);
RealOpenMM
dt
=
integrator
.
getStepSize
();
double
dt
=
integrator
.
getStepSize
();
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
{
if
(
particleInvMass
[
i
]
!=
0.0
)
{
if
(
particleInvMass
[
i
]
!=
0.0
)
{
vel
[
i
]
+=
force
[
i
]
*
particleInvMass
[
i
]
*
dt
;
vel
[
i
]
+=
force
[
i
]
*
particleInvMass
[
i
]
*
dt
;
...
@@ -460,7 +460,7 @@ void ReferenceIntegrateDrudeSCFStepKernel::execute(ContextImpl& context, const D
...
@@ -460,7 +460,7 @@ void ReferenceIntegrateDrudeSCFStepKernel::execute(ContextImpl& context, const D
// Record the constrained positions and velocities.
// Record the constrained positions and velocities.
RealOpenMM
dtInv
=
1.0
/
dt
;
double
dtInv
=
1.0
/
dt
;
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
{
if
(
particleInvMass
[
i
]
!=
0.0
)
{
if
(
particleInvMass
[
i
]
!=
0.0
)
{
vel
[
i
]
=
(
xPrime
[
i
]
-
pos
[
i
])
*
dtInv
;
vel
[
i
]
=
(
xPrime
[
i
]
-
pos
[
i
])
*
dtInv
;
...
@@ -494,13 +494,13 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
...
@@ -494,13 +494,13 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
// Compute the force and energy for this configuration.
// Compute the force and energy for this configuration.
vector
<
Real
Vec
>&
pos
=
extractPositions
(
context
);
vector
<
Vec
3
>&
pos
=
extractPositions
(
context
);
vector
<
Real
Vec
>&
force
=
extractForces
(
context
);
vector
<
Vec
3
>&
force
=
extractForces
(
context
);
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
pos
[
drudeParticles
[
i
]]
=
Real
Vec
(
x
[
3
*
i
],
x
[
3
*
i
+
1
],
x
[
3
*
i
+
2
]);
pos
[
drudeParticles
[
i
]]
=
Vec
3
(
x
[
3
*
i
],
x
[
3
*
i
+
1
],
x
[
3
*
i
+
2
]);
double
energy
=
context
.
calcForcesAndEnergy
(
true
,
true
);
double
energy
=
context
.
calcForcesAndEnergy
(
true
,
true
);
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
{
Real
Vec
f
=
force
[
drudeParticles
[
i
]];
Vec
3
f
=
force
[
drudeParticles
[
i
]];
g
[
3
*
i
]
=
-
f
[
0
];
g
[
3
*
i
]
=
-
f
[
0
];
g
[
3
*
i
+
1
]
=
-
f
[
1
];
g
[
3
*
i
+
1
]
=
-
f
[
1
];
g
[
3
*
i
+
2
]
=
-
f
[
2
];
g
[
3
*
i
+
2
]
=
-
f
[
2
];
...
@@ -511,11 +511,11 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
...
@@ -511,11 +511,11 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
void
ReferenceIntegrateDrudeSCFStepKernel
::
minimize
(
ContextImpl
&
context
,
double
tolerance
)
{
void
ReferenceIntegrateDrudeSCFStepKernel
::
minimize
(
ContextImpl
&
context
,
double
tolerance
)
{
// Record the initial positions and determine a normalization constant for scaling the tolerance.
// Record the initial positions and determine a normalization constant for scaling the tolerance.
vector
<
Real
Vec
>&
pos
=
extractPositions
(
context
);
vector
<
Vec
3
>&
pos
=
extractPositions
(
context
);
int
numDrudeParticles
=
drudeParticles
.
size
();
int
numDrudeParticles
=
drudeParticles
.
size
();
double
norm
=
0.0
;
double
norm
=
0.0
;
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
{
Real
Vec
p
=
pos
[
drudeParticles
[
i
]];
Vec
3
p
=
pos
[
drudeParticles
[
i
]];
minimizerPos
[
3
*
i
]
=
p
[
0
];
minimizerPos
[
3
*
i
]
=
p
[
0
];
minimizerPos
[
3
*
i
+
1
]
=
p
[
1
];
minimizerPos
[
3
*
i
+
1
]
=
p
[
1
];
minimizerPos
[
3
*
i
+
2
]
=
p
[
2
];
minimizerPos
[
3
*
i
+
2
]
=
p
[
2
];
...
...
plugins/drude/platforms/reference/src/ReferenceDrudeKernels.h
View file @
a783b996
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#include "ReferencePlatform.h"
#include "ReferencePlatform.h"
#include "openmm/DrudeKernels.h"
#include "openmm/DrudeKernels.h"
#include "
Real
Vec.h"
#include "
openmm/
Vec
3
.h"
#include "lbfgs.h"
#include "lbfgs.h"
#include <utility>
#include <utility>
#include <vector>
#include <vector>
...
...
plugins/rpmd/platforms/cuda/tests/TestCudaRpmd.cpp
View file @
a783b996
...
@@ -78,7 +78,7 @@ void testFreeParticles() {
...
@@ -78,7 +78,7 @@ void testFreeParticles() {
integ
.
step
(
1000
);
integ
.
step
(
1000
);
vector
<
double
>
ke
(
numCopies
,
0.0
);
vector
<
double
>
ke
(
numCopies
,
0.0
);
vector
<
double
>
rg
(
numParticles
,
0.0
);
vector
<
double
>
rg
(
numParticles
,
0.0
);
const
RealOpenMM
hbar
=
1.054571628e-34
*
AVOGADRO
/
(
1000
*
1e-12
);
const
double
hbar
=
1.054571628e-34
*
AVOGADRO
/
(
1000
*
1e-12
);
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
{
integ
.
step
(
1
);
integ
.
step
(
1
);
vector
<
State
>
state
(
numCopies
);
vector
<
State
>
state
(
numCopies
);
...
...
plugins/rpmd/platforms/opencl/tests/TestOpenCLRpmd.cpp
View file @
a783b996
...
@@ -78,7 +78,7 @@ void testFreeParticles() {
...
@@ -78,7 +78,7 @@ void testFreeParticles() {
integ
.
step
(
1000
);
integ
.
step
(
1000
);
vector
<
double
>
ke
(
numCopies
,
0.0
);
vector
<
double
>
ke
(
numCopies
,
0.0
);
vector
<
double
>
rg
(
numParticles
,
0.0
);
vector
<
double
>
rg
(
numParticles
,
0.0
);
const
RealOpenMM
hbar
=
1.054571628e-34
*
AVOGADRO
/
(
1000
*
1e-12
);
const
double
hbar
=
1.054571628e-34
*
AVOGADRO
/
(
1000
*
1e-12
);
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
{
integ
.
step
(
1
);
integ
.
step
(
1
);
vector
<
State
>
state
(
numCopies
);
vector
<
State
>
state
(
numCopies
);
...
@@ -171,7 +171,7 @@ void testParaHydrogen() {
...
@@ -171,7 +171,7 @@ void testParaHydrogen() {
vector
<
int
>
counts
(
numBins
,
0
);
vector
<
int
>
counts
(
numBins
,
0
);
const
double
invBoxSize
=
1.0
/
boxSize
;
const
double
invBoxSize
=
1.0
/
boxSize
;
double
meanKE
=
0.0
;
double
meanKE
=
0.0
;
const
RealOpenMM
hbar
=
1.054571628e-34
*
AVOGADRO
/
(
1000
*
1e-12
);
const
double
hbar
=
1.054571628e-34
*
AVOGADRO
/
(
1000
*
1e-12
);
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
integ
.
step
(
20
);
integ
.
step
(
20
);
vector
<
State
>
states
(
numCopies
);
vector
<
State
>
states
(
numCopies
);
...
...
plugins/rpmd/platforms/reference/src/ReferenceRpmdKernels.cpp
View file @
a783b996
...
@@ -37,19 +37,19 @@
...
@@ -37,19 +37,19 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
static
vector
<
Real
Vec
>&
extractPositions
(
ContextImpl
&
context
)
{
static
vector
<
Vec
3
>&
extractPositions
(
ContextImpl
&
context
)
{
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
return
*
((
vector
<
Real
Vec
>*
)
data
->
positions
);
return
*
((
vector
<
Vec
3
>*
)
data
->
positions
);
}
}
static
vector
<
Real
Vec
>&
extractVelocities
(
ContextImpl
&
context
)
{
static
vector
<
Vec
3
>&
extractVelocities
(
ContextImpl
&
context
)
{
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
return
*
((
vector
<
Real
Vec
>*
)
data
->
velocities
);
return
*
((
vector
<
Vec
3
>*
)
data
->
velocities
);
}
}
static
vector
<
Real
Vec
>&
extractForces
(
ContextImpl
&
context
)
{
static
vector
<
Vec
3
>&
extractForces
(
ContextImpl
&
context
)
{
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
return
*
((
vector
<
Real
Vec
>*
)
data
->
forces
);
return
*
((
vector
<
Vec
3
>*
)
data
->
forces
);
}
}
ReferenceIntegrateRPMDStepKernel
::~
ReferenceIntegrateRPMDStepKernel
()
{
ReferenceIntegrateRPMDStepKernel
::~
ReferenceIntegrateRPMDStepKernel
()
{
...
@@ -113,12 +113,12 @@ void ReferenceIntegrateRPMDStepKernel::initialize(const System& system, const RP
...
@@ -113,12 +113,12 @@ void ReferenceIntegrateRPMDStepKernel::initialize(const System& system, const RP
void
ReferenceIntegrateRPMDStepKernel
::
execute
(
ContextImpl
&
context
,
const
RPMDIntegrator
&
integrator
,
bool
forcesAreValid
)
{
void
ReferenceIntegrateRPMDStepKernel
::
execute
(
ContextImpl
&
context
,
const
RPMDIntegrator
&
integrator
,
bool
forcesAreValid
)
{
const
int
numCopies
=
positions
.
size
();
const
int
numCopies
=
positions
.
size
();
const
int
numParticles
=
positions
[
0
].
size
();
const
int
numParticles
=
positions
[
0
].
size
();
const
RealOpenMM
dt
=
integrator
.
getStepSize
();
const
double
dt
=
integrator
.
getStepSize
();
const
RealOpenMM
halfdt
=
0.5
*
dt
;
const
double
halfdt
=
0.5
*
dt
;
const
System
&
system
=
context
.
getSystem
();
const
System
&
system
=
context
.
getSystem
();
vector
<
Real
Vec
>&
pos
=
extractPositions
(
context
);
vector
<
Vec
3
>&
pos
=
extractPositions
(
context
);
vector
<
Real
Vec
>&
vel
=
extractVelocities
(
context
);
vector
<
Vec
3
>&
vel
=
extractVelocities
(
context
);
vector
<
Real
Vec
>&
f
=
extractForces
(
context
);
vector
<
Vec
3
>&
f
=
extractForces
(
context
);
// Loop over copies and compute the force on each one.
// Loop over copies and compute the force on each one.
...
@@ -129,17 +129,17 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
...
@@ -129,17 +129,17 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
vector
<
t_complex
>
v
(
numCopies
);
vector
<
t_complex
>
v
(
numCopies
);
vector
<
t_complex
>
q
(
numCopies
);
vector
<
t_complex
>
q
(
numCopies
);
const
RealOpenMM
hbar
=
1.054571628e-34
*
AVOGADRO
/
(
1000
*
1e-12
);
const
double
hbar
=
1.054571628e-34
*
AVOGADRO
/
(
1000
*
1e-12
);
const
RealOpenMM
scale
=
1.0
/
sqrt
((
RealOpenMM
)
numCopies
);
const
double
scale
=
1.0
/
sqrt
((
double
)
numCopies
);
const
RealOpenMM
nkT
=
numCopies
*
BOLTZ
*
integrator
.
getTemperature
();
const
double
nkT
=
numCopies
*
BOLTZ
*
integrator
.
getTemperature
();
const
RealOpenMM
twown
=
2.0
*
nkT
/
hbar
;
const
double
twown
=
2.0
*
nkT
/
hbar
;
const
RealOpenMM
c1_0
=
exp
(
-
halfdt
*
integrator
.
getFriction
());
const
double
c1_0
=
exp
(
-
halfdt
*
integrator
.
getFriction
());
const
RealOpenMM
c2_0
=
sqrt
(
1.0
-
c1_0
*
c1_0
);
const
double
c2_0
=
sqrt
(
1.0
-
c1_0
*
c1_0
);
if
(
integrator
.
getApplyThermostat
())
{
if
(
integrator
.
getApplyThermostat
())
{
for
(
int
particle
=
0
;
particle
<
numParticles
;
particle
++
)
{
for
(
int
particle
=
0
;
particle
<
numParticles
;
particle
++
)
{
if
(
system
.
getParticleMass
(
particle
)
==
0.0
)
if
(
system
.
getParticleMass
(
particle
)
==
0.0
)
continue
;
continue
;
const
RealOpenMM
c3_0
=
c2_0
*
sqrt
(
nkT
/
system
.
getParticleMass
(
particle
));
const
double
c3_0
=
c2_0
*
sqrt
(
nkT
/
system
.
getParticleMass
(
particle
));
for
(
int
component
=
0
;
component
<
3
;
component
++
)
{
for
(
int
component
=
0
;
component
<
3
;
component
++
)
{
for
(
int
k
=
0
;
k
<
numCopies
;
k
++
)
for
(
int
k
=
0
;
k
<
numCopies
;
k
++
)
v
[
k
]
=
t_complex
(
scale
*
velocities
[
k
][
particle
][
component
],
0.0
);
v
[
k
]
=
t_complex
(
scale
*
velocities
[
k
][
particle
][
component
],
0.0
);
...
@@ -153,12 +153,12 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
...
@@ -153,12 +153,12 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
for
(
int
k
=
1
;
k
<=
numCopies
/
2
;
k
++
)
{
for
(
int
k
=
1
;
k
<=
numCopies
/
2
;
k
++
)
{
const
bool
isCenter
=
(
numCopies
%
2
==
0
&&
k
==
numCopies
/
2
);
const
bool
isCenter
=
(
numCopies
%
2
==
0
&&
k
==
numCopies
/
2
);
const
RealOpenMM
wk
=
twown
*
sin
(
k
*
M_PI
/
numCopies
);
const
double
wk
=
twown
*
sin
(
k
*
M_PI
/
numCopies
);
const
RealOpenMM
c1
=
exp
(
-
2.0
*
wk
*
halfdt
);
const
double
c1
=
exp
(
-
2.0
*
wk
*
halfdt
);
const
RealOpenMM
c2
=
sqrt
((
1.0
-
c1
*
c1
)
/
2
)
*
(
isCenter
?
sqrt
(
2.0
)
:
1.0
);
const
double
c2
=
sqrt
((
1.0
-
c1
*
c1
)
/
2
)
*
(
isCenter
?
sqrt
(
2.0
)
:
1.0
);
const
RealOpenMM
c3
=
c2
*
sqrt
(
nkT
/
system
.
getParticleMass
(
particle
));
const
double
c3
=
c2
*
sqrt
(
nkT
/
system
.
getParticleMass
(
particle
));
RealOpenMM
rand1
=
c3
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
();
double
rand1
=
c3
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
();
RealOpenMM
rand2
=
(
isCenter
?
0.0
:
c3
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
());
double
rand2
=
(
isCenter
?
0.0
:
c3
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
());
v
[
k
]
=
v
[
k
]
*
c1
+
t_complex
(
rand1
,
rand2
);
v
[
k
]
=
v
[
k
]
*
c1
+
t_complex
(
rand1
,
rand2
);
if
(
k
<
numCopies
-
k
)
if
(
k
<
numCopies
-
k
)
v
[
numCopies
-
k
]
=
v
[
numCopies
-
k
]
*
c1
+
t_complex
(
rand1
,
-
rand2
);
v
[
numCopies
-
k
]
=
v
[
numCopies
-
k
]
*
c1
+
t_complex
(
rand1
,
-
rand2
);
...
@@ -191,11 +191,11 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
...
@@ -191,11 +191,11 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
fftpack_exec_1d
(
fft
,
FFTPACK_FORWARD
,
&
v
[
0
],
&
v
[
0
]);
fftpack_exec_1d
(
fft
,
FFTPACK_FORWARD
,
&
v
[
0
],
&
v
[
0
]);
q
[
0
]
+=
v
[
0
]
*
dt
;
q
[
0
]
+=
v
[
0
]
*
dt
;
for
(
int
k
=
1
;
k
<
numCopies
;
k
++
)
{
for
(
int
k
=
1
;
k
<
numCopies
;
k
++
)
{
const
RealOpenMM
wk
=
twown
*
sin
(
k
*
M_PI
/
numCopies
);
const
double
wk
=
twown
*
sin
(
k
*
M_PI
/
numCopies
);
const
RealOpenMM
wt
=
wk
*
dt
;
const
double
wt
=
wk
*
dt
;
const
RealOpenMM
coswt
=
cos
(
wt
);
const
double
coswt
=
cos
(
wt
);
const
RealOpenMM
sinwt
=
sin
(
wt
);
const
double
sinwt
=
sin
(
wt
);
const
RealOpenMM
wm
=
wk
*
system
.
getParticleMass
(
particle
);
const
double
wm
=
wk
*
system
.
getParticleMass
(
particle
);
const
t_complex
vprime
=
v
[
k
]
*
coswt
-
q
[
k
]
*
(
wk
*
sinwt
);
// Advance velocity from t to t+dt
const
t_complex
vprime
=
v
[
k
]
*
coswt
-
q
[
k
]
*
(
wk
*
sinwt
);
// Advance velocity from t to t+dt
q
[
k
]
=
v
[
k
]
*
(
sinwt
/
wk
)
+
q
[
k
]
*
coswt
;
// Advance position from t to t+dt
q
[
k
]
=
v
[
k
]
*
(
sinwt
/
wk
)
+
q
[
k
]
*
coswt
;
// Advance position from t to t+dt
v
[
k
]
=
vprime
;
v
[
k
]
=
vprime
;
...
@@ -226,7 +226,7 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
...
@@ -226,7 +226,7 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
for
(
int
particle
=
0
;
particle
<
numParticles
;
particle
++
)
{
for
(
int
particle
=
0
;
particle
<
numParticles
;
particle
++
)
{
if
(
system
.
getParticleMass
(
particle
)
==
0.0
)
if
(
system
.
getParticleMass
(
particle
)
==
0.0
)
continue
;
continue
;
const
RealOpenMM
c3_0
=
c2_0
*
sqrt
(
nkT
/
system
.
getParticleMass
(
particle
));
const
double
c3_0
=
c2_0
*
sqrt
(
nkT
/
system
.
getParticleMass
(
particle
));
for
(
int
component
=
0
;
component
<
3
;
component
++
)
{
for
(
int
component
=
0
;
component
<
3
;
component
++
)
{
for
(
int
k
=
0
;
k
<
numCopies
;
k
++
)
for
(
int
k
=
0
;
k
<
numCopies
;
k
++
)
v
[
k
]
=
t_complex
(
scale
*
velocities
[
k
][
particle
][
component
],
0.0
);
v
[
k
]
=
t_complex
(
scale
*
velocities
[
k
][
particle
][
component
],
0.0
);
...
@@ -240,12 +240,12 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
...
@@ -240,12 +240,12 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
for
(
int
k
=
1
;
k
<=
numCopies
/
2
;
k
++
)
{
for
(
int
k
=
1
;
k
<=
numCopies
/
2
;
k
++
)
{
const
bool
isCenter
=
(
numCopies
%
2
==
0
&&
k
==
numCopies
/
2
);
const
bool
isCenter
=
(
numCopies
%
2
==
0
&&
k
==
numCopies
/
2
);
const
RealOpenMM
wk
=
twown
*
sin
(
k
*
M_PI
/
numCopies
);
const
double
wk
=
twown
*
sin
(
k
*
M_PI
/
numCopies
);
const
RealOpenMM
c1
=
exp
(
-
2.0
*
wk
*
halfdt
);
const
double
c1
=
exp
(
-
2.0
*
wk
*
halfdt
);
const
RealOpenMM
c2
=
sqrt
((
1.0
-
c1
*
c1
)
/
2
)
*
(
isCenter
?
sqrt
(
2.0
)
:
1.0
);
const
double
c2
=
sqrt
((
1.0
-
c1
*
c1
)
/
2
)
*
(
isCenter
?
sqrt
(
2.0
)
:
1.0
);
const
RealOpenMM
c3
=
c2
*
sqrt
(
nkT
/
system
.
getParticleMass
(
particle
));
const
double
c3
=
c2
*
sqrt
(
nkT
/
system
.
getParticleMass
(
particle
));
RealOpenMM
rand1
=
c3
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
();
double
rand1
=
c3
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
();
RealOpenMM
rand2
=
(
isCenter
?
0.0
:
c3
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
());
double
rand2
=
(
isCenter
?
0.0
:
c3
*
SimTKOpenMMUtilities
::
getNormallyDistributedRandomNumber
());
v
[
k
]
=
v
[
k
]
*
c1
+
t_complex
(
rand1
,
rand2
);
v
[
k
]
=
v
[
k
]
*
c1
+
t_complex
(
rand1
,
rand2
);
if
(
k
<
numCopies
-
k
)
if
(
k
<
numCopies
-
k
)
v
[
numCopies
-
k
]
=
v
[
numCopies
-
k
]
*
c1
+
t_complex
(
rand1
,
-
rand2
);
v
[
numCopies
-
k
]
=
v
[
numCopies
-
k
]
*
c1
+
t_complex
(
rand1
,
-
rand2
);
...
@@ -265,9 +265,9 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
...
@@ -265,9 +265,9 @@ void ReferenceIntegrateRPMDStepKernel::execute(ContextImpl& context, const RPMDI
void
ReferenceIntegrateRPMDStepKernel
::
computeForces
(
ContextImpl
&
context
,
const
RPMDIntegrator
&
integrator
)
{
void
ReferenceIntegrateRPMDStepKernel
::
computeForces
(
ContextImpl
&
context
,
const
RPMDIntegrator
&
integrator
)
{
const
int
totalCopies
=
positions
.
size
();
const
int
totalCopies
=
positions
.
size
();
const
int
numParticles
=
positions
[
0
].
size
();
const
int
numParticles
=
positions
[
0
].
size
();
vector
<
Real
Vec
>&
pos
=
extractPositions
(
context
);
vector
<
Vec
3
>&
pos
=
extractPositions
(
context
);
vector
<
Real
Vec
>&
vel
=
extractVelocities
(
context
);
vector
<
Vec
3
>&
vel
=
extractVelocities
(
context
);
vector
<
Real
Vec
>&
f
=
extractForces
(
context
);
vector
<
Vec
3
>&
f
=
extractForces
(
context
);
// Compute forces from all groups that didn't have a specified contraction.
// Compute forces from all groups that didn't have a specified contraction.
...
@@ -298,7 +298,7 @@ void ReferenceIntegrateRPMDStepKernel::computeForces(ContextImpl& context, const
...
@@ -298,7 +298,7 @@ void ReferenceIntegrateRPMDStepKernel::computeForces(ContextImpl& context, const
// Find the contracted positions.
// Find the contracted positions.
vector
<
t_complex
>
q
(
totalCopies
);
vector
<
t_complex
>
q
(
totalCopies
);
const
RealOpenMM
scale1
=
1.0
/
totalCopies
;
const
double
scale1
=
1.0
/
totalCopies
;
for
(
int
particle
=
0
;
particle
<
numParticles
;
particle
++
)
{
for
(
int
particle
=
0
;
particle
<
numParticles
;
particle
++
)
{
for
(
int
component
=
0
;
component
<
3
;
component
++
)
{
for
(
int
component
=
0
;
component
<
3
;
component
++
)
{
// Transform to the frequency domain, set high frequency components to zero, and transform back.
// Transform to the frequency domain, set high frequency components to zero, and transform back.
...
@@ -329,7 +329,7 @@ void ReferenceIntegrateRPMDStepKernel::computeForces(ContextImpl& context, const
...
@@ -329,7 +329,7 @@ void ReferenceIntegrateRPMDStepKernel::computeForces(ContextImpl& context, const
// Apply the forces to the original copies.
// Apply the forces to the original copies.
const
RealOpenMM
scale2
=
1.0
/
copies
;
const
double
scale2
=
1.0
/
copies
;
for
(
int
particle
=
0
;
particle
<
numParticles
;
particle
++
)
{
for
(
int
particle
=
0
;
particle
<
numParticles
;
particle
++
)
{
for
(
int
component
=
0
;
component
<
3
;
component
++
)
{
for
(
int
component
=
0
;
component
<
3
;
component
++
)
{
// Transform to the frequency domain, pad with zeros, and transform back.
// Transform to the frequency domain, pad with zeros, and transform back.
...
@@ -355,12 +355,12 @@ void ReferenceIntegrateRPMDStepKernel::computeForces(ContextImpl& context, const
...
@@ -355,12 +355,12 @@ void ReferenceIntegrateRPMDStepKernel::computeForces(ContextImpl& context, const
double
ReferenceIntegrateRPMDStepKernel
::
computeKineticEnergy
(
ContextImpl
&
context
,
const
RPMDIntegrator
&
integrator
)
{
double
ReferenceIntegrateRPMDStepKernel
::
computeKineticEnergy
(
ContextImpl
&
context
,
const
RPMDIntegrator
&
integrator
)
{
const
System
&
system
=
context
.
getSystem
();
const
System
&
system
=
context
.
getSystem
();
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
vector
<
Real
Vec
>&
velData
=
extractVelocities
(
context
);
vector
<
Vec
3
>&
velData
=
extractVelocities
(
context
);
double
energy
=
0.0
;
double
energy
=
0.0
;
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
double
mass
=
system
.
getParticleMass
(
i
);
double
mass
=
system
.
getParticleMass
(
i
);
if
(
mass
>
0
)
{
if
(
mass
>
0
)
{
Real
Vec
v
=
velData
[
i
];
Vec
3
v
=
velData
[
i
];
energy
+=
mass
*
(
v
.
dot
(
v
));
energy
+=
mass
*
(
v
.
dot
(
v
));
}
}
}
}
...
...
plugins/rpmd/platforms/reference/src/ReferenceRpmdKernels.h
View file @
a783b996
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#include "ReferencePlatform.h"
#include "ReferencePlatform.h"
#include "openmm/RpmdKernels.h"
#include "openmm/RpmdKernels.h"
#include "
Real
Vec.h"
#include "
openmm/
Vec
3
.h"
#include "fftpack.h"
#include "fftpack.h"
namespace
OpenMM
{
namespace
OpenMM
{
...
@@ -86,11 +86,11 @@ public:
...
@@ -86,11 +86,11 @@ public:
void
copyToContext
(
int
copy
,
ContextImpl
&
context
);
void
copyToContext
(
int
copy
,
ContextImpl
&
context
);
private:
private:
void
computeForces
(
ContextImpl
&
context
,
const
RPMDIntegrator
&
integrator
);
void
computeForces
(
ContextImpl
&
context
,
const
RPMDIntegrator
&
integrator
);
std
::
vector
<
std
::
vector
<
Real
Vec
>
>
positions
;
std
::
vector
<
std
::
vector
<
Vec
3
>
>
positions
;
std
::
vector
<
std
::
vector
<
Real
Vec
>
>
velocities
;
std
::
vector
<
std
::
vector
<
Vec
3
>
>
velocities
;
std
::
vector
<
std
::
vector
<
Real
Vec
>
>
forces
;
std
::
vector
<
std
::
vector
<
Vec
3
>
>
forces
;
std
::
vector
<
std
::
vector
<
Real
Vec
>
>
contractedPositions
;
std
::
vector
<
std
::
vector
<
Vec
3
>
>
contractedPositions
;
std
::
vector
<
std
::
vector
<
Real
Vec
>
>
contractedForces
;
std
::
vector
<
std
::
vector
<
Vec
3
>
>
contractedForces
;
std
::
map
<
int
,
int
>
groupsByCopies
;
std
::
map
<
int
,
int
>
groupsByCopies
;
int
groupsNotContracted
;
int
groupsNotContracted
;
fftpack
*
fft
;
fftpack
*
fft
;
...
...
plugins/rpmd/platforms/reference/tests/TestReferenceRpmd.cpp
View file @
a783b996
...
@@ -77,7 +77,7 @@ void testFreeParticles() {
...
@@ -77,7 +77,7 @@ void testFreeParticles() {
integ
.
step
(
1000
);
integ
.
step
(
1000
);
vector
<
double
>
ke
(
numCopies
,
0.0
);
vector
<
double
>
ke
(
numCopies
,
0.0
);
vector
<
double
>
rg
(
numParticles
,
0.0
);
vector
<
double
>
rg
(
numParticles
,
0.0
);
const
RealOpenMM
hbar
=
1.054571628e-34
*
AVOGADRO
/
(
1000
*
1e-12
);
const
double
hbar
=
1.054571628e-34
*
AVOGADRO
/
(
1000
*
1e-12
);
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
{
integ
.
step
(
1
);
integ
.
step
(
1
);
vector
<
State
>
state
(
numCopies
);
vector
<
State
>
state
(
numCopies
);
...
...
Prev
1
…
4
5
6
7
8
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment