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
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "ReferenceCustomAngleIxn.h" #include "ReferenceCustomAngleIxn.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
using namespace OpenMM;
using namespace std; using namespace std;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -79,9 +80,9 @@ ReferenceCustomAngleIxn::~ReferenceCustomAngleIxn( ){ ...@@ -79,9 +80,9 @@ ReferenceCustomAngleIxn::~ReferenceCustomAngleIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomAngleIxn::calculateBondIxn( int* atomIndices, void ReferenceCustomAngleIxn::calculateBondIxn( int* atomIndices,
RealOpenMM** atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM* parameters,
RealOpenMM** forces, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const { RealOpenMM* totalEnergy ) const {
static const std::string methodName = "\nReferenceCustomAngleIxn::calculateAngleIxn"; static const std::string methodName = "\nReferenceCustomAngleIxn::calculateAngleIxn";
......
...@@ -68,8 +68,8 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn { ...@@ -68,8 +68,8 @@ class ReferenceCustomAngleIxn : 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;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "ReferenceForce.h" #include "ReferenceForce.h"
using namespace std; using namespace std;
using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -80,9 +81,9 @@ ReferenceCustomBondIxn::~ReferenceCustomBondIxn( ){ ...@@ -80,9 +81,9 @@ ReferenceCustomBondIxn::~ReferenceCustomBondIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices, void ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices,
RealOpenMM** atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM* parameters,
RealOpenMM** forces, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const { RealOpenMM* totalEnergy ) const {
static const std::string methodName = "\nReferenceCustomBondIxn::calculateBondIxn"; static const std::string methodName = "\nReferenceCustomBondIxn::calculateBondIxn";
......
...@@ -69,8 +69,8 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn { ...@@ -69,8 +69,8 @@ class ReferenceCustomBondIxn : 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;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "ReferenceForce.h" #include "ReferenceForce.h"
using namespace std; using namespace std;
using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -82,9 +83,9 @@ ReferenceCustomExternalIxn::~ReferenceCustomExternalIxn( ){ ...@@ -82,9 +83,9 @@ ReferenceCustomExternalIxn::~ReferenceCustomExternalIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomExternalIxn::calculateForce( int atomIndex, void ReferenceCustomExternalIxn::calculateForce( int atomIndex,
RealOpenMM** atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM* parameters,
RealOpenMM** forces, vector<RealVec>& forces,
RealOpenMM* energy ) const { RealOpenMM* energy ) const {
static const std::string methodName = "\nReferenceCustomExternalIxn::calculateBondIxn"; static const std::string methodName = "\nReferenceCustomExternalIxn::calculateBondIxn";
......
...@@ -72,8 +72,8 @@ class ReferenceCustomExternalIxn { ...@@ -72,8 +72,8 @@ class ReferenceCustomExternalIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateForce( int atomIndex, RealOpenMM** atomCoordinates, void calculateForce( int atomIndex, std::vector<OpenMM::RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM** forces, RealOpenMM* energy ) const; RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, RealOpenMM* energy ) const;
}; };
......
...@@ -36,6 +36,7 @@ using std::set; ...@@ -36,6 +36,7 @@ using std::set;
using std::string; using std::string;
using std::stringstream; using std::stringstream;
using std::vector; using std::vector;
using OpenMM::RealVec;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -134,8 +135,8 @@ ReferenceCustomGBIxn::~ReferenceCustomGBIxn( ){ ...@@ -134,8 +135,8 @@ ReferenceCustomGBIxn::~ReferenceCustomGBIxn( ){
periodicBoxSize[2] = boxSize[2]; periodicBoxSize[2] = boxSize[2];
} }
void ReferenceCustomGBIxn::calculateIxn(int numberOfAtoms, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void ReferenceCustomGBIxn::calculateIxn(int numberOfAtoms, vector<RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const vector<set<int> >& exclusions, map<string, double>& globalParameters, RealOpenMM** forces, const vector<set<int> >& exclusions, map<string, double>& globalParameters, vector<RealVec>& forces,
RealOpenMM* totalEnergy) const { RealOpenMM* totalEnergy) const {
// First calculate the computed values. // First calculate the computed values.
...@@ -167,7 +168,7 @@ void ReferenceCustomGBIxn::calculateIxn(int numberOfAtoms, RealOpenMM** atomCoor ...@@ -167,7 +168,7 @@ void ReferenceCustomGBIxn::calculateIxn(int numberOfAtoms, RealOpenMM** atomCoor
calculateChainRuleForces(numberOfAtoms, atomCoordinates, atomParameters, values, globalParameters, exclusions, forces, dEdV); calculateChainRuleForces(numberOfAtoms, atomCoordinates, atomParameters, values, globalParameters, exclusions, forces, dEdV);
} }
void ReferenceCustomGBIxn::calculateSingleParticleValue(int index, int numAtoms, RealOpenMM** atomCoordinates, vector<vector<RealOpenMM> >& values, void ReferenceCustomGBIxn::calculateSingleParticleValue(int index, int numAtoms, vector<RealVec>& atomCoordinates, vector<vector<RealOpenMM> >& values,
const map<string, double>& globalParameters, RealOpenMM** atomParameters) const { const map<string, double>& globalParameters, RealOpenMM** atomParameters) const {
values[index].resize(numAtoms); values[index].resize(numAtoms);
map<string, double> variables = globalParameters; map<string, double> variables = globalParameters;
...@@ -183,7 +184,7 @@ void ReferenceCustomGBIxn::calculateSingleParticleValue(int index, int numAtoms, ...@@ -183,7 +184,7 @@ void ReferenceCustomGBIxn::calculateSingleParticleValue(int index, int numAtoms,
} }
} }
void ReferenceCustomGBIxn::calculateParticlePairValue(int index, int numAtoms, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void ReferenceCustomGBIxn::calculateParticlePairValue(int index, int numAtoms, vector<RealVec>& atomCoordinates, RealOpenMM** atomParameters,
vector<vector<RealOpenMM> >& values, const map<string, double>& globalParameters, const vector<set<int> >& exclusions, bool useExclusions) const { vector<vector<RealOpenMM> >& values, const map<string, double>& globalParameters, const vector<set<int> >& exclusions, bool useExclusions) const {
values[index].resize(numAtoms); values[index].resize(numAtoms);
for (int i = 0; i < numAtoms; i++) for (int i = 0; i < numAtoms; i++)
...@@ -213,7 +214,7 @@ void ReferenceCustomGBIxn::calculateParticlePairValue(int index, int numAtoms, R ...@@ -213,7 +214,7 @@ void ReferenceCustomGBIxn::calculateParticlePairValue(int index, int numAtoms, R
} }
} }
void ReferenceCustomGBIxn::calculateOnePairValue(int index, int atom1, int atom2, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void ReferenceCustomGBIxn::calculateOnePairValue(int index, int atom1, int atom2, vector<RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const map<string, double>& globalParameters, vector<vector<RealOpenMM> >& values) const { const map<string, double>& globalParameters, vector<vector<RealOpenMM> >& values) const {
RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex]; RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (periodic) if (periodic)
...@@ -236,8 +237,8 @@ void ReferenceCustomGBIxn::calculateOnePairValue(int index, int atom1, int atom2 ...@@ -236,8 +237,8 @@ void ReferenceCustomGBIxn::calculateOnePairValue(int index, int atom1, int atom2
values[index][atom1] += (RealOpenMM) valueExpressions[index].evaluate(variables); values[index][atom1] += (RealOpenMM) valueExpressions[index].evaluate(variables);
} }
void ReferenceCustomGBIxn::calculateSingleParticleEnergyTerm(int index, int numAtoms, RealOpenMM** atomCoordinates, const vector<vector<RealOpenMM> >& values, void ReferenceCustomGBIxn::calculateSingleParticleEnergyTerm(int index, int numAtoms, vector<RealVec>& atomCoordinates, const vector<vector<RealOpenMM> >& values,
const map<string, double>& globalParameters, RealOpenMM** atomParameters, RealOpenMM** forces, RealOpenMM* totalEnergy, const map<string, double>& globalParameters, RealOpenMM** atomParameters, vector<RealVec>& forces, RealOpenMM* totalEnergy,
vector<vector<RealOpenMM> >& dEdV) const { vector<vector<RealOpenMM> >& dEdV) const {
map<string, double> variables = globalParameters; map<string, double> variables = globalParameters;
for (int i = 0; i < numAtoms; i++) { for (int i = 0; i < numAtoms; i++) {
...@@ -258,9 +259,9 @@ void ReferenceCustomGBIxn::calculateSingleParticleEnergyTerm(int index, int numA ...@@ -258,9 +259,9 @@ void ReferenceCustomGBIxn::calculateSingleParticleEnergyTerm(int index, int numA
} }
} }
void ReferenceCustomGBIxn::calculateParticlePairEnergyTerm(int index, int numAtoms, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void ReferenceCustomGBIxn::calculateParticlePairEnergyTerm(int index, int numAtoms, vector<RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const vector<vector<RealOpenMM> >& values, const map<string, double>& globalParameters, const vector<set<int> >& exclusions, bool useExclusions, const vector<vector<RealOpenMM> >& values, const map<string, double>& globalParameters, const vector<set<int> >& exclusions, bool useExclusions,
RealOpenMM** forces, RealOpenMM* totalEnergy, vector<vector<RealOpenMM> >& dEdV) const { vector<RealVec>& forces, RealOpenMM* totalEnergy, vector<vector<RealOpenMM> >& dEdV) const {
if (cutoff) { if (cutoff) {
// Loop over all pairs in the neighbor list. // Loop over all pairs in the neighbor list.
...@@ -284,8 +285,8 @@ void ReferenceCustomGBIxn::calculateParticlePairEnergyTerm(int index, int numAto ...@@ -284,8 +285,8 @@ void ReferenceCustomGBIxn::calculateParticlePairEnergyTerm(int index, int numAto
} }
} }
void ReferenceCustomGBIxn::calculateOnePairEnergyTerm(int index, int atom1, int atom2, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void ReferenceCustomGBIxn::calculateOnePairEnergyTerm(int index, int atom1, int atom2, vector<RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const map<string, double>& globalParameters, const vector<vector<RealOpenMM> >& values, RealOpenMM** forces, RealOpenMM* totalEnergy, const map<string, double>& globalParameters, const vector<vector<RealOpenMM> >& values, vector<RealVec>& forces, RealOpenMM* totalEnergy,
vector<vector<RealOpenMM> >& dEdV) const { vector<vector<RealOpenMM> >& dEdV) const {
// Compute the displacement. // Compute the displacement.
...@@ -327,9 +328,9 @@ void ReferenceCustomGBIxn::calculateOnePairEnergyTerm(int index, int atom1, int ...@@ -327,9 +328,9 @@ void ReferenceCustomGBIxn::calculateOnePairEnergyTerm(int index, int atom1, int
} }
} }
void ReferenceCustomGBIxn::calculateChainRuleForces(int numAtoms, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void ReferenceCustomGBIxn::calculateChainRuleForces(int numAtoms, vector<RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const vector<vector<RealOpenMM> >& values, const map<string, double>& globalParameters, const vector<vector<RealOpenMM> >& values, const map<string, double>& globalParameters,
const vector<set<int> >& exclusions, RealOpenMM** forces, vector<vector<RealOpenMM> >& dEdV) const { const vector<set<int> >& exclusions, vector<RealVec>& forces, vector<vector<RealOpenMM> >& dEdV) const {
if (cutoff) { if (cutoff) {
// Loop over all pairs in the neighbor list. // Loop over all pairs in the neighbor list.
...@@ -382,8 +383,8 @@ void ReferenceCustomGBIxn::calculateChainRuleForces(int numAtoms, RealOpenMM** a ...@@ -382,8 +383,8 @@ void ReferenceCustomGBIxn::calculateChainRuleForces(int numAtoms, RealOpenMM** a
} }
} }
void ReferenceCustomGBIxn::calculateOnePairChainRule(int atom1, int atom2, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void ReferenceCustomGBIxn::calculateOnePairChainRule(int atom1, int atom2, vector<RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const map<string, double>& globalParameters, const vector<vector<RealOpenMM> >& values, RealOpenMM** forces, const map<string, double>& globalParameters, const vector<vector<RealOpenMM> >& values, vector<RealVec>& forces,
vector<vector<RealOpenMM> >& dEdV, bool isExcluded) const { vector<vector<RealOpenMM> >& dEdV, bool isExcluded) const {
// Compute the displacement. // Compute the displacement.
......
...@@ -69,7 +69,7 @@ class ReferenceCustomGBIxn { ...@@ -69,7 +69,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateSingleParticleValue(int index, int numAtoms, RealOpenMM** atomCoordinates, std::vector<std::vector<RealOpenMM> >& values, void calculateSingleParticleValue(int index, int numAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<std::vector<RealOpenMM> >& values,
const std::map<std::string, double>& globalParameters, RealOpenMM** atomParameters) const; const std::map<std::string, double>& globalParameters, RealOpenMM** atomParameters) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -87,7 +87,7 @@ class ReferenceCustomGBIxn { ...@@ -87,7 +87,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateParticlePairValue(int index, int numAtoms, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void calculateParticlePairValue(int index, int numAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, RealOpenMM** atomParameters,
std::vector<std::vector<RealOpenMM> >& values, std::vector<std::vector<RealOpenMM> >& values,
const std::map<std::string, double>& globalParameters, const std::map<std::string, double>& globalParameters,
const std::vector<std::set<int> >& exclusions, bool useExclusions) const; const std::vector<std::set<int> >& exclusions, bool useExclusions) const;
...@@ -106,7 +106,7 @@ class ReferenceCustomGBIxn { ...@@ -106,7 +106,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateOnePairValue(int index, int atom1, int atom2, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void calculateOnePairValue(int index, int atom1, int atom2, std::vector<OpenMM::RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const std::map<std::string, double>& globalParameters, const std::map<std::string, double>& globalParameters,
std::vector<std::vector<RealOpenMM> >& values) const; std::vector<std::vector<RealOpenMM> >& values) const;
...@@ -126,8 +126,8 @@ class ReferenceCustomGBIxn { ...@@ -126,8 +126,8 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateSingleParticleEnergyTerm(int index, int numAtoms, RealOpenMM** atomCoordinates, const std::vector<std::vector<RealOpenMM> >& values, void calculateSingleParticleEnergyTerm(int index, int numAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, const std::vector<std::vector<RealOpenMM> >& values,
const std::map<std::string, double>& globalParameters, RealOpenMM** atomParameters, RealOpenMM** forces, const std::map<std::string, double>& globalParameters, RealOpenMM** atomParameters, std::vector<OpenMM::RealVec>& forces,
RealOpenMM* totalEnergy, std::vector<std::vector<RealOpenMM> >& dEdV) const; RealOpenMM* totalEnergy, std::vector<std::vector<RealOpenMM> >& dEdV) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -148,11 +148,11 @@ class ReferenceCustomGBIxn { ...@@ -148,11 +148,11 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateParticlePairEnergyTerm(int index, int numAtoms, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void calculateParticlePairEnergyTerm(int index, int numAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const std::vector<std::vector<RealOpenMM> >& values, const std::vector<std::vector<RealOpenMM> >& values,
const std::map<std::string, double>& globalParameters, const std::map<std::string, double>& globalParameters,
const std::vector<std::set<int> >& exclusions, bool useExclusions, const std::vector<std::set<int> >& exclusions, bool useExclusions,
RealOpenMM** forces, RealOpenMM* totalEnergy, std::vector<std::vector<RealOpenMM> >& dEdV) const; std::vector<OpenMM::RealVec>& forces, RealOpenMM* totalEnergy, std::vector<std::vector<RealOpenMM> >& dEdV) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -171,10 +171,10 @@ class ReferenceCustomGBIxn { ...@@ -171,10 +171,10 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateOnePairEnergyTerm(int index, int atom1, int atom2, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void calculateOnePairEnergyTerm(int index, int atom1, int atom2, std::vector<OpenMM::RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const std::map<std::string, double>& globalParameters, const std::map<std::string, double>& globalParameters,
const std::vector<std::vector<RealOpenMM> >& values, const std::vector<std::vector<RealOpenMM> >& values,
RealOpenMM** forces, RealOpenMM* totalEnergy, std::vector<std::vector<RealOpenMM> >& dEdV) const; std::vector<OpenMM::RealVec>& forces, RealOpenMM* totalEnergy, std::vector<std::vector<RealOpenMM> >& dEdV) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -191,11 +191,11 @@ class ReferenceCustomGBIxn { ...@@ -191,11 +191,11 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateChainRuleForces(int numAtoms, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void calculateChainRuleForces(int numAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const std::vector<std::vector<RealOpenMM> >& values, const std::vector<std::vector<RealOpenMM> >& values,
const std::map<std::string, double>& globalParameters, const std::map<std::string, double>& globalParameters,
const std::vector<std::set<int> >& exclusions, const std::vector<std::set<int> >& exclusions,
RealOpenMM** forces, std::vector<std::vector<RealOpenMM> >& dEdV) const; std::vector<OpenMM::RealVec>& forces, std::vector<std::vector<RealOpenMM> >& dEdV) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -213,10 +213,10 @@ class ReferenceCustomGBIxn { ...@@ -213,10 +213,10 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateOnePairChainRule(int atom1, int atom2, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, void calculateOnePairChainRule(int atom1, int atom2, std::vector<OpenMM::RealVec>& atomCoordinates, RealOpenMM** atomParameters,
const std::map<std::string, double>& globalParameters, const std::map<std::string, double>& globalParameters,
const std::vector<std::vector<RealOpenMM> >& values, const std::vector<std::vector<RealOpenMM> >& values,
RealOpenMM** forces, std::vector<std::vector<RealOpenMM> >& dEdV, std::vector<OpenMM::RealVec>& forces, std::vector<std::vector<RealOpenMM> >& dEdV,
bool isExcluded) const; bool isExcluded) const;
public: public:
...@@ -283,8 +283,8 @@ class ReferenceCustomGBIxn { ...@@ -283,8 +283,8 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateIxn(int numberOfAtoms, RealOpenMM** atomCoordinates, RealOpenMM** atomParameters, const std::vector<std::set<int> >& exclusions, void calculateIxn(int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, RealOpenMM** atomParameters, const std::vector<std::set<int> >& exclusions,
std::map<std::string, double>& globalParameters, RealOpenMM** forces, RealOpenMM* totalEnergy) const; std::map<std::string, double>& globalParameters, std::vector<OpenMM::RealVec>& forces, RealOpenMM* totalEnergy) const;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -37,6 +37,7 @@ using std::pair; ...@@ -37,6 +37,7 @@ using std::pair;
using std::string; using std::string;
using std::stringstream; using std::stringstream;
using std::vector; using std::vector;
using OpenMM::RealVec;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -118,8 +119,8 @@ void ReferenceCustomHbondIxn::setPeriodic(RealOpenMM* boxSize) { ...@@ -118,8 +119,8 @@ void ReferenceCustomHbondIxn::setPeriodic(RealOpenMM* boxSize) {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomHbondIxn::calculatePairIxn(RealOpenMM** atomCoordinates, RealOpenMM** donorParameters, RealOpenMM** acceptorParameters, void ReferenceCustomHbondIxn::calculatePairIxn(vector<RealVec>& atomCoordinates, RealOpenMM** donorParameters, RealOpenMM** acceptorParameters,
int** exclusions, const map<string, double>& globalParameters, RealOpenMM** forces, int** exclusions, const map<string, double>& globalParameters, vector<RealVec>& forces,
RealOpenMM* totalEnergy) const { RealOpenMM* totalEnergy) const {
map<string, double> variables = globalParameters; map<string, double> variables = globalParameters;
...@@ -174,8 +175,8 @@ void ReferenceCustomHbondIxn::calculatePairIxn(RealOpenMM** atomCoordinates, Rea ...@@ -174,8 +175,8 @@ void ReferenceCustomHbondIxn::calculatePairIxn(RealOpenMM** atomCoordinates, Rea
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomHbondIxn::calculateOneIxn(int donor, int acceptor, RealOpenMM** atomCoordinates, void ReferenceCustomHbondIxn::calculateOneIxn(int donor, int acceptor, vector<RealVec>& atomCoordinates,
map<string, double>& variables, RealOpenMM** forces, RealOpenMM* totalEnergy) const { map<string, double>& variables, vector<RealVec>& forces, RealOpenMM* totalEnergy) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -299,7 +300,7 @@ void ReferenceCustomHbondIxn::calculateOneIxn(int donor, int acceptor, RealOpenM ...@@ -299,7 +300,7 @@ void ReferenceCustomHbondIxn::calculateOneIxn(int donor, int acceptor, RealOpenM
*totalEnergy += (RealOpenMM) energyExpression.evaluate(variables); *totalEnergy += (RealOpenMM) energyExpression.evaluate(variables);
} }
void ReferenceCustomHbondIxn::computeDelta(int atom1, int atom2, RealOpenMM* delta, RealOpenMM** atomCoordinates) const { void ReferenceCustomHbondIxn::computeDelta(int atom1, int atom2, RealOpenMM* delta, vector<RealVec>& atomCoordinates) const {
if (periodic) if (periodic)
ReferenceForce::getDeltaRPeriodic(atomCoordinates[atom1], atomCoordinates[atom2], periodicBoxSize, delta); ReferenceForce::getDeltaRPeriodic(atomCoordinates[atom1], atomCoordinates[atom2], periodicBoxSize, delta);
else else
......
...@@ -64,11 +64,11 @@ class ReferenceCustomHbondIxn : public ReferenceBondIxn { ...@@ -64,11 +64,11 @@ class ReferenceCustomHbondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateOneIxn(int donor, int acceptor, RealOpenMM** atomCoordinates, void calculateOneIxn(int donor, int acceptor, std::vector<OpenMM::RealVec>& atomCoordinates,
std::map<std::string, double>& variables, RealOpenMM** forces, std::map<std::string, double>& variables, std::vector<OpenMM::RealVec>& forces,
RealOpenMM* totalEnergy) const; RealOpenMM* totalEnergy) const;
void computeDelta(int atom1, int atom2, RealOpenMM* delta, RealOpenMM** atomCoordinates) const; void computeDelta(int atom1, int atom2, RealOpenMM* delta, std::vector<OpenMM::RealVec>& atomCoordinates) const;
static RealOpenMM computeAngle(RealOpenMM* vec1, RealOpenMM* vec2); static RealOpenMM computeAngle(RealOpenMM* vec1, RealOpenMM* vec2);
...@@ -133,9 +133,9 @@ class ReferenceCustomHbondIxn : public ReferenceBondIxn { ...@@ -133,9 +133,9 @@ class ReferenceCustomHbondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculatePairIxn(RealOpenMM** atomCoordinates, RealOpenMM** donorParameters, RealOpenMM** acceptorParameters, void calculatePairIxn(std::vector<OpenMM::RealVec>& atomCoordinates, RealOpenMM** donorParameters, RealOpenMM** acceptorParameters,
int** exclusions, const std::map<std::string, double>& globalParameters, int** exclusions, const std::map<std::string, double>& globalParameters,
RealOpenMM** forces, RealOpenMM* totalEnergy) const; std::vector<OpenMM::RealVec>& forces, RealOpenMM* totalEnergy) const;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -35,6 +35,7 @@ using std::map; ...@@ -35,6 +35,7 @@ using std::map;
using std::string; using std::string;
using std::stringstream; using std::stringstream;
using std::vector; using std::vector;
using OpenMM::RealVec;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -145,9 +146,9 @@ ReferenceCustomNonbondedIxn::~ReferenceCustomNonbondedIxn( ){ ...@@ -145,9 +146,9 @@ ReferenceCustomNonbondedIxn::~ReferenceCustomNonbondedIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM** atomCoordinates, int ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, vector<RealVec>& atomCoordinates,
RealOpenMM** atomParameters, int** exclusions, RealOpenMM** atomParameters, int** exclusions,
RealOpenMM* fixedParameters, const map<string, double>& globalParameters, RealOpenMM** forces, RealOpenMM* fixedParameters, const map<string, double>& globalParameters, vector<RealVec>& forces,
RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) const { RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) const {
map<string, double> variables = globalParameters; map<string, double> variables = globalParameters;
...@@ -211,8 +212,8 @@ int ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM ...@@ -211,8 +212,8 @@ int ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, RealOpenMM** atomCoordinates, void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& atomCoordinates,
map<string, double>& variables, RealOpenMM** forces, map<string, double>& variables, vector<RealVec>& forces,
RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) const { RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -61,8 +61,8 @@ class ReferenceCustomNonbondedIxn { ...@@ -61,8 +61,8 @@ class ReferenceCustomNonbondedIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateOneIxn( int atom1, int atom2, RealOpenMM** atomCoordinates, void calculateOneIxn( int atom1, int atom2, std::vector<OpenMM::RealVec>& atomCoordinates,
std::map<std::string, double>& variables, RealOpenMM** forces, std::map<std::string, double>& variables, std::vector<OpenMM::RealVec>& forces,
RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) const; RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) const;
...@@ -133,10 +133,10 @@ class ReferenceCustomNonbondedIxn { ...@@ -133,10 +133,10 @@ class ReferenceCustomNonbondedIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int calculatePairIxn( int numberOfAtoms, RealOpenMM** atomCoordinates, int calculatePairIxn( int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates,
RealOpenMM** atomParameters, int** exclusions, RealOpenMM** atomParameters, int** exclusions,
RealOpenMM* fixedParameters, const std::map<std::string, double>& globalParameters, RealOpenMM* fixedParameters, const std::map<std::string, double>& globalParameters,
RealOpenMM** forces, RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) const; std::vector<OpenMM::RealVec>& forces, RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) const;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "ReferenceForce.h" #include "ReferenceForce.h"
using namespace std; using namespace std;
using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -79,9 +80,9 @@ ReferenceCustomTorsionIxn::~ReferenceCustomTorsionIxn( ){ ...@@ -79,9 +80,9 @@ ReferenceCustomTorsionIxn::~ReferenceCustomTorsionIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomTorsionIxn::calculateBondIxn( int* atomIndices, void ReferenceCustomTorsionIxn::calculateBondIxn( int* atomIndices,
RealOpenMM** atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM* parameters,
RealOpenMM** forces, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const { RealOpenMM* totalEnergy ) const {
static const std::string methodName = "\nReferenceCustomTorsionIxn::calculateTorsionIxn"; static const std::string methodName = "\nReferenceCustomTorsionIxn::calculateTorsionIxn";
......
...@@ -68,8 +68,8 @@ class ReferenceCustomTorsionIxn : public ReferenceBondIxn { ...@@ -68,8 +68,8 @@ class ReferenceCustomTorsionIxn : 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;
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
#include <cstdio> #include <cstdio>
using std::vector;
using OpenMM::RealVec;
const int ReferenceDynamics::DefaultReturn = 0; const int ReferenceDynamics::DefaultReturn = 0;
const int ReferenceDynamics::ErrorReturn = -1; const int ReferenceDynamics::ErrorReturn = -1;
...@@ -59,12 +62,6 @@ ReferenceDynamics::ReferenceDynamics( int numberOfAtoms, RealOpenMM deltaT, Rea ...@@ -59,12 +62,6 @@ ReferenceDynamics::ReferenceDynamics( int numberOfAtoms, RealOpenMM deltaT, Rea
_timeStep = 0; _timeStep = 0;
_twoDTempArrays = 0;
_twoDTempArrays = NULL;
_oneDTempArrays = 0;
_oneDTempArrays = NULL;
_ownReferenceConstraint = false; _ownReferenceConstraint = false;
_referenceConstraint = NULL; _referenceConstraint = NULL;
} }
...@@ -83,211 +80,11 @@ ReferenceDynamics::~ReferenceDynamics( ){ ...@@ -83,211 +80,11 @@ ReferenceDynamics::~ReferenceDynamics( ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
_freeTwoDArrays();
_freeOneDArrays();
if( _ownReferenceConstraint ){ if( _ownReferenceConstraint ){
delete _referenceConstraint; delete _referenceConstraint;
} }
} }
/**---------------------------------------------------------------------------------------
Free memory associated w/ 2D arrays
@return ReferenceDynamics::DefaultReturn
--------------------------------------------------------------------------------------- */
int ReferenceDynamics::_freeTwoDArrays( void ){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nReferenceDynamics::_freeTwoDArrays";
// ---------------------------------------------------------------------------------------
if( _twoDTempArrays ){
delete[] _twoDTempArrays[0][0];
delete[] _twoDTempArrays[0];
delete[] _twoDTempArrays;
}
_twoDTempArrays = NULL;
_numberOf2DTempArrays = 0;
return ReferenceDynamics::DefaultReturn;
}
/**---------------------------------------------------------------------------------------
Free memory associated w/ 1D arrays
@return ReferenceDynamics::DefaultReturn
--------------------------------------------------------------------------------------- */
int ReferenceDynamics::_freeOneDArrays( void ){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nReferenceDynamics::_freeOneDArrays";
// ---------------------------------------------------------------------------------------
if( _oneDTempArrays ){
delete[] _oneDTempArrays[0];
delete[] _oneDTempArrays;
}
_oneDTempArrays = NULL;
_numberOf1DTempArrays = 0;
return ReferenceDynamics::DefaultReturn;
}
/**---------------------------------------------------------------------------------------
Allocate memory associated w/ 2D arrays
@param dimension1 first dimension
@param dimension2 second dimension
@param numberOfArrays number of arrays to allocate
@return ReferenceDynamics::DefaultReturn
--------------------------------------------------------------------------------------- */
int ReferenceDynamics::allocate2DArrays( int dimension1, int dimension2, int numberOfArrays ){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nReferenceDynamics::allocate2DArrays";
// ---------------------------------------------------------------------------------------
_freeTwoDArrays();
_numberOf2DTempArrays = numberOfArrays;
_twoDTempArrays = new RealOpenMM**[_numberOf2DTempArrays];
RealOpenMM** totalArray = new RealOpenMM*[dimension1*numberOfArrays];
RealOpenMM* totalBlock = new RealOpenMM[dimension1*dimension2*numberOfArrays];
memset( totalBlock, 0, sizeof( RealOpenMM )*dimension1*dimension2*numberOfArrays );
for( int ii = 0; ii < _numberOf2DTempArrays; ii++ ){
_twoDTempArrays[ii] = totalArray;
totalArray += dimension1;
for( int jj = 0; jj < dimension1; jj++ ){
_twoDTempArrays[ii][jj] = totalBlock;
totalBlock += dimension2;
}
}
return ReferenceDynamics::DefaultReturn;
}
/**---------------------------------------------------------------------------------------
Get array at specified index
@param index array index
@return array or NULL if index invalid or arrays not allocated
--------------------------------------------------------------------------------------- */
RealOpenMM** ReferenceDynamics::get2DArrayAtIndex( int index ) const {
// ---------------------------------------------------------------------------------------
static const char* methodName = "\nReferenceDynamics::get2DArrayAtIndex";
// ---------------------------------------------------------------------------------------
if( index < 0 || index >= _numberOf2DTempArrays ){
std::stringstream message;
message << methodName;
message << " requested 2d array at index=" << index << " is unavailable.";
SimTKOpenMMLog::printError( message );
return NULL;
}
return _twoDTempArrays[index];
}
/**---------------------------------------------------------------------------------------
Allocate memory associated w/ 1D arrays
@param dimension1 dimension
@param numberOfArrays number of arrays to allocate
@return ReferenceDynamics::DefaultReturn
--------------------------------------------------------------------------------------- */
int ReferenceDynamics::allocate1DArrays( int dimension, int numberOfArrays ){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nReferenceDynamics::allocate1DArrays";
// ---------------------------------------------------------------------------------------
_freeOneDArrays();
_numberOf1DTempArrays = numberOfArrays;
_oneDTempArrays = new RealOpenMM*[_numberOf1DTempArrays];
RealOpenMM* totalArray = new RealOpenMM[dimension*numberOfArrays];
memset( totalArray, 0, sizeof( RealOpenMM )*dimension*numberOfArrays );
for( int ii = 0; ii < _numberOf1DTempArrays; ii++ ){
_oneDTempArrays[ii] = totalArray;
totalArray += dimension;
}
return ReferenceDynamics::DefaultReturn;
}
/**---------------------------------------------------------------------------------------
Get array at specified index
@param index array index
@return array or NULL if index invalid or arrays not allocated
--------------------------------------------------------------------------------------- */
RealOpenMM* ReferenceDynamics::get1DArrayAtIndex( int index ) const {
// ---------------------------------------------------------------------------------------
static const char* methodName = "\nReferenceDynamics::get1DArrayAtIndex";
// ---------------------------------------------------------------------------------------
if( index < 0 || index >= _numberOf1DTempArrays ){
std::stringstream message;
message << methodName;
message << " requested 1d array at index=" << index << " is unavailable.";
SimTKOpenMMLog::printError( message );
return NULL;
}
return _oneDTempArrays[index];
}
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
Get number of atoms Get number of atoms
...@@ -464,8 +261,8 @@ int ReferenceDynamics::setReferenceConstraintAlgorithm( ReferenceConstraintAlgor ...@@ -464,8 +261,8 @@ int ReferenceDynamics::setReferenceConstraintAlgorithm( ReferenceConstraintAlgor
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceDynamics::update( int numberOfAtoms, RealOpenMM** atomCoordinates, int ReferenceDynamics::update( int numberOfAtoms, vector<RealVec>& atomCoordinates,
RealOpenMM** velocities, RealOpenMM** forces, RealOpenMM* masses ){ vector<RealVec>& velocities, vector<RealVec>& forces, vector<RealOpenMM>& masses ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -492,7 +289,7 @@ int ReferenceDynamics::update( int numberOfAtoms, RealOpenMM** atomCoordinates, ...@@ -492,7 +289,7 @@ int ReferenceDynamics::update( int numberOfAtoms, RealOpenMM** atomCoordinates,
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceDynamics::removeTotalLinearMomentum( int numberOfAtoms, RealOpenMM* masses, int ReferenceDynamics::removeTotalLinearMomentum( int numberOfAtoms, RealOpenMM* masses,
RealOpenMM** velocities ) const { vector<RealVec>& velocities ) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "ReferenceConstraintAlgorithm.h" #include "ReferenceConstraintAlgorithm.h"
#include "../SimTKUtilities/SimTKOpenMMCommon.h" #include "../SimTKUtilities/SimTKOpenMMCommon.h"
#include <cstddef> #include <cstddef>
#include <vector>
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -62,88 +63,9 @@ class OPENMM_EXPORT ReferenceDynamics { ...@@ -62,88 +63,9 @@ class OPENMM_EXPORT ReferenceDynamics {
RealOpenMM _deltaT; RealOpenMM _deltaT;
RealOpenMM _temperature; RealOpenMM _temperature;
int _numberOf2DTempArrays;
RealOpenMM*** _twoDTempArrays;
int _numberOf1DTempArrays;
RealOpenMM** _oneDTempArrays;
int _ownReferenceConstraint; int _ownReferenceConstraint;
ReferenceConstraintAlgorithm* _referenceConstraint; ReferenceConstraintAlgorithm* _referenceConstraint;
/**---------------------------------------------------------------------------------------
Free memory associated w/ 2D arrays
@return ReferenceDynamics::DefaultReturn
--------------------------------------------------------------------------------------- */
int _freeTwoDArrays( void );
/**---------------------------------------------------------------------------------------
Free memory associated w/ 1D arrays
@return ReferenceDynamics::DefaultReturn
--------------------------------------------------------------------------------------- */
int _freeOneDArrays( void );
protected:
/**---------------------------------------------------------------------------------------
Allocate memory associated w/ 2D arrays
@param dimension1 first dimension
@param dimension2 second dimension
@param numberOfArrays number of arrays to allocate
@return ReferenceDynamics::DefaultReturn
--------------------------------------------------------------------------------------- */
int allocate2DArrays( int dimension1, int dimension2, int numberOfArrays );
/**---------------------------------------------------------------------------------------
Get array at specified index
@param index array index
@return array or NULL if index invalid or arrays not allocated
--------------------------------------------------------------------------------------- */
RealOpenMM** get2DArrayAtIndex( int index ) const;
/**---------------------------------------------------------------------------------------
Allocate memory associated w/ 1D arrays
@param dimension1 dimension
@param numberOfArrays number of arrays to allocate
@return DefaultReturn
--------------------------------------------------------------------------------------- */
int allocate1DArrays( int dimension, int numberOfArrays );
/**---------------------------------------------------------------------------------------
Get array at specified index
@param index array index
@return array or NULL if index invalid or arrays not allocated
--------------------------------------------------------------------------------------- */
RealOpenMM* get1DArrayAtIndex( int index ) const;
public: public:
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -236,7 +158,7 @@ class OPENMM_EXPORT ReferenceDynamics { ...@@ -236,7 +158,7 @@ class OPENMM_EXPORT ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int removeTotalLinearMomentum( int numberOfAtoms, RealOpenMM* masses, RealOpenMM** velocities ) const; int removeTotalLinearMomentum( int numberOfAtoms, RealOpenMM* masses, std::vector<OpenMM::RealVec>& velocities ) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -252,8 +174,8 @@ class OPENMM_EXPORT ReferenceDynamics { ...@@ -252,8 +174,8 @@ class OPENMM_EXPORT ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
virtual int update( int numberOfAtoms, RealOpenMM** atomCoordinates, virtual 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 );
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <cstdio> #include <cstdio>
using OpenMM::RealVec;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
ReferenceForce constructor ReferenceForce constructor
...@@ -91,7 +93,7 @@ RealOpenMM ReferenceForce::periodicDifference(RealOpenMM val1, RealOpenMM val2, ...@@ -91,7 +93,7 @@ RealOpenMM ReferenceForce::periodicDifference(RealOpenMM val1, RealOpenMM val2,
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceForce::getDeltaR( const RealOpenMM* atomCoordinatesI, const RealOpenMM* atomCoordinatesJ, int ReferenceForce::getDeltaR( const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
RealOpenMM* deltaR ){ RealOpenMM* deltaR ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -124,7 +126,7 @@ int ReferenceForce::getDeltaR( const RealOpenMM* atomCoordinatesI, const RealOpe ...@@ -124,7 +126,7 @@ int ReferenceForce::getDeltaR( const RealOpenMM* atomCoordinatesI, const RealOpe
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceForce::getDeltaRPeriodic( const RealOpenMM* atomCoordinatesI, const RealOpenMM* atomCoordinatesJ, int ReferenceForce::getDeltaRPeriodic( const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
const RealOpenMM* boxSize, RealOpenMM* deltaR ){ const RealOpenMM* boxSize, RealOpenMM* deltaR ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -84,7 +84,7 @@ class OPENMM_EXPORT ReferenceForce { ...@@ -84,7 +84,7 @@ class OPENMM_EXPORT ReferenceForce {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static int getDeltaR( const RealOpenMM* atomCoordinatesI, const RealOpenMM* atomCoordinatesJ, static int getDeltaR( const OpenMM::RealVec& atomCoordinatesI, const OpenMM::RealVec& atomCoordinatesJ,
RealOpenMM* deltaR ); RealOpenMM* deltaR );
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -101,7 +101,7 @@ class OPENMM_EXPORT ReferenceForce { ...@@ -101,7 +101,7 @@ class OPENMM_EXPORT ReferenceForce {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static int getDeltaRPeriodic( const RealOpenMM* atomCoordinatesI, const RealOpenMM* atomCoordinatesJ, static int getDeltaRPeriodic( const OpenMM::RealVec& atomCoordinatesI, const OpenMM::RealVec& atomCoordinatesJ,
const RealOpenMM* boxSize, RealOpenMM* deltaR ); const RealOpenMM* boxSize, RealOpenMM* deltaR );
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include "ReferenceHarmonicBondIxn.h" #include "ReferenceHarmonicBondIxn.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
using std::vector;
using OpenMM::RealVec;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
ReferenceHarmonicBondIxn constructor ReferenceHarmonicBondIxn constructor
...@@ -77,9 +80,9 @@ ReferenceHarmonicBondIxn::~ReferenceHarmonicBondIxn( ){ ...@@ -77,9 +80,9 @@ ReferenceHarmonicBondIxn::~ReferenceHarmonicBondIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceHarmonicBondIxn::calculateBondIxn( int* atomIndices, void ReferenceHarmonicBondIxn::calculateBondIxn( int* atomIndices,
RealOpenMM** atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM* parameters,
RealOpenMM** forces, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const { RealOpenMM* totalEnergy ) const {
static const std::string methodName = "\nReferenceHarmonicBondIxn::calculateBondIxn"; static const std::string methodName = "\nReferenceHarmonicBondIxn::calculateBondIxn";
......
...@@ -64,8 +64,8 @@ class ReferenceHarmonicBondIxn : public ReferenceBondIxn { ...@@ -64,8 +64,8 @@ class ReferenceHarmonicBondIxn : 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;
}; };
......
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