Commit 8469621f authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #1747 from peastman/realtype

Eliminated RealOpenMM
parents b84e22ba 6813ca57
...@@ -109,7 +109,7 @@ void CpuNonbondedForce::setUseSwitchingFunction(float distance) { ...@@ -109,7 +109,7 @@ void CpuNonbondedForce::setUseSwitchingFunction(float distance) {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void CpuNonbondedForce::setPeriodic(RealVec* periodicBoxVectors) { void CpuNonbondedForce::setPeriodic(Vec3* periodicBoxVectors) {
assert(cutoff); assert(cutoff);
assert(periodicBoxVectors[0][0] >= 2.0*cutoffDistance); assert(periodicBoxVectors[0][0] >= 2.0*cutoffDistance);
...@@ -241,9 +241,9 @@ void CpuNonbondedForce::tabulateExpTerms() { ...@@ -241,9 +241,9 @@ void CpuNonbondedForce::tabulateExpTerms() {
} }
} }
void CpuNonbondedForce::calculateReciprocalIxn(int numberOfAtoms, float* posq, const vector<RealVec>& atomCoordinates, void CpuNonbondedForce::calculateReciprocalIxn(int numberOfAtoms, float* posq, const vector<Vec3>& atomCoordinates,
const vector<pair<float, float> >& atomParameters, const vector<float> &C6params, const vector<set<int> >& exclusions, const vector<pair<float, float> >& atomParameters, const vector<float> &C6params, const vector<set<int> >& exclusions,
vector<RealVec>& forces, double* totalEnergy) const { vector<Vec3>& forces, double* totalEnergy) const {
typedef std::complex<float> d_complex; typedef std::complex<float> d_complex;
static const float epsilon = 1.0; static const float epsilon = 1.0;
...@@ -256,10 +256,10 @@ void CpuNonbondedForce::calculateReciprocalIxn(int numberOfAtoms, float* posq, c ...@@ -256,10 +256,10 @@ void CpuNonbondedForce::calculateReciprocalIxn(int numberOfAtoms, float* posq, c
if (pme) { if (pme) {
pme_t pmedata; pme_t pmedata;
pme_init(&pmedata, alphaEwald, numberOfAtoms, meshDim, 5, 1); pme_init(&pmedata, alphaEwald, numberOfAtoms, meshDim, 5, 1);
vector<RealOpenMM> charges(numberOfAtoms); vector<double> charges(numberOfAtoms);
for (int i = 0; i < numberOfAtoms; i++) for (int i = 0; i < numberOfAtoms; i++)
charges[i] = posq[4*i+3]; charges[i] = posq[4*i+3];
RealOpenMM recipEnergy = 0.0; double recipEnergy = 0.0;
pme_exec(pmedata, atomCoordinates, forces, charges, periodicBoxVectors, &recipEnergy); pme_exec(pmedata, atomCoordinates, forces, charges, periodicBoxVectors, &recipEnergy);
if (totalEnergy) if (totalEnergy)
*totalEnergy += recipEnergy; *totalEnergy += recipEnergy;
...@@ -269,12 +269,12 @@ void CpuNonbondedForce::calculateReciprocalIxn(int numberOfAtoms, float* posq, c ...@@ -269,12 +269,12 @@ void CpuNonbondedForce::calculateReciprocalIxn(int numberOfAtoms, float* posq, c
// Dispersion reciprocal space terms // Dispersion reciprocal space terms
pme_init(&pmedata,alphaDispersionEwald,numberOfAtoms,dispersionMeshDim,5,1); pme_init(&pmedata,alphaDispersionEwald,numberOfAtoms,dispersionMeshDim,5,1);
std::vector<RealVec> dpmeforces; std::vector<Vec3> dpmeforces;
for (int i = 0; i < numberOfAtoms; i++){ for (int i = 0; i < numberOfAtoms; i++){
charges[i] = (RealOpenMM)C6params[i]; charges[i] = C6params[i];
dpmeforces.push_back(RealVec()); dpmeforces.push_back(Vec3());
} }
RealOpenMM recipDispersionEnergy = 0.0; double recipDispersionEnergy = 0.0;
pme_exec_dpme(pmedata,atomCoordinates,dpmeforces,charges,periodicBoxVectors,&recipDispersionEnergy); pme_exec_dpme(pmedata,atomCoordinates,dpmeforces,charges,periodicBoxVectors,&recipDispersionEnergy);
for (int i = 0; i < numberOfAtoms; i++){ for (int i = 0; i < numberOfAtoms; i++){
forces[i][0] -= 2.0*dpmeforces[i][0]; forces[i][0] -= 2.0*dpmeforces[i][0];
...@@ -376,7 +376,7 @@ void CpuNonbondedForce::calculateReciprocalIxn(int numberOfAtoms, float* posq, c ...@@ -376,7 +376,7 @@ void CpuNonbondedForce::calculateReciprocalIxn(int numberOfAtoms, float* posq, c
} }
void CpuNonbondedForce::calculateDirectIxn(int numberOfAtoms, float* posq, const vector<RealVec>& atomCoordinates, const vector<pair<float, float> >& atomParameters, void CpuNonbondedForce::calculateDirectIxn(int numberOfAtoms, float* posq, const vector<Vec3>& atomCoordinates, const vector<pair<float, float> >& atomParameters,
const vector<float>& C6params, const vector<set<int> >& exclusions, vector<AlignedArray<float> >& threadForce, double* totalEnergy, ThreadPool& threads) { const vector<float>& C6params, const vector<set<int> >& exclusions, vector<AlignedArray<float> >& threadForce, double* totalEnergy, ThreadPool& threads) {
// Record the parameters for the threads. // Record the parameters for the threads.
......
...@@ -38,7 +38,7 @@ using namespace std; ...@@ -38,7 +38,7 @@ using namespace std;
CpuSETTLE::CpuSETTLE(const System& system, const ReferenceSETTLEAlgorithm& settle, ThreadPool& threads) : threads(threads) { CpuSETTLE::CpuSETTLE(const System& system, const ReferenceSETTLEAlgorithm& settle, ThreadPool& threads) : threads(threads) {
int numBlocks = 10*threads.getNumThreads(); int numBlocks = 10*threads.getNumThreads();
int numClusters = settle.getNumClusters(); int numClusters = settle.getNumClusters();
vector<RealOpenMM> mass(system.getNumParticles()); vector<double> mass(system.getNumParticles());
for (int i = 0; i < system.getNumParticles(); i++) for (int i = 0; i < system.getNumParticles(); i++)
mass[i] = system.getParticleMass(i); mass[i] = system.getParticleMass(i);
for (int i = 0; i < numBlocks; i++) { for (int i = 0; i < numBlocks; i++) {
...@@ -47,7 +47,7 @@ CpuSETTLE::CpuSETTLE(const System& system, const ReferenceSETTLEAlgorithm& settl ...@@ -47,7 +47,7 @@ CpuSETTLE::CpuSETTLE(const System& system, const ReferenceSETTLEAlgorithm& settl
if (start != end) { if (start != end) {
int numThreadClusters = end-start; int numThreadClusters = end-start;
vector<int> atom1(numThreadClusters), atom2(numThreadClusters), atom3(numThreadClusters); vector<int> atom1(numThreadClusters), atom2(numThreadClusters), atom3(numThreadClusters);
vector<RealOpenMM> distance1(numThreadClusters), distance2(numThreadClusters); vector<double> distance1(numThreadClusters), distance2(numThreadClusters);
for (int j = 0; j < numThreadClusters; j++) for (int j = 0; j < numThreadClusters; j++)
settle.getClusterParameters(start+j, atom1[j], atom2[j], atom3[j], distance1[j], distance2[j]); settle.getClusterParameters(start+j, atom1[j], atom2[j], atom3[j], distance1[j], distance2[j]);
threadSettle.push_back(new ReferenceSETTLEAlgorithm(atom1, atom2, atom3, distance1, distance2, mass)); threadSettle.push_back(new ReferenceSETTLEAlgorithm(atom1, atom2, atom3, distance1, distance2, mass));
...@@ -60,7 +60,7 @@ CpuSETTLE::~CpuSETTLE() { ...@@ -60,7 +60,7 @@ CpuSETTLE::~CpuSETTLE() {
delete threadSettle[i]; delete threadSettle[i];
} }
void CpuSETTLE::apply(vector<OpenMM::RealVec>& atomCoordinates, vector<OpenMM::RealVec>& atomCoordinatesP, vector<RealOpenMM>& inverseMasses, RealOpenMM tolerance) { void CpuSETTLE::apply(vector<OpenMM::Vec3>& atomCoordinates, vector<OpenMM::Vec3>& atomCoordinatesP, vector<double>& inverseMasses, double tolerance) {
gmx_atomic_t atomicCounter; gmx_atomic_t atomicCounter;
gmx_atomic_set(&atomicCounter, 0); gmx_atomic_set(&atomicCounter, 0);
threads.execute([&] (ThreadPool& threads, int threadIndex) { threads.execute([&] (ThreadPool& threads, int threadIndex) {
...@@ -74,7 +74,7 @@ void CpuSETTLE::apply(vector<OpenMM::RealVec>& atomCoordinates, vector<OpenMM::R ...@@ -74,7 +74,7 @@ void CpuSETTLE::apply(vector<OpenMM::RealVec>& atomCoordinates, vector<OpenMM::R
threads.waitForThreads(); threads.waitForThreads();
} }
void CpuSETTLE::applyToVelocities(vector<OpenMM::RealVec>& atomCoordinates, vector<OpenMM::RealVec>& velocities, vector<RealOpenMM>& inverseMasses, RealOpenMM tolerance) { void CpuSETTLE::applyToVelocities(vector<OpenMM::Vec3>& atomCoordinates, vector<OpenMM::Vec3>& velocities, vector<double>& inverseMasses, double tolerance) {
gmx_atomic_t atomicCounter; gmx_atomic_t atomicCounter;
gmx_atomic_set(&atomicCounter, 0); gmx_atomic_set(&atomicCounter, 0);
threads.execute([&] (ThreadPool& threads, int threadIndex) { threads.execute([&] (ThreadPool& threads, int threadIndex) {
......
...@@ -51,16 +51,16 @@ using namespace std; ...@@ -51,16 +51,16 @@ using namespace std;
void testNeighborList(bool periodic, bool triclinic) { void testNeighborList(bool periodic, bool triclinic) {
const int numParticles = 500; const int numParticles = 500;
const float cutoff = 2.0f; const float cutoff = 2.0f;
RealVec boxVectors[3]; Vec3 boxVectors[3];
if (triclinic) { if (triclinic) {
boxVectors[0] = RealVec(10, 0, 0); boxVectors[0] = Vec3(10, 0, 0);
boxVectors[1] = RealVec(4, 9, 0); boxVectors[1] = Vec3(4, 9, 0);
boxVectors[2] = RealVec(-3, -3.5, 11); boxVectors[2] = Vec3(-3, -3.5, 11);
} }
else { else {
boxVectors[0] = RealVec(10, 0, 0); boxVectors[0] = Vec3(10, 0, 0);
boxVectors[1] = RealVec(0, 9, 0); boxVectors[1] = Vec3(0, 9, 0);
boxVectors[2] = RealVec(0, 0, 11); boxVectors[2] = Vec3(0, 0, 11);
} }
const float boxSize[3] = {(float) boxVectors[0][0], (float) boxVectors[1][1], (float) boxVectors[2][2]}; const float boxSize[3] = {(float) boxVectors[0][0], (float) boxVectors[1][1], (float) boxVectors[2][2]};
const int blockSize = 8; const int blockSize = 8;
......
...@@ -310,15 +310,15 @@ CudaIntegrationUtilities::CudaIntegrationUtilities(CudaContext& context, const S ...@@ -310,15 +310,15 @@ CudaIntegrationUtilities::CudaIntegrationUtilities(CudaContext& context, const S
// Record information needed by ReferenceCCMAAlgorithm. // Record information needed by ReferenceCCMAAlgorithm.
vector<pair<int, int> > refIndices(numCCMA); vector<pair<int, int> > refIndices(numCCMA);
vector<RealOpenMM> refDistance(numCCMA); vector<double> refDistance(numCCMA);
for (int i = 0; i < numCCMA; i++) { for (int i = 0; i < numCCMA; i++) {
int index = ccmaConstraints[i]; int index = ccmaConstraints[i];
refIndices[i] = make_pair(atom1[index], atom2[index]); refIndices[i] = make_pair(atom1[index], atom2[index]);
refDistance[i] = distance[index]; refDistance[i] = distance[index];
} }
vector<RealOpenMM> refMasses(numAtoms); vector<double> refMasses(numAtoms);
for (int i = 0; i < numAtoms; ++i) for (int i = 0; i < numAtoms; ++i)
refMasses[i] = (RealOpenMM) system.getParticleMass(i); refMasses[i] = system.getParticleMass(i);
// Look up angles for CCMA. // Look up angles for CCMA.
...@@ -330,7 +330,7 @@ CudaIntegrationUtilities::CudaIntegrationUtilities(CudaContext& context, const S ...@@ -330,7 +330,7 @@ CudaIntegrationUtilities::CudaIntegrationUtilities(CudaContext& context, const S
int atom1, atom2, atom3; int atom1, atom2, atom3;
double angle, k; double angle, k;
force->getAngleParameters(j, atom1, atom2, atom3, angle, k); force->getAngleParameters(j, atom1, atom2, atom3, angle, k);
angles.push_back(ReferenceCCMAAlgorithm::AngleInfo(atom1, atom2, atom3, (RealOpenMM) angle)); angles.push_back(ReferenceCCMAAlgorithm::AngleInfo(atom1, atom2, atom3, angle));
} }
} }
} }
......
...@@ -329,15 +329,15 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c ...@@ -329,15 +329,15 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
// Record information needed by ReferenceCCMAAlgorithm. // Record information needed by ReferenceCCMAAlgorithm.
vector<pair<int, int> > refIndices(numCCMA); vector<pair<int, int> > refIndices(numCCMA);
vector<RealOpenMM> refDistance(numCCMA); vector<double> refDistance(numCCMA);
for (int i = 0; i < numCCMA; i++) { for (int i = 0; i < numCCMA; i++) {
int index = ccmaConstraints[i]; int index = ccmaConstraints[i];
refIndices[i] = make_pair(atom1[index], atom2[index]); refIndices[i] = make_pair(atom1[index], atom2[index]);
refDistance[i] = distance[index]; refDistance[i] = distance[index];
} }
vector<RealOpenMM> refMasses(numAtoms); vector<double> refMasses(numAtoms);
for (int i = 0; i < numAtoms; ++i) for (int i = 0; i < numAtoms; ++i)
refMasses[i] = (RealOpenMM) system.getParticleMass(i); refMasses[i] = (double) system.getParticleMass(i);
// Look up angles for CCMA. // Look up angles for CCMA.
...@@ -349,7 +349,7 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c ...@@ -349,7 +349,7 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
int atom1, atom2, atom3; int atom1, atom2, atom3;
double angle, k; double angle, k;
force->getAngleParameters(j, atom1, atom2, atom3, angle, k); force->getAngleParameters(j, atom1, atom2, atom3, angle, k);
angles.push_back(ReferenceCCMAAlgorithm::AngleInfo(atom1, atom2, atom3, (RealOpenMM) angle)); angles.push_back(ReferenceCCMAAlgorithm::AngleInfo(atom1, atom2, atom3, angle));
} }
} }
} }
......
...@@ -2077,7 +2077,10 @@ double OpenCLCalcNonbondedForceKernel::execute(ContextImpl& context, bool includ ...@@ -2077,7 +2077,10 @@ double OpenCLCalcNonbondedForceKernel::execute(ContextImpl& context, bool includ
else else
pmeDispersionSpreadChargeKernel.setArg<cl::Buffer>(3, pmeGrid->getDeviceBuffer()); pmeDispersionSpreadChargeKernel.setArg<cl::Buffer>(3, pmeGrid->getDeviceBuffer());
pmeDispersionSpreadChargeKernel.setArg<cl::Buffer>(4, pmeBsplineTheta->getDeviceBuffer()); pmeDispersionSpreadChargeKernel.setArg<cl::Buffer>(4, pmeBsplineTheta->getDeviceBuffer());
pmeDispersionSpreadChargeKernel.setArg<cl::Buffer>(13, sigmaEpsilon->getDeviceBuffer()); if (deviceIsCpu || cl.getSupports64BitGlobalAtomics())
pmeDispersionSpreadChargeKernel.setArg<cl::Buffer>(13, sigmaEpsilon->getDeviceBuffer());
else
pmeDispersionSpreadChargeKernel.setArg<cl::Buffer>(5, sigmaEpsilon->getDeviceBuffer());
pmeDispersionConvolutionKernel.setArg<cl::Buffer>(0, pmeGrid2->getDeviceBuffer()); pmeDispersionConvolutionKernel.setArg<cl::Buffer>(0, pmeGrid2->getDeviceBuffer());
pmeDispersionConvolutionKernel.setArg<cl::Buffer>(1, pmeDispersionBsplineModuliX->getDeviceBuffer()); pmeDispersionConvolutionKernel.setArg<cl::Buffer>(1, pmeDispersionBsplineModuliX->getDeviceBuffer());
pmeDispersionConvolutionKernel.setArg<cl::Buffer>(2, pmeDispersionBsplineModuliY->getDeviceBuffer()); pmeDispersionConvolutionKernel.setArg<cl::Buffer>(2, pmeDispersionBsplineModuliY->getDeviceBuffer());
......
...@@ -38,7 +38,7 @@ __kernel void updateBsplines(__global const real4* restrict posq, __global real4 ...@@ -38,7 +38,7 @@ __kernel void updateBsplines(__global const real4* restrict posq, __global real4
data[0] = scale*(-dr+1.0f)*data[0]; data[0] = scale*(-dr+1.0f)*data[0];
for (int j = 0; j < PME_ORDER; j++) { for (int j = 0; j < PME_ORDER; j++) {
#ifdef USE_LJPME #ifdef USE_LJPME
const float2 sigEps = sigmaEpsilon[atom]; const float2 sigEps = sigmaEpsilon[i];
const real charge = 8*sigEps.x*sigEps.x*sigEps.x*sigEps.y; const real charge = 8*sigEps.x*sigEps.x*sigEps.x*sigEps.y;
#else #else
const real charge = pos.w; const real charge = pos.w;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef __ObcParameters_H__ #ifndef __ObcParameters_H__
#define __ObcParameters_H__ #define __ObcParameters_H__
#include "RealVec.h" #include "openmm/Vec3.h"
#include <vector> #include <vector>
namespace OpenMM { namespace OpenMM {
...@@ -44,29 +44,29 @@ class ObcParameters { ...@@ -44,29 +44,29 @@ class ObcParameters {
int _numberOfAtoms; int _numberOfAtoms;
RealOpenMM _solventDielectric; double _solventDielectric;
RealOpenMM _soluteDielectric; double _soluteDielectric;
RealOpenMM _electricConstant; double _electricConstant;
RealOpenMM _probeRadius; double _probeRadius;
RealOpenMM _pi4Asolv; double _pi4Asolv;
RealOpenMM _dielectricOffset; double _dielectricOffset;
RealOpenMM _alphaObc; double _alphaObc;
RealOpenMM _betaObc; double _betaObc;
RealOpenMM _gammaObc; double _gammaObc;
ObcType _obcType; ObcType _obcType;
// scaled radius factors (S_kk in HCT paper) // scaled radius factors (S_kk in HCT paper)
std::vector<RealOpenMM> _atomicRadii; std::vector<double> _atomicRadii;
std::vector<RealOpenMM> _scaledRadiusFactors; std::vector<double> _scaledRadiusFactors;
// cutoff and periodic boundary conditions // cutoff and periodic boundary conditions
bool _cutoff; bool _cutoff;
bool _periodic; bool _periodic;
OpenMM::RealVec _periodicBoxVectors[3]; OpenMM::Vec3 _periodicBoxVectors[3];
RealOpenMM _cutoffDistance; double _cutoffDistance;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -76,7 +76,7 @@ class ObcParameters { ...@@ -76,7 +76,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setDielectricOffset(RealOpenMM dielectricOffset); void setDielectricOffset(double dielectricOffset);
public: public:
...@@ -116,7 +116,7 @@ class ObcParameters { ...@@ -116,7 +116,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getElectricConstant() const; double getElectricConstant() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -126,7 +126,7 @@ class ObcParameters { ...@@ -126,7 +126,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getProbeRadius() const; double getProbeRadius() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -136,18 +136,18 @@ class ObcParameters { ...@@ -136,18 +136,18 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setProbeRadius(RealOpenMM probeRadius); void setProbeRadius(double probeRadius);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
Get pi4Asolv: used in ACE approximation for nonpolar term Get pi4Asolv: used in ACE approximation for nonpolar term
((RealOpenMM) M_PI)*4.0f*0.0049f*1000.0f; (Simbios) M_PI*4.0f*0.0049f*1000.0f; (Simbios)
@return pi4Asolv @return pi4Asolv
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getPi4Asolv() const; double getPi4Asolv() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -155,7 +155,7 @@ class ObcParameters { ...@@ -155,7 +155,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setPi4Asolv(RealOpenMM pi4Asolv); void setPi4Asolv(double pi4Asolv);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -165,7 +165,7 @@ class ObcParameters { ...@@ -165,7 +165,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getSolventDielectric() const; double getSolventDielectric() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -175,7 +175,7 @@ class ObcParameters { ...@@ -175,7 +175,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setSolventDielectric(RealOpenMM solventDielectric); void setSolventDielectric(double solventDielectric);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -185,7 +185,7 @@ class ObcParameters { ...@@ -185,7 +185,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getSoluteDielectric() const; double getSoluteDielectric() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -195,7 +195,7 @@ class ObcParameters { ...@@ -195,7 +195,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setSoluteDielectric(RealOpenMM soluteDielectric); void setSoluteDielectric(double soluteDielectric);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -225,7 +225,7 @@ class ObcParameters { ...@@ -225,7 +225,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getAlphaObc() const; double getAlphaObc() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -235,7 +235,7 @@ class ObcParameters { ...@@ -235,7 +235,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getBetaObc() const; double getBetaObc() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -245,7 +245,7 @@ class ObcParameters { ...@@ -245,7 +245,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getGammaObc() const; double getGammaObc() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -255,7 +255,7 @@ class ObcParameters { ...@@ -255,7 +255,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getDielectricOffset() const; double getDielectricOffset() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -265,7 +265,7 @@ class ObcParameters { ...@@ -265,7 +265,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const std::vector<RealOpenMM>& getScaledRadiusFactors() const; const std::vector<double>& getScaledRadiusFactors() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -275,7 +275,7 @@ class ObcParameters { ...@@ -275,7 +275,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setScaledRadiusFactors(const std::vector<RealOpenMM>& scaledRadiusFactors); void setScaledRadiusFactors(const std::vector<double>& scaledRadiusFactors);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -285,7 +285,7 @@ class ObcParameters { ...@@ -285,7 +285,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const std::vector<RealOpenMM>& getAtomicRadii() const; const std::vector<double>& getAtomicRadii() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -295,7 +295,7 @@ class ObcParameters { ...@@ -295,7 +295,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setAtomicRadii(const std::vector<RealOpenMM>& atomicRadii); void setAtomicRadii(const std::vector<double>& atomicRadii);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -306,7 +306,7 @@ class ObcParameters { ...@@ -306,7 +306,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setUseCutoff(RealOpenMM distance); void setUseCutoff(double distance);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -322,7 +322,7 @@ class ObcParameters { ...@@ -322,7 +322,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getCutoffDistance() const; double getCutoffDistance() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -334,7 +334,7 @@ class ObcParameters { ...@@ -334,7 +334,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setPeriodic(OpenMM::RealVec* vectors); void setPeriodic(OpenMM::Vec3* vectors);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -350,7 +350,7 @@ class ObcParameters { ...@@ -350,7 +350,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const OpenMM::RealVec* getPeriodicBox(); const OpenMM::Vec3* getPeriodicBox();
}; };
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2013 Stanford University and the Authors. * * Portions copyright (c) 2008-2017 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -34,143 +34,14 @@ ...@@ -34,143 +34,14 @@
#include "SimTKOpenMMRealType.h" #include "SimTKOpenMMRealType.h"
#include "openmm/Vec3.h" #include "openmm/Vec3.h"
#include <cassert>
#include <iosfwd>
namespace OpenMM {
/** /**
* This is identical to Vec3, except that the components are of type RealOpenMM, so * This file exists only for backward compatibility. RealVec is now just a typedef for Vec3.
* it can be compiled in either single or double precision. Automatic conversion
* between this class and Vec3 is supported.
*/ */
class RealVec { namespace OpenMM {
public:
/**
* Create a RealVec whose elements are all 0.
*/
RealVec() {
data[0] = data[1] = data[2] = 0.0;
}
/**
* Create a RealVec with specified x, y, and z components.
*/
RealVec(RealOpenMM x, RealOpenMM y, RealOpenMM z) {
data[0] = x;
data[1] = y;
data[2] = z;
}
/**
* Create a RealVec from a Vec3.
*/
RealVec(Vec3 v) {
data[0] = v[0];
data[1] = v[1];
data[2] = v[2];
}
/**
* Create a Vec3 from a RealVec.
*/
operator Vec3() const {
return Vec3(data[0], data[1], data[2]);
}
RealOpenMM operator[](int index) const {
assert(index >= 0 && index < 3);
return data[index];
}
RealOpenMM& operator[](int index) {
assert(index >= 0 && index < 3);
return data[index];
}
// Arithmetic operators
// unary plus
RealVec operator+() const {
return RealVec(*this);
}
// plus
RealVec operator+(const RealVec& rhs) const {
const RealVec& lhs = *this;
return RealVec(lhs[0] + rhs[0], lhs[1] + rhs[1], lhs[2] + rhs[2]);
}
RealVec& operator+=(const RealVec& rhs) {
data[0] += rhs[0];
data[1] += rhs[1];
data[2] += rhs[2];
return *this;
}
// unary minus
RealVec operator-() const {
const RealVec& lhs = *this;
return RealVec(-lhs[0], -lhs[1], -lhs[2]);
}
// minus
RealVec operator-(const RealVec& rhs) const {
const RealVec& lhs = *this;
return RealVec(lhs[0] - rhs[0], lhs[1] - rhs[1], lhs[2] - rhs[2]);
}
RealVec& operator-=(const RealVec& rhs) {
data[0] -= rhs[0];
data[1] -= rhs[1];
data[2] -= rhs[2];
return *this;
}
// scalar product
RealVec operator*(RealOpenMM rhs) const {
const RealVec& lhs = *this;
return RealVec(lhs[0]*rhs, lhs[1]*rhs, lhs[2]*rhs);
}
RealVec& operator*=(RealOpenMM rhs) {
data[0] *= rhs;
data[1] *= rhs;
data[2] *= rhs;
return *this;
}
// scalar division
RealVec operator/(double rhs) const {
const RealVec& lhs = *this;
double scale = 1.0/rhs;
return RealVec(lhs[0]*scale, lhs[1]*scale, lhs[2]*scale);
}
RealVec& operator/=(double rhs) {
double scale = 1.0/rhs;
data[0] *= scale;
data[1] *= scale;
data[2] *= scale;
return *this;
}
// dot product
RealOpenMM dot(const RealVec& rhs) const {
const RealVec& lhs = *this;
return lhs[0]*rhs[0] + lhs[1]*rhs[1] + lhs[2]*rhs[2];
}
// cross product
RealVec cross(const RealVec& rhs) const {
return RealVec(data[1]*rhs[2]-data[2]*rhs[1], data[2]*rhs[0]-data[0]*rhs[2], data[0]*rhs[1]-data[1]*rhs[0]);
}
private:
RealOpenMM data[3];
};
template <class CHAR, class TRAITS> typedef Vec3 RealVec;
std::basic_ostream<CHAR,TRAITS>& operator<<(std::basic_ostream<CHAR,TRAITS>& o, const RealVec& v) {
o<<'['<<v[0]<<", "<<v[1]<<", "<<v[2]<<']';
return o;
}
} // namespace OpenMM } // namespace OpenMM
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#ifndef __ReferenceAndersenThermostat_H__ #ifndef __ReferenceAndersenThermostat_H__
#define __ReferenceAndersenThermostat_H__ #define __ReferenceAndersenThermostat_H__
#include "openmm/Vec3.h"
#include <vector> #include <vector>
namespace OpenMM { namespace OpenMM {
...@@ -64,8 +65,8 @@ class ReferenceAndersenThermostat { ...@@ -64,8 +65,8 @@ class ReferenceAndersenThermostat {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void applyThermostat(const std::vector<std::vector<int> >& atomGroups, std::vector<OpenMM::RealVec>& atomVelocities, std::vector<RealOpenMM>& atomMasses, void applyThermostat(const std::vector<std::vector<int> >& atomGroups, std::vector<OpenMM::Vec3>& atomVelocities, std::vector<double>& atomMasses,
RealOpenMM temperature, RealOpenMM collisionFrequency, RealOpenMM stepSize) const; double temperature, double collisionFrequency, double stepSize) const;
}; };
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define __ReferenceAngleBondIxn_H__ #define __ReferenceAngleBondIxn_H__
#include "ReferenceBondIxn.h" #include "ReferenceBondIxn.h"
#include "openmm/Vec3.h"
namespace OpenMM { namespace OpenMM {
...@@ -34,7 +35,7 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn { ...@@ -34,7 +35,7 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
private: private:
bool usePeriodic; bool usePeriodic;
RealVec boxVectors[3]; Vec3 boxVectors[3];
public: public:
...@@ -62,7 +63,7 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn { ...@@ -62,7 +63,7 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setPeriodic(OpenMM::RealVec* vectors); void setPeriodic(OpenMM::Vec3* vectors);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -76,8 +77,8 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn { ...@@ -76,8 +77,8 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void getPrefactorsGivenAngleCosine(RealOpenMM cosine, RealOpenMM* angleParameters, void getPrefactorsGivenAngleCosine(double cosine, double* angleParameters,
RealOpenMM* dEdR, RealOpenMM* energyTerm) const; double* dEdR, double* energyTerm) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -92,9 +93,9 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn { ...@@ -92,9 +93,9 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, void calculateBondIxn(int* atomIndices, std::vector<OpenMM::Vec3>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, double* parameters, std::vector<OpenMM::Vec3>& forces,
RealOpenMM* totalEnergy, double* energyParamDerivs); double* totalEnergy, double* energyParamDerivs);
}; };
......
...@@ -68,9 +68,9 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce { ...@@ -68,9 +68,9 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateForce(int numberOfBonds, int** atomIndices, void calculateForce(int numberOfBonds, int** atomIndices,
std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::Vec3>& atomCoordinates,
RealOpenMM** parameters, std::vector<OpenMM::RealVec>& forces, double** parameters, std::vector<OpenMM::Vec3>& forces,
RealOpenMM* totalEnergy, ReferenceBondIxn& referenceBondIxn); double* totalEnergy, ReferenceBondIxn& referenceBondIxn);
}; };
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef __ReferenceBondIxn_H__ #ifndef __ReferenceBondIxn_H__
#define __ReferenceBondIxn_H__ #define __ReferenceBondIxn_H__
#include "RealVec.h" #include "openmm/Vec3.h"
#include "openmm/internal/windowsExport.h" #include "openmm/internal/windowsExport.h"
#include <vector> #include <vector>
...@@ -65,9 +65,9 @@ class OPENMM_EXPORT ReferenceBondIxn { ...@@ -65,9 +65,9 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
virtual void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, virtual void calculateBondIxn(int* atomIndices, std::vector<OpenMM::Vec3>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, double* parameters, std::vector<OpenMM::Vec3>& forces,
RealOpenMM* totalEnergy, double* energyParamDerivs); double* totalEnergy, double* energyParamDerivs);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -82,7 +82,7 @@ class OPENMM_EXPORT ReferenceBondIxn { ...@@ -82,7 +82,7 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getNormedDotProduct(RealOpenMM* vector1, RealOpenMM* vector2, int hasREntry); static double getNormedDotProduct(double* vector1, double* vector2, int hasREntry);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -98,8 +98,8 @@ class OPENMM_EXPORT ReferenceBondIxn { ...@@ -98,8 +98,8 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getAngleBetweenTwoVectors(RealOpenMM* vector1, RealOpenMM* vector2, static double getAngleBetweenTwoVectors(double* vector1, double* vector2,
RealOpenMM* outputDotProduct, int hasREntry); double* outputDotProduct, int hasREntry);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -119,10 +119,10 @@ class OPENMM_EXPORT ReferenceBondIxn { ...@@ -119,10 +119,10 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getDihedralAngleBetweenThreeVectors(RealOpenMM* vector1, RealOpenMM* vector2, static double getDihedralAngleBetweenThreeVectors(double* vector1, double* vector2,
RealOpenMM* vector3, RealOpenMM** outputCrossProduct, double* vector3, double** outputCrossProduct,
RealOpenMM* cosineOfAngle, RealOpenMM* signVector, double* cosineOfAngle, double* signVector,
RealOpenMM* signOfAngle, int hasREntry); double* signOfAngle, int hasREntry);
}; };
......
...@@ -33,9 +33,9 @@ class ReferenceBrownianDynamics : public ReferenceDynamics { ...@@ -33,9 +33,9 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
private: private:
std::vector<OpenMM::RealVec> xPrime; std::vector<OpenMM::Vec3> xPrime;
std::vector<RealOpenMM> inverseMasses; std::vector<double> inverseMasses;
RealOpenMM friction; double friction;
public: public:
...@@ -50,7 +50,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics { ...@@ -50,7 +50,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceBrownianDynamics(int numberOfAtoms, RealOpenMM deltaT, RealOpenMM friction, RealOpenMM temperature); ReferenceBrownianDynamics(int numberOfAtoms, double deltaT, double friction, double temperature);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -68,7 +68,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics { ...@@ -68,7 +68,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getFriction() const; double getFriction() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -83,8 +83,8 @@ class ReferenceBrownianDynamics : public ReferenceDynamics { ...@@ -83,8 +83,8 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void update(const OpenMM::System& system, std::vector<OpenMM::RealVec>& atomCoordinates, void update(const OpenMM::System& system, std::vector<OpenMM::Vec3>& atomCoordinates,
std::vector<OpenMM::RealVec>& velocities, std::vector<OpenMM::RealVec>& forces, std::vector<RealOpenMM>& masses, RealOpenMM tolerance); std::vector<OpenMM::Vec3>& velocities, std::vector<OpenMM::Vec3>& forces, std::vector<double>& masses, double tolerance);
}; };
......
...@@ -37,23 +37,23 @@ class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm ...@@ -37,23 +37,23 @@ class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm
protected: protected:
int _maximumNumberOfIterations; int _maximumNumberOfIterations;
RealOpenMM _elementCutoff; double _elementCutoff;
int _numberOfConstraints; int _numberOfConstraints;
std::vector<std::pair<int, int> > _atomIndices; std::vector<std::pair<int, int> > _atomIndices;
std::vector<RealOpenMM> _distance; std::vector<double> _distance;
std::vector<OpenMM::RealVec> _r_ij; std::vector<OpenMM::Vec3> _r_ij;
RealOpenMM* _d_ij2; double* _d_ij2;
RealOpenMM* _distanceTolerance; double* _distanceTolerance;
RealOpenMM* _reducedMasses; double* _reducedMasses;
bool _hasInitializedMasses; bool _hasInitializedMasses;
std::vector<std::vector<std::pair<int, RealOpenMM> > > _matrix; std::vector<std::vector<std::pair<int, double> > > _matrix;
private: private:
void applyConstraints(std::vector<OpenMM::RealVec>& atomCoordinates, void applyConstraints(std::vector<OpenMM::Vec3>& atomCoordinates,
std::vector<OpenMM::RealVec>& atomCoordinatesP, std::vector<RealOpenMM>& inverseMasses, bool constrainingVelocities, RealOpenMM tolerance); std::vector<OpenMM::Vec3>& atomCoordinatesP, std::vector<double>& inverseMasses, bool constrainingVelocities, double tolerance);
public: public:
class AngleInfo; class AngleInfo;
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
* @param angles angle force field terms * @param angles angle force field terms
* @param elementCutoff the cutoff for which elements of the inverse matrix to keep * @param elementCutoff the cutoff for which elements of the inverse matrix to keep
*/ */
ReferenceCCMAAlgorithm(int numberOfAtoms, int numberOfConstraints, const std::vector<std::pair<int, int> >& atomIndices, const std::vector<RealOpenMM>& distance, std::vector<RealOpenMM>& masses, std::vector<AngleInfo>& angles, RealOpenMM elementCutoff); ReferenceCCMAAlgorithm(int numberOfAtoms, int numberOfConstraints, const std::vector<std::pair<int, int> >& atomIndices, const std::vector<double>& distance, std::vector<double>& masses, std::vector<AngleInfo>& angles, double elementCutoff);
~ReferenceCCMAAlgorithm(); ~ReferenceCCMAAlgorithm();
...@@ -96,8 +96,8 @@ public: ...@@ -96,8 +96,8 @@ public:
* @param inverseMasses 1/mass * @param inverseMasses 1/mass
* @param tolerance the constraint tolerance * @param tolerance the constraint tolerance
*/ */
void apply(std::vector<OpenMM::RealVec>& atomCoordinates, void apply(std::vector<OpenMM::Vec3>& atomCoordinates,
std::vector<OpenMM::RealVec>& atomCoordinatesP, std::vector<RealOpenMM>& inverseMasses, RealOpenMM tolerance); std::vector<OpenMM::Vec3>& atomCoordinatesP, std::vector<double>& inverseMasses, double tolerance);
/** /**
* Apply the constraint algorithm to velocities. * Apply the constraint algorithm to velocities.
...@@ -107,14 +107,14 @@ public: ...@@ -107,14 +107,14 @@ public:
* @param inverseMasses 1/mass * @param inverseMasses 1/mass
* @param tolerance the constraint tolerance * @param tolerance the constraint tolerance
*/ */
void applyToVelocities(std::vector<OpenMM::RealVec>& atomCoordinates, void applyToVelocities(std::vector<OpenMM::Vec3>& atomCoordinates,
std::vector<OpenMM::RealVec>& velocities, std::vector<RealOpenMM>& inverseMasses, RealOpenMM tolerance); std::vector<OpenMM::Vec3>& velocities, std::vector<double>& inverseMasses, double tolerance);
/** /**
* Get the inverse constraint matrix. Each element represents one column, and contains a list * Get the inverse constraint matrix. Each element represents one column, and contains a list
* of all non-zero elements in the form (index, value). * of all non-zero elements in the form (index, value).
*/ */
const std::vector<std::vector<std::pair<int, RealOpenMM> > >& getMatrix() const; const std::vector<std::vector<std::pair<int, double> > >& getMatrix() const;
}; };
...@@ -122,8 +122,8 @@ class ReferenceCCMAAlgorithm::AngleInfo ...@@ -122,8 +122,8 @@ class ReferenceCCMAAlgorithm::AngleInfo
{ {
public: public:
int atom1, atom2, atom3; int atom1, atom2, atom3;
RealOpenMM angle; double angle;
AngleInfo(int atom1, int atom2, int atom3, RealOpenMM angle) : AngleInfo(int atom1, int atom2, int atom3, double angle) :
atom1(atom1), atom2(atom2), atom3(atom3), angle(angle) atom1(atom1), atom2(atom2), atom3(atom3), angle(angle)
{ {
} }
......
...@@ -35,11 +35,11 @@ class ReferenceCMAPTorsionIxn : public ReferenceBondIxn { ...@@ -35,11 +35,11 @@ class ReferenceCMAPTorsionIxn : public ReferenceBondIxn {
private: private:
std::vector<std::vector<std::vector<RealOpenMM> > > coeff; std::vector<std::vector<std::vector<double> > > coeff;
std::vector<int> torsionMaps; std::vector<int> torsionMaps;
std::vector<std::vector<int> > torsionIndices; std::vector<std::vector<int> > torsionIndices;
bool usePeriodic; bool usePeriodic;
RealVec boxVectors[3]; Vec3 boxVectors[3];
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -52,8 +52,8 @@ private: ...@@ -52,8 +52,8 @@ private:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateOneIxn(int index, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& forces, void calculateOneIxn(int index, std::vector<OpenMM::Vec3>& atomCoordinates, std::vector<OpenMM::Vec3>& forces,
RealOpenMM* totalEnergy) const; double* totalEnergy) const;
public: public:
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceCMAPTorsionIxn(const std::vector<std::vector<std::vector<RealOpenMM> > >& coeff, ReferenceCMAPTorsionIxn(const std::vector<std::vector<std::vector<double> > >& coeff,
const std::vector<int>& torsionMaps, const std::vector<int>& torsionMaps,
const std::vector<std::vector<int> >& torsionIndices); const std::vector<std::vector<int> >& torsionIndices);
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setPeriodic(OpenMM::RealVec* vectors); void setPeriodic(OpenMM::Vec3* vectors);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateIxn(std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& forces, RealOpenMM* totalEnergy) const; void calculateIxn(std::vector<OpenMM::Vec3>& atomCoordinates, std::vector<OpenMM::Vec3>& forces, double* totalEnergy) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -95,9 +95,9 @@ public: ...@@ -95,9 +95,9 @@ public:
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, void calculateBondIxn(int* atomIndices, std::vector<OpenMM::Vec3>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, double* parameters, std::vector<OpenMM::Vec3>& forces,
RealOpenMM* totalEnergy, double* energyParamDerivs); double* totalEnergy, double* energyParamDerivs);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
#ifndef __ReferenceConstraintAlgorithm_H__ #ifndef __ReferenceConstraintAlgorithm_H__
#define __ReferenceConstraintAlgorithm_H__ #define __ReferenceConstraintAlgorithm_H__
#include "RealVec.h" #include "openmm/Vec3.h"
#include "openmm/internal/windowsExport.h" #include "openmm/internal/windowsExport.h"
#include "SimTKOpenMMRealType.h"
#include <vector> #include <vector>
namespace OpenMM { namespace OpenMM {
...@@ -47,8 +48,8 @@ public: ...@@ -47,8 +48,8 @@ public:
* @param inverseMasses 1/mass * @param inverseMasses 1/mass
* @param tolerance the constraint tolerance * @param tolerance the constraint tolerance
*/ */
virtual void apply(std::vector<OpenMM::RealVec>& atomCoordinates, virtual void apply(std::vector<OpenMM::Vec3>& atomCoordinates,
std::vector<OpenMM::RealVec>& atomCoordinatesP, std::vector<RealOpenMM>& inverseMasses, RealOpenMM tolerance) = 0; std::vector<OpenMM::Vec3>& atomCoordinatesP, std::vector<double>& inverseMasses, double tolerance) = 0;
/** /**
* Apply the constraint algorithm to velocities. * Apply the constraint algorithm to velocities.
...@@ -58,8 +59,8 @@ public: ...@@ -58,8 +59,8 @@ public:
* @param inverseMasses 1/mass * @param inverseMasses 1/mass
* @param tolerance the constraint tolerance * @param tolerance the constraint tolerance
*/ */
virtual void applyToVelocities(std::vector<OpenMM::RealVec>& atomCoordinates, virtual void applyToVelocities(std::vector<OpenMM::Vec3>& atomCoordinates,
std::vector<OpenMM::RealVec>& velocities, std::vector<RealOpenMM>& inverseMasses, RealOpenMM tolerance) = 0; std::vector<OpenMM::Vec3>& velocities, std::vector<double>& inverseMasses, double tolerance) = 0;
}; };
} // namespace OpenMM } // namespace OpenMM
......
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
* @param inverseMasses 1/mass * @param inverseMasses 1/mass
* @param tolerance the constraint tolerance * @param tolerance the constraint tolerance
*/ */
void apply(std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& atomCoordinatesP, std::vector<RealOpenMM>& inverseMasses, RealOpenMM tolerance); void apply(std::vector<OpenMM::Vec3>& atomCoordinates, std::vector<OpenMM::Vec3>& atomCoordinatesP, std::vector<double>& inverseMasses, double tolerance);
/** /**
* Apply the constraint algorithm to velocities. * Apply the constraint algorithm to velocities.
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
* @param inverseMasses 1/mass * @param inverseMasses 1/mass
* @param tolerance the constraint tolerance * @param tolerance the constraint tolerance
*/ */
void applyToVelocities(std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& velocities, std::vector<RealOpenMM>& inverseMasses, RealOpenMM tolerance); void applyToVelocities(std::vector<OpenMM::Vec3>& atomCoordinates, std::vector<OpenMM::Vec3>& velocities, std::vector<double>& inverseMasses, double tolerance);
ReferenceConstraintAlgorithm* ccma; ReferenceConstraintAlgorithm* ccma;
ReferenceConstraintAlgorithm* settle; ReferenceConstraintAlgorithm* settle;
}; };
......
...@@ -40,7 +40,7 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn { ...@@ -40,7 +40,7 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
int thetaIndex; int thetaIndex;
int numParameters; int numParameters;
bool usePeriodic; bool usePeriodic;
RealVec boxVectors[3]; Vec3 boxVectors[3];
public: public:
...@@ -70,7 +70,7 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn { ...@@ -70,7 +70,7 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setPeriodic(OpenMM::RealVec* vectors); void setPeriodic(OpenMM::Vec3* vectors);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -84,9 +84,9 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn { ...@@ -84,9 +84,9 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, void calculateBondIxn(int* atomIndices, std::vector<OpenMM::Vec3>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, double* parameters, std::vector<OpenMM::Vec3>& forces,
RealOpenMM* totalEnergy, double* energyParamDerivs); double* totalEnergy, double* energyParamDerivs);
}; };
......
...@@ -41,7 +41,7 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn { ...@@ -41,7 +41,7 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
int rIndex; int rIndex;
int numParameters; int numParameters;
bool usePeriodic; bool usePeriodic;
RealVec boxVectors[3]; Vec3 boxVectors[3];
public: public:
...@@ -71,7 +71,7 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn { ...@@ -71,7 +71,7 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setPeriodic(OpenMM::RealVec* vectors); void setPeriodic(OpenMM::Vec3* vectors);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -85,9 +85,9 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn { ...@@ -85,9 +85,9 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, void calculateBondIxn(int* atomIndices, std::vector<OpenMM::Vec3>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, double* parameters, std::vector<OpenMM::Vec3>& forces,
RealOpenMM* totalEnergy, double* energyParamDerivs); double* totalEnergy, double* energyParamDerivs);
}; };
......
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