"platforms/vscode:/vscode.git/clone" did not exist on "bb5552c01ca8d6a2a3d0d188f6c104f9ba649d22"
Commit 0843c5f3 authored by Peter Eastman's avatar Peter Eastman
Browse files

First stage of a refactoring to clean up the reference platform

parent bacc1eff
......@@ -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 = "\nReferenceLJCoulomb14::calculateBondIxn";
......
......@@ -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;
};
......
......@@ -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 {
// ---------------------------------------------------------------------------------------
......
......@@ -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;
};
......
......@@ -31,7 +31,7 @@
#include "ReferenceDynamics.h"
using std::vector;
using OpenMM::Vec3;
using OpenMM::RealVec;
/**---------------------------------------------------------------------------------------
......@@ -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++) {
Vec3 delta(_sMatrix[i]*_solution[i]*_constraintDir[i][0],
RealVec 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] = Vec3(atomCoordinatesP[atom1][0]-atomCoordinatesP[atom2][0],
_constraintDir[i] = RealVec(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++) {
Vec3& dir1 = _constraintDir[c1];
RealVec& dir1 = _constraintDir[c1];
for (int j = 0; j < (int)_couplingMatrix[c1].size(); j++) {
int c2 = _linkedConstraints[c1][j];
Vec3& dir2 = _constraintDir[c2];
RealVec& 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];
Vec3 delta(atomCoordinatesP[atom1][0]-atomCoordinatesP[atom2][0],
RealVec 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));
......
......@@ -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::Vec3> _constraintDir;
std::vector<OpenMM::RealVec> _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 );
};
// ---------------------------------------------------------------------------------------
......
......@@ -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++) {
RealOpenMM* atomPos = atomPositions[molecules[i][j]];
RealVec& 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++) {
RealOpenMM* atomPos = atomPositions[molecules[i][j]];
RealVec& 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++)
......
......@@ -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);
};
......
......@@ -18,7 +18,7 @@ static double periodicDifference(double val1, double val2, double period) {
}
// squared distance between two points
static double compPairDistanceSquared(const RealOpenMM* pos1, const RealOpenMM* pos2, const RealOpenMM* periodicBoxSize) {
static double compPairDistanceSquared(const RealVec& pos1, const RealVec& 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 RealOpenMM*, AtomIndex> VoxelItem;
typedef std::pair<const RealVec*, AtomIndex> VoxelItem;
typedef std::vector< VoxelItem > Voxel;
class VoxelHash
......@@ -104,16 +104,16 @@ public:
}
}
void insert(const AtomIndex& item, const RealOpenMM* location)
void insert(const AtomIndex& item, const RealVec& 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 RealOpenMM* location) const {
VoxelIndex getVoxelIndex(const RealVec& 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 RealOpenMM* locationI = referencePoint.first;
const RealVec& 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 RealOpenMM* locationJ = itemIter->first;
const RealVec& 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 RealOpenMM* location = atomLocations[atomJ];
const RealVec& location = atomLocations[atomJ];
voxelHash.getNeighbors(
neighborList,
VoxelItem(location, atomJ),
VoxelItem(&location, atomJ),
exclusions,
reportSymmetricPairs,
maxDistance,
......
#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;
......
......@@ -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;
};
......
......@@ -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 = "\nReferenceProperDihedralBond::calculateBondIxn";
......
......@@ -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;
};
......
......@@ -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 = "\nReferenceRbDihedralBond::calculateBondIxn";
......
......@@ -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;
};
......
......@@ -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 ){
// ---------------------------------------------------------------------------------------
......
......@@ -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 );
};
// ---------------------------------------------------------------------------------------
......
......@@ -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 ){
......
......@@ -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 );
};
......
......@@ -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 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment