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
0843c5f3
Commit
0843c5f3
authored
Jan 03, 2011
by
Peter Eastman
Browse files
First stage of a refactoring to clean up the reference platform
parent
bacc1eff
Changes
86
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
159 additions
and
198 deletions
+159
-198
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+71
-107
platforms/reference/src/ReferenceKernels.h
platforms/reference/src/ReferenceKernels.h
+14
-14
platforms/reference/src/ReferencePlatform.cpp
platforms/reference/src/ReferencePlatform.cpp
+8
-22
platforms/reference/src/SimTKReference/PME.cpp
platforms/reference/src/SimTKReference/PME.cpp
+6
-4
platforms/reference/src/SimTKReference/PME.h
platforms/reference/src/SimTKReference/PME.h
+3
-2
platforms/reference/src/SimTKReference/ReferenceAndersenThermostat.cpp
...erence/src/SimTKReference/ReferenceAndersenThermostat.cpp
+2
-1
platforms/reference/src/SimTKReference/ReferenceAndersenThermostat.h
...eference/src/SimTKReference/ReferenceAndersenThermostat.h
+1
-1
platforms/reference/src/SimTKReference/ReferenceAngleBondIxn.cpp
...ms/reference/src/SimTKReference/ReferenceAngleBondIxn.cpp
+5
-2
platforms/reference/src/SimTKReference/ReferenceAngleBondIxn.h
...orms/reference/src/SimTKReference/ReferenceAngleBondIxn.h
+2
-2
platforms/reference/src/SimTKReference/ReferenceBondForce.cpp
...forms/reference/src/SimTKReference/ReferenceBondForce.cpp
+5
-2
platforms/reference/src/SimTKReference/ReferenceBondForce.h
platforms/reference/src/SimTKReference/ReferenceBondForce.h
+2
-2
platforms/reference/src/SimTKReference/ReferenceBondIxn.cpp
platforms/reference/src/SimTKReference/ReferenceBondIxn.cpp
+5
-2
platforms/reference/src/SimTKReference/ReferenceBondIxn.h
platforms/reference/src/SimTKReference/ReferenceBondIxn.h
+2
-2
platforms/reference/src/SimTKReference/ReferenceBrownianDynamics.cpp
...eference/src/SimTKReference/ReferenceBrownianDynamics.cpp
+8
-11
platforms/reference/src/SimTKReference/ReferenceBrownianDynamics.h
.../reference/src/SimTKReference/ReferenceBrownianDynamics.h
+4
-5
platforms/reference/src/SimTKReference/ReferenceCCMAAlgorithm.cpp
...s/reference/src/SimTKReference/ReferenceCCMAAlgorithm.cpp
+6
-5
platforms/reference/src/SimTKReference/ReferenceCCMAAlgorithm.h
...rms/reference/src/SimTKReference/ReferenceCCMAAlgorithm.h
+4
-4
platforms/reference/src/SimTKReference/ReferenceCMAPTorsionIxn.cpp
.../reference/src/SimTKReference/ReferenceCMAPTorsionIxn.cpp
+5
-4
platforms/reference/src/SimTKReference/ReferenceCMAPTorsionIxn.h
...ms/reference/src/SimTKReference/ReferenceCMAPTorsionIxn.h
+4
-4
platforms/reference/src/SimTKReference/ReferenceConstraintAlgorithm.h
...ference/src/SimTKReference/ReferenceConstraintAlgorithm.h
+2
-2
No files found.
platforms/reference/src/ReferenceKernels.cpp
View file @
0843c5f3
...
@@ -90,26 +90,6 @@ static RealOpenMM** allocateRealArray(int length, int width) {
...
@@ -90,26 +90,6 @@ static RealOpenMM** allocateRealArray(int length, int width) {
return
array
;
return
array
;
}
}
static
int
**
copyToArray
(
const
vector
<
vector
<
int
>
>
vec
)
{
if
(
vec
.
size
()
==
0
)
return
new
int
*
[
1
];
int
**
array
=
allocateIntArray
(
vec
.
size
(),
vec
[
0
].
size
());
for
(
size_t
i
=
0
;
i
<
vec
.
size
();
++
i
)
for
(
size_t
j
=
0
;
j
<
vec
[
i
].
size
();
++
j
)
array
[
i
][
j
]
=
vec
[
i
][
j
];
return
array
;
}
static
RealOpenMM
**
copyToArray
(
const
vector
<
vector
<
double
>
>
vec
)
{
if
(
vec
.
size
()
==
0
)
return
new
RealOpenMM
*
[
1
];
RealOpenMM
**
array
=
allocateRealArray
(
vec
.
size
(),
vec
[
0
].
size
());
for
(
size_t
i
=
0
;
i
<
vec
.
size
();
++
i
)
for
(
size_t
j
=
0
;
j
<
vec
[
i
].
size
();
++
j
)
array
[
i
][
j
]
=
static_cast
<
RealOpenMM
>
(
vec
[
i
][
j
]);
return
array
;
}
static
void
disposeIntArray
(
int
**
array
,
int
size
)
{
static
void
disposeIntArray
(
int
**
array
,
int
size
)
{
if
(
array
)
{
if
(
array
)
{
for
(
int
i
=
0
;
i
<
size
;
++
i
)
for
(
int
i
=
0
;
i
<
size
;
++
i
)
...
@@ -126,19 +106,19 @@ static void disposeRealArray(RealOpenMM** array, int size) {
...
@@ -126,19 +106,19 @@ static void disposeRealArray(RealOpenMM** array, int size) {
}
}
}
}
static
RealOpenMM
**
extractPositions
(
ContextImpl
&
context
)
{
static
vector
<
RealVec
>&
extractPositions
(
ContextImpl
&
context
)
{
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
return
(
RealOpenMM
*
*
)
data
->
positions
;
return
*
((
vector
<
RealVec
>
*
)
data
->
positions
)
;
}
}
static
RealOpenMM
**
extractVelocities
(
ContextImpl
&
context
)
{
static
vector
<
RealVec
>&
extractVelocities
(
ContextImpl
&
context
)
{
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
return
(
RealOpenMM
*
*
)
data
->
velocities
;
return
*
((
vector
<
RealVec
>
*
)
data
->
velocities
)
;
}
}
static
RealOpenMM
**
extractForces
(
ContextImpl
&
context
)
{
static
vector
<
RealVec
>&
extractForces
(
ContextImpl
&
context
)
{
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
ReferencePlatform
::
PlatformData
*
data
=
reinterpret_cast
<
ReferencePlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
return
(
RealOpenMM
*
*
)
data
->
forces
;
return
*
((
vector
<
RealVec
>
*
)
data
->
forces
)
;
}
}
static
RealOpenMM
*
extractBoxSize
(
ContextImpl
&
context
)
{
static
RealOpenMM
*
extractBoxSize
(
ContextImpl
&
context
)
{
...
@@ -166,7 +146,7 @@ void ReferenceCalcForcesAndEnergyKernel::initialize(const System& system) {
...
@@ -166,7 +146,7 @@ void ReferenceCalcForcesAndEnergyKernel::initialize(const System& system) {
void
ReferenceCalcForcesAndEnergyKernel
::
beginComputation
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
void
ReferenceCalcForcesAndEnergyKernel
::
beginComputation
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
if
(
includeForces
)
{
if
(
includeForces
)
{
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
forceData
[
i
][
0
]
=
(
RealOpenMM
)
0.0
;
forceData
[
i
][
0
]
=
(
RealOpenMM
)
0.0
;
forceData
[
i
][
1
]
=
(
RealOpenMM
)
0.0
;
forceData
[
i
][
1
]
=
(
RealOpenMM
)
0.0
;
...
@@ -192,7 +172,7 @@ void ReferenceUpdateStateDataKernel::setTime(ContextImpl& context, double time)
...
@@ -192,7 +172,7 @@ void ReferenceUpdateStateDataKernel::setTime(ContextImpl& context, double time)
void
ReferenceUpdateStateDataKernel
::
getPositions
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
positions
)
{
void
ReferenceUpdateStateDataKernel
::
getPositions
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
positions
)
{
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
positions
.
resize
(
numParticles
);
positions
.
resize
(
numParticles
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
positions
[
i
]
=
Vec3
(
posData
[
i
][
0
],
posData
[
i
][
1
],
posData
[
i
][
2
]);
positions
[
i
]
=
Vec3
(
posData
[
i
][
0
],
posData
[
i
][
1
],
posData
[
i
][
2
]);
...
@@ -200,7 +180,7 @@ void ReferenceUpdateStateDataKernel::getPositions(ContextImpl& context, std::vec
...
@@ -200,7 +180,7 @@ void ReferenceUpdateStateDataKernel::getPositions(ContextImpl& context, std::vec
void
ReferenceUpdateStateDataKernel
::
setPositions
(
ContextImpl
&
context
,
const
std
::
vector
<
Vec3
>&
positions
)
{
void
ReferenceUpdateStateDataKernel
::
setPositions
(
ContextImpl
&
context
,
const
std
::
vector
<
Vec3
>&
positions
)
{
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
posData
[
i
][
0
]
=
(
RealOpenMM
)
positions
[
i
][
0
];
posData
[
i
][
0
]
=
(
RealOpenMM
)
positions
[
i
][
0
];
posData
[
i
][
1
]
=
(
RealOpenMM
)
positions
[
i
][
1
];
posData
[
i
][
1
]
=
(
RealOpenMM
)
positions
[
i
][
1
];
...
@@ -210,7 +190,7 @@ void ReferenceUpdateStateDataKernel::setPositions(ContextImpl& context, const st
...
@@ -210,7 +190,7 @@ void ReferenceUpdateStateDataKernel::setPositions(ContextImpl& context, const st
void
ReferenceUpdateStateDataKernel
::
getVelocities
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
velocities
)
{
void
ReferenceUpdateStateDataKernel
::
getVelocities
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
velocities
)
{
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
RealOpenMM
**
velData
=
extractVelocities
(
context
);
vector
<
RealVec
>&
velData
=
extractVelocities
(
context
);
velocities
.
resize
(
numParticles
);
velocities
.
resize
(
numParticles
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
velocities
[
i
]
=
Vec3
(
velData
[
i
][
0
],
velData
[
i
][
1
],
velData
[
i
][
2
]);
velocities
[
i
]
=
Vec3
(
velData
[
i
][
0
],
velData
[
i
][
1
],
velData
[
i
][
2
]);
...
@@ -218,7 +198,7 @@ void ReferenceUpdateStateDataKernel::getVelocities(ContextImpl& context, std::ve
...
@@ -218,7 +198,7 @@ void ReferenceUpdateStateDataKernel::getVelocities(ContextImpl& context, std::ve
void
ReferenceUpdateStateDataKernel
::
setVelocities
(
ContextImpl
&
context
,
const
std
::
vector
<
Vec3
>&
velocities
)
{
void
ReferenceUpdateStateDataKernel
::
setVelocities
(
ContextImpl
&
context
,
const
std
::
vector
<
Vec3
>&
velocities
)
{
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
RealOpenMM
**
velData
=
extractVelocities
(
context
);
vector
<
RealVec
>&
velData
=
extractVelocities
(
context
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
velData
[
i
][
0
]
=
(
RealOpenMM
)
velocities
[
i
][
0
];
velData
[
i
][
0
]
=
(
RealOpenMM
)
velocities
[
i
][
0
];
velData
[
i
][
1
]
=
(
RealOpenMM
)
velocities
[
i
][
1
];
velData
[
i
][
1
]
=
(
RealOpenMM
)
velocities
[
i
][
1
];
...
@@ -228,7 +208,7 @@ void ReferenceUpdateStateDataKernel::setVelocities(ContextImpl& context, const s
...
@@ -228,7 +208,7 @@ void ReferenceUpdateStateDataKernel::setVelocities(ContextImpl& context, const s
void
ReferenceUpdateStateDataKernel
::
getForces
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
forces
)
{
void
ReferenceUpdateStateDataKernel
::
getForces
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
forces
)
{
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
int
numParticles
=
context
.
getSystem
().
getNumParticles
();
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
forces
.
resize
(
numParticles
);
forces
.
resize
(
numParticles
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
forces
[
i
]
=
Vec3
(
forceData
[
i
][
0
],
forceData
[
i
][
1
],
forceData
[
i
][
2
]);
forces
[
i
]
=
Vec3
(
forceData
[
i
][
0
],
forceData
[
i
][
1
],
forceData
[
i
][
2
]);
...
@@ -250,8 +230,8 @@ void ReferenceUpdateStateDataKernel::setPeriodicBoxVectors(ContextImpl& context,
...
@@ -250,8 +230,8 @@ void ReferenceUpdateStateDataKernel::setPeriodicBoxVectors(ContextImpl& context,
void
ReferenceApplyConstraintsKernel
::
initialize
(
const
System
&
system
)
{
void
ReferenceApplyConstraintsKernel
::
initialize
(
const
System
&
system
)
{
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
masses
=
new
RealOpenMM
[
numParticles
]
;
masses
.
resize
(
numParticles
)
;
inverseMasses
=
new
RealOpenMM
[
numParticles
]
;
inverseMasses
.
resize
(
numParticles
)
;
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
inverseMasses
[
i
]
=
1.0
/
masses
[
i
];
inverseMasses
[
i
]
=
1.0
/
masses
[
i
];
...
@@ -272,10 +252,6 @@ void ReferenceApplyConstraintsKernel::initialize(const System& system) {
...
@@ -272,10 +252,6 @@ void ReferenceApplyConstraintsKernel::initialize(const System& system) {
ReferenceApplyConstraintsKernel
::~
ReferenceApplyConstraintsKernel
()
{
ReferenceApplyConstraintsKernel
::~
ReferenceApplyConstraintsKernel
()
{
if
(
constraints
)
if
(
constraints
)
delete
constraints
;
delete
constraints
;
if
(
masses
)
delete
[]
masses
;
if
(
inverseMasses
)
delete
[]
inverseMasses
;
if
(
constraintIndices
)
if
(
constraintIndices
)
disposeIntArray
(
constraintIndices
,
numConstraints
);
disposeIntArray
(
constraintIndices
,
numConstraints
);
if
(
constraintDistances
)
if
(
constraintDistances
)
...
@@ -288,7 +264,7 @@ void ReferenceApplyConstraintsKernel::apply(ContextImpl& context, double tol) {
...
@@ -288,7 +264,7 @@ void ReferenceApplyConstraintsKernel::apply(ContextImpl& context, double tol) {
findAnglesForCCMA
(
context
.
getSystem
(),
angles
);
findAnglesForCCMA
(
context
.
getSystem
(),
angles
);
constraints
=
new
ReferenceCCMAAlgorithm
(
context
.
getSystem
().
getNumParticles
(),
numConstraints
,
constraintIndices
,
constraintDistances
,
masses
,
angles
,
tol
);
constraints
=
new
ReferenceCCMAAlgorithm
(
context
.
getSystem
().
getNumParticles
(),
numConstraints
,
constraintIndices
,
constraintDistances
,
masses
,
angles
,
tol
);
}
}
RealOpenMM
**
positions
=
extractPositions
(
context
);
vector
<
RealVec
>&
positions
=
extractPositions
(
context
);
constraints
->
setTolerance
(
tol
);
constraints
->
setTolerance
(
tol
);
constraints
->
apply
(
data
.
numParticles
,
positions
,
positions
,
inverseMasses
);
constraints
->
apply
(
data
.
numParticles
,
positions
,
positions
,
inverseMasses
);
}
}
...
@@ -314,8 +290,8 @@ void ReferenceCalcHarmonicBondForceKernel::initialize(const System& system, cons
...
@@ -314,8 +290,8 @@ void ReferenceCalcHarmonicBondForceKernel::initialize(const System& system, cons
}
}
double
ReferenceCalcHarmonicBondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcHarmonicBondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceHarmonicBondIxn
harmonicBond
;
ReferenceHarmonicBondIxn
harmonicBond
;
...
@@ -358,8 +334,8 @@ void ReferenceCalcCustomBondForceKernel::initialize(const System& system, const
...
@@ -358,8 +334,8 @@ void ReferenceCalcCustomBondForceKernel::initialize(const System& system, const
}
}
double
ReferenceCalcCustomBondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcCustomBondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
...
@@ -392,8 +368,8 @@ void ReferenceCalcHarmonicAngleForceKernel::initialize(const System& system, con
...
@@ -392,8 +368,8 @@ void ReferenceCalcHarmonicAngleForceKernel::initialize(const System& system, con
}
}
double
ReferenceCalcHarmonicAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcHarmonicAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceAngleBondIxn
angleBond
;
ReferenceAngleBondIxn
angleBond
;
...
@@ -437,8 +413,8 @@ void ReferenceCalcCustomAngleForceKernel::initialize(const System& system, const
...
@@ -437,8 +413,8 @@ void ReferenceCalcCustomAngleForceKernel::initialize(const System& system, const
}
}
double
ReferenceCalcCustomAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcCustomAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
...
@@ -473,8 +449,8 @@ void ReferenceCalcPeriodicTorsionForceKernel::initialize(const System& system, c
...
@@ -473,8 +449,8 @@ void ReferenceCalcPeriodicTorsionForceKernel::initialize(const System& system, c
}
}
double
ReferenceCalcPeriodicTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcPeriodicTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceProperDihedralBond
periodicTorsionBond
;
ReferenceProperDihedralBond
periodicTorsionBond
;
...
@@ -509,8 +485,8 @@ void ReferenceCalcRBTorsionForceKernel::initialize(const System& system, const R
...
@@ -509,8 +485,8 @@ void ReferenceCalcRBTorsionForceKernel::initialize(const System& system, const R
}
}
double
ReferenceCalcRBTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcRBTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceRbDihedralBond
rbTorsionBond
;
ReferenceRbDihedralBond
rbTorsionBond
;
...
@@ -545,8 +521,8 @@ void ReferenceCalcCMAPTorsionForceKernel::initialize(const System& system, const
...
@@ -545,8 +521,8 @@ void ReferenceCalcCMAPTorsionForceKernel::initialize(const System& system, const
}
}
double
ReferenceCalcCMAPTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcCMAPTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
totalEnergy
=
0
;
RealOpenMM
totalEnergy
=
0
;
ReferenceCMAPTorsionIxn
torsion
(
coeff
,
torsionMaps
,
torsionIndices
);
ReferenceCMAPTorsionIxn
torsion
(
coeff
,
torsionMaps
,
torsionIndices
);
torsion
.
calculateIxn
(
posData
,
forceData
,
&
totalEnergy
);
torsion
.
calculateIxn
(
posData
,
forceData
,
&
totalEnergy
);
...
@@ -590,8 +566,8 @@ void ReferenceCalcCustomTorsionForceKernel::initialize(const System& system, con
...
@@ -590,8 +566,8 @@ void ReferenceCalcCustomTorsionForceKernel::initialize(const System& system, con
}
}
double
ReferenceCalcCustomTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcCustomTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
...
@@ -684,8 +660,8 @@ void ReferenceCalcNonbondedForceKernel::initialize(const System& system, const N
...
@@ -684,8 +660,8 @@ void ReferenceCalcNonbondedForceKernel::initialize(const System& system, const N
}
}
double
ReferenceCalcNonbondedForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcNonbondedForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceLJCoulombIxn
clj
;
ReferenceLJCoulombIxn
clj
;
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
...
@@ -817,8 +793,8 @@ void ReferenceCalcCustomNonbondedForceKernel::initialize(const System& system, c
...
@@ -817,8 +793,8 @@ void ReferenceCalcCustomNonbondedForceKernel::initialize(const System& system, c
}
}
double
ReferenceCalcCustomNonbondedForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcCustomNonbondedForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceCustomNonbondedIxn
ixn
(
energyExpression
,
forceExpression
,
parameterNames
);
ReferenceCustomNonbondedIxn
ixn
(
energyExpression
,
forceExpression
,
parameterNames
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
bool
periodic
=
(
nonbondedMethod
==
CutoffPeriodic
);
...
@@ -867,8 +843,8 @@ void ReferenceCalcGBSAOBCForceKernel::initialize(const System& system, const GBS
...
@@ -867,8 +843,8 @@ void ReferenceCalcGBSAOBCForceKernel::initialize(const System& system, const GBS
}
}
double
ReferenceCalcGBSAOBCForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcGBSAOBCForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
if
(
isPeriodic
)
if
(
isPeriodic
)
obc
->
getObcParameters
()
->
setPeriodic
(
extractBoxSize
(
context
));
obc
->
getObcParameters
()
->
setPeriodic
(
extractBoxSize
(
context
));
obc
->
computeImplicitSolventForces
(
posData
,
&
charges
[
0
],
forceData
,
1
);
obc
->
computeImplicitSolventForces
(
posData
,
&
charges
[
0
],
forceData
,
1
);
...
@@ -908,13 +884,13 @@ void ReferenceCalcGBVIForceKernel::initialize(const System& system, const GBVIFo
...
@@ -908,13 +884,13 @@ void ReferenceCalcGBVIForceKernel::initialize(const System& system, const GBVIFo
}
}
double
ReferenceCalcGBVIForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcGBVIForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
*
bornRadii
=
new
RealOpenMM
[
context
.
getSystem
().
getNumParticles
()];
RealOpenMM
*
bornRadii
=
new
RealOpenMM
[
context
.
getSystem
().
getNumParticles
()];
if
(
isPeriodic
)
if
(
isPeriodic
)
gbvi
->
getGBVIParameters
()
->
setPeriodic
(
extractBoxSize
(
context
));
gbvi
->
getGBVIParameters
()
->
setPeriodic
(
extractBoxSize
(
context
));
gbvi
->
computeBornRadii
(
posData
,
bornRadii
,
NULL
);
gbvi
->
computeBornRadii
(
posData
,
bornRadii
,
NULL
);
if
(
includeForces
)
{
if
(
includeForces
)
{
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
gbvi
->
computeBornForces
(
bornRadii
,
posData
,
&
charges
[
0
],
forceData
);
gbvi
->
computeBornForces
(
bornRadii
,
posData
,
&
charges
[
0
],
forceData
);
}
}
RealOpenMM
energy
=
0.0
;
RealOpenMM
energy
=
0.0
;
...
@@ -1044,8 +1020,8 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu
...
@@ -1044,8 +1020,8 @@ void ReferenceCalcCustomGBForceKernel::initialize(const System& system, const Cu
}
}
double
ReferenceCalcCustomGBForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcCustomGBForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceCustomGBIxn
ixn
(
valueExpressions
,
valueDerivExpressions
,
valueGradientExpressions
,
valueNames
,
valueTypes
,
energyExpressions
,
ReferenceCustomGBIxn
ixn
(
valueExpressions
,
valueDerivExpressions
,
valueGradientExpressions
,
valueNames
,
valueTypes
,
energyExpressions
,
energyDerivExpressions
,
energyGradientExpressions
,
energyTypes
,
particleParameterNames
);
energyDerivExpressions
,
energyGradientExpressions
,
energyTypes
,
particleParameterNames
);
...
@@ -1096,8 +1072,8 @@ void ReferenceCalcCustomExternalForceKernel::initialize(const System& system, co
...
@@ -1096,8 +1072,8 @@ void ReferenceCalcCustomExternalForceKernel::initialize(const System& system, co
}
}
double
ReferenceCalcCustomExternalForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcCustomExternalForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
...
@@ -1206,8 +1182,8 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const
...
@@ -1206,8 +1182,8 @@ void ReferenceCalcCustomHbondForceKernel::initialize(const System& system, const
}
}
double
ReferenceCalcCustomHbondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcCustomHbondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
if
(
isPeriodic
)
if
(
isPeriodic
)
ixn
->
setPeriodic
(
extractBoxSize
(
context
));
ixn
->
setPeriodic
(
extractBoxSize
(
context
));
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
...
@@ -1223,8 +1199,6 @@ ReferenceIntegrateVerletStepKernel::~ReferenceIntegrateVerletStepKernel() {
...
@@ -1223,8 +1199,6 @@ ReferenceIntegrateVerletStepKernel::~ReferenceIntegrateVerletStepKernel() {
delete
dynamics
;
delete
dynamics
;
if
(
constraints
)
if
(
constraints
)
delete
constraints
;
delete
constraints
;
if
(
masses
)
delete
[]
masses
;
if
(
constraintIndices
)
if
(
constraintIndices
)
disposeIntArray
(
constraintIndices
,
numConstraints
);
disposeIntArray
(
constraintIndices
,
numConstraints
);
if
(
constraintDistances
)
if
(
constraintDistances
)
...
@@ -1233,7 +1207,7 @@ ReferenceIntegrateVerletStepKernel::~ReferenceIntegrateVerletStepKernel() {
...
@@ -1233,7 +1207,7 @@ ReferenceIntegrateVerletStepKernel::~ReferenceIntegrateVerletStepKernel() {
void
ReferenceIntegrateVerletStepKernel
::
initialize
(
const
System
&
system
,
const
VerletIntegrator
&
integrator
)
{
void
ReferenceIntegrateVerletStepKernel
::
initialize
(
const
System
&
system
,
const
VerletIntegrator
&
integrator
)
{
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
masses
=
new
RealOpenMM
[
numParticles
]
;
masses
.
resize
(
numParticles
)
;
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
numConstraints
=
system
.
getNumConstraints
();
numConstraints
=
system
.
getNumConstraints
();
...
@@ -1251,9 +1225,9 @@ void ReferenceIntegrateVerletStepKernel::initialize(const System& system, const
...
@@ -1251,9 +1225,9 @@ void ReferenceIntegrateVerletStepKernel::initialize(const System& system, const
void
ReferenceIntegrateVerletStepKernel
::
execute
(
ContextImpl
&
context
,
const
VerletIntegrator
&
integrator
)
{
void
ReferenceIntegrateVerletStepKernel
::
execute
(
ContextImpl
&
context
,
const
VerletIntegrator
&
integrator
)
{
double
stepSize
=
integrator
.
getStepSize
();
double
stepSize
=
integrator
.
getStepSize
();
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
velData
=
extractVelocities
(
context
);
vector
<
RealVec
>&
velData
=
extractVelocities
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
if
(
dynamics
==
0
||
stepSize
!=
prevStepSize
)
{
if
(
dynamics
==
0
||
stepSize
!=
prevStepSize
)
{
// Recreate the computation objects with the new parameters.
// Recreate the computation objects with the new parameters.
...
@@ -1278,8 +1252,6 @@ ReferenceIntegrateLangevinStepKernel::~ReferenceIntegrateLangevinStepKernel() {
...
@@ -1278,8 +1252,6 @@ ReferenceIntegrateLangevinStepKernel::~ReferenceIntegrateLangevinStepKernel() {
delete
dynamics
;
delete
dynamics
;
if
(
constraints
)
if
(
constraints
)
delete
constraints
;
delete
constraints
;
if
(
masses
)
delete
[]
masses
;
if
(
constraintIndices
)
if
(
constraintIndices
)
disposeIntArray
(
constraintIndices
,
numConstraints
);
disposeIntArray
(
constraintIndices
,
numConstraints
);
if
(
constraintDistances
)
if
(
constraintDistances
)
...
@@ -1288,7 +1260,7 @@ ReferenceIntegrateLangevinStepKernel::~ReferenceIntegrateLangevinStepKernel() {
...
@@ -1288,7 +1260,7 @@ ReferenceIntegrateLangevinStepKernel::~ReferenceIntegrateLangevinStepKernel() {
void
ReferenceIntegrateLangevinStepKernel
::
initialize
(
const
System
&
system
,
const
LangevinIntegrator
&
integrator
)
{
void
ReferenceIntegrateLangevinStepKernel
::
initialize
(
const
System
&
system
,
const
LangevinIntegrator
&
integrator
)
{
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
masses
=
new
RealOpenMM
[
numParticles
]
;
masses
.
resize
(
numParticles
)
;
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
numConstraints
=
system
.
getNumConstraints
();
numConstraints
=
system
.
getNumConstraints
();
...
@@ -1309,9 +1281,9 @@ void ReferenceIntegrateLangevinStepKernel::execute(ContextImpl& context, const L
...
@@ -1309,9 +1281,9 @@ void ReferenceIntegrateLangevinStepKernel::execute(ContextImpl& context, const L
double
temperature
=
integrator
.
getTemperature
();
double
temperature
=
integrator
.
getTemperature
();
double
friction
=
integrator
.
getFriction
();
double
friction
=
integrator
.
getFriction
();
double
stepSize
=
integrator
.
getStepSize
();
double
stepSize
=
integrator
.
getStepSize
();
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
velData
=
extractVelocities
(
context
);
vector
<
RealVec
>&
velData
=
extractVelocities
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
if
(
dynamics
==
0
||
temperature
!=
prevTemp
||
friction
!=
prevFriction
||
stepSize
!=
prevStepSize
)
{
if
(
dynamics
==
0
||
temperature
!=
prevTemp
||
friction
!=
prevFriction
||
stepSize
!=
prevStepSize
)
{
// Recreate the computation objects with the new parameters.
// Recreate the computation objects with the new parameters.
...
@@ -1343,8 +1315,6 @@ ReferenceIntegrateBrownianStepKernel::~ReferenceIntegrateBrownianStepKernel() {
...
@@ -1343,8 +1315,6 @@ ReferenceIntegrateBrownianStepKernel::~ReferenceIntegrateBrownianStepKernel() {
delete
dynamics
;
delete
dynamics
;
if
(
constraints
)
if
(
constraints
)
delete
constraints
;
delete
constraints
;
if
(
masses
)
delete
[]
masses
;
if
(
constraintIndices
)
if
(
constraintIndices
)
disposeIntArray
(
constraintIndices
,
numConstraints
);
disposeIntArray
(
constraintIndices
,
numConstraints
);
if
(
constraintDistances
)
if
(
constraintDistances
)
...
@@ -1353,7 +1323,7 @@ ReferenceIntegrateBrownianStepKernel::~ReferenceIntegrateBrownianStepKernel() {
...
@@ -1353,7 +1323,7 @@ ReferenceIntegrateBrownianStepKernel::~ReferenceIntegrateBrownianStepKernel() {
void
ReferenceIntegrateBrownianStepKernel
::
initialize
(
const
System
&
system
,
const
BrownianIntegrator
&
integrator
)
{
void
ReferenceIntegrateBrownianStepKernel
::
initialize
(
const
System
&
system
,
const
BrownianIntegrator
&
integrator
)
{
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
masses
=
new
RealOpenMM
[
numParticles
]
;
masses
.
resize
(
numParticles
)
;
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
numConstraints
=
system
.
getNumConstraints
();
numConstraints
=
system
.
getNumConstraints
();
...
@@ -1374,9 +1344,9 @@ void ReferenceIntegrateBrownianStepKernel::execute(ContextImpl& context, const B
...
@@ -1374,9 +1344,9 @@ void ReferenceIntegrateBrownianStepKernel::execute(ContextImpl& context, const B
double
temperature
=
integrator
.
getTemperature
();
double
temperature
=
integrator
.
getTemperature
();
double
friction
=
integrator
.
getFriction
();
double
friction
=
integrator
.
getFriction
();
double
stepSize
=
integrator
.
getStepSize
();
double
stepSize
=
integrator
.
getStepSize
();
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
velData
=
extractVelocities
(
context
);
vector
<
RealVec
>&
velData
=
extractVelocities
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
if
(
dynamics
==
0
||
temperature
!=
prevTemp
||
friction
!=
prevFriction
||
stepSize
!=
prevStepSize
)
{
if
(
dynamics
==
0
||
temperature
!=
prevTemp
||
friction
!=
prevFriction
||
stepSize
!=
prevStepSize
)
{
// Recreate the computation objects with the new parameters.
// Recreate the computation objects with the new parameters.
...
@@ -1407,8 +1377,6 @@ ReferenceIntegrateVariableLangevinStepKernel::~ReferenceIntegrateVariableLangevi
...
@@ -1407,8 +1377,6 @@ ReferenceIntegrateVariableLangevinStepKernel::~ReferenceIntegrateVariableLangevi
delete
dynamics
;
delete
dynamics
;
if
(
constraints
)
if
(
constraints
)
delete
constraints
;
delete
constraints
;
if
(
masses
)
delete
[]
masses
;
if
(
constraintIndices
)
if
(
constraintIndices
)
disposeIntArray
(
constraintIndices
,
numConstraints
);
disposeIntArray
(
constraintIndices
,
numConstraints
);
if
(
constraintDistances
)
if
(
constraintDistances
)
...
@@ -1417,7 +1385,7 @@ ReferenceIntegrateVariableLangevinStepKernel::~ReferenceIntegrateVariableLangevi
...
@@ -1417,7 +1385,7 @@ ReferenceIntegrateVariableLangevinStepKernel::~ReferenceIntegrateVariableLangevi
void
ReferenceIntegrateVariableLangevinStepKernel
::
initialize
(
const
System
&
system
,
const
VariableLangevinIntegrator
&
integrator
)
{
void
ReferenceIntegrateVariableLangevinStepKernel
::
initialize
(
const
System
&
system
,
const
VariableLangevinIntegrator
&
integrator
)
{
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
masses
=
new
RealOpenMM
[
numParticles
]
;
masses
.
resize
(
numParticles
)
;
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
numConstraints
=
system
.
getNumConstraints
();
numConstraints
=
system
.
getNumConstraints
();
...
@@ -1438,9 +1406,9 @@ void ReferenceIntegrateVariableLangevinStepKernel::execute(ContextImpl& context,
...
@@ -1438,9 +1406,9 @@ void ReferenceIntegrateVariableLangevinStepKernel::execute(ContextImpl& context,
double
temperature
=
integrator
.
getTemperature
();
double
temperature
=
integrator
.
getTemperature
();
double
friction
=
integrator
.
getFriction
();
double
friction
=
integrator
.
getFriction
();
double
errorTol
=
integrator
.
getErrorTolerance
();
double
errorTol
=
integrator
.
getErrorTolerance
();
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
velData
=
extractVelocities
(
context
);
vector
<
RealVec
>&
velData
=
extractVelocities
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
if
(
dynamics
==
0
||
temperature
!=
prevTemp
||
friction
!=
prevFriction
||
errorTol
!=
prevErrorTol
)
{
if
(
dynamics
==
0
||
temperature
!=
prevTemp
||
friction
!=
prevFriction
||
errorTol
!=
prevErrorTol
)
{
// Recreate the computation objects with the new parameters.
// Recreate the computation objects with the new parameters.
...
@@ -1471,8 +1439,6 @@ ReferenceIntegrateVariableVerletStepKernel::~ReferenceIntegrateVariableVerletSte
...
@@ -1471,8 +1439,6 @@ ReferenceIntegrateVariableVerletStepKernel::~ReferenceIntegrateVariableVerletSte
delete
dynamics
;
delete
dynamics
;
if
(
constraints
)
if
(
constraints
)
delete
constraints
;
delete
constraints
;
if
(
masses
)
delete
[]
masses
;
if
(
constraintIndices
)
if
(
constraintIndices
)
disposeIntArray
(
constraintIndices
,
numConstraints
);
disposeIntArray
(
constraintIndices
,
numConstraints
);
if
(
constraintDistances
)
if
(
constraintDistances
)
...
@@ -1481,7 +1447,7 @@ ReferenceIntegrateVariableVerletStepKernel::~ReferenceIntegrateVariableVerletSte
...
@@ -1481,7 +1447,7 @@ ReferenceIntegrateVariableVerletStepKernel::~ReferenceIntegrateVariableVerletSte
void
ReferenceIntegrateVariableVerletStepKernel
::
initialize
(
const
System
&
system
,
const
VariableVerletIntegrator
&
integrator
)
{
void
ReferenceIntegrateVariableVerletStepKernel
::
initialize
(
const
System
&
system
,
const
VariableVerletIntegrator
&
integrator
)
{
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
masses
=
new
RealOpenMM
[
numParticles
]
;
masses
.
resize
(
numParticles
)
;
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
numConstraints
=
system
.
getNumConstraints
();
numConstraints
=
system
.
getNumConstraints
();
...
@@ -1499,9 +1465,9 @@ void ReferenceIntegrateVariableVerletStepKernel::initialize(const System& system
...
@@ -1499,9 +1465,9 @@ void ReferenceIntegrateVariableVerletStepKernel::initialize(const System& system
void
ReferenceIntegrateVariableVerletStepKernel
::
execute
(
ContextImpl
&
context
,
const
VariableVerletIntegrator
&
integrator
,
double
maxTime
)
{
void
ReferenceIntegrateVariableVerletStepKernel
::
execute
(
ContextImpl
&
context
,
const
VariableVerletIntegrator
&
integrator
,
double
maxTime
)
{
double
errorTol
=
integrator
.
getErrorTolerance
();
double
errorTol
=
integrator
.
getErrorTolerance
();
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
**
velData
=
extractVelocities
(
context
);
vector
<
RealVec
>&
velData
=
extractVelocities
(
context
);
RealOpenMM
**
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
if
(
dynamics
==
0
||
errorTol
!=
prevErrorTol
)
{
if
(
dynamics
==
0
||
errorTol
!=
prevErrorTol
)
{
// Recreate the computation objects with the new parameters.
// Recreate the computation objects with the new parameters.
...
@@ -1527,13 +1493,11 @@ void ReferenceIntegrateVariableVerletStepKernel::execute(ContextImpl& context, c
...
@@ -1527,13 +1493,11 @@ void ReferenceIntegrateVariableVerletStepKernel::execute(ContextImpl& context, c
ReferenceApplyAndersenThermostatKernel
::~
ReferenceApplyAndersenThermostatKernel
()
{
ReferenceApplyAndersenThermostatKernel
::~
ReferenceApplyAndersenThermostatKernel
()
{
if
(
thermostat
)
if
(
thermostat
)
delete
thermostat
;
delete
thermostat
;
if
(
masses
)
delete
[]
masses
;
}
}
void
ReferenceApplyAndersenThermostatKernel
::
initialize
(
const
System
&
system
,
const
AndersenThermostat
&
thermostat
)
{
void
ReferenceApplyAndersenThermostatKernel
::
initialize
(
const
System
&
system
,
const
AndersenThermostat
&
thermostat
)
{
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
masses
=
new
RealOpenMM
[
numParticles
]
;
masses
.
resize
(
numParticles
)
;
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
masses
[
i
]
=
static_cast
<
RealOpenMM
>
(
system
.
getParticleMass
(
i
));
this
->
thermostat
=
new
ReferenceAndersenThermostat
();
this
->
thermostat
=
new
ReferenceAndersenThermostat
();
...
@@ -1542,7 +1506,7 @@ void ReferenceApplyAndersenThermostatKernel::initialize(const System& system, co
...
@@ -1542,7 +1506,7 @@ void ReferenceApplyAndersenThermostatKernel::initialize(const System& system, co
}
}
void
ReferenceApplyAndersenThermostatKernel
::
execute
(
ContextImpl
&
context
)
{
void
ReferenceApplyAndersenThermostatKernel
::
execute
(
ContextImpl
&
context
)
{
RealOpenMM
**
velData
=
extractVelocities
(
context
);
vector
<
RealVec
>&
velData
=
extractVelocities
(
context
);
thermostat
->
applyThermostat
(
particleGroups
,
velData
,
masses
,
thermostat
->
applyThermostat
(
particleGroups
,
velData
,
masses
,
static_cast
<
RealOpenMM
>
(
context
.
getParameter
(
AndersenThermostat
::
Temperature
())),
static_cast
<
RealOpenMM
>
(
context
.
getParameter
(
AndersenThermostat
::
Temperature
())),
static_cast
<
RealOpenMM
>
(
context
.
getParameter
(
AndersenThermostat
::
CollisionFrequency
())),
static_cast
<
RealOpenMM
>
(
context
.
getParameter
(
AndersenThermostat
::
CollisionFrequency
())),
...
@@ -1560,13 +1524,13 @@ void ReferenceApplyMonteCarloBarostatKernel::initialize(const System& system, co
...
@@ -1560,13 +1524,13 @@ void ReferenceApplyMonteCarloBarostatKernel::initialize(const System& system, co
void
ReferenceApplyMonteCarloBarostatKernel
::
scaleCoordinates
(
ContextImpl
&
context
,
double
scale
)
{
void
ReferenceApplyMonteCarloBarostatKernel
::
scaleCoordinates
(
ContextImpl
&
context
,
double
scale
)
{
if
(
barostat
==
NULL
)
if
(
barostat
==
NULL
)
barostat
=
new
ReferenceMonteCarloBarostat
(
context
.
getSystem
().
getNumParticles
(),
context
.
getMolecules
());
barostat
=
new
ReferenceMonteCarloBarostat
(
context
.
getSystem
().
getNumParticles
(),
context
.
getMolecules
());
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
RealOpenMM
*
boxSize
=
extractBoxSize
(
context
);
RealOpenMM
*
boxSize
=
extractBoxSize
(
context
);
barostat
->
applyBarostat
(
posData
,
boxSize
,
scale
);
barostat
->
applyBarostat
(
posData
,
boxSize
,
scale
);
}
}
void
ReferenceApplyMonteCarloBarostatKernel
::
restoreCoordinates
(
ContextImpl
&
context
)
{
void
ReferenceApplyMonteCarloBarostatKernel
::
restoreCoordinates
(
ContextImpl
&
context
)
{
RealOpenMM
**
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
barostat
->
restorePositions
(
posData
);
barostat
->
restorePositions
(
posData
);
}
}
...
@@ -1578,7 +1542,7 @@ void ReferenceCalcKineticEnergyKernel::initialize(const System& system) {
...
@@ -1578,7 +1542,7 @@ void ReferenceCalcKineticEnergyKernel::initialize(const System& system) {
}
}
double
ReferenceCalcKineticEnergyKernel
::
execute
(
ContextImpl
&
context
)
{
double
ReferenceCalcKineticEnergyKernel
::
execute
(
ContextImpl
&
context
)
{
RealOpenMM
**
velData
=
extractVelocities
(
context
);
vector
<
RealVec
>&
velData
=
extractVelocities
(
context
);
double
energy
=
0.0
;
double
energy
=
0.0
;
for
(
size_t
i
=
0
;
i
<
masses
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
masses
.
size
();
++
i
)
energy
+=
masses
[
i
]
*
(
velData
[
i
][
0
]
*
velData
[
i
][
0
]
+
velData
[
i
][
1
]
*
velData
[
i
][
1
]
+
velData
[
i
][
2
]
*
velData
[
i
][
2
]);
energy
+=
masses
[
i
]
*
(
velData
[
i
][
0
]
*
velData
[
i
][
0
]
+
velData
[
i
][
1
]
*
velData
[
i
][
1
]
+
velData
[
i
][
2
]
*
velData
[
i
][
2
]);
...
@@ -1595,7 +1559,7 @@ void ReferenceRemoveCMMotionKernel::initialize(const System& system, const CMMot
...
@@ -1595,7 +1559,7 @@ void ReferenceRemoveCMMotionKernel::initialize(const System& system, const CMMot
void
ReferenceRemoveCMMotionKernel
::
execute
(
ContextImpl
&
context
)
{
void
ReferenceRemoveCMMotionKernel
::
execute
(
ContextImpl
&
context
)
{
if
(
data
.
stepCount
%
frequency
!=
0
)
if
(
data
.
stepCount
%
frequency
!=
0
)
return
;
return
;
RealOpenMM
**
velData
=
extractVelocities
(
context
);
vector
<
RealVec
>&
velData
=
extractVelocities
(
context
);
// Calculate the center of mass momentum.
// Calculate the center of mass momentum.
...
...
platforms/reference/src/ReferenceKernels.h
View file @
0843c5f3
...
@@ -172,7 +172,7 @@ private:
...
@@ -172,7 +172,7 @@ private:
class
ReferenceApplyConstraintsKernel
:
public
ApplyConstraintsKernel
{
class
ReferenceApplyConstraintsKernel
:
public
ApplyConstraintsKernel
{
public:
public:
ReferenceApplyConstraintsKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
ReferenceApplyConstraintsKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
ApplyConstraintsKernel
(
name
,
platform
),
data
(
data
),
constraints
(
0
),
masses
(
0
),
inverseMasses
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
ApplyConstraintsKernel
(
name
,
platform
),
data
(
data
),
constraints
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
}
}
~
ReferenceApplyConstraintsKernel
();
~
ReferenceApplyConstraintsKernel
();
/**
/**
...
@@ -191,8 +191,8 @@ public:
...
@@ -191,8 +191,8 @@ public:
private:
private:
ReferencePlatform
::
PlatformData
&
data
;
ReferencePlatform
::
PlatformData
&
data
;
ReferenceConstraintAlgorithm
*
constraints
;
ReferenceConstraintAlgorithm
*
constraints
;
RealOpenMM
*
masses
;
std
::
vector
<
RealOpenMM
>
masses
;
RealOpenMM
*
inverseMasses
;
std
::
vector
<
RealOpenMM
>
inverseMasses
;
RealOpenMM
*
constraintDistances
;
RealOpenMM
*
constraintDistances
;
int
**
constraintIndices
;
int
**
constraintIndices
;
int
numConstraints
;
int
numConstraints
;
...
@@ -691,7 +691,7 @@ private:
...
@@ -691,7 +691,7 @@ private:
class
ReferenceIntegrateVerletStepKernel
:
public
IntegrateVerletStepKernel
{
class
ReferenceIntegrateVerletStepKernel
:
public
IntegrateVerletStepKernel
{
public:
public:
ReferenceIntegrateVerletStepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
IntegrateVerletStepKernel
(
name
,
platform
),
ReferenceIntegrateVerletStepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
IntegrateVerletStepKernel
(
name
,
platform
),
data
(
data
),
dynamics
(
0
),
constraints
(
0
),
masses
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
data
(
data
),
dynamics
(
0
),
constraints
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
}
}
~
ReferenceIntegrateVerletStepKernel
();
~
ReferenceIntegrateVerletStepKernel
();
/**
/**
...
@@ -712,7 +712,7 @@ private:
...
@@ -712,7 +712,7 @@ private:
ReferencePlatform
::
PlatformData
&
data
;
ReferencePlatform
::
PlatformData
&
data
;
ReferenceVerletDynamics
*
dynamics
;
ReferenceVerletDynamics
*
dynamics
;
ReferenceConstraintAlgorithm
*
constraints
;
ReferenceConstraintAlgorithm
*
constraints
;
RealOpenMM
*
masses
;
std
::
vector
<
RealOpenMM
>
masses
;
RealOpenMM
*
constraintDistances
;
RealOpenMM
*
constraintDistances
;
int
**
constraintIndices
;
int
**
constraintIndices
;
int
numConstraints
;
int
numConstraints
;
...
@@ -725,7 +725,7 @@ private:
...
@@ -725,7 +725,7 @@ private:
class
ReferenceIntegrateLangevinStepKernel
:
public
IntegrateLangevinStepKernel
{
class
ReferenceIntegrateLangevinStepKernel
:
public
IntegrateLangevinStepKernel
{
public:
public:
ReferenceIntegrateLangevinStepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
IntegrateLangevinStepKernel
(
name
,
platform
),
ReferenceIntegrateLangevinStepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
IntegrateLangevinStepKernel
(
name
,
platform
),
data
(
data
),
dynamics
(
0
),
constraints
(
0
),
masses
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
data
(
data
),
dynamics
(
0
),
constraints
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
}
}
~
ReferenceIntegrateLangevinStepKernel
();
~
ReferenceIntegrateLangevinStepKernel
();
/**
/**
...
@@ -746,7 +746,7 @@ private:
...
@@ -746,7 +746,7 @@ private:
ReferencePlatform
::
PlatformData
&
data
;
ReferencePlatform
::
PlatformData
&
data
;
ReferenceStochasticDynamics
*
dynamics
;
ReferenceStochasticDynamics
*
dynamics
;
ReferenceConstraintAlgorithm
*
constraints
;
ReferenceConstraintAlgorithm
*
constraints
;
RealOpenMM
*
masses
;
std
::
vector
<
RealOpenMM
>
masses
;
RealOpenMM
*
constraintDistances
;
RealOpenMM
*
constraintDistances
;
int
**
constraintIndices
;
int
**
constraintIndices
;
int
numConstraints
;
int
numConstraints
;
...
@@ -759,7 +759,7 @@ private:
...
@@ -759,7 +759,7 @@ private:
class
ReferenceIntegrateBrownianStepKernel
:
public
IntegrateBrownianStepKernel
{
class
ReferenceIntegrateBrownianStepKernel
:
public
IntegrateBrownianStepKernel
{
public:
public:
ReferenceIntegrateBrownianStepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
IntegrateBrownianStepKernel
(
name
,
platform
),
ReferenceIntegrateBrownianStepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
IntegrateBrownianStepKernel
(
name
,
platform
),
data
(
data
),
dynamics
(
0
),
constraints
(
0
),
masses
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
data
(
data
),
dynamics
(
0
),
constraints
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
}
}
~
ReferenceIntegrateBrownianStepKernel
();
~
ReferenceIntegrateBrownianStepKernel
();
/**
/**
...
@@ -780,7 +780,7 @@ private:
...
@@ -780,7 +780,7 @@ private:
ReferencePlatform
::
PlatformData
&
data
;
ReferencePlatform
::
PlatformData
&
data
;
ReferenceBrownianDynamics
*
dynamics
;
ReferenceBrownianDynamics
*
dynamics
;
ReferenceConstraintAlgorithm
*
constraints
;
ReferenceConstraintAlgorithm
*
constraints
;
RealOpenMM
*
masses
;
std
::
vector
<
RealOpenMM
>
masses
;
RealOpenMM
*
constraintDistances
;
RealOpenMM
*
constraintDistances
;
int
**
constraintIndices
;
int
**
constraintIndices
;
int
numConstraints
;
int
numConstraints
;
...
@@ -793,7 +793,7 @@ private:
...
@@ -793,7 +793,7 @@ private:
class
ReferenceIntegrateVariableLangevinStepKernel
:
public
IntegrateVariableLangevinStepKernel
{
class
ReferenceIntegrateVariableLangevinStepKernel
:
public
IntegrateVariableLangevinStepKernel
{
public:
public:
ReferenceIntegrateVariableLangevinStepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
IntegrateVariableLangevinStepKernel
(
name
,
platform
),
ReferenceIntegrateVariableLangevinStepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
IntegrateVariableLangevinStepKernel
(
name
,
platform
),
data
(
data
),
dynamics
(
0
),
constraints
(
0
),
masses
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
data
(
data
),
dynamics
(
0
),
constraints
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
}
}
~
ReferenceIntegrateVariableLangevinStepKernel
();
~
ReferenceIntegrateVariableLangevinStepKernel
();
/**
/**
...
@@ -815,7 +815,7 @@ private:
...
@@ -815,7 +815,7 @@ private:
ReferencePlatform
::
PlatformData
&
data
;
ReferencePlatform
::
PlatformData
&
data
;
ReferenceVariableStochasticDynamics
*
dynamics
;
ReferenceVariableStochasticDynamics
*
dynamics
;
ReferenceConstraintAlgorithm
*
constraints
;
ReferenceConstraintAlgorithm
*
constraints
;
RealOpenMM
*
masses
;
std
::
vector
<
RealOpenMM
>
masses
;
RealOpenMM
*
constraintDistances
;
RealOpenMM
*
constraintDistances
;
int
**
constraintIndices
;
int
**
constraintIndices
;
int
numConstraints
;
int
numConstraints
;
...
@@ -828,7 +828,7 @@ private:
...
@@ -828,7 +828,7 @@ private:
class
ReferenceIntegrateVariableVerletStepKernel
:
public
IntegrateVariableVerletStepKernel
{
class
ReferenceIntegrateVariableVerletStepKernel
:
public
IntegrateVariableVerletStepKernel
{
public:
public:
ReferenceIntegrateVariableVerletStepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
IntegrateVariableVerletStepKernel
(
name
,
platform
),
ReferenceIntegrateVariableVerletStepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
IntegrateVariableVerletStepKernel
(
name
,
platform
),
data
(
data
),
dynamics
(
0
),
constraints
(
0
),
masses
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
data
(
data
),
dynamics
(
0
),
constraints
(
0
),
constraintDistances
(
0
),
constraintIndices
(
0
)
{
}
}
~
ReferenceIntegrateVariableVerletStepKernel
();
~
ReferenceIntegrateVariableVerletStepKernel
();
/**
/**
...
@@ -850,7 +850,7 @@ private:
...
@@ -850,7 +850,7 @@ private:
ReferencePlatform
::
PlatformData
&
data
;
ReferencePlatform
::
PlatformData
&
data
;
ReferenceVariableVerletDynamics
*
dynamics
;
ReferenceVariableVerletDynamics
*
dynamics
;
ReferenceConstraintAlgorithm
*
constraints
;
ReferenceConstraintAlgorithm
*
constraints
;
RealOpenMM
*
masses
;
std
::
vector
<
RealOpenMM
>
masses
;
RealOpenMM
*
constraintDistances
;
RealOpenMM
*
constraintDistances
;
int
**
constraintIndices
;
int
**
constraintIndices
;
int
numConstraints
;
int
numConstraints
;
...
@@ -881,7 +881,7 @@ public:
...
@@ -881,7 +881,7 @@ public:
private:
private:
ReferenceAndersenThermostat
*
thermostat
;
ReferenceAndersenThermostat
*
thermostat
;
std
::
vector
<
std
::
vector
<
int
>
>
particleGroups
;
std
::
vector
<
std
::
vector
<
int
>
>
particleGroups
;
RealOpenMM
*
masses
;
std
::
vector
<
RealOpenMM
>
masses
;
};
};
/**
/**
...
...
platforms/reference/src/ReferencePlatform.cpp
View file @
0843c5f3
...
@@ -34,6 +34,8 @@
...
@@ -34,6 +34,8 @@
#include "ReferenceKernels.h"
#include "ReferenceKernels.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/internal/ContextImpl.h"
#include "SimTKUtilities/SimTKOpenMMRealType.h"
#include "SimTKUtilities/SimTKOpenMMRealType.h"
#include "SimTKUtilities/RealVec.h"
#include <vector>
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
...
@@ -83,32 +85,16 @@ void ReferencePlatform::contextDestroyed(ContextImpl& context) const {
...
@@ -83,32 +85,16 @@ void ReferencePlatform::contextDestroyed(ContextImpl& context) const {
}
}
ReferencePlatform
::
PlatformData
::
PlatformData
(
int
numParticles
)
:
time
(
0.0
),
stepCount
(
0
),
numParticles
(
numParticles
)
{
ReferencePlatform
::
PlatformData
::
PlatformData
(
int
numParticles
)
:
time
(
0.0
),
stepCount
(
0
),
numParticles
(
numParticles
)
{
RealOpenMM
**
positions
=
new
RealOpenMM
*
[
numParticles
];
positions
=
new
vector
<
RealVec
>
(
numParticles
);
RealOpenMM
**
velocities
=
new
RealOpenMM
*
[
numParticles
];
velocities
=
new
vector
<
RealVec
>
(
numParticles
);
RealOpenMM
**
forces
=
new
RealOpenMM
*
[
numParticles
];
forces
=
new
vector
<
RealVec
>
(
numParticles
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
positions
[
i
]
=
new
RealOpenMM
[
3
];
velocities
[
i
]
=
new
RealOpenMM
[
3
];
forces
[
i
]
=
new
RealOpenMM
[
3
];
}
this
->
positions
=
positions
;
this
->
velocities
=
velocities
;
this
->
forces
=
forces
;
periodicBoxSize
=
new
RealOpenMM
[
3
];
periodicBoxSize
=
new
RealOpenMM
[
3
];
}
}
ReferencePlatform
::
PlatformData
::~
PlatformData
()
{
ReferencePlatform
::
PlatformData
::~
PlatformData
()
{
RealOpenMM
**
positions
=
(
RealOpenMM
**
)
this
->
positions
;
delete
(
vector
<
RealVec
>*
)
positions
;
RealOpenMM
**
velocities
=
(
RealOpenMM
**
)
this
->
velocities
;
delete
(
vector
<
RealVec
>*
)
velocities
;
RealOpenMM
**
forces
=
(
RealOpenMM
**
)
this
->
forces
;
delete
(
vector
<
RealVec
>*
)
forces
;
RealOpenMM
*
periodicBoxSize
=
(
RealOpenMM
*
)
this
->
periodicBoxSize
;
RealOpenMM
*
periodicBoxSize
=
(
RealOpenMM
*
)
this
->
periodicBoxSize
;
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
delete
[]
positions
[
i
];
delete
[]
velocities
[
i
];
delete
[]
forces
[
i
];
}
delete
[]
positions
;
delete
[]
velocities
;
delete
[]
forces
;
delete
[]
periodicBoxSize
;
delete
[]
periodicBoxSize
;
}
}
platforms/reference/src/SimTKReference/PME.cpp
View file @
0843c5f3
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
#include "PME.h"
#include "PME.h"
#include "fftpack.h"
#include "fftpack.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
typedef
int
ivec
[
3
];
typedef
int
ivec
[
3
];
...
@@ -193,7 +195,7 @@ pme_calculate_bsplines_moduli(pme_t pme)
...
@@ -193,7 +195,7 @@ pme_calculate_bsplines_moduli(pme_t pme)
static
void
static
void
pme_update_grid_index_and_fraction
(
pme_t
pme
,
pme_update_grid_index_and_fraction
(
pme_t
pme
,
RealOpenMM
**
atomCoordinates
,
vector
<
RealVec
>&
atomCoordinates
,
const
RealOpenMM
periodicBoxSize
[
3
])
const
RealOpenMM
periodicBoxSize
[
3
])
{
{
int
i
;
int
i
;
...
@@ -522,7 +524,7 @@ static void
...
@@ -522,7 +524,7 @@ static void
pme_grid_interpolate_force
(
pme_t
pme
,
pme_grid_interpolate_force
(
pme_t
pme
,
const
RealOpenMM
periodicBoxSize
[
3
],
const
RealOpenMM
periodicBoxSize
[
3
],
RealOpenMM
**
atomParameters
,
RealOpenMM
**
atomParameters
,
RealOpenMM
**
forces
)
vector
<
RealVec
>&
forces
)
{
{
static
const
int
QIndex
=
2
;
// atom charges are stored in atomParameters[atomID][2]
static
const
int
QIndex
=
2
;
// atom charges are stored in atomParameters[atomID][2]
int
i
;
int
i
;
...
@@ -667,8 +669,8 @@ pme_init(pme_t * ppme,
...
@@ -667,8 +669,8 @@ pme_init(pme_t * ppme,
int
pme_exec
(
pme_t
pme
,
int
pme_exec
(
pme_t
pme
,
RealOpenMM
**
atomCoordinates
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
**
forces
,
vector
<
RealVec
>&
forces
,
RealOpenMM
**
atomParameters
,
RealOpenMM
**
atomParameters
,
const
RealOpenMM
periodicBoxSize
[
3
],
const
RealOpenMM
periodicBoxSize
[
3
],
RealOpenMM
*
energy
,
RealOpenMM
*
energy
,
...
...
platforms/reference/src/SimTKReference/PME.h
View file @
0843c5f3
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
*/
*/
#include "../SimTKUtilities/SimTKOpenMMCommon.h"
#include "../SimTKUtilities/SimTKOpenMMCommon.h"
#include <vector>
typedef
RealOpenMM
rvec
[
3
];
typedef
RealOpenMM
rvec
[
3
];
...
@@ -74,8 +75,8 @@ pme_init(pme_t * ppme,
...
@@ -74,8 +75,8 @@ pme_init(pme_t * ppme,
*/
*/
int
int
pme_exec
(
pme_t
pme
,
pme_exec
(
pme_t
pme
,
RealOpenMM
**
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
forces
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
**
atomParameters
,
RealOpenMM
**
atomParameters
,
const
RealOpenMM
periodicBoxSize
[
3
],
const
RealOpenMM
periodicBoxSize
[
3
],
RealOpenMM
*
energy
,
RealOpenMM
*
energy
,
...
...
platforms/reference/src/SimTKReference/ReferenceAndersenThermostat.cpp
View file @
0843c5f3
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include "ReferenceAndersenThermostat.h"
#include "ReferenceAndersenThermostat.h"
using
std
::
vector
;
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -60,7 +61,7 @@ using std::vector;
...
@@ -60,7 +61,7 @@ using std::vector;
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
ReferenceAndersenThermostat
::
applyThermostat
(
const
vector
<
vector
<
int
>
>&
atomGroups
,
RealOpenMM
**
atomVelocities
,
RealOpenMM
*
atomMasses
,
void
ReferenceAndersenThermostat
::
applyThermostat
(
const
vector
<
vector
<
int
>
>&
atomGroups
,
vector
<
RealVec
>&
atomVelocities
,
vector
<
RealOpenMM
>&
atomMasses
,
RealOpenMM
temperature
,
RealOpenMM
collisionFrequency
,
RealOpenMM
stepSize
)
const
{
RealOpenMM
temperature
,
RealOpenMM
collisionFrequency
,
RealOpenMM
stepSize
)
const
{
const
RealOpenMM
collisionProbability
=
1.0
f
-
EXP
(
-
collisionFrequency
*
stepSize
);
const
RealOpenMM
collisionProbability
=
1.0
f
-
EXP
(
-
collisionFrequency
*
stepSize
);
...
...
platforms/reference/src/SimTKReference/ReferenceAndersenThermostat.h
View file @
0843c5f3
...
@@ -65,7 +65,7 @@ class ReferenceAndersenThermostat {
...
@@ -65,7 +65,7 @@ class ReferenceAndersenThermostat {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
applyThermostat
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
atomGroups
,
RealOpenMM
**
atomVelocities
,
RealOpenMM
*
atomMasses
,
void
applyThermostat
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
atomGroups
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomVelocities
,
std
::
vector
<
RealOpenMM
>&
atomMasses
,
RealOpenMM
temperature
,
RealOpenMM
collisionFrequency
,
RealOpenMM
stepSize
)
const
;
RealOpenMM
temperature
,
RealOpenMM
collisionFrequency
,
RealOpenMM
stepSize
)
const
;
};
};
...
...
platforms/reference/src/SimTKReference/ReferenceAngleBondIxn.cpp
View file @
0843c5f3
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
#include "ReferenceAngleBondIxn.h"
#include "ReferenceAngleBondIxn.h"
#include "ReferenceForce.h"
#include "ReferenceForce.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
ReferenceAngleBondIxn constructor
ReferenceAngleBondIxn constructor
...
@@ -122,9 +125,9 @@ int ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine( RealOpenMM cosine, Rea
...
@@ -122,9 +125,9 @@ int ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine( RealOpenMM cosine, Rea
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
ReferenceAngleBondIxn
::
calculateBondIxn
(
int
*
atomIndices
,
void
ReferenceAngleBondIxn
::
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
RealOpenMM
*
totalEnergy
)
const
{
// constants -- reduce Visual Studio warnings regarding conversions between float & double
// constants -- reduce Visual Studio warnings regarding conversions between float & double
...
...
platforms/reference/src/SimTKReference/ReferenceAngleBondIxn.h
View file @
0843c5f3
...
@@ -81,8 +81,8 @@ class ReferenceAngleBondIxn : public ReferenceBondIxn {
...
@@ -81,8 +81,8 @@ class ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
RealOpenMM
*
totalEnergy
)
const
;
...
...
platforms/reference/src/SimTKReference/ReferenceBondForce.cpp
View file @
0843c5f3
...
@@ -30,6 +30,9 @@
...
@@ -30,6 +30,9 @@
#include "../SimTKUtilities/SimTKOpenMMUtilities.h"
#include "../SimTKUtilities/SimTKOpenMMUtilities.h"
#include "ReferenceBondForce.h"
#include "ReferenceBondForce.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
ReferenceBondForce constructor
ReferenceBondForce constructor
...
@@ -78,9 +81,9 @@ ReferenceBondForce::~ReferenceBondForce( ){
...
@@ -78,9 +81,9 @@ ReferenceBondForce::~ReferenceBondForce( ){
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
ReferenceBondForce
::
calculateForce
(
int
numberOfBonds
,
int
**
atomIndices
,
void
ReferenceBondForce
::
calculateForce
(
int
numberOfBonds
,
int
**
atomIndices
,
RealOpenMM
**
atomCoordinates
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
**
parameters
,
RealOpenMM
**
parameters
,
RealOpenMM
**
forces
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
,
RealOpenMM
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
){
ReferenceBondIxn
&
referenceBondIxn
){
...
...
platforms/reference/src/SimTKReference/ReferenceBondForce.h
View file @
0843c5f3
...
@@ -68,8 +68,8 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce {
...
@@ -68,8 +68,8 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateForce
(
int
numberOfBonds
,
int
**
atomIndices
,
void
calculateForce
(
int
numberOfBonds
,
int
**
atomIndices
,
RealOpenMM
**
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
**
parameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
);
RealOpenMM
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
);
};
};
...
...
platforms/reference/src/SimTKReference/ReferenceBondIxn.cpp
View file @
0843c5f3
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
#include "ReferenceForce.h"
#include "ReferenceForce.h"
#include "ReferenceBondIxn.h"
#include "ReferenceBondIxn.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
ReferenceBondIxn constructor
ReferenceBondIxn constructor
...
@@ -75,8 +78,8 @@ ReferenceBondIxn::~ReferenceBondIxn( ){
...
@@ -75,8 +78,8 @@ ReferenceBondIxn::~ReferenceBondIxn( ){
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
ReferenceBondIxn
::
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
void
ReferenceBondIxn
::
calculateBondIxn
(
int
*
atomIndices
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
parameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
RealOpenMM
*
totalEnergy
)
const
{
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/src/SimTKReference/ReferenceBondIxn.h
View file @
0843c5f3
...
@@ -63,8 +63,8 @@ class OPENMM_EXPORT ReferenceBondIxn {
...
@@ -63,8 +63,8 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
virtual
void
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
virtual
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
RealOpenMM
*
totalEnergy
)
const
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
...
platforms/reference/src/SimTKReference/ReferenceBrownianDynamics.cpp
View file @
0843c5f3
...
@@ -32,6 +32,9 @@
...
@@ -32,6 +32,9 @@
#include <cstdio>
#include <cstdio>
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
ReferenceBrownianDynamics constructor
ReferenceBrownianDynamics constructor
...
@@ -67,9 +70,8 @@ ReferenceBrownianDynamics::ReferenceBrownianDynamics( int numberOfAtoms,
...
@@ -67,9 +70,8 @@ ReferenceBrownianDynamics::ReferenceBrownianDynamics( int numberOfAtoms,
this
->
friction
=
one
;
this
->
friction
=
one
;
}
}
allocate2DArrays
(
numberOfAtoms
,
3
,
Max2DArrays
);
xPrime
.
resize
(
numberOfAtoms
);
allocate1DArrays
(
numberOfAtoms
,
Max1DArrays
);
inverseMasses
.
resize
(
numberOfAtoms
);
}
}
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -122,9 +124,9 @@ RealOpenMM ReferenceBrownianDynamics::getFriction( void ) const {
...
@@ -122,9 +124,9 @@ RealOpenMM ReferenceBrownianDynamics::getFriction( void ) const {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
int
ReferenceBrownianDynamics
::
update
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
ReferenceBrownianDynamics
::
update
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
**
velocities
,
vector
<
RealVec
>&
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
masses
){
vector
<
RealVec
>&
forces
,
vector
<
RealOpenMM
>&
masses
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -135,11 +137,6 @@ int ReferenceBrownianDynamics::update( int numberOfAtoms, RealOpenMM** atomCoord
...
@@ -135,11 +137,6 @@ int ReferenceBrownianDynamics::update( int numberOfAtoms, RealOpenMM** atomCoord
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// get work arrays
RealOpenMM
**
xPrime
=
get2DArrayAtIndex
(
xPrime2D
);
RealOpenMM
*
inverseMasses
=
get1DArrayAtIndex
(
InverseMasses
);
// first-time-through initialization
// first-time-through initialization
if
(
getTimeStep
()
==
0
){
if
(
getTimeStep
()
==
0
){
...
...
platforms/reference/src/SimTKReference/ReferenceBrownianDynamics.h
View file @
0843c5f3
...
@@ -33,9 +33,8 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
...
@@ -33,9 +33,8 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
private:
private:
enum
TwoDArrayIndicies
{
xPrime2D
,
Max2DArrays
};
std
::
vector
<
OpenMM
::
RealVec
>
xPrime
;
enum
OneDArrayIndicies
{
InverseMasses
,
Max1DArrays
};
std
::
vector
<
RealOpenMM
>
inverseMasses
;
RealOpenMM
friction
;
RealOpenMM
friction
;
public:
public:
...
@@ -85,8 +84,8 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
...
@@ -85,8 +84,8 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
int
update
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
update
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
masses
);
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
std
::
vector
<
RealOpenMM
>&
masses
);
};
};
...
...
platforms/reference/src/SimTKReference/ReferenceCCMAAlgorithm.cpp
View file @
0843c5f3
...
@@ -39,6 +39,7 @@ using std::pair;
...
@@ -39,6 +39,7 @@ using std::pair;
using
std
::
vector
;
using
std
::
vector
;
using
std
::
set
;
using
std
::
set
;
using
OpenMM
::
Vec3
;
using
OpenMM
::
Vec3
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -58,7 +59,7 @@ ReferenceCCMAAlgorithm::ReferenceCCMAAlgorithm( int numberOfAtoms,
...
@@ -58,7 +59,7 @@ ReferenceCCMAAlgorithm::ReferenceCCMAAlgorithm( int numberOfAtoms,
int
numberOfConstraints
,
int
numberOfConstraints
,
int
**
atomIndices
,
int
**
atomIndices
,
RealOpenMM
*
distance
,
RealOpenMM
*
distance
,
RealOpenMM
*
masses
,
vector
<
RealOpenMM
>&
masses
,
vector
<
AngleInfo
>&
angles
,
vector
<
AngleInfo
>&
angles
,
RealOpenMM
tolerance
){
RealOpenMM
tolerance
){
...
@@ -348,9 +349,9 @@ void ReferenceCCMAAlgorithm::setTolerance( RealOpenMM tolerance ){
...
@@ -348,9 +349,9 @@ void ReferenceCCMAAlgorithm::setTolerance( RealOpenMM tolerance ){
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
int
ReferenceCCMAAlgorithm
::
apply
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
ReferenceCCMAAlgorithm
::
apply
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomCoordinatesP
,
vector
<
RealVec
>&
atomCoordinatesP
,
RealOpenMM
*
inverseMasses
){
vector
<
RealOpenMM
>&
inverseMasses
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -479,7 +480,7 @@ int ReferenceCCMAAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordinat
...
@@ -479,7 +480,7 @@ int ReferenceCCMAAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordinat
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
int
ReferenceCCMAAlgorithm
::
reportCCMA
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
ReferenceCCMAAlgorithm
::
reportCCMA
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
std
::
stringstream
&
message
){
std
::
stringstream
&
message
){
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/src/SimTKReference/ReferenceCCMAAlgorithm.h
View file @
0843c5f3
...
@@ -67,7 +67,7 @@ class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm
...
@@ -67,7 +67,7 @@ class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
ReferenceCCMAAlgorithm
(
int
numberOfAtoms
,
int
numberOfConstraints
,
int
**
atomIndices
,
RealOpenMM
*
distance
,
RealOpenMM
*
masses
,
std
::
vector
<
AngleInfo
>&
angles
,
RealOpenMM
tolerance
);
ReferenceCCMAAlgorithm
(
int
numberOfAtoms
,
int
numberOfConstraints
,
int
**
atomIndices
,
RealOpenMM
*
distance
,
std
::
vector
<
RealOpenMM
>&
masses
,
std
::
vector
<
AngleInfo
>&
angles
,
RealOpenMM
tolerance
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -142,8 +142,8 @@ class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm
...
@@ -142,8 +142,8 @@ class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
int
apply
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
apply
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomCoordinatesP
,
RealOpenMM
*
inverseMasses
);
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -157,7 +157,7 @@ class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm
...
@@ -157,7 +157,7 @@ class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
int
reportCCMA
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
std
::
stringstream
&
message
);
int
reportCCMA
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
stringstream
&
message
);
};
};
class
ReferenceCCMAAlgorithm
::
AngleInfo
class
ReferenceCCMAAlgorithm
::
AngleInfo
...
...
platforms/reference/src/SimTKReference/ReferenceCMAPTorsionIxn.cpp
View file @
0843c5f3
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "ReferenceForce.h"
#include "ReferenceForce.h"
using
std
::
vector
;
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -51,7 +52,7 @@ ReferenceCMAPTorsionIxn::ReferenceCMAPTorsionIxn(const vector<vector<vector<Real
...
@@ -51,7 +52,7 @@ ReferenceCMAPTorsionIxn::ReferenceCMAPTorsionIxn(const vector<vector<vector<Real
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
ReferenceCMAPTorsionIxn
::
calculateIxn
(
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
forces
,
RealOpenMM
*
totalEnergy
)
const
{
void
ReferenceCMAPTorsionIxn
::
calculateIxn
(
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
for
(
unsigned
int
i
=
0
;
i
<
torsionMaps
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
torsionMaps
.
size
();
i
++
)
calculateOneIxn
(
i
,
atomCoordinates
,
forces
,
totalEnergy
);
calculateOneIxn
(
i
,
atomCoordinates
,
forces
,
totalEnergy
);
}
}
...
@@ -67,7 +68,7 @@ void ReferenceCMAPTorsionIxn::calculateIxn(RealOpenMM** atomCoordinates, RealOpe
...
@@ -67,7 +68,7 @@ void ReferenceCMAPTorsionIxn::calculateIxn(RealOpenMM** atomCoordinates, RealOpe
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
ReferenceCMAPTorsionIxn
::
calculateOneIxn
(
int
index
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
forces
,
void
ReferenceCMAPTorsionIxn
::
calculateOneIxn
(
int
index
,
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
RealOpenMM
*
totalEnergy
)
const
{
int
map
=
torsionMaps
[
index
];
int
map
=
torsionMaps
[
index
];
int
a1
=
torsionIndices
[
index
][
0
];
int
a1
=
torsionIndices
[
index
][
0
];
...
@@ -188,6 +189,6 @@ void ReferenceCMAPTorsionIxn::calculateOneIxn(int index, RealOpenMM** atomCoordi
...
@@ -188,6 +189,6 @@ void ReferenceCMAPTorsionIxn::calculateOneIxn(int index, RealOpenMM** atomCoordi
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
ReferenceCMAPTorsionIxn
::
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
void
ReferenceCMAPTorsionIxn
::
calculateBondIxn
(
int
*
atomIndices
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
totalEnergy
)
const
{
RealOpenMM
*
parameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
}
}
platforms/reference/src/SimTKReference/ReferenceCMAPTorsionIxn.h
View file @
0843c5f3
...
@@ -51,7 +51,7 @@ private:
...
@@ -51,7 +51,7 @@ private:
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateOneIxn
(
int
index
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
forces
,
void
calculateOneIxn
(
int
index
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
RealOpenMM
*
totalEnergy
)
const
;
public:
public:
...
@@ -76,7 +76,7 @@ public:
...
@@ -76,7 +76,7 @@ public:
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateIxn
(
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
forces
,
RealOpenMM
*
totalEnergy
)
const
;
void
calculateIxn
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -84,8 +84,8 @@ public:
...
@@ -84,8 +84,8 @@ public:
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
RealOpenMM
*
totalEnergy
)
const
;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/src/SimTKReference/ReferenceConstraintAlgorithm.h
View file @
0843c5f3
...
@@ -65,8 +65,8 @@ public:
...
@@ -65,8 +65,8 @@ public:
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
virtual
int
apply
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
virtual
int
apply
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomCoordinatesP
,
RealOpenMM
*
inverseMasses
)
=
0
;
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
)
=
0
;
};
};
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
Prev
1
2
3
4
5
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