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
...@@ -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;
}; };
/** /**
......
...@@ -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;
} }
...@@ -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,
......
...@@ -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,
......
...@@ -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.0f - EXP(-collisionFrequency*stepSize); const RealOpenMM collisionProbability = 1.0f - EXP(-collisionFrequency*stepSize);
......
...@@ -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;
}; };
......
...@@ -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
......
...@@ -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;
......
...@@ -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 ){
......
...@@ -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 );
}; };
......
...@@ -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 {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -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;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
......
...@@ -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 ){
......
...@@ -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 );
}; };
......
...@@ -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 ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -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
......
...@@ -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 {
} }
...@@ -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;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -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;
}; };
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
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