"plugins/amoeba/vscode:/vscode.git/clone" did not exist on "49c9817fe5f99efea0e23ae677b0182dc3d993a9"
Commit 162d69a2 authored by peastman's avatar peastman
Browse files

Merge pull request #827 from peastman/reference

Lots of cleanup to reference platform
parents 2379b982 c44c956d
......@@ -25,14 +25,12 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceAngleBondIxn.h"
#include "ReferenceForce.h"
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -40,7 +38,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
ReferenceAngleBondIxn::ReferenceAngleBondIxn( ){
ReferenceAngleBondIxn::ReferenceAngleBondIxn() {
// ---------------------------------------------------------------------------------------
......@@ -56,7 +54,7 @@ ReferenceAngleBondIxn::ReferenceAngleBondIxn( ){
--------------------------------------------------------------------------------------- */
ReferenceAngleBondIxn::~ReferenceAngleBondIxn( ){
ReferenceAngleBondIxn::~ReferenceAngleBondIxn() {
// ---------------------------------------------------------------------------------------
......@@ -78,8 +76,8 @@ ReferenceAngleBondIxn::~ReferenceAngleBondIxn( ){
--------------------------------------------------------------------------------------- */
void ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine( RealOpenMM cosine, RealOpenMM* angleParameters,
RealOpenMM* dEdR, RealOpenMM* energyTerm ) const {
void ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine(RealOpenMM cosine, RealOpenMM* angleParameters,
RealOpenMM* dEdR, RealOpenMM* energyTerm) const {
// ---------------------------------------------------------------------------------------
......@@ -92,9 +90,9 @@ void ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine( RealOpenMM cosine, Re
// ---------------------------------------------------------------------------------------
RealOpenMM angle;
if( cosine >= one ){
if (cosine >= one) {
angle = zero;
} else if( cosine <= -one ){
} else if (cosine <= -one) {
angle = PI_M;
} else {
angle = ACOS(cosine);
......@@ -120,11 +118,11 @@ void ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine( RealOpenMM cosine, Re
--------------------------------------------------------------------------------------- */
void ReferenceAngleBondIxn::calculateBondIxn( int* atomIndices,
void ReferenceAngleBondIxn::calculateBondIxn(int* atomIndices,
vector<RealVec>& atomCoordinates,
RealOpenMM* parameters,
vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const {
RealOpenMM* totalEnergy) const {
// constants -- reduce Visual Studio warnings regarding conversions between float & double
......@@ -147,31 +145,31 @@ void ReferenceAngleBondIxn::calculateBondIxn( int* atomIndices,
int atomAIndex = atomIndices[0];
int atomBIndex = atomIndices[1];
int atomCIndex = atomIndices[2];
ReferenceForce::getDeltaR( atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR[0] );
ReferenceForce::getDeltaR( atomCoordinates[atomCIndex], atomCoordinates[atomBIndex], deltaR[1] );
ReferenceForce::getDeltaR(atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR[0]);
ReferenceForce::getDeltaR(atomCoordinates[atomCIndex], atomCoordinates[atomBIndex], deltaR[1]);
RealOpenMM pVector[threeI];
SimTKOpenMMUtilities::crossProductVector3( deltaR[0], deltaR[1], pVector );
RealOpenMM rp = DOT3( pVector, pVector );
rp = SQRT( rp );
if( rp < 1.0e-06 ){
SimTKOpenMMUtilities::crossProductVector3(deltaR[0], deltaR[1], pVector);
RealOpenMM rp = DOT3(pVector, pVector);
rp = SQRT(rp);
if (rp < 1.0e-06) {
rp = (RealOpenMM) 1.0e-06;
}
RealOpenMM dot = DOT3( deltaR[0], deltaR[1] );
RealOpenMM cosine = dot/SQRT( (deltaR[0][ReferenceForce::R2Index]*deltaR[1][ReferenceForce::R2Index]) );
RealOpenMM dot = DOT3(deltaR[0], deltaR[1]);
RealOpenMM cosine = dot/SQRT((deltaR[0][ReferenceForce::R2Index]*deltaR[1][ReferenceForce::R2Index]));
RealOpenMM dEdR;
RealOpenMM energy;
getPrefactorsGivenAngleCosine( cosine, parameters, &dEdR, &energy );
getPrefactorsGivenAngleCosine(cosine, parameters, &dEdR, &energy);
RealOpenMM termA = dEdR/(deltaR[0][ReferenceForce::R2Index]*rp);
RealOpenMM termC = -dEdR/(deltaR[1][ReferenceForce::R2Index]*rp);
RealOpenMM deltaCrossP[LastAtomIndex][threeI];
SimTKOpenMMUtilities::crossProductVector3( deltaR[0], pVector, deltaCrossP[0] );
SimTKOpenMMUtilities::crossProductVector3( deltaR[1], pVector, deltaCrossP[2] );
SimTKOpenMMUtilities::crossProductVector3(deltaR[0], pVector, deltaCrossP[0]);
SimTKOpenMMUtilities::crossProductVector3(deltaR[1], pVector, deltaCrossP[2]);
for( int ii = 0; ii < threeI; ii++ ){
for (int ii = 0; ii < threeI; ii++) {
deltaCrossP[0][ii] *= termA;
deltaCrossP[2][ii] *= termC;
deltaCrossP[1][ii] = oneM*(deltaCrossP[0][ii] + deltaCrossP[2][ii]);
......@@ -179,8 +177,8 @@ void ReferenceAngleBondIxn::calculateBondIxn( int* atomIndices,
// accumulate forces
for( int jj = 0; jj < LastAtomIndex; jj++ ){
for( int ii = 0; ii < threeI; ii++ ){
for (int jj = 0; jj < LastAtomIndex; jj++) {
for (int ii = 0; ii < threeI; ii++) {
forces[atomIndices[jj]][ii] += deltaCrossP[jj][ii];
}
}
......
......@@ -25,13 +25,11 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceBondForce.h"
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -39,7 +37,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
ReferenceBondForce::ReferenceBondForce( ){
ReferenceBondForce::ReferenceBondForce() {
// ---------------------------------------------------------------------------------------
......@@ -55,7 +53,7 @@ ReferenceBondForce::ReferenceBondForce( ){
--------------------------------------------------------------------------------------- */
ReferenceBondForce::~ReferenceBondForce( ){
ReferenceBondForce::~ReferenceBondForce() {
// ---------------------------------------------------------------------------------------
......@@ -80,12 +78,12 @@ ReferenceBondForce::~ReferenceBondForce( ){
--------------------------------------------------------------------------------------- */
void ReferenceBondForce::calculateForce( int numberOfBonds, int** atomIndices,
void ReferenceBondForce::calculateForce(int numberOfBonds, int** atomIndices,
vector<RealVec>& atomCoordinates,
RealOpenMM** parameters,
vector<RealVec>& forces,
RealOpenMM *totalEnergy,
ReferenceBondIxn& referenceBondIxn ){
ReferenceBondIxn& referenceBondIxn) {
// ---------------------------------------------------------------------------------------
......@@ -94,12 +92,12 @@ void ReferenceBondForce::calculateForce( int numberOfBonds, int** atomIndices,
// ---------------------------------------------------------------------------------------
for( int ii = 0; ii < numberOfBonds; ii++ ){
for (int ii = 0; ii < numberOfBonds; ii++) {
// calculate bond ixn
referenceBondIxn.calculateBondIxn( atomIndices[ii], atomCoordinates, parameters[ii],
forces, totalEnergy );
referenceBondIxn.calculateBondIxn(atomIndices[ii], atomCoordinates, parameters[ii],
forces, totalEnergy);
}
}
......@@ -25,14 +25,12 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h"
#include "ReferenceBondIxn.h"
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -40,7 +38,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
ReferenceBondIxn::ReferenceBondIxn( ){
ReferenceBondIxn::ReferenceBondIxn() {
// ---------------------------------------------------------------------------------------
......@@ -56,7 +54,7 @@ ReferenceBondIxn::ReferenceBondIxn( ){
--------------------------------------------------------------------------------------- */
ReferenceBondIxn::~ReferenceBondIxn( ){
ReferenceBondIxn::~ReferenceBondIxn() {
// ---------------------------------------------------------------------------------------
......@@ -78,9 +76,9 @@ ReferenceBondIxn::~ReferenceBondIxn( ){
--------------------------------------------------------------------------------------- */
void ReferenceBondIxn::calculateBondIxn( int* atomIndices, vector<RealVec>& atomCoordinates,
void ReferenceBondIxn::calculateBondIxn(int* atomIndices, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const {
RealOpenMM* totalEnergy) const {
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nReferenceBondIxn::calculateBondIxn";
......@@ -104,8 +102,8 @@ ReferenceBondIxn::~ReferenceBondIxn( ){
--------------------------------------------------------------------------------------- */
RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenMM* vector2,
int hasREntry = 0 ) {
RealOpenMM ReferenceBondIxn::getNormedDotProduct(RealOpenMM* vector1, RealOpenMM* vector2,
int hasREntry = 0) {
// ---------------------------------------------------------------------------------------
......@@ -124,35 +122,35 @@ RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenM
#if defined USE_DOUBLE_FOR_NORMED_DOT_PRODUCT
double v1D[3];
double v2D[3];
v1D[0] = static_cast<double>( vector1[0] );
v1D[1] = static_cast<double>( vector1[1] );
v1D[2] = static_cast<double>( vector1[2] );
v2D[0] = static_cast<double>( vector2[0] );
v2D[1] = static_cast<double>( vector2[1] );
v2D[2] = static_cast<double>( vector2[2] );
double dotProductD = DOT3( v1D, v2D );
if( dotProductD != 0.0 ){
if( hasREntry ){
dotProductD /= ( static_cast<double>(vector1[ReferenceForce::RIndex])*static_cast<double>(vector2[ReferenceForce::RIndex]) );
v1D[0] = static_cast<double>(vector1[0]);
v1D[1] = static_cast<double>(vector1[1]);
v1D[2] = static_cast<double>(vector1[2]);
v2D[0] = static_cast<double>(vector2[0]);
v2D[1] = static_cast<double>(vector2[1]);
v2D[2] = static_cast<double>(vector2[2]);
double dotProductD = DOT3(v1D, v2D);
if (dotProductD != 0.0) {
if (hasREntry) {
dotProductD /= (static_cast<double>(vector1[ReferenceForce::RIndex])*static_cast<double>(vector2[ReferenceForce::RIndex]));
} else {
double norm1 = DOT3( v1D, v1D );
double norm2 = DOT3( v2D, v2D);
dotProductD /= sqrt( norm1*norm2 );
double norm1 = DOT3(v1D, v1D);
double norm2 = DOT3(v2D, v2D);
dotProductD /= sqrt(norm1*norm2);
}
}
RealOpenMM dotProduct = static_cast<RealOpenMM>(dotProductD);
#else
RealOpenMM dotProduct = DOT3( vector1, vector2 );
if( dotProduct != zero ){
if( hasREntry ){
dotProduct /= ( vector1[ReferenceForce::RIndex]*vector2[ReferenceForce::RIndex] );
RealOpenMM dotProduct = DOT3(vector1, vector2);
if (dotProduct != zero) {
if (hasREntry) {
dotProduct /= (vector1[ReferenceForce::RIndex]*vector2[ReferenceForce::RIndex]);
} else {
RealOpenMM norm1 = DOT3( vector1, vector1 );
RealOpenMM norm2 = DOT3( vector2, vector2 );
dotProduct /= SQRT( norm1*norm2 );
RealOpenMM norm1 = DOT3(vector1, vector1);
RealOpenMM norm2 = DOT3(vector2, vector2);
dotProduct /= SQRT(norm1*norm2);
}
}
......@@ -161,9 +159,9 @@ RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenM
// clamp dot product to [-1,1]
if( dotProduct > one ){
if (dotProduct > one) {
dotProduct = one;
} else if( dotProduct < -one ){
} else if (dotProduct < -one) {
dotProduct = -one;
}
......@@ -185,9 +183,9 @@ RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenM
--------------------------------------------------------------------------------------- */
RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, RealOpenMM* vector2,
RealOpenMM* outputDotProduct = NULL,
int hasREntry = 0 ) {
RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors(RealOpenMM* vector1, RealOpenMM* vector2,
RealOpenMM* outputDotProduct = NULL,
int hasREntry = 0) {
// ---------------------------------------------------------------------------------------
......@@ -200,7 +198,7 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea
// get dot product betweenn vectors and then angle
RealOpenMM dotProduct = getNormedDotProduct( vector1, vector2, hasREntry );
RealOpenMM dotProduct = getNormedDotProduct(vector1, vector2, hasREntry);
RealOpenMM angle;
if (dotProduct > (RealOpenMM) 0.99 || dotProduct < (RealOpenMM) -0.99) {
......@@ -216,7 +214,7 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea
angle = ACOS(dotProduct);
}
if( outputDotProduct ){
if (outputDotProduct) {
*outputDotProduct = dotProduct;
}
......@@ -242,14 +240,14 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea
--------------------------------------------------------------------------------------- */
RealOpenMM ReferenceBondIxn::getDihedralAngleBetweenThreeVectors( RealOpenMM* vector1,
RealOpenMM* vector2,
RealOpenMM* vector3,
RealOpenMM** outputCrossProduct = NULL,
RealOpenMM* cosineOfAngle = NULL,
RealOpenMM* signVector = NULL,
RealOpenMM* signOfAngle = NULL,
int hasREntry = 0 ) {
RealOpenMM ReferenceBondIxn::getDihedralAngleBetweenThreeVectors(RealOpenMM* vector1,
RealOpenMM* vector2,
RealOpenMM* vector3,
RealOpenMM** outputCrossProduct = NULL,
RealOpenMM* cosineOfAngle = NULL,
RealOpenMM* signVector = NULL,
RealOpenMM* signOfAngle = NULL,
int hasREntry = 0) {
// ---------------------------------------------------------------------------------------
......@@ -265,7 +263,7 @@ RealOpenMM ReferenceBondIxn::getDihedralAngleBetweenThreeVectors( RealOpenMM* v
// get cross products between vectors and then angle between cross product vectors
RealOpenMM* crossProduct[2];
if( outputCrossProduct ){
if (outputCrossProduct) {
crossProduct[0] = outputCrossProduct[0];
crossProduct[1] = outputCrossProduct[1];
} else {
......@@ -273,17 +271,17 @@ RealOpenMM ReferenceBondIxn::getDihedralAngleBetweenThreeVectors( RealOpenMM* v
crossProduct[1] = tempVectors + 3;
}
SimTKOpenMMUtilities::crossProductVector3( vector1, vector2, crossProduct[0] );
SimTKOpenMMUtilities::crossProductVector3( vector2, vector3, crossProduct[1] );
SimTKOpenMMUtilities::crossProductVector3(vector1, vector2, crossProduct[0]);
SimTKOpenMMUtilities::crossProductVector3(vector2, vector3, crossProduct[1]);
RealOpenMM angle = getAngleBetweenTwoVectors( crossProduct[0], crossProduct[1], cosineOfAngle, 0 );
RealOpenMM angle = getAngleBetweenTwoVectors(crossProduct[0], crossProduct[1], cosineOfAngle, 0);
// take care of sign of angle
if( signVector ){
RealOpenMM dotProduct = DOT3( signVector, crossProduct[1] );
if (signVector) {
RealOpenMM dotProduct = DOT3(signVector, crossProduct[1]);
RealOpenMM sign = dotProduct < zero ? -one : one;
if( signOfAngle ){
if (signOfAngle) {
*signOfAngle = sign;
}
angle *= sign;
......
......@@ -25,16 +25,15 @@
#include <cstring>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceBrownianDynamics.h"
#include "ReferenceVirtualSites.h"
#include "openmm/OpenMMException.h"
#include <cstdio>
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -47,29 +46,15 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
ReferenceBrownianDynamics::ReferenceBrownianDynamics( int numberOfAtoms,
ReferenceBrownianDynamics::ReferenceBrownianDynamics(int numberOfAtoms,
RealOpenMM deltaT, RealOpenMM friction,
RealOpenMM temperature ) :
ReferenceDynamics( numberOfAtoms, deltaT, temperature ), friction( friction ) {
// ---------------------------------------------------------------------------------------
static const char* methodName = "\nReferenceBrownianDynamics::ReferenceBrownianDynamics";
static const RealOpenMM zero = 0.0;
static const RealOpenMM one = 1.0;
// ---------------------------------------------------------------------------------------
if( friction <= zero ){
RealOpenMM temperature) :
ReferenceDynamics(numberOfAtoms, deltaT, temperature), friction(friction) {
if (friction <= 0) {
std::stringstream message;
message << methodName;
message << " input frction value=" << friction << " is invalid -- setting to 1.";
SimTKOpenMMLog::printError( message );
this->friction = one;
message << "illegal friction value: " << friction;
throw OpenMMException(message.str());
}
xPrime.resize(numberOfAtoms);
inverseMasses.resize(numberOfAtoms);
......@@ -81,7 +66,7 @@ ReferenceBrownianDynamics::ReferenceBrownianDynamics( int numberOfAtoms,
--------------------------------------------------------------------------------------- */
ReferenceBrownianDynamics::~ReferenceBrownianDynamics( ){
ReferenceBrownianDynamics::~ReferenceBrownianDynamics() {
// ---------------------------------------------------------------------------------------
......@@ -99,7 +84,7 @@ ReferenceBrownianDynamics::~ReferenceBrownianDynamics( ){
--------------------------------------------------------------------------------------- */
RealOpenMM ReferenceBrownianDynamics::getFriction( void ) const {
RealOpenMM ReferenceBrownianDynamics::getFriction() const {
// ---------------------------------------------------------------------------------------
......@@ -139,10 +124,10 @@ void ReferenceBrownianDynamics::update(const OpenMM::System& system, vector<Real
// first-time-through initialization
int numberOfAtoms = system.getNumParticles();
if( getTimeStep() == 0 ){
if (getTimeStep() == 0) {
// invert masses
for( int ii = 0; ii < numberOfAtoms; ii++ ){
for (int ii = 0; ii < numberOfAtoms; ii++) {
if (masses[ii] == zero)
inverseMasses[ii] = zero;
else
......@@ -152,7 +137,7 @@ void ReferenceBrownianDynamics::update(const OpenMM::System& system, vector<Real
// Perform the integration.
const RealOpenMM noiseAmplitude = static_cast<RealOpenMM>( sqrt(2.0*BOLTZ*getTemperature()*getDeltaT()/getFriction()) );
const RealOpenMM noiseAmplitude = static_cast<RealOpenMM>(sqrt(2.0*BOLTZ*getTemperature()*getDeltaT()/getFriction()));
const RealOpenMM forceScale = getDeltaT()/getFriction();
for (int i = 0; i < numberOfAtoms; ++i) {
if (masses[i] != zero)
......@@ -166,7 +151,7 @@ void ReferenceBrownianDynamics::update(const OpenMM::System& system, vector<Real
// Update the positions and velocities.
RealOpenMM velocityScale = static_cast<RealOpenMM>( 1.0/getDeltaT() );
RealOpenMM velocityScale = static_cast<RealOpenMM>(1.0/getDeltaT());
for (int i = 0; i < numberOfAtoms; ++i) {
if (masses[i] != zero)
for (int j = 0; j < 3; ++j) {
......
......@@ -25,9 +25,7 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMUtilities.h"
#include "SimTKOpenMMLog.h"
#include "ReferenceCCMAAlgorithm.h"
#include "ReferenceDynamics.h"
#include "quern.h"
......@@ -39,9 +37,7 @@ using std::map;
using std::pair;
using std::vector;
using std::set;
using OpenMM::OpenMMException;
using OpenMM::Vec3;
using OpenMM::RealVec;
using namespace OpenMM;
ReferenceCCMAAlgorithm::ReferenceCCMAAlgorithm(int numberOfAtoms,
int numberOfConstraints,
......
......@@ -26,7 +26,7 @@
#include "ReferenceForce.h"
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......
......@@ -24,8 +24,6 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceCustomAngleIxn.h"
#include "ReferenceForce.h"
......@@ -62,7 +60,7 @@ ReferenceCustomAngleIxn::ReferenceCustomAngleIxn(const Lepton::CompiledExpressio
--------------------------------------------------------------------------------------- */
ReferenceCustomAngleIxn::~ReferenceCustomAngleIxn( ){
ReferenceCustomAngleIxn::~ReferenceCustomAngleIxn() {
// ---------------------------------------------------------------------------------------
......@@ -84,11 +82,11 @@ ReferenceCustomAngleIxn::~ReferenceCustomAngleIxn( ){
--------------------------------------------------------------------------------------- */
void ReferenceCustomAngleIxn::calculateBondIxn( int* atomIndices,
vector<RealVec>& atomCoordinates,
RealOpenMM* parameters,
vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const {
void ReferenceCustomAngleIxn::calculateBondIxn(int* atomIndices,
vector<RealVec>& atomCoordinates,
RealOpenMM* parameters,
vector<RealVec>& forces,
RealOpenMM* totalEnergy) const {
static const std::string methodName = "\nReferenceCustomAngleIxn::calculateAngleIxn";
......
......@@ -25,8 +25,6 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceCustomBondIxn.h"
#include "ReferenceForce.h"
......@@ -62,7 +60,7 @@ ReferenceCustomBondIxn::ReferenceCustomBondIxn(const Lepton::CompiledExpression&
--------------------------------------------------------------------------------------- */
ReferenceCustomBondIxn::~ReferenceCustomBondIxn( ){
ReferenceCustomBondIxn::~ReferenceCustomBondIxn() {
// ---------------------------------------------------------------------------------------
......@@ -84,11 +82,11 @@ ReferenceCustomBondIxn::~ReferenceCustomBondIxn( ){
--------------------------------------------------------------------------------------- */
void ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices,
vector<RealVec>& atomCoordinates,
RealOpenMM* parameters,
vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const {
void ReferenceCustomBondIxn::calculateBondIxn(int* atomIndices,
vector<RealVec>& atomCoordinates,
RealOpenMM* parameters,
vector<RealVec>& forces,
RealOpenMM* totalEnergy) const {
static const std::string methodName = "\nReferenceCustomBondIxn::calculateBondIxn";
......@@ -110,7 +108,7 @@ void ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices,
int atomAIndex = atomIndices[0];
int atomBIndex = atomIndices[1];
ReferenceForce::getDeltaR( atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR );
ReferenceForce::getDeltaR(atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR);
ReferenceForce::setVariable(energyR, deltaR[ReferenceForce::RIndex]);
ReferenceForce::setVariable(forceR, deltaR[ReferenceForce::RIndex]);
......
......@@ -26,8 +26,6 @@
#include <sstream>
#include <utility>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h"
#include "ReferenceCustomCompoundBondIxn.h"
......@@ -37,7 +35,7 @@ using std::pair;
using std::string;
using std::stringstream;
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -72,7 +70,7 @@ ReferenceCustomCompoundBondIxn::ReferenceCustomCompoundBondIxn(int numParticlesP
--------------------------------------------------------------------------------------- */
ReferenceCustomCompoundBondIxn::~ReferenceCustomCompoundBondIxn( ){
ReferenceCustomCompoundBondIxn::~ReferenceCustomCompoundBondIxn() {
}
/**---------------------------------------------------------------------------------------
......@@ -93,7 +91,7 @@ void ReferenceCustomCompoundBondIxn::calculatePairIxn(vector<RealVec>& atomCoord
map<string, double> variables = globalParameters;
int numBonds = bondAtoms.size();
for (int bond = 0; bond < numBonds; bond++){
for (int bond = 0; bond < numBonds; bond++) {
for (int j = 0; j < (int) bondParamNames.size(); j++)
variables[bondParamNames[j]] = bondParameters[bond][j];
calculateOneIxn(bond, atomCoordinates, variables, forces, totalEnergy);
......
......@@ -22,8 +22,6 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceVirtualSites.h"
#include "ReferenceCustomDynamics.h"
......@@ -97,7 +95,7 @@ ReferenceCustomDynamics::~ReferenceCustomDynamics() {
void ReferenceCustomDynamics::update(ContextImpl& context, int numberOfAtoms, vector<RealVec>& atomCoordinates,
vector<RealVec>& velocities, vector<RealVec>& forces, vector<RealOpenMM>& masses,
map<string, RealOpenMM>& globals, vector<vector<RealVec> >& perDof, bool& forcesAreValid, RealOpenMM tolerance){
map<string, RealOpenMM>& globals, vector<vector<RealVec> >& perDof, bool& forcesAreValid, RealOpenMM tolerance) {
int numSteps = stepType.size();
globals.insert(context.getParameters().begin(), context.getParameters().end());
oldPos = atomCoordinates;
......
......@@ -25,8 +25,6 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceCustomExternalIxn.h"
#include "ReferenceForce.h"
......@@ -79,7 +77,7 @@ ReferenceCustomExternalIxn::ReferenceCustomExternalIxn(const Lepton::CompiledExp
--------------------------------------------------------------------------------------- */
ReferenceCustomExternalIxn::~ReferenceCustomExternalIxn( ){
ReferenceCustomExternalIxn::~ReferenceCustomExternalIxn() {
// ---------------------------------------------------------------------------------------
......@@ -101,11 +99,11 @@ ReferenceCustomExternalIxn::~ReferenceCustomExternalIxn( ){
--------------------------------------------------------------------------------------- */
void ReferenceCustomExternalIxn::calculateForce( int atomIndex,
void ReferenceCustomExternalIxn::calculateForce(int atomIndex,
vector<RealVec>& atomCoordinates,
RealOpenMM* parameters,
vector<RealVec>& forces,
RealOpenMM* energy ) const {
RealOpenMM* energy) const {
static const std::string methodName = "\nReferenceCustomExternalIxn::calculateBondIxn";
......
......@@ -25,8 +25,6 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h"
#include "ReferenceCustomGBIxn.h"
......@@ -36,7 +34,7 @@ using std::set;
using std::string;
using std::stringstream;
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -86,7 +84,7 @@ ReferenceCustomGBIxn::ReferenceCustomGBIxn(const vector<Lepton::ExpressionProgra
--------------------------------------------------------------------------------------- */
ReferenceCustomGBIxn::~ReferenceCustomGBIxn( ){
ReferenceCustomGBIxn::~ReferenceCustomGBIxn() {
// ---------------------------------------------------------------------------------------
......@@ -105,7 +103,7 @@ ReferenceCustomGBIxn::~ReferenceCustomGBIxn( ){
--------------------------------------------------------------------------------------- */
void ReferenceCustomGBIxn::setUseCutoff( RealOpenMM distance, const OpenMM::NeighborList& neighbors ) {
void ReferenceCustomGBIxn::setUseCutoff(RealOpenMM distance, const OpenMM::NeighborList& neighbors) {
cutoff = true;
cutoffDistance = distance;
......@@ -203,8 +201,8 @@ void ReferenceCustomGBIxn::calculateParticlePairValue(int index, int numAtoms, v
else {
// Perform an O(N^2) loop over all atom pairs.
for (int i = 0; i < numAtoms; i++){
for (int j = i+1; j < numAtoms; j++ ){
for (int i = 0; i < numAtoms; i++) {
for (int j = i+1; j < numAtoms; j++) {
if (useExclusions && exclusions[i].find(j) != exclusions[i].end())
continue;
calculateOnePairValue(index, i, j, atomCoordinates, atomParameters, globalParameters, values);
......@@ -275,8 +273,8 @@ void ReferenceCustomGBIxn::calculateParticlePairEnergyTerm(int index, int numAto
else {
// Perform an O(N^2) loop over all atom pairs.
for (int i = 0; i < numAtoms; i++){
for (int j = i+1; j < numAtoms; j++ ){
for (int i = 0; i < numAtoms; i++) {
for (int j = i+1; j < numAtoms; j++) {
if (useExclusions && exclusions[i].find(j) != exclusions[i].end())
continue;
calculateOnePairEnergyTerm(index, i, j, atomCoordinates, atomParameters, globalParameters, values, forces, totalEnergy, dEdV);
......@@ -344,8 +342,8 @@ void ReferenceCustomGBIxn::calculateChainRuleForces(int numAtoms, vector<RealVec
else {
// Perform an O(N^2) loop over all atom pairs.
for (int i = 0; i < numAtoms; i++){
for (int j = i+1; j < numAtoms; j++ ){
for (int i = 0; i < numAtoms; i++) {
for (int j = i+1; j < numAtoms; j++) {
bool isExcluded = (exclusions[i].find(j) != exclusions[i].end());
calculateOnePairChainRule(i, j, atomCoordinates, atomParameters, globalParameters, values, forces, dEdV, isExcluded);
calculateOnePairChainRule(j, i, atomCoordinates, atomParameters, globalParameters, values, forces, dEdV, isExcluded);
......
......@@ -26,8 +26,6 @@
#include <sstream>
#include <utility>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h"
#include "ReferenceCustomHbondIxn.h"
......@@ -38,7 +36,7 @@ using std::set;
using std::string;
using std::stringstream;
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -65,7 +63,7 @@ ReferenceCustomHbondIxn::ReferenceCustomHbondIxn(const vector<vector<int> >& don
--------------------------------------------------------------------------------------- */
ReferenceCustomHbondIxn::~ReferenceCustomHbondIxn( ){
ReferenceCustomHbondIxn::~ReferenceCustomHbondIxn() {
}
/**---------------------------------------------------------------------------------------
......@@ -129,7 +127,7 @@ void ReferenceCustomHbondIxn::calculatePairIxn(vector<RealVec>& atomCoordinates,
int numDonors = donorAtoms.size();
int numAcceptors = acceptorAtoms.size();
for( int donor = 0; donor < numDonors; donor++ ){
for (int donor = 0; donor < numDonors; donor++) {
// Initialize per-donor parameters.
for (int j = 0; j < (int) donorParamNames.size(); j++)
......@@ -137,7 +135,7 @@ void ReferenceCustomHbondIxn::calculatePairIxn(vector<RealVec>& atomCoordinates,
// loop over atom pairs
for( int acceptor = 0; acceptor < numAcceptors; acceptor++ ){
for (int acceptor = 0; acceptor < numAcceptors; acceptor++) {
if (exclusions[donor].find(acceptor) == exclusions[donor].end()) {
for (int j = 0; j < (int) acceptorParamNames.size(); j++)
variables[acceptorParamNames[j]] = acceptorParameters[acceptor][j];
......
......@@ -26,8 +26,6 @@
#include <sstream>
#include <utility>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h"
#include "ReferenceCustomManyParticleIxn.h"
......@@ -104,7 +102,7 @@ ReferenceCustomManyParticleIxn::ReferenceCustomManyParticleIxn(const CustomManyP
CustomManyParticleForceImpl::buildFilterArrays(force, numTypes, particleTypes, orderIndex, particleOrder);
}
ReferenceCustomManyParticleIxn::~ReferenceCustomManyParticleIxn( ){
ReferenceCustomManyParticleIxn::~ReferenceCustomManyParticleIxn() {
}
void ReferenceCustomManyParticleIxn::calculateIxn(vector<RealVec>& atomCoordinates, RealOpenMM** particleParameters,
......
......@@ -25,8 +25,6 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h"
#include "ReferenceCustomNonbondedIxn.h"
......@@ -37,7 +35,7 @@ using std::string;
using std::stringstream;
using std::set;
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -73,7 +71,7 @@ ReferenceCustomNonbondedIxn::ReferenceCustomNonbondedIxn(const Lepton::CompiledE
--------------------------------------------------------------------------------------- */
ReferenceCustomNonbondedIxn::~ReferenceCustomNonbondedIxn( ){
ReferenceCustomNonbondedIxn::~ReferenceCustomNonbondedIxn() {
// ---------------------------------------------------------------------------------------
......@@ -92,7 +90,7 @@ ReferenceCustomNonbondedIxn::~ReferenceCustomNonbondedIxn( ){
--------------------------------------------------------------------------------------- */
void ReferenceCustomNonbondedIxn::setUseCutoff( RealOpenMM distance, const OpenMM::NeighborList& neighbors ) {
void ReferenceCustomNonbondedIxn::setUseCutoff(RealOpenMM distance, const OpenMM::NeighborList& neighbors) {
cutoff = true;
cutoffDistance = distance;
......@@ -120,7 +118,7 @@ void ReferenceCustomNonbondedIxn::setInteractionGroups(const vector<pair<set<int
--------------------------------------------------------------------------------------- */
void ReferenceCustomNonbondedIxn::setUseSwitchingFunction( RealOpenMM distance ) {
void ReferenceCustomNonbondedIxn::setUseSwitchingFunction(RealOpenMM distance) {
useSwitch = true;
switchingDistance = distance;
}
......@@ -166,10 +164,10 @@ void ReferenceCustomNonbondedIxn::setUseSwitchingFunction( RealOpenMM distance )
--------------------------------------------------------------------------------------- */
void ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, vector<RealVec>& atomCoordinates,
void ReferenceCustomNonbondedIxn::calculatePairIxn(int numberOfAtoms, vector<RealVec>& atomCoordinates,
RealOpenMM** atomParameters, vector<set<int> >& exclusions,
RealOpenMM* fixedParameters, const map<string, double>& globalParameters, vector<RealVec>& forces,
RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) {
RealOpenMM* energyByAtom, RealOpenMM* totalEnergy) {
for (map<string, double>::const_iterator iter = globalParameters.begin(); iter != globalParameters.end(); ++iter) {
ReferenceForce::setVariable(ReferenceForce::getVariablePointer(energyExpression, iter->first), iter->second);
......@@ -245,8 +243,8 @@ void ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, vector<Re
--------------------------------------------------------------------------------------- */
void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& atomCoordinates, vector<RealVec>& forces,
RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) {
void ReferenceCustomNonbondedIxn::calculateOneIxn(int ii, int jj, vector<RealVec>& atomCoordinates, vector<RealVec>& forces,
RealOpenMM* energyByAtom, RealOpenMM* totalEnergy) {
// ---------------------------------------------------------------------------------------
......@@ -268,9 +266,9 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVe
RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (periodic)
ReferenceForce::getDeltaRPeriodic( atomCoordinates[jj], atomCoordinates[ii], periodicBoxVectors, deltaR );
ReferenceForce::getDeltaRPeriodic(atomCoordinates[jj], atomCoordinates[ii], periodicBoxVectors, deltaR);
else
ReferenceForce::getDeltaR( atomCoordinates[jj], atomCoordinates[ii], deltaR );
ReferenceForce::getDeltaR(atomCoordinates[jj], atomCoordinates[ii], deltaR);
RealOpenMM r = deltaR[ReferenceForce::RIndex];
if (cutoff && r >= cutoffDistance)
return;
......@@ -290,7 +288,7 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVe
energy *= switchValue;
}
}
for( int kk = 0; kk < 3; kk++ ){
for (int kk = 0; kk < 3; kk++) {
RealOpenMM force = -dEdR*deltaR[kk];
forces[ii][kk] += force;
forces[jj][kk] -= force;
......@@ -298,10 +296,10 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVe
// accumulate energies
if( totalEnergy || energyByAtom ) {
if( totalEnergy )
if (totalEnergy || energyByAtom) {
if (totalEnergy)
*totalEnergy += energy;
if( energyByAtom ){
if (energyByAtom) {
energyByAtom[ii] += energy;
energyByAtom[jj] += energy;
}
......
......@@ -24,8 +24,6 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceCustomTorsionIxn.h"
#include "ReferenceForce.h"
......@@ -62,7 +60,7 @@ ReferenceCustomTorsionIxn::ReferenceCustomTorsionIxn(const Lepton::CompiledExpre
--------------------------------------------------------------------------------------- */
ReferenceCustomTorsionIxn::~ReferenceCustomTorsionIxn( ){
ReferenceCustomTorsionIxn::~ReferenceCustomTorsionIxn() {
// ---------------------------------------------------------------------------------------
......@@ -84,11 +82,11 @@ ReferenceCustomTorsionIxn::~ReferenceCustomTorsionIxn( ){
--------------------------------------------------------------------------------------- */
void ReferenceCustomTorsionIxn::calculateBondIxn( int* atomIndices,
void ReferenceCustomTorsionIxn::calculateBondIxn(int* atomIndices,
vector<RealVec>& atomCoordinates,
RealOpenMM* parameters,
vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const {
RealOpenMM* totalEnergy) const {
static const std::string methodName = "\nReferenceCustomTorsionIxn::calculateTorsionIxn";
......@@ -136,20 +134,20 @@ void ReferenceCustomTorsionIxn::calculateBondIxn( int* atomIndices,
RealOpenMM internalF[4][3];
RealOpenMM forceFactors[4];
RealOpenMM normCross1 = DOT3( crossProduct[0], crossProduct[0] );
RealOpenMM normCross1 = DOT3(crossProduct[0], crossProduct[0]);
RealOpenMM normBC = deltaR[1][ReferenceForce::RIndex];
forceFactors[0] = (-dEdAngle*normBC)/normCross1;
RealOpenMM normCross2 = DOT3( crossProduct[1], crossProduct[1] );
RealOpenMM normCross2 = DOT3(crossProduct[1], crossProduct[1]);
forceFactors[3] = (dEdAngle*normBC)/normCross2;
forceFactors[1] = DOT3( deltaR[0], deltaR[1] );
forceFactors[1] = DOT3(deltaR[0], deltaR[1]);
forceFactors[1] /= deltaR[1][ReferenceForce::R2Index];
forceFactors[2] = DOT3( deltaR[2], deltaR[1] );
forceFactors[2] = DOT3(deltaR[2], deltaR[1]);
forceFactors[2] /= deltaR[1][ReferenceForce::R2Index];
for( int ii = 0; ii < 3; ii++ ){
for (int ii = 0; ii < 3; ii++) {
internalF[0][ii] = forceFactors[0]*crossProduct[0][ii];
internalF[3][ii] = forceFactors[3]*crossProduct[1][ii];
......@@ -162,7 +160,7 @@ void ReferenceCustomTorsionIxn::calculateBondIxn( int* atomIndices,
// accumulate forces
for( int ii = 0; ii < 3; ii++ ){
for (int ii = 0; ii < 3; ii++) {
forces[atomAIndex][ii] += internalF[0][ii];
forces[atomBIndex][ii] -= internalF[1][ii];
forces[atomCIndex][ii] -= internalF[2][ii];
......
......@@ -25,15 +25,13 @@
#include <cstring>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceDynamics.h"
#include <cstdio>
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -46,7 +44,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
ReferenceDynamics::ReferenceDynamics( int numberOfAtoms, RealOpenMM deltaT, RealOpenMM temperature ) :
ReferenceDynamics::ReferenceDynamics(int numberOfAtoms, RealOpenMM deltaT, RealOpenMM temperature) :
_numberOfAtoms(numberOfAtoms), _deltaT(deltaT), _temperature(temperature) {
// ---------------------------------------------------------------------------------------
......@@ -69,7 +67,7 @@ ReferenceDynamics::ReferenceDynamics( int numberOfAtoms, RealOpenMM deltaT, Rea
--------------------------------------------------------------------------------------- */
ReferenceDynamics::~ReferenceDynamics( ){
ReferenceDynamics::~ReferenceDynamics() {
// ---------------------------------------------------------------------------------------
......@@ -77,7 +75,7 @@ ReferenceDynamics::~ReferenceDynamics( ){
// ---------------------------------------------------------------------------------------
if( _ownReferenceConstraint ){
if (_ownReferenceConstraint) {
delete _referenceConstraint;
}
}
......@@ -90,7 +88,7 @@ ReferenceDynamics::~ReferenceDynamics( ){
--------------------------------------------------------------------------------------- */
int ReferenceDynamics::getNumberOfAtoms( void ) const {
int ReferenceDynamics::getNumberOfAtoms() const {
// ---------------------------------------------------------------------------------------
......@@ -109,7 +107,7 @@ int ReferenceDynamics::getNumberOfAtoms( void ) const {
--------------------------------------------------------------------------------------- */
int ReferenceDynamics::getTimeStep( void ) const {
int ReferenceDynamics::getTimeStep() const {
// ---------------------------------------------------------------------------------------
......@@ -128,7 +126,7 @@ int ReferenceDynamics::getTimeStep( void ) const {
--------------------------------------------------------------------------------------- */
int ReferenceDynamics::incrementTimeStep( void ){
int ReferenceDynamics::incrementTimeStep() {
// ---------------------------------------------------------------------------------------
......@@ -147,7 +145,7 @@ int ReferenceDynamics::incrementTimeStep( void ){
--------------------------------------------------------------------------------------- */
RealOpenMM ReferenceDynamics::getDeltaT( void ) const {
RealOpenMM ReferenceDynamics::getDeltaT() const {
// ---------------------------------------------------------------------------------------
......@@ -164,7 +162,7 @@ RealOpenMM ReferenceDynamics::getDeltaT( void ) const {
--------------------------------------------------------------------------------------- */
void ReferenceDynamics::setDeltaT( RealOpenMM deltaT ) {
void ReferenceDynamics::setDeltaT(RealOpenMM deltaT) {
// ---------------------------------------------------------------------------------------
......@@ -183,7 +181,7 @@ void ReferenceDynamics::setDeltaT( RealOpenMM deltaT ) {
--------------------------------------------------------------------------------------- */
RealOpenMM ReferenceDynamics::getTemperature( void ) const {
RealOpenMM ReferenceDynamics::getTemperature() const {
// ---------------------------------------------------------------------------------------
......@@ -202,7 +200,7 @@ RealOpenMM ReferenceDynamics::getTemperature( void ) const {
--------------------------------------------------------------------------------------- */
ReferenceConstraintAlgorithm* ReferenceDynamics::getReferenceConstraintAlgorithm( void ) const {
ReferenceConstraintAlgorithm* ReferenceDynamics::getReferenceConstraintAlgorithm() const {
// ---------------------------------------------------------------------------------------
......@@ -221,7 +219,7 @@ ReferenceConstraintAlgorithm* ReferenceDynamics::getReferenceConstraintAlgorithm
--------------------------------------------------------------------------------------- */
void ReferenceDynamics::setReferenceConstraintAlgorithm( ReferenceConstraintAlgorithm* referenceConstraint ){
void ReferenceDynamics::setReferenceConstraintAlgorithm(ReferenceConstraintAlgorithm* referenceConstraint) {
// ---------------------------------------------------------------------------------------
......@@ -231,7 +229,7 @@ void ReferenceDynamics::setReferenceConstraintAlgorithm( ReferenceConstraintAlgo
// delete if own
if( _referenceConstraint && _ownReferenceConstraint ){
if (_referenceConstraint && _ownReferenceConstraint) {
delete _referenceConstraint;
}
......
......@@ -25,14 +25,12 @@
#include <cstring>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h"
#include <cstdio>
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -40,7 +38,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
ReferenceForce::ReferenceForce( ){
ReferenceForce::ReferenceForce() {
}
/**---------------------------------------------------------------------------------------
......@@ -49,7 +47,7 @@ ReferenceForce::ReferenceForce( ){
--------------------------------------------------------------------------------------- */
ReferenceForce::~ReferenceForce( ){
ReferenceForce::~ReferenceForce() {
}
/**---------------------------------------------------------------------------------------
......@@ -65,28 +63,28 @@ RealOpenMM ReferenceForce::periodicDifference(RealOpenMM val1, RealOpenMM val2,
}
void ReferenceForce::getDeltaR( const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
RealOpenMM* deltaR ){
void ReferenceForce::getDeltaR(const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
RealOpenMM* deltaR) {
deltaR[XIndex] = atomCoordinatesJ[0] - atomCoordinatesI[0];
deltaR[YIndex] = atomCoordinatesJ[1] - atomCoordinatesI[1];
deltaR[ZIndex] = atomCoordinatesJ[2] - atomCoordinatesI[2];
deltaR[R2Index] = DOT3( deltaR, deltaR );
deltaR[RIndex] = (RealOpenMM) SQRT( deltaR[R2Index] );
deltaR[R2Index] = DOT3(deltaR, deltaR);
deltaR[RIndex] = (RealOpenMM) SQRT(deltaR[R2Index]);
}
void ReferenceForce::getDeltaRPeriodic( const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
const RealOpenMM* boxSize, RealOpenMM* deltaR ){
void ReferenceForce::getDeltaRPeriodic(const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
const RealOpenMM* boxSize, RealOpenMM* deltaR) {
deltaR[XIndex] = periodicDifference(atomCoordinatesJ[0], atomCoordinatesI[0], boxSize[0]);
deltaR[YIndex] = periodicDifference(atomCoordinatesJ[1], atomCoordinatesI[1], boxSize[1]);
deltaR[ZIndex] = periodicDifference(atomCoordinatesJ[2], atomCoordinatesI[2], boxSize[2]);
deltaR[R2Index] = DOT3( deltaR, deltaR );
deltaR[RIndex] = (RealOpenMM) SQRT( deltaR[R2Index] );
deltaR[R2Index] = DOT3(deltaR, deltaR);
deltaR[RIndex] = (RealOpenMM) SQRT(deltaR[R2Index]);
}
void ReferenceForce::getDeltaRPeriodic( const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
const RealVec* boxVectors, RealOpenMM* deltaR ){
void ReferenceForce::getDeltaRPeriodic(const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
const RealVec* boxVectors, RealOpenMM* deltaR) {
RealVec diff = atomCoordinatesJ-atomCoordinatesI;
diff -= boxVectors[2]*floor(diff[2]/boxVectors[2][2]+0.5);
diff -= boxVectors[1]*floor(diff[1]/boxVectors[1][1]+0.5);
......
......@@ -26,32 +26,31 @@
#include <sstream>
#include <stdio.h>
#include "SimTKOpenMMCommon.h"
#include "ReferenceForce.h"
#include "CpuGBVI.h"
#include "ReferenceGBVI.h"
using namespace std;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
CpuGBVI constructor
ReferenceGBVI constructor
gbviParameters gbviParameters object
--------------------------------------------------------------------------------------- */
CpuGBVI::CpuGBVI( GBVIParameters* gbviParameters ) : _gbviParameters(gbviParameters) {
_switchDeriviative.resize( gbviParameters->getNumberOfAtoms() );
ReferenceGBVI::ReferenceGBVI(GBVIParameters* gbviParameters) : _gbviParameters(gbviParameters) {
_switchDeriviative.resize(gbviParameters->getNumberOfAtoms());
}
/**---------------------------------------------------------------------------------------
CpuGBVI destructor
ReferenceGBVI destructor
--------------------------------------------------------------------------------------- */
CpuGBVI::~CpuGBVI( ){
ReferenceGBVI::~ReferenceGBVI() {
}
/**---------------------------------------------------------------------------------------
......@@ -62,7 +61,7 @@ CpuGBVI::~CpuGBVI( ){
--------------------------------------------------------------------------------------- */
GBVIParameters* CpuGBVI::getGBVIParameters( void ) const {
GBVIParameters* ReferenceGBVI::getGBVIParameters() const {
return _gbviParameters;
}
......@@ -74,7 +73,7 @@ GBVIParameters* CpuGBVI::getGBVIParameters( void ) const {
--------------------------------------------------------------------------------------- */
void CpuGBVI::setGBVIParameters( GBVIParameters* gbviParameters ){
void ReferenceGBVI::setGBVIParameters(GBVIParameters* gbviParameters) {
_gbviParameters = gbviParameters;
}
......@@ -86,7 +85,7 @@ void CpuGBVI::setGBVIParameters( GBVIParameters* gbviParameters ){
--------------------------------------------------------------------------------------- */
RealOpenMMVector& CpuGBVI::getSwitchDeriviative( void ){
vector<RealOpenMM>& ReferenceGBVI::getSwitchDeriviative() {
return _switchDeriviative;
}
......@@ -102,17 +101,17 @@ RealOpenMMVector& CpuGBVI::getSwitchDeriviative( void ){
--------------------------------------------------------------------------------------- */
void CpuGBVI::quinticSpline( RealOpenMM x, RealOpenMM rl, RealOpenMM ru,
RealOpenMM* outValue, RealOpenMM* outDerivative ){
void ReferenceGBVI::quinticSpline(RealOpenMM x, RealOpenMM rl, RealOpenMM ru,
RealOpenMM* outValue, RealOpenMM* outDerivative) {
// ---------------------------------------------------------------------------------------
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 );
static const RealOpenMM minusSix = static_cast<RealOpenMM>( -6.0 );
static const RealOpenMM minusTen = static_cast<RealOpenMM>( -10.0 );
static const RealOpenMM minusThirty = static_cast<RealOpenMM>( -30.0 );
static const RealOpenMM fifteen = static_cast<RealOpenMM>( 15.0 );
static const RealOpenMM sixty = static_cast<RealOpenMM>( 60.0 );
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0);
static const RealOpenMM minusSix = static_cast<RealOpenMM>( -6.0);
static const RealOpenMM minusTen = static_cast<RealOpenMM>(-10.0);
static const RealOpenMM minusThirty = static_cast<RealOpenMM>(-30.0);
static const RealOpenMM fifteen = static_cast<RealOpenMM>( 15.0);
static const RealOpenMM sixty = static_cast<RealOpenMM>( 60.0);
// ---------------------------------------------------------------------------------------
......@@ -140,19 +139,19 @@ void CpuGBVI::quinticSpline( RealOpenMM x, RealOpenMM rl, RealOpenMM ru,
--------------------------------------------------------------------------------------- */
void CpuGBVI::computeBornRadiiUsingQuinticSpline( RealOpenMM atomicRadius3, RealOpenMM bornSum,
GBVIParameters* gbviParameters,
RealOpenMM* bornRadius, RealOpenMM* switchDeriviative ){
void ReferenceGBVI::computeBornRadiiUsingQuinticSpline(RealOpenMM atomicRadius3, RealOpenMM bornSum,
GBVIParameters* gbviParameters,
RealOpenMM* bornRadius, RealOpenMM* switchDeriviative) {
// ---------------------------------------------------------------------------------------
static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0 );
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 );
static const RealOpenMM minusOne = static_cast<RealOpenMM>( -1.0 );
static const RealOpenMM minusThree = static_cast<RealOpenMM>( -3.0 );
static const RealOpenMM oneEighth = static_cast<RealOpenMM>( 0.125 );
static const RealOpenMM minusOneThird = static_cast<RealOpenMM>( (-1.0/3.0) );
static const RealOpenMM three = static_cast<RealOpenMM>( 3.0 );
static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0);
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0);
static const RealOpenMM minusOne = static_cast<RealOpenMM>(-1.0);
static const RealOpenMM minusThree = static_cast<RealOpenMM>(-3.0);
static const RealOpenMM oneEighth = static_cast<RealOpenMM>( 0.125);
static const RealOpenMM minusOneThird = static_cast<RealOpenMM>((-1.0/3.0));
static const RealOpenMM three = static_cast<RealOpenMM>( 3.0);
// ---------------------------------------------------------------------------------------
......@@ -176,10 +175,10 @@ void CpuGBVI::computeBornRadiiUsingQuinticSpline( RealOpenMM atomicRadius3, Real
RealOpenMM splineL = gbviParameters->getQuinticLowerLimitFactor()*atomicRadius3;
RealOpenMM sum;
if( bornSum > splineL ){
if( bornSum < atomicRadius3 ){
if (bornSum > splineL) {
if (bornSum < atomicRadius3) {
RealOpenMM splineValue, splineDerivative;
quinticSpline( bornSum, splineL, atomicRadius3, &splineValue, &splineDerivative );
quinticSpline(bornSum, splineL, atomicRadius3, &splineValue, &splineDerivative);
sum = (atomicRadius3 - bornSum)*splineValue + gbviParameters->getQuinticUpperBornRadiusLimit();
*switchDeriviative = splineValue - (atomicRadius3 - bornSum)*splineDerivative;
} else {
......@@ -190,7 +189,7 @@ void CpuGBVI::computeBornRadiiUsingQuinticSpline( RealOpenMM atomicRadius3, Real
sum = atomicRadius3 - bornSum;
*switchDeriviative = one;
}
*bornRadius = POW( sum, minusOneThird );
*bornRadius = POW(sum, minusOneThird);
}
/**---------------------------------------------------------------------------------------
......@@ -203,66 +202,66 @@ void CpuGBVI::computeBornRadiiUsingQuinticSpline( RealOpenMM atomicRadius3, Real
--------------------------------------------------------------------------------------- */
void CpuGBVI::computeBornRadii( const vector<RealVec>& atomCoordinates, RealOpenMMVector& bornRadii ){
void ReferenceGBVI::computeBornRadii(const vector<RealVec>& atomCoordinates, vector<RealOpenMM>& bornRadii) {
// ---------------------------------------------------------------------------------------
static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0 );
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 );
static const RealOpenMM minusThree = static_cast<RealOpenMM>( -3.0 );
static const RealOpenMM oneEighth = static_cast<RealOpenMM>( 0.125 );
static const RealOpenMM minusOneThird = static_cast<RealOpenMM>( (-1.0/3.0) );
static const RealOpenMM three = static_cast<RealOpenMM>( 3.0 );
static const RealOpenMM zero = static_cast<RealOpenMM>(0.0);
static const RealOpenMM one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM minusThree = static_cast<RealOpenMM>(-3.0);
static const RealOpenMM oneEighth = static_cast<RealOpenMM>(0.125);
static const RealOpenMM minusOneThird = static_cast<RealOpenMM>((-1.0/3.0));
static const RealOpenMM three = static_cast<RealOpenMM>(3.0);
// ---------------------------------------------------------------------------------------
GBVIParameters* gbviParameters = getGBVIParameters();
int numberOfAtoms = gbviParameters->getNumberOfAtoms();
const RealOpenMMVector& atomicRadii = gbviParameters->getAtomicRadii();
const RealOpenMMVector& scaledRadii = gbviParameters->getScaledRadii();
const vector<RealOpenMM>& atomicRadii = gbviParameters->getAtomicRadii();
const vector<RealOpenMM>& scaledRadii = gbviParameters->getScaledRadii();
RealOpenMMVector& switchDeriviatives = getSwitchDeriviative();
vector<RealOpenMM>& switchDeriviatives = getSwitchDeriviative();
// ---------------------------------------------------------------------------------------
// calculate Born radii
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){
for (int atomI = 0; atomI < numberOfAtoms; atomI++) {
RealOpenMM radiusI = atomicRadii[atomI];
RealOpenMM sum = zero;
// sum over volumes
for( int atomJ = 0; atomJ < numberOfAtoms; atomJ++ ){
for (int atomJ = 0; atomJ < numberOfAtoms; atomJ++) {
if( atomJ != atomI ){
if (atomJ != atomI) {
RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (_gbviParameters->getPeriodic())
ReferenceForce::getDeltaRPeriodic( atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR );
ReferenceForce::getDeltaRPeriodic(atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR);
else
ReferenceForce::getDeltaR( atomCoordinates[atomI], atomCoordinates[atomJ], deltaR );
ReferenceForce::getDeltaR(atomCoordinates[atomI], atomCoordinates[atomJ], deltaR);
RealOpenMM r = deltaR[ReferenceForce::RIndex];
if (_gbviParameters->getUseCutoff() && r > _gbviParameters->getCutoffDistance())
continue;
sum += CpuGBVI::getVolume( r, radiusI, scaledRadii[atomJ] );
sum += ReferenceGBVI::getVolume(r, radiusI, scaledRadii[atomJ]);
}
}
RealOpenMM atomicRadius3 = POW( radiusI, minusThree );
if( _gbviParameters->getBornRadiusScalingMethod() != GBVIParameters::QuinticSpline ){
RealOpenMM atomicRadius3 = POW(radiusI, minusThree);
if (_gbviParameters->getBornRadiusScalingMethod() != GBVIParameters::QuinticSpline) {
sum = atomicRadius3 - sum;
bornRadii[atomI] = POW( sum, minusOneThird );
bornRadii[atomI] = POW(sum, minusOneThird);
switchDeriviatives[atomI] = one;
} else {
RealOpenMM bornRadius, switchDeriviative;
computeBornRadiiUsingQuinticSpline( atomicRadius3, sum, gbviParameters,
&bornRadius, &switchDeriviative );
computeBornRadiiUsingQuinticSpline(atomicRadius3, sum, gbviParameters,
&bornRadius, &switchDeriviative);
bornRadii[atomI] = bornRadius;
switchDeriviatives[atomI] = switchDeriviative;
}
......@@ -281,25 +280,25 @@ void CpuGBVI::computeBornRadii( const vector<RealVec>& atomCoordinates, RealOpen
--------------------------------------------------------------------------------------- */
RealOpenMM CpuGBVI::getVolume( RealOpenMM r, RealOpenMM R, RealOpenMM S ){
RealOpenMM ReferenceGBVI::getVolume(RealOpenMM r, RealOpenMM R, RealOpenMM S) {
// ---------------------------------------------------------------------------------------
static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0 );
static const RealOpenMM minusThree = static_cast<RealOpenMM>( -3.0 );
static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0);
static const RealOpenMM minusThree = static_cast<RealOpenMM>(-3.0);
RealOpenMM diff = (S - R);
if( FABS( diff ) < r ){
if (FABS(diff) < r) {
RealOpenMM lowerBound = (R > (r - S)) ? R : (r - S);
return (CpuGBVI::getL( r, (r + S), S ) -
CpuGBVI::getL( r, lowerBound, S ));
return (ReferenceGBVI::getL(r, (r + S), S) -
ReferenceGBVI::getL(r, lowerBound, S));
} else if( r <= diff ){
} else if (r <= diff) {
return CpuGBVI::getL( r, (r + S), S ) -
CpuGBVI::getL( r, (r - S), S ) +
POW( R, minusThree );
return ReferenceGBVI::getL(r, (r + S), S) -
ReferenceGBVI::getL(r, (r - S), S) +
POW(R, minusThree);
} else {
return zero;
......@@ -318,15 +317,15 @@ RealOpenMM CpuGBVI::getVolume( RealOpenMM r, RealOpenMM R, RealOpenMM S ){
--------------------------------------------------------------------------------------- */
RealOpenMM CpuGBVI::getL( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
RealOpenMM ReferenceGBVI::getL(RealOpenMM r, RealOpenMM x, RealOpenMM S) {
// ---------------------------------------------------------------------------------------
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 );
static const RealOpenMM threeHalves = static_cast<RealOpenMM>( 1.5 );
static const RealOpenMM third = static_cast<RealOpenMM>( (1.0/3.0) );
static const RealOpenMM fourth = static_cast<RealOpenMM>( 0.25 );
static const RealOpenMM eighth = static_cast<RealOpenMM>( 0.125 );
static const RealOpenMM one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM threeHalves = static_cast<RealOpenMM>(1.5);
static const RealOpenMM third = static_cast<RealOpenMM>((1.0/3.0));
static const RealOpenMM fourth = static_cast<RealOpenMM>(0.25);
static const RealOpenMM eighth = static_cast<RealOpenMM>(0.125);
// ---------------------------------------------------------------------------------------
......@@ -338,7 +337,7 @@ RealOpenMM CpuGBVI::getL( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
RealOpenMM diff2 = (r + S)*(r - S);
return (threeHalves*xInv)*( (xInv*fourth*rInv) - (xInv2*third) + (diff2*xInv3*eighth*rInv) );
return (threeHalves*xInv)*((xInv*fourth*rInv) - (xInv2*third) + (diff2*xInv3*eighth*rInv));
}
/**---------------------------------------------------------------------------------------
......@@ -353,16 +352,16 @@ RealOpenMM CpuGBVI::getL( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
--------------------------------------------------------------------------------------- */
RealOpenMM CpuGBVI::dL_dr( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
RealOpenMM ReferenceGBVI::dL_dr(RealOpenMM r, RealOpenMM x, RealOpenMM S) {
// ---------------------------------------------------------------------------------------
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 );
static const RealOpenMM threeHalves = static_cast<RealOpenMM>( 1.5 );
static const RealOpenMM threeEights = static_cast<RealOpenMM>( 0.375 );
static const RealOpenMM third = static_cast<RealOpenMM>( (1.0/3.0) );
static const RealOpenMM fourth = static_cast<RealOpenMM>( 0.25 );
static const RealOpenMM eighth = static_cast<RealOpenMM>( 0.125 );
static const RealOpenMM one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM threeHalves = static_cast<RealOpenMM>(1.5);
static const RealOpenMM threeEights = static_cast<RealOpenMM>(0.375);
static const RealOpenMM third = static_cast<RealOpenMM>((1.0/3.0));
static const RealOpenMM fourth = static_cast<RealOpenMM>(0.25);
static const RealOpenMM eighth = static_cast<RealOpenMM>(0.125);
// ---------------------------------------------------------------------------------------
......@@ -375,7 +374,7 @@ RealOpenMM CpuGBVI::dL_dr( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
RealOpenMM diff2 = (r + S)*(r - S);
return ( (-threeHalves*xInv2*rInv2)*( fourth + eighth*diff2*xInv2 ) + threeEights*xInv3*xInv );
return ((-threeHalves*xInv2*rInv2)*(fourth + eighth*diff2*xInv2) + threeEights*xInv3*xInv);
}
/**---------------------------------------------------------------------------------------
......@@ -390,14 +389,14 @@ RealOpenMM CpuGBVI::dL_dr( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
--------------------------------------------------------------------------------------- */
RealOpenMM CpuGBVI::dL_dx( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
RealOpenMM ReferenceGBVI::dL_dx(RealOpenMM r, RealOpenMM x, RealOpenMM S) {
// ---------------------------------------------------------------------------------------
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 );
static const RealOpenMM half = static_cast<RealOpenMM>( 0.5 );
static const RealOpenMM threeHalvesM = static_cast<RealOpenMM>( -1.5 );
static const RealOpenMM third = static_cast<RealOpenMM>( (1.0/3.0) );
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0);
static const RealOpenMM half = static_cast<RealOpenMM>( 0.5);
static const RealOpenMM threeHalvesM = static_cast<RealOpenMM>(-1.5);
static const RealOpenMM third = static_cast<RealOpenMM>( (1.0/3.0));
// ---------------------------------------------------------------------------------------
......@@ -409,7 +408,7 @@ RealOpenMM CpuGBVI::dL_dx( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
RealOpenMM diff = (r + S)*(r - S);
return (threeHalvesM*xInv3)*( (half*rInv) - xInv + (half*diff*xInv2*rInv) );
return (threeHalvesM*xInv3)*((half*rInv) - xInv + (half*diff*xInv2*rInv));
}
/**---------------------------------------------------------------------------------------
......@@ -422,19 +421,19 @@ RealOpenMM CpuGBVI::dL_dx( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
--------------------------------------------------------------------------------------- */
RealOpenMM CpuGBVI::Sgb( RealOpenMM t ){
RealOpenMM ReferenceGBVI::Sgb(RealOpenMM t) {
// ---------------------------------------------------------------------------------------
// static const char* methodName = "CpuGBVI::Sgb";
// static const char* methodName = "ReferenceGBVI::Sgb";
static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0 );
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 );
static const RealOpenMM fourth = static_cast<RealOpenMM>( 0.25 );
static const RealOpenMM zero = static_cast<RealOpenMM>(0.0);
static const RealOpenMM one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM fourth = static_cast<RealOpenMM>(0.25);
// ---------------------------------------------------------------------------------------
return ( (t != zero) ? one/SQRT( (one + (fourth*EXP( -t ))/t) ) : zero);
return ((t != zero) ? one/SQRT((one + (fourth*EXP(-t))/t)) : zero);
}
/**---------------------------------------------------------------------------------------
......@@ -448,31 +447,31 @@ RealOpenMM CpuGBVI::Sgb( RealOpenMM t ){
--------------------------------------------------------------------------------------- */
RealOpenMM CpuGBVI::computeBornEnergy( const vector<RealVec>& atomCoordinates, const RealOpenMMVector& partialCharges ){
RealOpenMM ReferenceGBVI::computeBornEnergy(const vector<RealVec>& atomCoordinates, const vector<RealOpenMM>& partialCharges) {
// ---------------------------------------------------------------------------------------
static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0 );
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 );
static const RealOpenMM two = static_cast<RealOpenMM>( 2.0 );
static const RealOpenMM three = static_cast<RealOpenMM>( 3.0 );
static const RealOpenMM four = static_cast<RealOpenMM>( 4.0 );
static const RealOpenMM half = static_cast<RealOpenMM>( 0.5 );
static const RealOpenMM fourth = static_cast<RealOpenMM>( 0.25 );
static const RealOpenMM eighth = static_cast<RealOpenMM>( 0.125 );
static const RealOpenMM zero = static_cast<RealOpenMM>(0.0);
static const RealOpenMM one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM two = static_cast<RealOpenMM>(2.0);
static const RealOpenMM three = static_cast<RealOpenMM>(3.0);
static const RealOpenMM four = static_cast<RealOpenMM>(4.0);
static const RealOpenMM half = static_cast<RealOpenMM>(0.5);
static const RealOpenMM fourth = static_cast<RealOpenMM>(0.25);
static const RealOpenMM eighth = static_cast<RealOpenMM>(0.125);
// ---------------------------------------------------------------------------------------
const GBVIParameters* gbviParameters = getGBVIParameters();
const RealOpenMM preFactor = gbviParameters->getElectricConstant();
const int numberOfAtoms = gbviParameters->getNumberOfAtoms();
const RealOpenMMVector& atomicRadii = gbviParameters->getAtomicRadii();
const RealOpenMMVector& gammaParameters = gbviParameters->getGammaParameters();
const vector<RealOpenMM>& atomicRadii = gbviParameters->getAtomicRadii();
const vector<RealOpenMM>& gammaParameters = gbviParameters->getGammaParameters();
// compute Born radii
RealOpenMMVector bornRadii( numberOfAtoms );
computeBornRadii( atomCoordinates, bornRadii );
vector<RealOpenMM> bornRadii(numberOfAtoms);
computeBornRadii(atomCoordinates, bornRadii);
// ---------------------------------------------------------------------------------------
......@@ -483,7 +482,7 @@ RealOpenMM CpuGBVI::computeBornEnergy( const vector<RealVec>& atomCoordinates, c
RealOpenMM energy = zero;
RealOpenMM cavityEnergy = zero;
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){
for (int atomI = 0; atomI < numberOfAtoms; atomI++) {
RealOpenMM partialChargeI = partialCharges[atomI];
......@@ -496,19 +495,19 @@ RealOpenMM CpuGBVI::computeBornEnergy( const vector<RealVec>& atomCoordinates, c
RealOpenMM ratio = (atomicRadii[atomI]/bornRadii[atomI]);
cavityEnergy += gammaParameters[atomI]*ratio*ratio*ratio;
for( int atomJ = atomI + 1; atomJ < numberOfAtoms; atomJ++ ){
for (int atomJ = atomI + 1; atomJ < numberOfAtoms; atomJ++) {
RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (_gbviParameters->getPeriodic())
ReferenceForce::getDeltaRPeriodic( atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR );
ReferenceForce::getDeltaRPeriodic(atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR);
else
ReferenceForce::getDeltaR( atomCoordinates[atomI], atomCoordinates[atomJ], deltaR );
ReferenceForce::getDeltaR(atomCoordinates[atomI], atomCoordinates[atomJ], deltaR);
if (_gbviParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _gbviParameters->getCutoffDistance())
continue;
RealOpenMM r2 = deltaR[ReferenceForce::R2Index];
RealOpenMM t = fourth*r2/(bornRadii[atomI]*bornRadii[atomJ]);
atomIEnergy += partialCharges[atomJ]*Sgb( t )/deltaR[ReferenceForce::RIndex];
atomIEnergy += partialCharges[atomJ]*Sgb(t)/deltaR[ReferenceForce::RIndex];
}
energy += two*partialChargeI*atomIEnergy;
......@@ -532,27 +531,27 @@ RealOpenMM CpuGBVI::computeBornEnergy( const vector<RealVec>& atomCoordinates, c
--------------------------------------------------------------------------------------- */
void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const RealOpenMMVector& partialCharges,
std::vector<OpenMM::RealVec>& inputForces){
void ReferenceGBVI::computeBornForces(std::vector<RealVec>& atomCoordinates, const vector<RealOpenMM>& partialCharges,
std::vector<OpenMM::RealVec>& inputForces) {
// ---------------------------------------------------------------------------------------
static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0 );
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 );
static const RealOpenMM two = static_cast<RealOpenMM>( 2.0 );
static const RealOpenMM three = static_cast<RealOpenMM>( 3.0 );
static const RealOpenMM four = static_cast<RealOpenMM>( 4.0 );
static const RealOpenMM half = static_cast<RealOpenMM>( 0.5 );
static const RealOpenMM oneThird = static_cast<RealOpenMM>( (1.0/3.0) );
static const RealOpenMM fourth = static_cast<RealOpenMM>( 0.25 );
static const RealOpenMM eighth = static_cast<RealOpenMM>( 0.125 );
static const RealOpenMM zero = static_cast<RealOpenMM>(0.0);
static const RealOpenMM one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM two = static_cast<RealOpenMM>(2.0);
static const RealOpenMM three = static_cast<RealOpenMM>(3.0);
static const RealOpenMM four = static_cast<RealOpenMM>(4.0);
static const RealOpenMM half = static_cast<RealOpenMM>(0.5);
static const RealOpenMM oneThird = static_cast<RealOpenMM>((1.0/3.0));
static const RealOpenMM fourth = static_cast<RealOpenMM>(0.25);
static const RealOpenMM eighth = static_cast<RealOpenMM>(0.125);
// ---------------------------------------------------------------------------------------
const GBVIParameters* gbviParameters = getGBVIParameters();
const int numberOfAtoms = gbviParameters->getNumberOfAtoms();
const RealOpenMMVector& atomicRadii = gbviParameters->getAtomicRadii();
const RealOpenMMVector& gammaParameters = gbviParameters->getGammaParameters();
const vector<RealOpenMM>& atomicRadii = gbviParameters->getAtomicRadii();
const vector<RealOpenMM>& gammaParameters = gbviParameters->getGammaParameters();
// ---------------------------------------------------------------------------------------
......@@ -564,37 +563,37 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
// compute Born radii
RealOpenMMVector bornRadii( numberOfAtoms );
computeBornRadii( atomCoordinates, bornRadii );
vector<RealOpenMM> bornRadii(numberOfAtoms);
computeBornRadii(atomCoordinates, bornRadii);
// set energy/forces to zero
std::vector<OpenMM::RealVec> forces( numberOfAtoms );
for( int ii = 0; ii < numberOfAtoms; ii++ ){
std::vector<OpenMM::RealVec> forces(numberOfAtoms);
for (int ii = 0; ii < numberOfAtoms; ii++) {
forces[ii][0] = zero;
forces[ii][1] = zero;
forces[ii][2] = zero;
}
RealOpenMMVector bornForces( numberOfAtoms, 0.0);
vector<RealOpenMM> bornForces(numberOfAtoms, 0.0);
// ---------------------------------------------------------------------------------------
// first main loop
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){
for (int atomI = 0; atomI < numberOfAtoms; atomI++) {
// partial of polar term wrt Born radius
// and (dGpol/dr)(dr/dx)
RealOpenMM partialChargeI = preFactor*partialCharges[atomI];
for( int atomJ = atomI; atomJ < numberOfAtoms; atomJ++ ){
for (int atomJ = atomI; atomJ < numberOfAtoms; atomJ++) {
RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (_gbviParameters->getPeriodic())
ReferenceForce::getDeltaRPeriodic( atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR );
ReferenceForce::getDeltaRPeriodic(atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR);
else
ReferenceForce::getDeltaR( atomCoordinates[atomI], atomCoordinates[atomJ], deltaR );
ReferenceForce::getDeltaR(atomCoordinates[atomI], atomCoordinates[atomJ], deltaR);
if (_gbviParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _gbviParameters->getCutoffDistance())
continue;
......@@ -607,16 +606,16 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
RealOpenMM alpha2_ij = bornRadii[atomI]*bornRadii[atomJ];
RealOpenMM D_ij = r2/(four*alpha2_ij);
RealOpenMM expTerm = EXP( -D_ij );
RealOpenMM expTerm = EXP(-D_ij);
RealOpenMM denominator2 = r2 + alpha2_ij*expTerm;
RealOpenMM denominator = SQRT( denominator2 );
RealOpenMM denominator = SQRT(denominator2);
RealOpenMM Gpol = (partialChargeI*partialCharges[atomJ])/denominator;
RealOpenMM dGpol_dr = -Gpol*( one - fourth*expTerm )/denominator2;
RealOpenMM dGpol_dr = -Gpol*(one - fourth*expTerm)/denominator2;
RealOpenMM dGpol_dalpha2_ij = -half*Gpol*expTerm*( one + D_ij )/denominator2;
RealOpenMM dGpol_dalpha2_ij = -half*Gpol*expTerm*(one + D_ij)/denominator2;
if( atomI != atomJ ){
if (atomI != atomJ) {
bornForces[atomJ] += dGpol_dalpha2_ij*bornRadii[atomI];
......@@ -645,9 +644,9 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
// dGpol/dBornRadius) = bornForces[]
// dBornRadius/dr = (1/3)*(bR**4)*(dV/dr)
const RealOpenMMVector& scaledRadii = gbviParameters->getScaledRadii();
const RealOpenMMVector& switchDeriviative = getSwitchDeriviative();
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){
const vector<RealOpenMM>& scaledRadii = gbviParameters->getScaledRadii();
const vector<RealOpenMM>& switchDeriviative = getSwitchDeriviative();
for (int atomI = 0; atomI < numberOfAtoms; atomI++) {
RealOpenMM R = atomicRadii[atomI];
......@@ -659,9 +658,9 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
RealOpenMM b2 = bornRadii[atomI]*bornRadii[atomI];
bornForces[atomI] *= switchDeriviative[atomI]*oneThird*b2*b2;
for( int atomJ = 0; atomJ < numberOfAtoms; atomJ++ ){
for (int atomJ = 0; atomJ < numberOfAtoms; atomJ++) {
if( atomJ != atomI ){
if (atomJ != atomI) {
RealOpenMM deltaX = atomCoordinates[atomJ][0] - atomCoordinates[atomI][0];
RealOpenMM deltaY = atomCoordinates[atomJ][1] - atomCoordinates[atomI][1];
......@@ -669,9 +668,9 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (_gbviParameters->getPeriodic())
ReferenceForce::getDeltaRPeriodic( atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR );
ReferenceForce::getDeltaRPeriodic(atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR);
else
ReferenceForce::getDeltaR( atomCoordinates[atomI], atomCoordinates[atomJ], deltaR );
ReferenceForce::getDeltaR(atomCoordinates[atomI], atomCoordinates[atomJ], deltaR);
if (_gbviParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _gbviParameters->getCutoffDistance())
continue;
......@@ -680,7 +679,7 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
deltaY = deltaR[ReferenceForce::YIndex];
deltaZ = deltaR[ReferenceForce::ZIndex];
RealOpenMM r = SQRT( r2 );
RealOpenMM r = SQRT(r2);
RealOpenMM S = scaledRadii[atomJ];
RealOpenMM diff = (S - R);
......@@ -689,16 +688,16 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
// find dRb/dr, where Rb is the Born radius
if( FABS( diff ) < r ){
de = CpuGBVI::dL_dr( r, r+S, S ) + CpuGBVI::dL_dx( r, r+S, S );
if( R > (r - S) ){
de -= CpuGBVI::dL_dr( r, R, S );
if (FABS(diff) < r) {
de = ReferenceGBVI::dL_dr(r, r+S, S) + ReferenceGBVI::dL_dx(r, r+S, S);
if (R > (r - S)) {
de -= ReferenceGBVI::dL_dr(r, R, S);
} else {
de -= ( CpuGBVI::dL_dr( r, (r-S), S ) + CpuGBVI::dL_dx( r, (r-S), S ) );
de -= (ReferenceGBVI::dL_dr(r, (r-S), S) + ReferenceGBVI::dL_dx(r, (r-S), S));
}
} else if( r < (S - R) ){
de = CpuGBVI::dL_dr( r, r+S, S ) + CpuGBVI::dL_dx( r, r+S, S );
de -= ( CpuGBVI::dL_dr( r, r-S, S ) + CpuGBVI::dL_dx( r, r-S, S ) );
} else if (r < (S - R)) {
de = ReferenceGBVI::dL_dr(r, r+S, S) + ReferenceGBVI::dL_dx(r, r+S, S);
de -= (ReferenceGBVI::dL_dr(r, r-S, S) + ReferenceGBVI::dL_dx(r, r-S, S));
}
// de = (dG/dRb)(dRb/dr)
......@@ -721,12 +720,10 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
}
}
//printGbvi( atomCoordinates, partialCharges, bornRadii, bornForces, forces, "GBVI: Post loop2", stderr );
// convert from cal to Joule & apply prefactor tau = (1/diel_solute - 1/diel_solvent)
RealOpenMM conversion = static_cast<RealOpenMM>(gbviParameters->getTau());
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){
for (int atomI = 0; atomI < numberOfAtoms; atomI++) {
inputForces[atomI][0] += conversion*forces[atomI][0];
inputForces[atomI][1] += conversion*forces[atomI][1];
inputForces[atomI][2] += conversion*forces[atomI][2];
......@@ -734,93 +731,6 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
}
/**---------------------------------------------------------------------------------------
Print GB/VI parameters, radii, forces, ...
@param atomCoordinates atomic coordinates
@param partialCharges partial charges
@param bornRadii Born radii (may be empty)
@param bornForces Born forces (may be empty)
@param forces forces (may be empty)
@param idString id string (who is calling)
@param log log file
--------------------------------------------------------------------------------------- */
void CpuGBVI::printGbvi( const std::vector<OpenMM::RealVec>& atomCoordinates, const RealOpenMMVector& partialCharges,
const RealOpenMMVector& bornRadii,
const RealOpenMMVector& bornForces,
const std::vector<OpenMM::RealVec>& forces,
const std::string& idString, FILE* log ){
// ---------------------------------------------------------------------------------------
const GBVIParameters* gbviParameters = getGBVIParameters();
const int numberOfAtoms = gbviParameters->getNumberOfAtoms();
const RealOpenMMVector& atomicRadii = gbviParameters->getAtomicRadii();
const RealOpenMMVector& gammaParameters = gbviParameters->getGammaParameters();
// ---------------------------------------------------------------------------------------
// constants
const RealOpenMM preFactor = 2.0*gbviParameters->getElectricConstant();
// ---------------------------------------------------------------------------------------
const RealOpenMMVector& scaledRadii = gbviParameters->getScaledRadii();
const RealOpenMMVector& switchDeriviative = getSwitchDeriviative();
RealOpenMM tau = static_cast<RealOpenMM>(gbviParameters->getTau());
int useComparisonFormat = 1;
(void) fprintf( log, "Reference Gbvi %s atoms=%d\n", idString.c_str(), numberOfAtoms );
(void) fprintf( log, " tau %15.7e\n", tau );
(void) fprintf( log, " scaleMethod %d (QuinticEnum=%d)\n",
_gbviParameters->getBornRadiusScalingMethod(), GBVIParameters::QuinticSpline );
(void) fprintf( log, " preFactor %15.7e)\n", preFactor );
if( useComparisonFormat ){
(void) fprintf( log, " br bF swd r scR tau*gamma q)\n" );
for( unsigned int atomI = 0; atomI < static_cast<unsigned int>(numberOfAtoms); atomI++ ){
(void) fprintf( log, "%6d ", atomI );
if( bornRadii.size() > atomI ){
(void) fprintf( log, "%15.7e ", bornRadii[atomI] );
}
if( bornForces.size() > atomI ){
(void) fprintf( log, "%15.7e ", tau*bornForces[atomI] );
}
(void) fprintf( log, " %15.7e %15.7e %15.7e %15.7e %15.7e",
switchDeriviative[atomI],
atomicRadii[atomI],
scaledRadii[atomI],
tau*gammaParameters[atomI],
partialCharges[atomI] );
(void) fprintf( log, "\n" );
}
} else {
for( unsigned int atomI = 0; atomI < static_cast<unsigned int>(numberOfAtoms); atomI++ ){
(void) fprintf( log, "%6d r=%15.7e rSc=%15.7e swd=%15.7e tau*gam=%15.7e q=%15.7e", atomI,
atomicRadii[atomI],
scaledRadii[atomI],
switchDeriviative[atomI],
tau*gammaParameters[atomI],
partialCharges[atomI] );
if( bornRadii.size() > atomI ){
(void) fprintf( log, " bR=%15.7e", bornRadii[atomI] );
}
if( bornForces.size() > atomI ){
(void) fprintf( log, " tau*bF=%15.7e", tau*bornForces[atomI] );
}
(void) fprintf( log, "\n" );
}
}
return;
}
/**---------------------------------------------------------------------------------------
Use double precision
......@@ -835,7 +745,7 @@ void CpuGBVI::printGbvi( const std::vector<OpenMM::RealVec>& atomCoordinates, co
--------------------------------------------------------------------------------------- */
double CpuGBVI::getVolumeD( double r, double R, double S ){
double ReferenceGBVI::getVolumeD(double r, double R, double S) {
// ---------------------------------------------------------------------------------------
......@@ -843,18 +753,18 @@ double CpuGBVI::getVolumeD( double r, double R, double S ){
static const double minusThree = -3.0;
double diff = (S - R);
if( fabs( diff ) < r ){
if (fabs(diff) < r) {
double lowerBound = (R > (r - S)) ? R : (r - S);
return (CpuGBVI::getLD( r, (r + S), S ) -
CpuGBVI::getLD( r, lowerBound, S ));
return (ReferenceGBVI::getLD(r, (r + S), S) -
ReferenceGBVI::getLD(r, lowerBound, S));
} else if( r < diff ){
} else if (r < diff) {
return CpuGBVI::getLD( r, (r + S), S ) -
CpuGBVI::getLD( r, (r - S), S ) +
pow( R, minusThree );
return ReferenceGBVI::getLD(r, (r + S), S) -
ReferenceGBVI::getLD(r, (r - S), S) +
pow(R, minusThree);
} else {
return zero;
......@@ -875,7 +785,7 @@ double CpuGBVI::getVolumeD( double r, double R, double S ){
--------------------------------------------------------------------------------------- */
double CpuGBVI::getLD( double r, double x, double S ){
double ReferenceGBVI::getLD(double r, double x, double S) {
// ---------------------------------------------------------------------------------------
......@@ -895,7 +805,7 @@ double CpuGBVI::getLD( double r, double x, double S ){
double diff2 = (r + S)*(r - S);
return (threeHalves*xInv)*( (xInv*fourth*rInv) - (xInv2*third) + (diff2*xInv3*eighth*rInv) );
return (threeHalves*xInv)*((xInv*fourth*rInv) - (xInv2*third) + (diff2*xInv3*eighth*rInv));
}
/**---------------------------------------------------------------------------------------
......@@ -912,7 +822,7 @@ double CpuGBVI::getLD( double r, double x, double S ){
--------------------------------------------------------------------------------------- */
double CpuGBVI::dL_drD( double r, double x, double S ){
double ReferenceGBVI::dL_drD(double r, double x, double S) {
// ---------------------------------------------------------------------------------------
......@@ -934,7 +844,7 @@ double CpuGBVI::dL_drD( double r, double x, double S ){
double diff2 = (r + S)*(r - S);
return ( (-threeHalves*xInv2*rInv2)*( fourth + eighth*diff2*xInv2 ) + threeEights*xInv3*xInv );
return ((-threeHalves*xInv2*rInv2)*(fourth + eighth*diff2*xInv2) + threeEights*xInv3*xInv);
}
/**---------------------------------------------------------------------------------------
......@@ -951,7 +861,7 @@ double CpuGBVI::dL_drD( double r, double x, double S ){
--------------------------------------------------------------------------------------- */
double CpuGBVI::dL_dxD( double r, double x, double S ){
double ReferenceGBVI::dL_dxD(double r, double x, double S) {
// ---------------------------------------------------------------------------------------
......@@ -970,5 +880,5 @@ double CpuGBVI::dL_dxD( double r, double x, double S ){
double diff = (r + S)*(r - S);
return (threeHalvesM*xInv3)*( (half*rInv) - xInv + (half*diff*xInv2*rInv) );
return (threeHalvesM*xInv3)*((half*rInv) - xInv + (half*diff*xInv2*rInv));
}
......@@ -25,14 +25,12 @@
#include <string.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "ReferenceHarmonicBondIxn.h"
#include "ReferenceForce.h"
using std::vector;
using OpenMM::RealVec;
using namespace OpenMM;
/**---------------------------------------------------------------------------------------
......@@ -40,7 +38,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */
ReferenceHarmonicBondIxn::ReferenceHarmonicBondIxn( ){
ReferenceHarmonicBondIxn::ReferenceHarmonicBondIxn() {
// ---------------------------------------------------------------------------------------
......@@ -56,7 +54,7 @@ ReferenceHarmonicBondIxn::ReferenceHarmonicBondIxn( ){
--------------------------------------------------------------------------------------- */
ReferenceHarmonicBondIxn::~ReferenceHarmonicBondIxn( ){
ReferenceHarmonicBondIxn::~ReferenceHarmonicBondIxn() {
// ---------------------------------------------------------------------------------------
......@@ -79,11 +77,11 @@ ReferenceHarmonicBondIxn::~ReferenceHarmonicBondIxn( ){
--------------------------------------------------------------------------------------- */
void ReferenceHarmonicBondIxn::calculateBondIxn( int* atomIndices,
void ReferenceHarmonicBondIxn::calculateBondIxn(int* atomIndices,
vector<RealVec>& atomCoordinates,
RealOpenMM* parameters,
vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const {
RealOpenMM* totalEnergy) const {
static const std::string methodName = "\nReferenceHarmonicBondIxn::calculateBondIxn";
......@@ -101,7 +99,7 @@ void ReferenceHarmonicBondIxn::calculateBondIxn( int* atomIndices,
int atomAIndex = atomIndices[0];
int atomBIndex = atomIndices[1];
ReferenceForce::getDeltaR( atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR );
ReferenceForce::getDeltaR(atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR);
// deltaIdeal = r - r_0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment