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
"platforms/vscode:/vscode.git/clone" did not exist on "bb5552c01ca8d6a2a3d0d188f6c104f9ba649d22"
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
122 additions
and
117 deletions
+122
-117
platforms/reference/src/SimTKReference/ReferenceLJCoulomb14.cpp
...rms/reference/src/SimTKReference/ReferenceLJCoulomb14.cpp
+5
-2
platforms/reference/src/SimTKReference/ReferenceLJCoulomb14.h
...forms/reference/src/SimTKReference/ReferenceLJCoulomb14.h
+2
-2
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
...ms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
+7
-6
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.h
...orms/reference/src/SimTKReference/ReferenceLJCoulombIxn.h
+8
-8
platforms/reference/src/SimTKReference/ReferenceLincsAlgorithm.cpp
.../reference/src/SimTKReference/ReferenceLincsAlgorithm.cpp
+11
-11
platforms/reference/src/SimTKReference/ReferenceLincsAlgorithm.h
...ms/reference/src/SimTKReference/ReferenceLincsAlgorithm.h
+6
-6
platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
...erence/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
+5
-4
platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.h
...eference/src/SimTKReference/ReferenceMonteCarloBarostat.h
+2
-2
platforms/reference/src/SimTKReference/ReferenceNeighborList.cpp
...ms/reference/src/SimTKReference/ReferenceNeighborList.cpp
+9
-9
platforms/reference/src/SimTKReference/ReferenceNeighborList.h
...orms/reference/src/SimTKReference/ReferenceNeighborList.h
+2
-2
platforms/reference/src/SimTKReference/ReferencePairIxn.h
platforms/reference/src/SimTKReference/ReferencePairIxn.h
+2
-2
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.cpp
...erence/src/SimTKReference/ReferenceProperDihedralBond.cpp
+5
-2
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.h
...eference/src/SimTKReference/ReferenceProperDihedralBond.h
+2
-2
platforms/reference/src/SimTKReference/ReferenceRbDihedralBond.cpp
.../reference/src/SimTKReference/ReferenceRbDihedralBond.cpp
+5
-2
platforms/reference/src/SimTKReference/ReferenceRbDihedralBond.h
...ms/reference/src/SimTKReference/ReferenceRbDihedralBond.h
+2
-2
platforms/reference/src/SimTKReference/ReferenceShakeAlgorithm.cpp
.../reference/src/SimTKReference/ReferenceShakeAlgorithm.cpp
+7
-4
platforms/reference/src/SimTKReference/ReferenceShakeAlgorithm.h
...ms/reference/src/SimTKReference/ReferenceShakeAlgorithm.h
+3
-3
platforms/reference/src/SimTKReference/ReferenceStochasticDynamics.cpp
...erence/src/SimTKReference/ReferenceStochasticDynamics.cpp
+15
-19
platforms/reference/src/SimTKReference/ReferenceStochasticDynamics.h
...eference/src/SimTKReference/ReferenceStochasticDynamics.h
+8
-9
platforms/reference/src/SimTKReference/ReferenceVariableStochasticDynamics.cpp
...rc/SimTKReference/ReferenceVariableStochasticDynamics.cpp
+16
-20
No files found.
platforms/reference/src/SimTKReference/ReferenceLJCoulomb14.cpp
View file @
0843c5f3
...
...
@@ -31,6 +31,9 @@
#include "ReferenceLJCoulomb14.h"
#include "ReferenceForce.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
ReferenceLJCoulomb14 constructor
...
...
@@ -78,8 +81,8 @@ ReferenceLJCoulomb14::~ReferenceLJCoulomb14( ){
--------------------------------------------------------------------------------------- */
void
ReferenceLJCoulomb14
::
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
void
ReferenceLJCoulomb14
::
calculateBondIxn
(
int
*
atomIndices
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
static
const
std
::
string
methodName
=
"
\n
ReferenceLJCoulomb14::calculateBondIxn"
;
...
...
platforms/reference/src/SimTKReference/ReferenceLJCoulomb14.h
View file @
0843c5f3
...
...
@@ -61,8 +61,8 @@ class ReferenceLJCoulomb14 : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
};
...
...
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
View file @
0843c5f3
...
...
@@ -38,6 +38,7 @@
#include "openmm/internal/MSVC_erfc.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
...
...
@@ -176,9 +177,9 @@ ReferenceLJCoulombIxn::~ReferenceLJCoulombIxn( ){
--------------------------------------------------------------------------------------- */
int
ReferenceLJCoulombIxn
::
calculateEwaldIxn
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
ReferenceLJCoulombIxn
::
calculateEwaldIxn
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
int
**
exclusions
,
RealOpenMM
*
fixedParameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
fixedParameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
{
typedef
std
::
complex
<
RealOpenMM
>
d_complex
;
...
...
@@ -472,9 +473,9 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
--------------------------------------------------------------------------------------- */
int
ReferenceLJCoulombIxn
::
calculatePairIxn
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
ReferenceLJCoulombIxn
::
calculatePairIxn
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
int
**
exclusions
,
RealOpenMM
*
fixedParameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
fixedParameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
{
if
(
ewald
||
pme
)
...
...
@@ -533,8 +534,8 @@ int ReferenceLJCoulombIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM** ato
--------------------------------------------------------------------------------------- */
int
ReferenceLJCoulombIxn
::
calculateOneIxn
(
int
ii
,
int
jj
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
atomParameters
,
RealOpenMM
**
forces
,
int
ReferenceLJCoulombIxn
::
calculateOneIxn
(
int
ii
,
int
jj
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
{
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.h
View file @
0843c5f3
...
...
@@ -68,8 +68,8 @@ class ReferenceLJCoulombIxn : public ReferencePairIxn {
--------------------------------------------------------------------------------------- */
int
calculateOneIxn
(
int
atom1
,
int
atom2
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
atomParameters
,
RealOpenMM
**
forces
,
int
calculateOneIxn
(
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
;
...
...
@@ -164,9 +164,9 @@ class ReferenceLJCoulombIxn : public ReferencePairIxn {
--------------------------------------------------------------------------------------- */
int
calculatePairIxn
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
calculatePairIxn
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
int
**
exclusions
,
RealOpenMM
*
fixedParameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
fixedParameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
;
private:
...
...
@@ -190,9 +190,9 @@ private:
--------------------------------------------------------------------------------------- */
int
calculateEwaldIxn
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
calculateEwaldIxn
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
int
**
exclusions
,
RealOpenMM
*
fixedParameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
fixedParameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -215,9 +215,9 @@ private:
--------------------------------------------------------------------------------------- */
int
calculatePMEIxn
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
calculatePMEIxn
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
int
**
exclusions
,
RealOpenMM
*
fixedParameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
fixedParameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
;
};
...
...
platforms/reference/src/SimTKReference/ReferenceLincsAlgorithm.cpp
View file @
0843c5f3
...
...
@@ -31,7 +31,7 @@
#include "ReferenceDynamics.h"
using
std
::
vector
;
using
OpenMM
::
Vec
3
;
using
OpenMM
::
Real
Vec
;
/**---------------------------------------------------------------------------------------
...
...
@@ -126,7 +126,7 @@ void ReferenceLincsAlgorithm::setNumTerms( int terms ){
--------------------------------------------------------------------------------------- */
void
ReferenceLincsAlgorithm
::
initialize
(
int
numberOfAtoms
,
RealOpenMM
*
inverseMasses
)
{
void
ReferenceLincsAlgorithm
::
initialize
(
int
numberOfAtoms
,
vector
<
RealOpenMM
>&
inverseMasses
)
{
static
const
RealOpenMM
one
=
1.0
;
_hasInitialized
=
true
;
vector
<
vector
<
int
>
>
atomConstraints
(
numberOfAtoms
);
...
...
@@ -188,9 +188,9 @@ void ReferenceLincsAlgorithm::solveMatrix() {
--------------------------------------------------------------------------------------- */
void
ReferenceLincsAlgorithm
::
updateAtomPositions
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
inverseMasses
)
{
void
ReferenceLincsAlgorithm
::
updateAtomPositions
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealOpenMM
>&
inverseMasses
)
{
for
(
int
i
=
0
;
i
<
_numberOfConstraints
;
i
++
)
{
Vec
3
delta
(
_sMatrix
[
i
]
*
_solution
[
i
]
*
_constraintDir
[
i
][
0
],
Real
Vec
delta
(
_sMatrix
[
i
]
*
_solution
[
i
]
*
_constraintDir
[
i
][
0
],
_sMatrix
[
i
]
*
_solution
[
i
]
*
_constraintDir
[
i
][
1
],
_sMatrix
[
i
]
*
_solution
[
i
]
*
_constraintDir
[
i
][
2
]);
int
atom1
=
_atomIndices
[
i
][
0
];
...
...
@@ -218,9 +218,9 @@ void ReferenceLincsAlgorithm::updateAtomPositions(int numberOfAtoms, RealOpenMM*
--------------------------------------------------------------------------------------- */
int
ReferenceLincsAlgorithm
::
apply
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
atomCoordinatesP
,
RealOpenMM
*
inverseMasses
){
int
ReferenceLincsAlgorithm
::
apply
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealVec
>&
atomCoordinatesP
,
vector
<
RealOpenMM
>&
inverseMasses
){
// ---------------------------------------------------------------------------------------
...
...
@@ -243,7 +243,7 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordina
for
(
int
i
=
0
;
i
<
_numberOfConstraints
;
i
++
)
{
int
atom1
=
_atomIndices
[
i
][
0
];
int
atom2
=
_atomIndices
[
i
][
1
];
_constraintDir
[
i
]
=
Vec
3
(
atomCoordinatesP
[
atom1
][
0
]
-
atomCoordinatesP
[
atom2
][
0
],
_constraintDir
[
i
]
=
Real
Vec
(
atomCoordinatesP
[
atom1
][
0
]
-
atomCoordinatesP
[
atom2
][
0
],
atomCoordinatesP
[
atom1
][
1
]
-
atomCoordinatesP
[
atom2
][
1
],
atomCoordinatesP
[
atom1
][
2
]
-
atomCoordinatesP
[
atom2
][
2
]);
RealOpenMM
invLength
=
(
RealOpenMM
)(
1
/
SQRT
((
RealOpenMM
)
_constraintDir
[
i
].
dot
(
_constraintDir
[
i
])));
...
...
@@ -256,10 +256,10 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordina
// Build the coupling matrix.
for
(
int
c1
=
0
;
c1
<
(
int
)
_couplingMatrix
.
size
();
c1
++
)
{
Vec
3
&
dir1
=
_constraintDir
[
c1
];
Real
Vec
&
dir1
=
_constraintDir
[
c1
];
for
(
int
j
=
0
;
j
<
(
int
)
_couplingMatrix
[
c1
].
size
();
j
++
)
{
int
c2
=
_linkedConstraints
[
c1
][
j
];
Vec
3
&
dir2
=
_constraintDir
[
c2
];
Real
Vec
&
dir2
=
_constraintDir
[
c2
];
if
(
_atomIndices
[
c1
][
0
]
==
_atomIndices
[
c2
][
0
]
||
_atomIndices
[
c1
][
1
]
==
_atomIndices
[
c2
][
1
])
_couplingMatrix
[
c1
][
j
]
=
(
RealOpenMM
)(
-
inverseMasses
[
_atomIndices
[
c1
][
0
]]
*
_sMatrix
[
c1
]
*
dir1
.
dot
(
dir2
)
*
_sMatrix
[
c2
]);
else
...
...
@@ -277,7 +277,7 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordina
for
(
int
i
=
0
;
i
<
_numberOfConstraints
;
i
++
)
{
int
atom1
=
_atomIndices
[
i
][
0
];
int
atom2
=
_atomIndices
[
i
][
1
];
Vec
3
delta
(
atomCoordinatesP
[
atom1
][
0
]
-
atomCoordinatesP
[
atom2
][
0
],
Real
Vec
delta
(
atomCoordinatesP
[
atom1
][
0
]
-
atomCoordinatesP
[
atom2
][
0
],
atomCoordinatesP
[
atom1
][
1
]
-
atomCoordinatesP
[
atom2
][
1
],
atomCoordinatesP
[
atom1
][
2
]
-
atomCoordinatesP
[
atom2
][
2
]);
RealOpenMM
p2
=
(
RealOpenMM
)(
two
*
_distance
[
i
]
*
_distance
[
i
]
-
delta
.
dot
(
delta
));
...
...
platforms/reference/src/SimTKReference/ReferenceLincsAlgorithm.h
View file @
0843c5f3
...
...
@@ -25,7 +25,7 @@
#define __ReferenceLincsAlgorithm_H__
#include "ReferenceConstraintAlgorithm.h"
#include "
openmm/Vec3
.h"
#include "
../SimTKUtilities/SimTKOpenMMRealType
.h"
#include <vector>
// ---------------------------------------------------------------------------------------
...
...
@@ -46,7 +46,7 @@ class ReferenceLincsAlgorithm : public ReferenceConstraintAlgorithm {
std
::
vector
<
RealOpenMM
>
_rhs2
;
std
::
vector
<
RealOpenMM
>
_solution
;
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
_couplingMatrix
;
std
::
vector
<
OpenMM
::
Vec
3
>
_constraintDir
;
std
::
vector
<
OpenMM
::
Real
Vec
>
_constraintDir
;
/**---------------------------------------------------------------------------------------
...
...
@@ -58,7 +58,7 @@ class ReferenceLincsAlgorithm : public ReferenceConstraintAlgorithm {
--------------------------------------------------------------------------------------- */
void
initialize
(
int
numberOfAtoms
,
RealOpenMM
*
inverseMasses
);
void
initialize
(
int
numberOfAtoms
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
);
/**---------------------------------------------------------------------------------------
...
...
@@ -78,7 +78,7 @@ class ReferenceLincsAlgorithm : public ReferenceConstraintAlgorithm {
--------------------------------------------------------------------------------------- */
void
updateAtomPositions
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
inverseMasses
);
void
updateAtomPositions
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
);
public:
...
...
@@ -136,8 +136,8 @@ class ReferenceLincsAlgorithm : public ReferenceConstraintAlgorithm {
--------------------------------------------------------------------------------------- */
int
apply
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
atomCoordinatesP
,
RealOpenMM
*
inverseMasses
);
int
apply
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
);
};
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
View file @
0843c5f3
...
...
@@ -29,6 +29,7 @@
#include "ReferenceMonteCarloBarostat.h"
using
namespace
std
;
using
namespace
OpenMM
;
/**---------------------------------------------------------------------------------------
...
...
@@ -61,7 +62,7 @@ ReferenceMonteCarloBarostat::~ReferenceMonteCarloBarostat( ) {
--------------------------------------------------------------------------------------- */
void
ReferenceMonteCarloBarostat
::
applyBarostat
(
RealOpenMM
**
atomPositions
,
RealOpenMM
*
boxSize
,
RealOpenMM
scale
)
{
void
ReferenceMonteCarloBarostat
::
applyBarostat
(
vector
<
RealVec
>&
atomPositions
,
RealOpenMM
*
boxSize
,
RealOpenMM
scale
)
{
int
numAtoms
=
savedAtomPositions
[
0
].
size
();
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
...
...
@@ -74,7 +75,7 @@ void ReferenceMonteCarloBarostat::applyBarostat(RealOpenMM** atomPositions, Real
RealOpenMM
pos
[
3
]
=
{
0
,
0
,
0
};
for
(
int
j
=
0
;
j
<
(
int
)
molecules
[
i
].
size
();
j
++
)
{
Real
OpenMM
*
atomPos
=
atomPositions
[
molecules
[
i
][
j
]];
Real
Vec
&
atomPos
=
atomPositions
[
molecules
[
i
][
j
]];
pos
[
0
]
+=
atomPos
[
0
];
pos
[
1
]
+=
atomPos
[
1
];
pos
[
2
]
+=
atomPos
[
2
];
...
...
@@ -101,7 +102,7 @@ void ReferenceMonteCarloBarostat::applyBarostat(RealOpenMM** atomPositions, Real
dy
=
pos
[
1
]
*
(
scale
-
1
)
-
dy
;
dz
=
pos
[
2
]
*
(
scale
-
1
)
-
dz
;
for
(
int
j
=
0
;
j
<
(
int
)
molecules
[
i
].
size
();
j
++
)
{
Real
OpenMM
*
atomPos
=
atomPositions
[
molecules
[
i
][
j
]];
Real
Vec
&
atomPos
=
atomPositions
[
molecules
[
i
][
j
]];
atomPos
[
0
]
+=
dx
;
atomPos
[
1
]
+=
dy
;
atomPos
[
2
]
+=
dz
;
...
...
@@ -117,7 +118,7 @@ void ReferenceMonteCarloBarostat::applyBarostat(RealOpenMM** atomPositions, Real
--------------------------------------------------------------------------------------- */
void
ReferenceMonteCarloBarostat
::
restorePositions
(
RealOpenMM
**
atomPositions
)
{
void
ReferenceMonteCarloBarostat
::
restorePositions
(
vector
<
RealVec
>&
atomPositions
)
{
int
numAtoms
=
savedAtomPositions
[
0
].
size
();
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
...
...
platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.h
View file @
0843c5f3
...
...
@@ -66,7 +66,7 @@ class ReferenceMonteCarloBarostat {
--------------------------------------------------------------------------------------- */
void
applyBarostat
(
RealOpenMM
**
atomPositions
,
RealOpenMM
*
boxSize
,
RealOpenMM
scale
);
void
applyBarostat
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomPositions
,
RealOpenMM
*
boxSize
,
RealOpenMM
scale
);
/**---------------------------------------------------------------------------------------
...
...
@@ -76,7 +76,7 @@ class ReferenceMonteCarloBarostat {
--------------------------------------------------------------------------------------- */
void
restorePositions
(
RealOpenMM
**
atomPositions
);
void
restorePositions
(
std
::
vector
<
OpenMM
::
RealVec
>&
atomPositions
);
};
...
...
platforms/reference/src/SimTKReference/ReferenceNeighborList.cpp
View file @
0843c5f3
...
...
@@ -18,7 +18,7 @@ static double periodicDifference(double val1, double val2, double period) {
}
// squared distance between two points
static
double
compPairDistanceSquared
(
const
Real
OpenMM
*
pos1
,
const
Real
OpenMM
*
pos2
,
const
RealOpenMM
*
periodicBoxSize
)
{
static
double
compPairDistanceSquared
(
const
Real
Vec
&
pos1
,
const
Real
Vec
&
pos2
,
const
RealOpenMM
*
periodicBoxSize
)
{
double
dx
,
dy
,
dz
;
if
(
periodicBoxSize
==
NULL
)
{
dx
=
pos2
[
0
]
-
pos1
[
0
];
...
...
@@ -89,7 +89,7 @@ public:
};
typedef
std
::
pair
<
const
Real
OpenMM
*
,
AtomIndex
>
VoxelItem
;
typedef
std
::
pair
<
const
Real
Vec
*
,
AtomIndex
>
VoxelItem
;
typedef
std
::
vector
<
VoxelItem
>
Voxel
;
class
VoxelHash
...
...
@@ -104,16 +104,16 @@ public:
}
}
void
insert
(
const
AtomIndex
&
item
,
const
Real
OpenMM
*
location
)
void
insert
(
const
AtomIndex
&
item
,
const
Real
Vec
&
location
)
{
VoxelIndex
voxelIndex
=
getVoxelIndex
(
location
);
if
(
voxelMap
.
find
(
voxelIndex
)
==
voxelMap
.
end
()
)
voxelMap
[
voxelIndex
]
=
Voxel
();
Voxel
&
voxel
=
voxelMap
.
find
(
voxelIndex
)
->
second
;
voxel
.
push_back
(
VoxelItem
(
location
,
item
)
);
voxel
.
push_back
(
VoxelItem
(
&
location
,
item
)
);
}
VoxelIndex
getVoxelIndex
(
const
Real
OpenMM
*
location
)
const
{
VoxelIndex
getVoxelIndex
(
const
Real
Vec
&
location
)
const
{
double
xperiodic
,
yperiodic
,
zperiodic
;
if
(
periodicBoxSize
==
NULL
)
{
xperiodic
=
location
[
0
];
...
...
@@ -150,7 +150,7 @@ public:
assert
(
voxelSizeZ
>
0
);
const
AtomIndex
atomI
=
referencePoint
.
second
;
const
Real
OpenMM
*
locationI
=
referencePoint
.
first
;
const
Real
Vec
&
locationI
=
*
referencePoint
.
first
;
double
maxDistanceSquared
=
maxDistance
*
maxDistance
;
double
minDistanceSquared
=
minDistance
*
minDistance
;
...
...
@@ -184,7 +184,7 @@ public:
for
(
Voxel
::
const_iterator
itemIter
=
voxel
.
begin
();
itemIter
!=
voxel
.
end
();
++
itemIter
)
{
const
AtomIndex
atomJ
=
itemIter
->
second
;
const
Real
OpenMM
*
locationJ
=
itemIter
->
first
;
const
Real
Vec
&
locationJ
=
*
itemIter
->
first
;
// Ignore self hits
if
(
atomI
==
atomJ
)
continue
;
...
...
@@ -239,10 +239,10 @@ void OPENMM_EXPORT computeNeighborListVoxelHash(
for
(
AtomIndex
atomJ
=
0
;
atomJ
<
(
AtomIndex
)
nAtoms
;
++
atomJ
)
// use "j", because j > i for pairs
{
// 1) Find other atoms that are close to this one
const
Real
OpenMM
*
location
=
atomLocations
[
atomJ
];
const
Real
Vec
&
location
=
atomLocations
[
atomJ
];
voxelHash
.
getNeighbors
(
neighborList
,
VoxelItem
(
location
,
atomJ
),
VoxelItem
(
&
location
,
atomJ
),
exclusions
,
reportSymmetricPairs
,
maxDistance
,
...
...
platforms/reference/src/SimTKReference/ReferenceNeighborList.h
View file @
0843c5f3
#ifndef OPENMM_REFERENCE_NEIGHBORLIST_H_
#define OPENMM_REFERENCE_NEIGHBORLIST_H_
#include "../SimTKUtilities/
SimTKOpenMMRealType
.h"
#include "../SimTKUtilities/
RealVec
.h"
#include "openmm/internal/windowsExport.h"
#include <set>
#include <vector>
namespace
OpenMM
{
typedef
RealOpenMM
**
AtomLocationList
;
typedef
std
::
vector
<
RealVec
>
AtomLocationList
;
typedef
unsigned
int
AtomIndex
;
typedef
std
::
pair
<
AtomIndex
,
AtomIndex
>
AtomPair
;
typedef
std
::
vector
<
AtomPair
>
NeighborList
;
...
...
platforms/reference/src/SimTKReference/ReferencePairIxn.h
View file @
0843c5f3
...
...
@@ -68,9 +68,9 @@ class OPENMM_EXPORT ReferencePairIxn {
--------------------------------------------------------------------------------------- */
virtual
int
calculatePairIxn
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
virtual
int
calculatePairIxn
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
**
atomParameters
,
int
**
exclusions
,
RealOpenMM
*
fixedParameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
fixedParameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
energyByAtom
,
RealOpenMM
*
totalEnergy
)
const
=
0
;
};
...
...
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.cpp
View file @
0843c5f3
...
...
@@ -31,6 +31,9 @@
#include "ReferenceProperDihedralBond.h"
#include "ReferenceForce.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
ReferenceProperDihedralBond constructor
...
...
@@ -78,9 +81,9 @@ ReferenceProperDihedralBond::~ReferenceProperDihedralBond( ){
--------------------------------------------------------------------------------------- */
void
ReferenceProperDihedralBond
::
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
static
const
std
::
string
methodName
=
"
\n
ReferenceProperDihedralBond::calculateBondIxn"
;
...
...
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.h
View file @
0843c5f3
...
...
@@ -65,8 +65,8 @@ class ReferenceProperDihedralBond : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
};
...
...
platforms/reference/src/SimTKReference/ReferenceRbDihedralBond.cpp
View file @
0843c5f3
...
...
@@ -31,6 +31,9 @@
#include "ReferenceRbDihedralBond.h"
#include "ReferenceForce.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
ReferenceRbDihedralBond constructor
...
...
@@ -76,9 +79,9 @@ ReferenceRbDihedralBond::~ReferenceRbDihedralBond( ){
--------------------------------------------------------------------------------------- */
void
ReferenceRbDihedralBond
::
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
static
const
std
::
string
methodName
=
"
\n
ReferenceRbDihedralBond::calculateBondIxn"
;
...
...
platforms/reference/src/SimTKReference/ReferenceRbDihedralBond.h
View file @
0843c5f3
...
...
@@ -63,8 +63,8 @@ class ReferenceRbDihedralBond : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
};
...
...
platforms/reference/src/SimTKReference/ReferenceShakeAlgorithm.cpp
View file @
0843c5f3
...
...
@@ -31,6 +31,9 @@
#include "ReferenceShakeAlgorithm.h"
#include "ReferenceDynamics.h"
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
ReferenceShakeAlgorithm constructor
...
...
@@ -218,9 +221,9 @@ void ReferenceShakeAlgorithm::setTolerance( RealOpenMM tolerance ){
--------------------------------------------------------------------------------------- */
int
ReferenceShakeAlgorithm
::
apply
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
atomCoordinatesP
,
RealOpenMM
*
inverseMasses
){
int
ReferenceShakeAlgorithm
::
apply
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealVec
>&
atomCoordinatesP
,
vector
<
RealOpenMM
>&
inverseMasses
){
// ---------------------------------------------------------------------------------------
...
...
@@ -336,7 +339,7 @@ int ReferenceShakeAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordina
--------------------------------------------------------------------------------------- */
int
ReferenceShakeAlgorithm
::
reportShake
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
int
ReferenceShakeAlgorithm
::
reportShake
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
std
::
stringstream
&
message
){
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/src/SimTKReference/ReferenceShakeAlgorithm.h
View file @
0843c5f3
...
...
@@ -134,8 +134,8 @@ class ReferenceShakeAlgorithm : public ReferenceConstraintAlgorithm {
--------------------------------------------------------------------------------------- */
int
apply
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
atomCoordinatesP
,
RealOpenMM
*
inverseMasses
);
int
apply
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
);
/**---------------------------------------------------------------------------------------
...
...
@@ -149,7 +149,7 @@ class ReferenceShakeAlgorithm : public ReferenceConstraintAlgorithm {
--------------------------------------------------------------------------------------- */
int
reportShake
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
std
::
stringstream
&
message
);
int
reportShake
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
stringstream
&
message
);
};
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/src/SimTKReference/ReferenceStochasticDynamics.cpp
View file @
0843c5f3
...
...
@@ -32,6 +32,9 @@
#include <cstdio>
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
ReferenceStochasticDynamics constructor
...
...
@@ -69,10 +72,8 @@ ReferenceStochasticDynamics::ReferenceStochasticDynamics( int numberOfAtoms,
_tau
=
one
;
}
allocate2DArrays
(
numberOfAtoms
,
3
,
Max2DArrays
);
allocate1DArrays
(
numberOfAtoms
,
Max1DArrays
);
xPrime
.
resize
(
numberOfAtoms
);
inverseMasses
.
resize
(
numberOfAtoms
);
}
/**---------------------------------------------------------------------------------------
...
...
@@ -125,10 +126,10 @@ RealOpenMM ReferenceStochasticDynamics::getTau( void ) const {
--------------------------------------------------------------------------------------- */
int
ReferenceStochasticDynamics
::
updatePart1
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
inverseMasses
,
RealOpenMM
**
xPrime
){
int
ReferenceStochasticDynamics
::
updatePart1
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealVec
>&
velocities
,
vector
<
RealVec
>&
forces
,
vector
<
RealOpenMM
>&
inverseMasses
,
vector
<
RealVec
>&
xPrime
){
// ---------------------------------------------------------------------------------------
...
...
@@ -169,10 +170,10 @@ int ReferenceStochasticDynamics::updatePart1( int numberOfAtoms, RealOpenMM** at
--------------------------------------------------------------------------------------- */
int
ReferenceStochasticDynamics
::
updatePart2
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
inverseMasses
,
RealOpenMM
**
xPrime
){
int
ReferenceStochasticDynamics
::
updatePart2
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealVec
>&
velocities
,
vector
<
RealVec
>&
forces
,
vector
<
RealOpenMM
>&
inverseMasses
,
vector
<
RealVec
>&
xPrime
){
// ---------------------------------------------------------------------------------------
...
...
@@ -207,8 +208,8 @@ int ReferenceStochasticDynamics::updatePart2( int numberOfAtoms, RealOpenMM** at
--------------------------------------------------------------------------------------- */
int
ReferenceStochasticDynamics
::
update
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
masses
){
int
ReferenceStochasticDynamics
::
update
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealVec
>&
velocities
,
vector
<
RealVec
>&
forces
,
vector
<
RealOpenMM
>&
masses
){
// ---------------------------------------------------------------------------------------
...
...
@@ -219,11 +220,6 @@ int ReferenceStochasticDynamics::update( int numberOfAtoms, RealOpenMM** atomCoo
// ---------------------------------------------------------------------------------------
// get work arrays
RealOpenMM
**
xPrime
=
get2DArrayAtIndex
(
xPrime2D
);
RealOpenMM
*
inverseMasses
=
get1DArrayAtIndex
(
InverseMasses
);
// first-time-through initialization
if
(
getTimeStep
()
==
0
){
...
...
platforms/reference/src/SimTKReference/ReferenceStochasticDynamics.h
View file @
0843c5f3
...
...
@@ -33,9 +33,8 @@ class ReferenceStochasticDynamics : public ReferenceDynamics {
private:
enum
TwoDArrayIndicies
{
xPrime2D
,
Max2DArrays
};
enum
OneDArrayIndicies
{
InverseMasses
,
Max1DArrays
};
std
::
vector
<
OpenMM
::
RealVec
>
xPrime
;
std
::
vector
<
RealOpenMM
>
inverseMasses
;
RealOpenMM
_tau
;
public:
...
...
@@ -85,8 +84,8 @@ class ReferenceStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */
int
update
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
masses
);
int
update
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
std
::
vector
<
RealOpenMM
>&
masses
);
/**---------------------------------------------------------------------------------------
...
...
@@ -103,8 +102,8 @@ class ReferenceStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */
int
updatePart1
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
inverseMasses
,
RealOpenMM
**
xPrime
);
int
updatePart1
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
,
std
::
vector
<
OpenMM
::
RealVec
>&
xPrime
);
/**---------------------------------------------------------------------------------------
...
...
@@ -120,8 +119,8 @@ class ReferenceStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */
int
updatePart2
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
inverseMasses
,
RealOpenMM
**
xPrime
);
int
updatePart2
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
,
std
::
vector
<
OpenMM
::
RealVec
>&
xPrime
);
};
...
...
platforms/reference/src/SimTKReference/ReferenceVariableStochasticDynamics.cpp
View file @
0843c5f3
...
...
@@ -32,6 +32,9 @@
#include <cstdio>
using
std
::
vector
;
using
OpenMM
::
RealVec
;
/**---------------------------------------------------------------------------------------
ReferenceVariableStochasticDynamics constructor
...
...
@@ -70,10 +73,8 @@ ReferenceVariableStochasticDynamics::ReferenceVariableStochasticDynamics( int nu
_tau
=
one
;
}
allocate2DArrays
(
numberOfAtoms
,
3
,
Max2DArrays
);
allocate1DArrays
(
numberOfAtoms
,
Max1DArrays
);
xPrime
.
resize
(
numberOfAtoms
);
inverseMasses
.
resize
(
numberOfAtoms
);
}
/**---------------------------------------------------------------------------------------
...
...
@@ -150,10 +151,10 @@ RealOpenMM ReferenceVariableStochasticDynamics::getTau( void ) const {
--------------------------------------------------------------------------------------- */
int
ReferenceVariableStochasticDynamics
::
updatePart1
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
masses
,
RealOpenMM
*
inverseMasses
,
RealOpenMM
**
xPrime
,
RealOpenMM
maxStepSize
){
int
ReferenceVariableStochasticDynamics
::
updatePart1
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealVec
>&
velocities
,
vector
<
RealVec
>&
forces
,
vector
<
RealOpenMM
>&
masses
,
vector
<
RealOpenMM
>&
inverseMasses
,
vector
<
RealVec
>&
xPrime
,
RealOpenMM
maxStepSize
){
// ---------------------------------------------------------------------------------------
...
...
@@ -239,10 +240,10 @@ int ReferenceVariableStochasticDynamics::updatePart1( int numberOfAtoms, RealOpe
--------------------------------------------------------------------------------------- */
int
ReferenceVariableStochasticDynamics
::
updatePart2
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
inverseMasses
,
RealOpenMM
**
xPrime
){
int
ReferenceVariableStochasticDynamics
::
updatePart2
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealVec
>&
velocities
,
vector
<
RealVec
>&
forces
,
vector
<
RealOpenMM
>&
inverseMasses
,
vector
<
RealVec
>&
xPrime
){
// ---------------------------------------------------------------------------------------
...
...
@@ -277,9 +278,9 @@ int ReferenceVariableStochasticDynamics::updatePart2( int numberOfAtoms, RealOpe
--------------------------------------------------------------------------------------- */
int
ReferenceVariableStochasticDynamics
::
update
(
int
numberOfAtoms
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
**
velocities
,
RealOpenMM
**
forces
,
RealOpenMM
*
masses
,
RealOpenMM
maxStepSize
){
int
ReferenceVariableStochasticDynamics
::
update
(
int
numberOfAtoms
,
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealVec
>&
velocities
,
vector
<
RealVec
>&
forces
,
vector
<
RealOpenMM
>&
masses
,
RealOpenMM
maxStepSize
){
// ---------------------------------------------------------------------------------------
...
...
@@ -287,11 +288,6 @@ int ReferenceVariableStochasticDynamics::update( int numberOfAtoms, RealOpenMM**
// ---------------------------------------------------------------------------------------
// get work arrays
RealOpenMM
**
xPrime
=
get2DArrayAtIndex
(
xPrime2D
);
RealOpenMM
*
inverseMasses
=
get1DArrayAtIndex
(
InverseMasses
);
// 1st update
updatePart1
(
numberOfAtoms
,
atomCoordinates
,
velocities
,
forces
,
masses
,
inverseMasses
,
xPrime
,
maxStepSize
);
...
...
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