Commit eb232608 authored by John Chodera (MSKCC)'s avatar John Chodera (MSKCC)
Browse files

Merge remote-tracking branch 'upstream/master'

parents 62581e9c 7f8c5089
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "SimTKOpenMMLog.h"
#include "ReferenceCCMAAlgorithm.h" #include "ReferenceCCMAAlgorithm.h"
#include "ReferenceDynamics.h" #include "ReferenceDynamics.h"
#include "quern.h" #include "quern.h"
...@@ -39,9 +37,7 @@ using std::map; ...@@ -39,9 +37,7 @@ using std::map;
using std::pair; using std::pair;
using std::vector; using std::vector;
using std::set; using std::set;
using OpenMM::OpenMMException; using namespace OpenMM;
using OpenMM::Vec3;
using OpenMM::RealVec;
ReferenceCCMAAlgorithm::ReferenceCCMAAlgorithm(int numberOfAtoms, ReferenceCCMAAlgorithm::ReferenceCCMAAlgorithm(int numberOfAtoms,
int numberOfConstraints, int numberOfConstraints,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "ReferenceForce.h" #include "ReferenceForce.h"
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceCustomAngleIxn.h" #include "ReferenceCustomAngleIxn.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
...@@ -62,7 +60,7 @@ ReferenceCustomAngleIxn::ReferenceCustomAngleIxn(const Lepton::CompiledExpressio ...@@ -62,7 +60,7 @@ ReferenceCustomAngleIxn::ReferenceCustomAngleIxn(const Lepton::CompiledExpressio
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceCustomAngleIxn::~ReferenceCustomAngleIxn( ){ ReferenceCustomAngleIxn::~ReferenceCustomAngleIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -84,11 +82,11 @@ ReferenceCustomAngleIxn::~ReferenceCustomAngleIxn( ){ ...@@ -84,11 +82,11 @@ ReferenceCustomAngleIxn::~ReferenceCustomAngleIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomAngleIxn::calculateBondIxn( int* atomIndices, void ReferenceCustomAngleIxn::calculateBondIxn(int* atomIndices,
vector<RealVec>& atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM* parameters,
vector<RealVec>& forces, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const { RealOpenMM* totalEnergy) const {
static const std::string methodName = "\nReferenceCustomAngleIxn::calculateAngleIxn"; static const std::string methodName = "\nReferenceCustomAngleIxn::calculateAngleIxn";
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceCustomBondIxn.h" #include "ReferenceCustomBondIxn.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
...@@ -62,7 +60,7 @@ ReferenceCustomBondIxn::ReferenceCustomBondIxn(const Lepton::CompiledExpression& ...@@ -62,7 +60,7 @@ ReferenceCustomBondIxn::ReferenceCustomBondIxn(const Lepton::CompiledExpression&
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceCustomBondIxn::~ReferenceCustomBondIxn( ){ ReferenceCustomBondIxn::~ReferenceCustomBondIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -84,11 +82,11 @@ ReferenceCustomBondIxn::~ReferenceCustomBondIxn( ){ ...@@ -84,11 +82,11 @@ ReferenceCustomBondIxn::~ReferenceCustomBondIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices, void ReferenceCustomBondIxn::calculateBondIxn(int* atomIndices,
vector<RealVec>& atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM* parameters,
vector<RealVec>& forces, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const { RealOpenMM* totalEnergy) const {
static const std::string methodName = "\nReferenceCustomBondIxn::calculateBondIxn"; static const std::string methodName = "\nReferenceCustomBondIxn::calculateBondIxn";
...@@ -110,7 +108,7 @@ void ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices, ...@@ -110,7 +108,7 @@ void ReferenceCustomBondIxn::calculateBondIxn( int* atomIndices,
int atomAIndex = atomIndices[0]; int atomAIndex = atomIndices[0];
int atomBIndex = atomIndices[1]; 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(energyR, deltaR[ReferenceForce::RIndex]);
ReferenceForce::setVariable(forceR, deltaR[ReferenceForce::RIndex]); ReferenceForce::setVariable(forceR, deltaR[ReferenceForce::RIndex]);
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <sstream> #include <sstream>
#include <utility> #include <utility>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
#include "ReferenceCustomCompoundBondIxn.h" #include "ReferenceCustomCompoundBondIxn.h"
...@@ -37,7 +35,7 @@ using std::pair; ...@@ -37,7 +35,7 @@ using std::pair;
using std::string; using std::string;
using std::stringstream; using std::stringstream;
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -72,7 +70,7 @@ ReferenceCustomCompoundBondIxn::ReferenceCustomCompoundBondIxn(int numParticlesP ...@@ -72,7 +70,7 @@ ReferenceCustomCompoundBondIxn::ReferenceCustomCompoundBondIxn(int numParticlesP
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceCustomCompoundBondIxn::~ReferenceCustomCompoundBondIxn( ){ ReferenceCustomCompoundBondIxn::~ReferenceCustomCompoundBondIxn() {
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -93,7 +91,7 @@ void ReferenceCustomCompoundBondIxn::calculatePairIxn(vector<RealVec>& atomCoord ...@@ -93,7 +91,7 @@ void ReferenceCustomCompoundBondIxn::calculatePairIxn(vector<RealVec>& atomCoord
map<string, double> variables = globalParameters; map<string, double> variables = globalParameters;
int numBonds = bondAtoms.size(); 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++) for (int j = 0; j < (int) bondParamNames.size(); j++)
variables[bondParamNames[j]] = bondParameters[bond][j]; variables[bondParamNames[j]] = bondParameters[bond][j];
calculateOneIxn(bond, atomCoordinates, variables, forces, totalEnergy); calculateOneIxn(bond, atomCoordinates, variables, forces, totalEnergy);
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceVirtualSites.h" #include "ReferenceVirtualSites.h"
#include "ReferenceCustomDynamics.h" #include "ReferenceCustomDynamics.h"
...@@ -97,7 +95,7 @@ ReferenceCustomDynamics::~ReferenceCustomDynamics() { ...@@ -97,7 +95,7 @@ ReferenceCustomDynamics::~ReferenceCustomDynamics() {
void ReferenceCustomDynamics::update(ContextImpl& context, int numberOfAtoms, vector<RealVec>& atomCoordinates, void ReferenceCustomDynamics::update(ContextImpl& context, int numberOfAtoms, vector<RealVec>& atomCoordinates,
vector<RealVec>& velocities, vector<RealVec>& forces, vector<RealOpenMM>& masses, 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(); int numSteps = stepType.size();
globals.insert(context.getParameters().begin(), context.getParameters().end()); globals.insert(context.getParameters().begin(), context.getParameters().end());
oldPos = atomCoordinates; oldPos = atomCoordinates;
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceCustomExternalIxn.h" #include "ReferenceCustomExternalIxn.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
...@@ -79,7 +77,7 @@ ReferenceCustomExternalIxn::ReferenceCustomExternalIxn(const Lepton::CompiledExp ...@@ -79,7 +77,7 @@ ReferenceCustomExternalIxn::ReferenceCustomExternalIxn(const Lepton::CompiledExp
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceCustomExternalIxn::~ReferenceCustomExternalIxn( ){ ReferenceCustomExternalIxn::~ReferenceCustomExternalIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -101,11 +99,11 @@ ReferenceCustomExternalIxn::~ReferenceCustomExternalIxn( ){ ...@@ -101,11 +99,11 @@ ReferenceCustomExternalIxn::~ReferenceCustomExternalIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomExternalIxn::calculateForce( int atomIndex, void ReferenceCustomExternalIxn::calculateForce(int atomIndex,
vector<RealVec>& atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM* parameters,
vector<RealVec>& forces, vector<RealVec>& forces,
RealOpenMM* energy ) const { RealOpenMM* energy) const {
static const std::string methodName = "\nReferenceCustomExternalIxn::calculateBondIxn"; static const std::string methodName = "\nReferenceCustomExternalIxn::calculateBondIxn";
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
#include "ReferenceCustomGBIxn.h" #include "ReferenceCustomGBIxn.h"
...@@ -36,7 +34,7 @@ using std::set; ...@@ -36,7 +34,7 @@ using std::set;
using std::string; using std::string;
using std::stringstream; using std::stringstream;
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -86,7 +84,7 @@ ReferenceCustomGBIxn::ReferenceCustomGBIxn(const vector<Lepton::ExpressionProgra ...@@ -86,7 +84,7 @@ ReferenceCustomGBIxn::ReferenceCustomGBIxn(const vector<Lepton::ExpressionProgra
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceCustomGBIxn::~ReferenceCustomGBIxn( ){ ReferenceCustomGBIxn::~ReferenceCustomGBIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -105,7 +103,7 @@ 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; cutoff = true;
cutoffDistance = distance; cutoffDistance = distance;
...@@ -203,8 +201,8 @@ void ReferenceCustomGBIxn::calculateParticlePairValue(int index, int numAtoms, v ...@@ -203,8 +201,8 @@ void ReferenceCustomGBIxn::calculateParticlePairValue(int index, int numAtoms, v
else { else {
// Perform an O(N^2) loop over all atom pairs. // Perform an O(N^2) loop over all atom pairs.
for (int i = 0; i < numAtoms; i++){ for (int i = 0; i < numAtoms; i++) {
for (int j = i+1; j < numAtoms; j++ ){ for (int j = i+1; j < numAtoms; j++) {
if (useExclusions && exclusions[i].find(j) != exclusions[i].end()) if (useExclusions && exclusions[i].find(j) != exclusions[i].end())
continue; continue;
calculateOnePairValue(index, i, j, atomCoordinates, atomParameters, globalParameters, values); calculateOnePairValue(index, i, j, atomCoordinates, atomParameters, globalParameters, values);
...@@ -275,8 +273,8 @@ void ReferenceCustomGBIxn::calculateParticlePairEnergyTerm(int index, int numAto ...@@ -275,8 +273,8 @@ void ReferenceCustomGBIxn::calculateParticlePairEnergyTerm(int index, int numAto
else { else {
// Perform an O(N^2) loop over all atom pairs. // Perform an O(N^2) loop over all atom pairs.
for (int i = 0; i < numAtoms; i++){ for (int i = 0; i < numAtoms; i++) {
for (int j = i+1; j < numAtoms; j++ ){ for (int j = i+1; j < numAtoms; j++) {
if (useExclusions && exclusions[i].find(j) != exclusions[i].end()) if (useExclusions && exclusions[i].find(j) != exclusions[i].end())
continue; continue;
calculateOnePairEnergyTerm(index, i, j, atomCoordinates, atomParameters, globalParameters, values, forces, totalEnergy, dEdV); calculateOnePairEnergyTerm(index, i, j, atomCoordinates, atomParameters, globalParameters, values, forces, totalEnergy, dEdV);
...@@ -344,8 +342,8 @@ void ReferenceCustomGBIxn::calculateChainRuleForces(int numAtoms, vector<RealVec ...@@ -344,8 +342,8 @@ void ReferenceCustomGBIxn::calculateChainRuleForces(int numAtoms, vector<RealVec
else { else {
// Perform an O(N^2) loop over all atom pairs. // Perform an O(N^2) loop over all atom pairs.
for (int i = 0; i < numAtoms; i++){ for (int i = 0; i < numAtoms; i++) {
for (int j = i+1; j < numAtoms; j++ ){ for (int j = i+1; j < numAtoms; j++) {
bool isExcluded = (exclusions[i].find(j) != exclusions[i].end()); bool isExcluded = (exclusions[i].find(j) != exclusions[i].end());
calculateOnePairChainRule(i, j, atomCoordinates, atomParameters, globalParameters, values, forces, dEdV, isExcluded); calculateOnePairChainRule(i, j, atomCoordinates, atomParameters, globalParameters, values, forces, dEdV, isExcluded);
calculateOnePairChainRule(j, i, atomCoordinates, atomParameters, globalParameters, values, forces, dEdV, isExcluded); calculateOnePairChainRule(j, i, atomCoordinates, atomParameters, globalParameters, values, forces, dEdV, isExcluded);
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <sstream> #include <sstream>
#include <utility> #include <utility>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
#include "ReferenceCustomHbondIxn.h" #include "ReferenceCustomHbondIxn.h"
...@@ -38,7 +36,7 @@ using std::set; ...@@ -38,7 +36,7 @@ using std::set;
using std::string; using std::string;
using std::stringstream; using std::stringstream;
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -65,7 +63,7 @@ ReferenceCustomHbondIxn::ReferenceCustomHbondIxn(const vector<vector<int> >& don ...@@ -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, ...@@ -129,7 +127,7 @@ void ReferenceCustomHbondIxn::calculatePairIxn(vector<RealVec>& atomCoordinates,
int numDonors = donorAtoms.size(); int numDonors = donorAtoms.size();
int numAcceptors = acceptorAtoms.size(); int numAcceptors = acceptorAtoms.size();
for( int donor = 0; donor < numDonors; donor++ ){ for (int donor = 0; donor < numDonors; donor++) {
// Initialize per-donor parameters. // Initialize per-donor parameters.
for (int j = 0; j < (int) donorParamNames.size(); j++) for (int j = 0; j < (int) donorParamNames.size(); j++)
...@@ -137,7 +135,7 @@ void ReferenceCustomHbondIxn::calculatePairIxn(vector<RealVec>& atomCoordinates, ...@@ -137,7 +135,7 @@ void ReferenceCustomHbondIxn::calculatePairIxn(vector<RealVec>& atomCoordinates,
// loop over atom pairs // 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()) { if (exclusions[donor].find(acceptor) == exclusions[donor].end()) {
for (int j = 0; j < (int) acceptorParamNames.size(); j++) for (int j = 0; j < (int) acceptorParamNames.size(); j++)
variables[acceptorParamNames[j]] = acceptorParameters[acceptor][j]; variables[acceptorParamNames[j]] = acceptorParameters[acceptor][j];
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <sstream> #include <sstream>
#include <utility> #include <utility>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
#include "ReferenceCustomManyParticleIxn.h" #include "ReferenceCustomManyParticleIxn.h"
...@@ -104,7 +102,7 @@ ReferenceCustomManyParticleIxn::ReferenceCustomManyParticleIxn(const CustomManyP ...@@ -104,7 +102,7 @@ ReferenceCustomManyParticleIxn::ReferenceCustomManyParticleIxn(const CustomManyP
CustomManyParticleForceImpl::buildFilterArrays(force, numTypes, particleTypes, orderIndex, particleOrder); CustomManyParticleForceImpl::buildFilterArrays(force, numTypes, particleTypes, orderIndex, particleOrder);
} }
ReferenceCustomManyParticleIxn::~ReferenceCustomManyParticleIxn( ){ ReferenceCustomManyParticleIxn::~ReferenceCustomManyParticleIxn() {
} }
void ReferenceCustomManyParticleIxn::calculateIxn(vector<RealVec>& atomCoordinates, RealOpenMM** particleParameters, void ReferenceCustomManyParticleIxn::calculateIxn(vector<RealVec>& atomCoordinates, RealOpenMM** particleParameters,
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
#include "ReferenceCustomNonbondedIxn.h" #include "ReferenceCustomNonbondedIxn.h"
...@@ -37,7 +35,7 @@ using std::string; ...@@ -37,7 +35,7 @@ using std::string;
using std::stringstream; using std::stringstream;
using std::set; using std::set;
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -73,7 +71,7 @@ ReferenceCustomNonbondedIxn::ReferenceCustomNonbondedIxn(const Lepton::CompiledE ...@@ -73,7 +71,7 @@ ReferenceCustomNonbondedIxn::ReferenceCustomNonbondedIxn(const Lepton::CompiledE
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceCustomNonbondedIxn::~ReferenceCustomNonbondedIxn( ){ ReferenceCustomNonbondedIxn::~ReferenceCustomNonbondedIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -92,7 +90,7 @@ 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; cutoff = true;
cutoffDistance = distance; cutoffDistance = distance;
...@@ -120,7 +118,7 @@ void ReferenceCustomNonbondedIxn::setInteractionGroups(const vector<pair<set<int ...@@ -120,7 +118,7 @@ void ReferenceCustomNonbondedIxn::setInteractionGroups(const vector<pair<set<int
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomNonbondedIxn::setUseSwitchingFunction( RealOpenMM distance ) { void ReferenceCustomNonbondedIxn::setUseSwitchingFunction(RealOpenMM distance) {
useSwitch = true; useSwitch = true;
switchingDistance = distance; switchingDistance = distance;
} }
...@@ -166,10 +164,10 @@ void ReferenceCustomNonbondedIxn::setUseSwitchingFunction( RealOpenMM 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** atomParameters, vector<set<int> >& exclusions,
RealOpenMM* fixedParameters, const map<string, double>& globalParameters, vector<RealVec>& forces, 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) { for (map<string, double>::const_iterator iter = globalParameters.begin(); iter != globalParameters.end(); ++iter) {
ReferenceForce::setVariable(ReferenceForce::getVariablePointer(energyExpression, iter->first), iter->second); ReferenceForce::setVariable(ReferenceForce::getVariablePointer(energyExpression, iter->first), iter->second);
...@@ -245,8 +243,8 @@ void ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, vector<Re ...@@ -245,8 +243,8 @@ void ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, vector<Re
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& atomCoordinates, vector<RealVec>& forces, void ReferenceCustomNonbondedIxn::calculateOneIxn(int ii, int jj, vector<RealVec>& atomCoordinates, vector<RealVec>& forces,
RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) { RealOpenMM* energyByAtom, RealOpenMM* totalEnergy) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -268,9 +266,9 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVe ...@@ -268,9 +266,9 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVe
RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex]; RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (periodic) if (periodic)
ReferenceForce::getDeltaRPeriodic( atomCoordinates[jj], atomCoordinates[ii], periodicBoxVectors, deltaR ); ReferenceForce::getDeltaRPeriodic(atomCoordinates[jj], atomCoordinates[ii], periodicBoxVectors, deltaR);
else else
ReferenceForce::getDeltaR( atomCoordinates[jj], atomCoordinates[ii], deltaR ); ReferenceForce::getDeltaR(atomCoordinates[jj], atomCoordinates[ii], deltaR);
RealOpenMM r = deltaR[ReferenceForce::RIndex]; RealOpenMM r = deltaR[ReferenceForce::RIndex];
if (cutoff && r >= cutoffDistance) if (cutoff && r >= cutoffDistance)
return; return;
...@@ -290,7 +288,7 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVe ...@@ -290,7 +288,7 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVe
energy *= switchValue; energy *= switchValue;
} }
} }
for( int kk = 0; kk < 3; kk++ ){ for (int kk = 0; kk < 3; kk++) {
RealOpenMM force = -dEdR*deltaR[kk]; RealOpenMM force = -dEdR*deltaR[kk];
forces[ii][kk] += force; forces[ii][kk] += force;
forces[jj][kk] -= force; forces[jj][kk] -= force;
...@@ -298,10 +296,10 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVe ...@@ -298,10 +296,10 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, vector<RealVe
// accumulate energies // accumulate energies
if( totalEnergy || energyByAtom ) { if (totalEnergy || energyByAtom) {
if( totalEnergy ) if (totalEnergy)
*totalEnergy += energy; *totalEnergy += energy;
if( energyByAtom ){ if (energyByAtom) {
energyByAtom[ii] += energy; energyByAtom[ii] += energy;
energyByAtom[jj] += energy; energyByAtom[jj] += energy;
} }
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceCustomTorsionIxn.h" #include "ReferenceCustomTorsionIxn.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
...@@ -62,7 +60,7 @@ ReferenceCustomTorsionIxn::ReferenceCustomTorsionIxn(const Lepton::CompiledExpre ...@@ -62,7 +60,7 @@ ReferenceCustomTorsionIxn::ReferenceCustomTorsionIxn(const Lepton::CompiledExpre
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceCustomTorsionIxn::~ReferenceCustomTorsionIxn( ){ ReferenceCustomTorsionIxn::~ReferenceCustomTorsionIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -84,11 +82,11 @@ ReferenceCustomTorsionIxn::~ReferenceCustomTorsionIxn( ){ ...@@ -84,11 +82,11 @@ ReferenceCustomTorsionIxn::~ReferenceCustomTorsionIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceCustomTorsionIxn::calculateBondIxn( int* atomIndices, void ReferenceCustomTorsionIxn::calculateBondIxn(int* atomIndices,
vector<RealVec>& atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM* parameters,
vector<RealVec>& forces, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const { RealOpenMM* totalEnergy) const {
static const std::string methodName = "\nReferenceCustomTorsionIxn::calculateTorsionIxn"; static const std::string methodName = "\nReferenceCustomTorsionIxn::calculateTorsionIxn";
...@@ -136,20 +134,20 @@ void ReferenceCustomTorsionIxn::calculateBondIxn( int* atomIndices, ...@@ -136,20 +134,20 @@ void ReferenceCustomTorsionIxn::calculateBondIxn( int* atomIndices,
RealOpenMM internalF[4][3]; RealOpenMM internalF[4][3];
RealOpenMM forceFactors[4]; RealOpenMM forceFactors[4];
RealOpenMM normCross1 = DOT3( crossProduct[0], crossProduct[0] ); RealOpenMM normCross1 = DOT3(crossProduct[0], crossProduct[0]);
RealOpenMM normBC = deltaR[1][ReferenceForce::RIndex]; RealOpenMM normBC = deltaR[1][ReferenceForce::RIndex];
forceFactors[0] = (-dEdAngle*normBC)/normCross1; 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[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[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]; 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[0][ii] = forceFactors[0]*crossProduct[0][ii];
internalF[3][ii] = forceFactors[3]*crossProduct[1][ii]; internalF[3][ii] = forceFactors[3]*crossProduct[1][ii];
...@@ -162,7 +160,7 @@ void ReferenceCustomTorsionIxn::calculateBondIxn( int* atomIndices, ...@@ -162,7 +160,7 @@ void ReferenceCustomTorsionIxn::calculateBondIxn( int* atomIndices,
// accumulate forces // accumulate forces
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
forces[atomAIndex][ii] += internalF[0][ii]; forces[atomAIndex][ii] += internalF[0][ii];
forces[atomBIndex][ii] -= internalF[1][ii]; forces[atomBIndex][ii] -= internalF[1][ii];
forces[atomCIndex][ii] -= internalF[2][ii]; forces[atomCIndex][ii] -= internalF[2][ii];
......
...@@ -25,15 +25,13 @@ ...@@ -25,15 +25,13 @@
#include <cstring> #include <cstring>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceDynamics.h" #include "ReferenceDynamics.h"
#include <cstdio> #include <cstdio>
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -46,7 +44,7 @@ using OpenMM::RealVec; ...@@ -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) { _numberOfAtoms(numberOfAtoms), _deltaT(deltaT), _temperature(temperature) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -69,7 +67,7 @@ ReferenceDynamics::ReferenceDynamics( int numberOfAtoms, RealOpenMM deltaT, Rea ...@@ -69,7 +67,7 @@ ReferenceDynamics::ReferenceDynamics( int numberOfAtoms, RealOpenMM deltaT, Rea
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceDynamics::~ReferenceDynamics( ){ ReferenceDynamics::~ReferenceDynamics() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -77,7 +75,7 @@ ReferenceDynamics::~ReferenceDynamics( ){ ...@@ -77,7 +75,7 @@ ReferenceDynamics::~ReferenceDynamics( ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
if( _ownReferenceConstraint ){ if (_ownReferenceConstraint) {
delete _referenceConstraint; delete _referenceConstraint;
} }
} }
...@@ -90,7 +88,7 @@ ReferenceDynamics::~ReferenceDynamics( ){ ...@@ -90,7 +88,7 @@ ReferenceDynamics::~ReferenceDynamics( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceDynamics::getNumberOfAtoms( void ) const { int ReferenceDynamics::getNumberOfAtoms() const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -109,7 +107,7 @@ int ReferenceDynamics::getNumberOfAtoms( void ) 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 { ...@@ -128,7 +126,7 @@ int ReferenceDynamics::getTimeStep( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceDynamics::incrementTimeStep( void ){ int ReferenceDynamics::incrementTimeStep() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -147,7 +145,7 @@ int ReferenceDynamics::incrementTimeStep( void ){ ...@@ -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 { ...@@ -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 ) { ...@@ -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 { ...@@ -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 ...@@ -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 ...@@ -231,7 +229,7 @@ void ReferenceDynamics::setReferenceConstraintAlgorithm( ReferenceConstraintAlgo
// delete if own // delete if own
if( _referenceConstraint && _ownReferenceConstraint ){ if (_referenceConstraint && _ownReferenceConstraint) {
delete _referenceConstraint; delete _referenceConstraint;
} }
......
...@@ -25,14 +25,12 @@ ...@@ -25,14 +25,12 @@
#include <cstring> #include <cstring>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
#include <cstdio> #include <cstdio>
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -40,7 +38,7 @@ using OpenMM::RealVec; ...@@ -40,7 +38,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceForce::ReferenceForce( ){ ReferenceForce::ReferenceForce() {
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -49,7 +47,7 @@ ReferenceForce::ReferenceForce( ){ ...@@ -49,7 +47,7 @@ ReferenceForce::ReferenceForce( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceForce::~ReferenceForce( ){ ReferenceForce::~ReferenceForce() {
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -65,28 +63,28 @@ RealOpenMM ReferenceForce::periodicDifference(RealOpenMM val1, RealOpenMM val2, ...@@ -65,28 +63,28 @@ RealOpenMM ReferenceForce::periodicDifference(RealOpenMM val1, RealOpenMM val2,
} }
void ReferenceForce::getDeltaR( const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ, void ReferenceForce::getDeltaR(const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
RealOpenMM* deltaR ){ RealOpenMM* deltaR) {
deltaR[XIndex] = atomCoordinatesJ[0] - atomCoordinatesI[0]; deltaR[XIndex] = atomCoordinatesJ[0] - atomCoordinatesI[0];
deltaR[YIndex] = atomCoordinatesJ[1] - atomCoordinatesI[1]; deltaR[YIndex] = atomCoordinatesJ[1] - atomCoordinatesI[1];
deltaR[ZIndex] = atomCoordinatesJ[2] - atomCoordinatesI[2]; deltaR[ZIndex] = atomCoordinatesJ[2] - atomCoordinatesI[2];
deltaR[R2Index] = DOT3( deltaR, deltaR ); deltaR[R2Index] = DOT3(deltaR, deltaR);
deltaR[RIndex] = (RealOpenMM) SQRT( deltaR[R2Index] ); deltaR[RIndex] = (RealOpenMM) SQRT(deltaR[R2Index]);
} }
void ReferenceForce::getDeltaRPeriodic( const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ, void ReferenceForce::getDeltaRPeriodic(const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
const RealOpenMM* boxSize, RealOpenMM* deltaR ){ const RealOpenMM* boxSize, RealOpenMM* deltaR) {
deltaR[XIndex] = periodicDifference(atomCoordinatesJ[0], atomCoordinatesI[0], boxSize[0]); deltaR[XIndex] = periodicDifference(atomCoordinatesJ[0], atomCoordinatesI[0], boxSize[0]);
deltaR[YIndex] = periodicDifference(atomCoordinatesJ[1], atomCoordinatesI[1], boxSize[1]); deltaR[YIndex] = periodicDifference(atomCoordinatesJ[1], atomCoordinatesI[1], boxSize[1]);
deltaR[ZIndex] = periodicDifference(atomCoordinatesJ[2], atomCoordinatesI[2], boxSize[2]); deltaR[ZIndex] = periodicDifference(atomCoordinatesJ[2], atomCoordinatesI[2], boxSize[2]);
deltaR[R2Index] = DOT3( deltaR, deltaR ); deltaR[R2Index] = DOT3(deltaR, deltaR);
deltaR[RIndex] = (RealOpenMM) SQRT( deltaR[R2Index] ); deltaR[RIndex] = (RealOpenMM) SQRT(deltaR[R2Index]);
} }
void ReferenceForce::getDeltaRPeriodic( const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ, void ReferenceForce::getDeltaRPeriodic(const RealVec& atomCoordinatesI, const RealVec& atomCoordinatesJ,
const RealVec* boxVectors, RealOpenMM* deltaR ){ const RealVec* boxVectors, RealOpenMM* deltaR) {
RealVec diff = atomCoordinatesJ-atomCoordinatesI; RealVec diff = atomCoordinatesJ-atomCoordinatesI;
diff -= boxVectors[2]*floor(diff[2]/boxVectors[2][2]+0.5); diff -= boxVectors[2]*floor(diff[2]/boxVectors[2][2]+0.5);
diff -= boxVectors[1]*floor(diff[1]/boxVectors[1][1]+0.5); diff -= boxVectors[1]*floor(diff[1]/boxVectors[1][1]+0.5);
......
...@@ -26,32 +26,31 @@ ...@@ -26,32 +26,31 @@
#include <sstream> #include <sstream>
#include <stdio.h> #include <stdio.h>
#include "SimTKOpenMMCommon.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
#include "CpuGBVI.h" #include "ReferenceGBVI.h"
using namespace std; using namespace std;
using namespace OpenMM; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
CpuGBVI constructor ReferenceGBVI constructor
gbviParameters gbviParameters object gbviParameters gbviParameters object
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
CpuGBVI::CpuGBVI( GBVIParameters* gbviParameters ) : _gbviParameters(gbviParameters) { ReferenceGBVI::ReferenceGBVI(GBVIParameters* gbviParameters) : _gbviParameters(gbviParameters) {
_switchDeriviative.resize( gbviParameters->getNumberOfAtoms() ); _switchDeriviative.resize(gbviParameters->getNumberOfAtoms());
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
CpuGBVI destructor ReferenceGBVI destructor
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
CpuGBVI::~CpuGBVI( ){ ReferenceGBVI::~ReferenceGBVI() {
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -62,7 +61,7 @@ CpuGBVI::~CpuGBVI( ){ ...@@ -62,7 +61,7 @@ CpuGBVI::~CpuGBVI( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
GBVIParameters* CpuGBVI::getGBVIParameters( void ) const { GBVIParameters* ReferenceGBVI::getGBVIParameters() const {
return _gbviParameters; return _gbviParameters;
} }
...@@ -74,7 +73,7 @@ GBVIParameters* CpuGBVI::getGBVIParameters( void ) const { ...@@ -74,7 +73,7 @@ GBVIParameters* CpuGBVI::getGBVIParameters( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void CpuGBVI::setGBVIParameters( GBVIParameters* gbviParameters ){ void ReferenceGBVI::setGBVIParameters(GBVIParameters* gbviParameters) {
_gbviParameters = gbviParameters; _gbviParameters = gbviParameters;
} }
...@@ -86,7 +85,7 @@ void CpuGBVI::setGBVIParameters( GBVIParameters* gbviParameters ){ ...@@ -86,7 +85,7 @@ void CpuGBVI::setGBVIParameters( GBVIParameters* gbviParameters ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMMVector& CpuGBVI::getSwitchDeriviative( void ){ vector<RealOpenMM>& ReferenceGBVI::getSwitchDeriviative() {
return _switchDeriviative; return _switchDeriviative;
} }
...@@ -102,17 +101,17 @@ RealOpenMMVector& CpuGBVI::getSwitchDeriviative( void ){ ...@@ -102,17 +101,17 @@ RealOpenMMVector& CpuGBVI::getSwitchDeriviative( void ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void CpuGBVI::quinticSpline( RealOpenMM x, RealOpenMM rl, RealOpenMM ru, void ReferenceGBVI::quinticSpline(RealOpenMM x, RealOpenMM rl, RealOpenMM ru,
RealOpenMM* outValue, RealOpenMM* outDerivative ){ RealOpenMM* outValue, RealOpenMM* outDerivative) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 ); static const RealOpenMM one = static_cast<RealOpenMM>( 1.0);
static const RealOpenMM minusSix = static_cast<RealOpenMM>( -6.0 ); static const RealOpenMM minusSix = static_cast<RealOpenMM>( -6.0);
static const RealOpenMM minusTen = static_cast<RealOpenMM>( -10.0 ); static const RealOpenMM minusTen = static_cast<RealOpenMM>(-10.0);
static const RealOpenMM minusThirty = static_cast<RealOpenMM>( -30.0 ); static const RealOpenMM minusThirty = static_cast<RealOpenMM>(-30.0);
static const RealOpenMM fifteen = static_cast<RealOpenMM>( 15.0 ); static const RealOpenMM fifteen = static_cast<RealOpenMM>( 15.0);
static const RealOpenMM sixty = static_cast<RealOpenMM>( 60.0 ); static const RealOpenMM sixty = static_cast<RealOpenMM>( 60.0);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -140,19 +139,19 @@ void CpuGBVI::quinticSpline( RealOpenMM x, RealOpenMM rl, RealOpenMM ru, ...@@ -140,19 +139,19 @@ void CpuGBVI::quinticSpline( RealOpenMM x, RealOpenMM rl, RealOpenMM ru,
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void CpuGBVI::computeBornRadiiUsingQuinticSpline( RealOpenMM atomicRadius3, RealOpenMM bornSum, void ReferenceGBVI::computeBornRadiiUsingQuinticSpline(RealOpenMM atomicRadius3, RealOpenMM bornSum,
GBVIParameters* gbviParameters, GBVIParameters* gbviParameters,
RealOpenMM* bornRadius, RealOpenMM* switchDeriviative ){ RealOpenMM* bornRadius, RealOpenMM* switchDeriviative) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0 ); static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0);
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 ); static const RealOpenMM one = static_cast<RealOpenMM>( 1.0);
static const RealOpenMM minusOne = 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 minusThree = static_cast<RealOpenMM>(-3.0);
static const RealOpenMM oneEighth = static_cast<RealOpenMM>( 0.125 ); static const RealOpenMM oneEighth = static_cast<RealOpenMM>( 0.125);
static const RealOpenMM minusOneThird = static_cast<RealOpenMM>( (-1.0/3.0) ); static const RealOpenMM minusOneThird = static_cast<RealOpenMM>((-1.0/3.0));
static const RealOpenMM three = static_cast<RealOpenMM>( 3.0 ); static const RealOpenMM three = static_cast<RealOpenMM>( 3.0);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -176,10 +175,10 @@ void CpuGBVI::computeBornRadiiUsingQuinticSpline( RealOpenMM atomicRadius3, Real ...@@ -176,10 +175,10 @@ void CpuGBVI::computeBornRadiiUsingQuinticSpline( RealOpenMM atomicRadius3, Real
RealOpenMM splineL = gbviParameters->getQuinticLowerLimitFactor()*atomicRadius3; RealOpenMM splineL = gbviParameters->getQuinticLowerLimitFactor()*atomicRadius3;
RealOpenMM sum; RealOpenMM sum;
if( bornSum > splineL ){ if (bornSum > splineL) {
if( bornSum < atomicRadius3 ){ if (bornSum < atomicRadius3) {
RealOpenMM splineValue, splineDerivative; RealOpenMM splineValue, splineDerivative;
quinticSpline( bornSum, splineL, atomicRadius3, &splineValue, &splineDerivative ); quinticSpline(bornSum, splineL, atomicRadius3, &splineValue, &splineDerivative);
sum = (atomicRadius3 - bornSum)*splineValue + gbviParameters->getQuinticUpperBornRadiusLimit(); sum = (atomicRadius3 - bornSum)*splineValue + gbviParameters->getQuinticUpperBornRadiusLimit();
*switchDeriviative = splineValue - (atomicRadius3 - bornSum)*splineDerivative; *switchDeriviative = splineValue - (atomicRadius3 - bornSum)*splineDerivative;
} else { } else {
...@@ -190,7 +189,7 @@ void CpuGBVI::computeBornRadiiUsingQuinticSpline( RealOpenMM atomicRadius3, Real ...@@ -190,7 +189,7 @@ void CpuGBVI::computeBornRadiiUsingQuinticSpline( RealOpenMM atomicRadius3, Real
sum = atomicRadius3 - bornSum; sum = atomicRadius3 - bornSum;
*switchDeriviative = one; *switchDeriviative = one;
} }
*bornRadius = POW( sum, minusOneThird ); *bornRadius = POW(sum, minusOneThird);
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -203,66 +202,66 @@ void CpuGBVI::computeBornRadiiUsingQuinticSpline( RealOpenMM atomicRadius3, Real ...@@ -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 zero = static_cast<RealOpenMM>(0.0);
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 ); static const RealOpenMM one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM minusThree = static_cast<RealOpenMM>( -3.0 ); static const RealOpenMM minusThree = static_cast<RealOpenMM>(-3.0);
static const RealOpenMM oneEighth = static_cast<RealOpenMM>( 0.125 ); static const RealOpenMM oneEighth = static_cast<RealOpenMM>(0.125);
static const RealOpenMM minusOneThird = static_cast<RealOpenMM>( (-1.0/3.0) ); static const RealOpenMM minusOneThird = static_cast<RealOpenMM>((-1.0/3.0));
static const RealOpenMM three = static_cast<RealOpenMM>( 3.0 ); static const RealOpenMM three = static_cast<RealOpenMM>(3.0);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
GBVIParameters* gbviParameters = getGBVIParameters(); GBVIParameters* gbviParameters = getGBVIParameters();
int numberOfAtoms = gbviParameters->getNumberOfAtoms(); int numberOfAtoms = gbviParameters->getNumberOfAtoms();
const RealOpenMMVector& atomicRadii = gbviParameters->getAtomicRadii(); const vector<RealOpenMM>& atomicRadii = gbviParameters->getAtomicRadii();
const RealOpenMMVector& scaledRadii = gbviParameters->getScaledRadii(); const vector<RealOpenMM>& scaledRadii = gbviParameters->getScaledRadii();
RealOpenMMVector& switchDeriviatives = getSwitchDeriviative(); vector<RealOpenMM>& switchDeriviatives = getSwitchDeriviative();
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// calculate Born radii // calculate Born radii
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){ for (int atomI = 0; atomI < numberOfAtoms; atomI++) {
RealOpenMM radiusI = atomicRadii[atomI]; RealOpenMM radiusI = atomicRadii[atomI];
RealOpenMM sum = zero; RealOpenMM sum = zero;
// sum over volumes // 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]; RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (_gbviParameters->getPeriodic()) if (_gbviParameters->getPeriodic())
ReferenceForce::getDeltaRPeriodic( atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR ); ReferenceForce::getDeltaRPeriodic(atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR);
else else
ReferenceForce::getDeltaR( atomCoordinates[atomI], atomCoordinates[atomJ], deltaR ); ReferenceForce::getDeltaR(atomCoordinates[atomI], atomCoordinates[atomJ], deltaR);
RealOpenMM r = deltaR[ReferenceForce::RIndex]; RealOpenMM r = deltaR[ReferenceForce::RIndex];
if (_gbviParameters->getUseCutoff() && r > _gbviParameters->getCutoffDistance()) if (_gbviParameters->getUseCutoff() && r > _gbviParameters->getCutoffDistance())
continue; continue;
sum += CpuGBVI::getVolume( r, radiusI, scaledRadii[atomJ] ); sum += ReferenceGBVI::getVolume(r, radiusI, scaledRadii[atomJ]);
} }
} }
RealOpenMM atomicRadius3 = POW( radiusI, minusThree ); RealOpenMM atomicRadius3 = POW(radiusI, minusThree);
if( _gbviParameters->getBornRadiusScalingMethod() != GBVIParameters::QuinticSpline ){ if (_gbviParameters->getBornRadiusScalingMethod() != GBVIParameters::QuinticSpline) {
sum = atomicRadius3 - sum; sum = atomicRadius3 - sum;
bornRadii[atomI] = POW( sum, minusOneThird ); bornRadii[atomI] = POW(sum, minusOneThird);
switchDeriviatives[atomI] = one; switchDeriviatives[atomI] = one;
} else { } else {
RealOpenMM bornRadius, switchDeriviative; RealOpenMM bornRadius, switchDeriviative;
computeBornRadiiUsingQuinticSpline( atomicRadius3, sum, gbviParameters, computeBornRadiiUsingQuinticSpline(atomicRadius3, sum, gbviParameters,
&bornRadius, &switchDeriviative ); &bornRadius, &switchDeriviative);
bornRadii[atomI] = bornRadius; bornRadii[atomI] = bornRadius;
switchDeriviatives[atomI] = switchDeriviative; switchDeriviatives[atomI] = switchDeriviative;
} }
...@@ -281,25 +280,25 @@ void CpuGBVI::computeBornRadii( const vector<RealVec>& atomCoordinates, RealOpen ...@@ -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 zero = static_cast<RealOpenMM>( 0.0);
static const RealOpenMM minusThree = static_cast<RealOpenMM>( -3.0 ); static const RealOpenMM minusThree = static_cast<RealOpenMM>(-3.0);
RealOpenMM diff = (S - R); RealOpenMM diff = (S - R);
if( FABS( diff ) < r ){ if (FABS(diff) < r) {
RealOpenMM lowerBound = (R > (r - S)) ? R : (r - S); RealOpenMM lowerBound = (R > (r - S)) ? R : (r - S);
return (CpuGBVI::getL( r, (r + S), S ) - return (ReferenceGBVI::getL(r, (r + S), S) -
CpuGBVI::getL( r, lowerBound, S )); ReferenceGBVI::getL(r, lowerBound, S));
} else if( r <= diff ){ } else if (r <= diff) {
return CpuGBVI::getL( r, (r + S), S ) - return ReferenceGBVI::getL(r, (r + S), S) -
CpuGBVI::getL( r, (r - S), S ) + ReferenceGBVI::getL(r, (r - S), S) +
POW( R, minusThree ); POW(R, minusThree);
} else { } else {
return zero; return zero;
...@@ -318,15 +317,15 @@ RealOpenMM CpuGBVI::getVolume( RealOpenMM r, RealOpenMM R, RealOpenMM S ){ ...@@ -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 one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM threeHalves = static_cast<RealOpenMM>( 1.5 ); static const RealOpenMM threeHalves = static_cast<RealOpenMM>(1.5);
static const RealOpenMM third = static_cast<RealOpenMM>( (1.0/3.0) ); static const RealOpenMM third = static_cast<RealOpenMM>((1.0/3.0));
static const RealOpenMM fourth = static_cast<RealOpenMM>( 0.25 ); static const RealOpenMM fourth = static_cast<RealOpenMM>(0.25);
static const RealOpenMM eighth = static_cast<RealOpenMM>( 0.125 ); static const RealOpenMM eighth = static_cast<RealOpenMM>(0.125);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -338,7 +337,7 @@ RealOpenMM CpuGBVI::getL( RealOpenMM r, RealOpenMM x, RealOpenMM S ){ ...@@ -338,7 +337,7 @@ RealOpenMM CpuGBVI::getL( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
RealOpenMM diff2 = (r + S)*(r - 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 ){ ...@@ -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 one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM threeHalves = static_cast<RealOpenMM>( 1.5 ); static const RealOpenMM threeHalves = static_cast<RealOpenMM>(1.5);
static const RealOpenMM threeEights = static_cast<RealOpenMM>( 0.375 ); static const RealOpenMM threeEights = static_cast<RealOpenMM>(0.375);
static const RealOpenMM third = static_cast<RealOpenMM>( (1.0/3.0) ); static const RealOpenMM third = static_cast<RealOpenMM>((1.0/3.0));
static const RealOpenMM fourth = static_cast<RealOpenMM>( 0.25 ); static const RealOpenMM fourth = static_cast<RealOpenMM>(0.25);
static const RealOpenMM eighth = static_cast<RealOpenMM>( 0.125 ); static const RealOpenMM eighth = static_cast<RealOpenMM>(0.125);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -375,7 +374,7 @@ RealOpenMM CpuGBVI::dL_dr( RealOpenMM r, RealOpenMM x, RealOpenMM S ){ ...@@ -375,7 +374,7 @@ RealOpenMM CpuGBVI::dL_dr( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
RealOpenMM diff2 = (r + S)*(r - 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 ){ ...@@ -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 one = static_cast<RealOpenMM>( 1.0);
static const RealOpenMM half = static_cast<RealOpenMM>( 0.5 ); static const RealOpenMM half = static_cast<RealOpenMM>( 0.5);
static const RealOpenMM threeHalvesM = static_cast<RealOpenMM>( -1.5 ); static const RealOpenMM threeHalvesM = static_cast<RealOpenMM>(-1.5);
static const RealOpenMM third = static_cast<RealOpenMM>( (1.0/3.0) ); 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 ){ ...@@ -409,7 +408,7 @@ RealOpenMM CpuGBVI::dL_dx( RealOpenMM r, RealOpenMM x, RealOpenMM S ){
RealOpenMM diff = (r + S)*(r - 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 ){ ...@@ -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 zero = static_cast<RealOpenMM>(0.0);
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 ); static const RealOpenMM one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM fourth = static_cast<RealOpenMM>( 0.25 ); 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 ){ ...@@ -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 zero = static_cast<RealOpenMM>(0.0);
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 ); static const RealOpenMM one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM two = static_cast<RealOpenMM>( 2.0 ); static const RealOpenMM two = static_cast<RealOpenMM>(2.0);
static const RealOpenMM three = static_cast<RealOpenMM>( 3.0 ); static const RealOpenMM three = static_cast<RealOpenMM>(3.0);
static const RealOpenMM four = static_cast<RealOpenMM>( 4.0 ); static const RealOpenMM four = static_cast<RealOpenMM>(4.0);
static const RealOpenMM half = static_cast<RealOpenMM>( 0.5 ); static const RealOpenMM half = static_cast<RealOpenMM>(0.5);
static const RealOpenMM fourth = static_cast<RealOpenMM>( 0.25 ); static const RealOpenMM fourth = static_cast<RealOpenMM>(0.25);
static const RealOpenMM eighth = static_cast<RealOpenMM>( 0.125 ); static const RealOpenMM eighth = static_cast<RealOpenMM>(0.125);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
const GBVIParameters* gbviParameters = getGBVIParameters(); const GBVIParameters* gbviParameters = getGBVIParameters();
const RealOpenMM preFactor = gbviParameters->getElectricConstant(); const RealOpenMM preFactor = gbviParameters->getElectricConstant();
const int numberOfAtoms = gbviParameters->getNumberOfAtoms(); const int numberOfAtoms = gbviParameters->getNumberOfAtoms();
const RealOpenMMVector& atomicRadii = gbviParameters->getAtomicRadii(); const vector<RealOpenMM>& atomicRadii = gbviParameters->getAtomicRadii();
const RealOpenMMVector& gammaParameters = gbviParameters->getGammaParameters(); const vector<RealOpenMM>& gammaParameters = gbviParameters->getGammaParameters();
// compute Born radii // compute Born radii
RealOpenMMVector bornRadii( numberOfAtoms ); vector<RealOpenMM> bornRadii(numberOfAtoms);
computeBornRadii( atomCoordinates, bornRadii ); computeBornRadii(atomCoordinates, bornRadii);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -483,7 +482,7 @@ RealOpenMM CpuGBVI::computeBornEnergy( const vector<RealVec>& atomCoordinates, c ...@@ -483,7 +482,7 @@ RealOpenMM CpuGBVI::computeBornEnergy( const vector<RealVec>& atomCoordinates, c
RealOpenMM energy = zero; RealOpenMM energy = zero;
RealOpenMM cavityEnergy = zero; RealOpenMM cavityEnergy = zero;
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){ for (int atomI = 0; atomI < numberOfAtoms; atomI++) {
RealOpenMM partialChargeI = partialCharges[atomI]; RealOpenMM partialChargeI = partialCharges[atomI];
...@@ -496,19 +495,19 @@ RealOpenMM CpuGBVI::computeBornEnergy( const vector<RealVec>& atomCoordinates, c ...@@ -496,19 +495,19 @@ RealOpenMM CpuGBVI::computeBornEnergy( const vector<RealVec>& atomCoordinates, c
RealOpenMM ratio = (atomicRadii[atomI]/bornRadii[atomI]); RealOpenMM ratio = (atomicRadii[atomI]/bornRadii[atomI]);
cavityEnergy += gammaParameters[atomI]*ratio*ratio*ratio; 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]; RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (_gbviParameters->getPeriodic()) if (_gbviParameters->getPeriodic())
ReferenceForce::getDeltaRPeriodic( atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR ); ReferenceForce::getDeltaRPeriodic(atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR);
else else
ReferenceForce::getDeltaR( atomCoordinates[atomI], atomCoordinates[atomJ], deltaR ); ReferenceForce::getDeltaR(atomCoordinates[atomI], atomCoordinates[atomJ], deltaR);
if (_gbviParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _gbviParameters->getCutoffDistance()) if (_gbviParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _gbviParameters->getCutoffDistance())
continue; continue;
RealOpenMM r2 = deltaR[ReferenceForce::R2Index]; RealOpenMM r2 = deltaR[ReferenceForce::R2Index];
RealOpenMM t = fourth*r2/(bornRadii[atomI]*bornRadii[atomJ]); 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; energy += two*partialChargeI*atomIEnergy;
...@@ -532,27 +531,27 @@ RealOpenMM CpuGBVI::computeBornEnergy( const vector<RealVec>& atomCoordinates, c ...@@ -532,27 +531,27 @@ RealOpenMM CpuGBVI::computeBornEnergy( const vector<RealVec>& atomCoordinates, c
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const RealOpenMMVector& partialCharges, void ReferenceGBVI::computeBornForces(std::vector<RealVec>& atomCoordinates, const vector<RealOpenMM>& partialCharges,
std::vector<OpenMM::RealVec>& inputForces){ std::vector<OpenMM::RealVec>& inputForces) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const RealOpenMM zero = static_cast<RealOpenMM>( 0.0 ); static const RealOpenMM zero = static_cast<RealOpenMM>(0.0);
static const RealOpenMM one = static_cast<RealOpenMM>( 1.0 ); static const RealOpenMM one = static_cast<RealOpenMM>(1.0);
static const RealOpenMM two = static_cast<RealOpenMM>( 2.0 ); static const RealOpenMM two = static_cast<RealOpenMM>(2.0);
static const RealOpenMM three = static_cast<RealOpenMM>( 3.0 ); static const RealOpenMM three = static_cast<RealOpenMM>(3.0);
static const RealOpenMM four = static_cast<RealOpenMM>( 4.0 ); static const RealOpenMM four = static_cast<RealOpenMM>(4.0);
static const RealOpenMM half = static_cast<RealOpenMM>( 0.5 ); static const RealOpenMM half = static_cast<RealOpenMM>(0.5);
static const RealOpenMM oneThird = static_cast<RealOpenMM>( (1.0/3.0) ); static const RealOpenMM oneThird = static_cast<RealOpenMM>((1.0/3.0));
static const RealOpenMM fourth = static_cast<RealOpenMM>( 0.25 ); static const RealOpenMM fourth = static_cast<RealOpenMM>(0.25);
static const RealOpenMM eighth = static_cast<RealOpenMM>( 0.125 ); static const RealOpenMM eighth = static_cast<RealOpenMM>(0.125);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
const GBVIParameters* gbviParameters = getGBVIParameters(); const GBVIParameters* gbviParameters = getGBVIParameters();
const int numberOfAtoms = gbviParameters->getNumberOfAtoms(); const int numberOfAtoms = gbviParameters->getNumberOfAtoms();
const RealOpenMMVector& atomicRadii = gbviParameters->getAtomicRadii(); const vector<RealOpenMM>& atomicRadii = gbviParameters->getAtomicRadii();
const RealOpenMMVector& gammaParameters = gbviParameters->getGammaParameters(); const vector<RealOpenMM>& gammaParameters = gbviParameters->getGammaParameters();
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -564,37 +563,37 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re ...@@ -564,37 +563,37 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
// compute Born radii // compute Born radii
RealOpenMMVector bornRadii( numberOfAtoms ); vector<RealOpenMM> bornRadii(numberOfAtoms);
computeBornRadii( atomCoordinates, bornRadii ); computeBornRadii(atomCoordinates, bornRadii);
// set energy/forces to zero // set energy/forces to zero
std::vector<OpenMM::RealVec> forces( numberOfAtoms ); std::vector<OpenMM::RealVec> forces(numberOfAtoms);
for( int ii = 0; ii < numberOfAtoms; ii++ ){ for (int ii = 0; ii < numberOfAtoms; ii++) {
forces[ii][0] = zero; forces[ii][0] = zero;
forces[ii][1] = zero; forces[ii][1] = zero;
forces[ii][2] = zero; forces[ii][2] = zero;
} }
RealOpenMMVector bornForces( numberOfAtoms, 0.0); vector<RealOpenMM> bornForces(numberOfAtoms, 0.0);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// first main loop // first main loop
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){ for (int atomI = 0; atomI < numberOfAtoms; atomI++) {
// partial of polar term wrt Born radius // partial of polar term wrt Born radius
// and (dGpol/dr)(dr/dx) // and (dGpol/dr)(dr/dx)
RealOpenMM partialChargeI = preFactor*partialCharges[atomI]; RealOpenMM partialChargeI = preFactor*partialCharges[atomI];
for( int atomJ = atomI; atomJ < numberOfAtoms; atomJ++ ){ for (int atomJ = atomI; atomJ < numberOfAtoms; atomJ++) {
RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex]; RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (_gbviParameters->getPeriodic()) if (_gbviParameters->getPeriodic())
ReferenceForce::getDeltaRPeriodic( atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR ); ReferenceForce::getDeltaRPeriodic(atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR);
else else
ReferenceForce::getDeltaR( atomCoordinates[atomI], atomCoordinates[atomJ], deltaR ); ReferenceForce::getDeltaR(atomCoordinates[atomI], atomCoordinates[atomJ], deltaR);
if (_gbviParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _gbviParameters->getCutoffDistance()) if (_gbviParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _gbviParameters->getCutoffDistance())
continue; continue;
...@@ -607,16 +606,16 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re ...@@ -607,16 +606,16 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
RealOpenMM alpha2_ij = bornRadii[atomI]*bornRadii[atomJ]; RealOpenMM alpha2_ij = bornRadii[atomI]*bornRadii[atomJ];
RealOpenMM D_ij = r2/(four*alpha2_ij); RealOpenMM D_ij = r2/(four*alpha2_ij);
RealOpenMM expTerm = EXP( -D_ij ); RealOpenMM expTerm = EXP(-D_ij);
RealOpenMM denominator2 = r2 + alpha2_ij*expTerm; RealOpenMM denominator2 = r2 + alpha2_ij*expTerm;
RealOpenMM denominator = SQRT( denominator2 ); RealOpenMM denominator = SQRT(denominator2);
RealOpenMM Gpol = (partialChargeI*partialCharges[atomJ])/denominator; 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]; bornForces[atomJ] += dGpol_dalpha2_ij*bornRadii[atomI];
...@@ -645,9 +644,9 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re ...@@ -645,9 +644,9 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
// dGpol/dBornRadius) = bornForces[] // dGpol/dBornRadius) = bornForces[]
// dBornRadius/dr = (1/3)*(bR**4)*(dV/dr) // dBornRadius/dr = (1/3)*(bR**4)*(dV/dr)
const RealOpenMMVector& scaledRadii = gbviParameters->getScaledRadii(); const vector<RealOpenMM>& scaledRadii = gbviParameters->getScaledRadii();
const RealOpenMMVector& switchDeriviative = getSwitchDeriviative(); const vector<RealOpenMM>& switchDeriviative = getSwitchDeriviative();
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){ for (int atomI = 0; atomI < numberOfAtoms; atomI++) {
RealOpenMM R = atomicRadii[atomI]; RealOpenMM R = atomicRadii[atomI];
...@@ -659,9 +658,9 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re ...@@ -659,9 +658,9 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
RealOpenMM b2 = bornRadii[atomI]*bornRadii[atomI]; RealOpenMM b2 = bornRadii[atomI]*bornRadii[atomI];
bornForces[atomI] *= switchDeriviative[atomI]*oneThird*b2*b2; 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 deltaX = atomCoordinates[atomJ][0] - atomCoordinates[atomI][0];
RealOpenMM deltaY = atomCoordinates[atomJ][1] - atomCoordinates[atomI][1]; RealOpenMM deltaY = atomCoordinates[atomJ][1] - atomCoordinates[atomI][1];
...@@ -669,9 +668,9 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re ...@@ -669,9 +668,9 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex]; RealOpenMM deltaR[ReferenceForce::LastDeltaRIndex];
if (_gbviParameters->getPeriodic()) if (_gbviParameters->getPeriodic())
ReferenceForce::getDeltaRPeriodic( atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR ); ReferenceForce::getDeltaRPeriodic(atomCoordinates[atomI], atomCoordinates[atomJ], _gbviParameters->getPeriodicBox(), deltaR);
else else
ReferenceForce::getDeltaR( atomCoordinates[atomI], atomCoordinates[atomJ], deltaR ); ReferenceForce::getDeltaR(atomCoordinates[atomI], atomCoordinates[atomJ], deltaR);
if (_gbviParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _gbviParameters->getCutoffDistance()) if (_gbviParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _gbviParameters->getCutoffDistance())
continue; continue;
...@@ -680,7 +679,7 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re ...@@ -680,7 +679,7 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
deltaY = deltaR[ReferenceForce::YIndex]; deltaY = deltaR[ReferenceForce::YIndex];
deltaZ = deltaR[ReferenceForce::ZIndex]; deltaZ = deltaR[ReferenceForce::ZIndex];
RealOpenMM r = SQRT( r2 ); RealOpenMM r = SQRT(r2);
RealOpenMM S = scaledRadii[atomJ]; RealOpenMM S = scaledRadii[atomJ];
RealOpenMM diff = (S - R); RealOpenMM diff = (S - R);
...@@ -689,16 +688,16 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re ...@@ -689,16 +688,16 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re
// find dRb/dr, where Rb is the Born radius // find dRb/dr, where Rb is the Born radius
if( FABS( diff ) < r ){ if (FABS(diff) < r) {
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);
if( R > (r - S) ){ if (R > (r - S)) {
de -= CpuGBVI::dL_dr( r, R, S ); de -= ReferenceGBVI::dL_dr(r, R, S);
} else { } 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) ){ } else if (r < (S - R)) {
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);
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));
} }
// de = (dG/dRb)(dRb/dr) // de = (dG/dRb)(dRb/dr)
...@@ -721,12 +720,10 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re ...@@ -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) // convert from cal to Joule & apply prefactor tau = (1/diel_solute - 1/diel_solvent)
RealOpenMM conversion = static_cast<RealOpenMM>(gbviParameters->getTau()); 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][0] += conversion*forces[atomI][0];
inputForces[atomI][1] += conversion*forces[atomI][1]; inputForces[atomI][1] += conversion*forces[atomI][1];
inputForces[atomI][2] += conversion*forces[atomI][2]; inputForces[atomI][2] += conversion*forces[atomI][2];
...@@ -734,93 +731,6 @@ void CpuGBVI::computeBornForces( std::vector<RealVec>& atomCoordinates, const Re ...@@ -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 Use double precision
...@@ -835,7 +745,7 @@ void CpuGBVI::printGbvi( const std::vector<OpenMM::RealVec>& atomCoordinates, co ...@@ -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 ){ ...@@ -843,18 +753,18 @@ double CpuGBVI::getVolumeD( double r, double R, double S ){
static const double minusThree = -3.0; static const double minusThree = -3.0;
double diff = (S - R); double diff = (S - R);
if( fabs( diff ) < r ){ if (fabs(diff) < r) {
double lowerBound = (R > (r - S)) ? R : (r - S); double lowerBound = (R > (r - S)) ? R : (r - S);
return (CpuGBVI::getLD( r, (r + S), S ) - return (ReferenceGBVI::getLD(r, (r + S), S) -
CpuGBVI::getLD( r, lowerBound, S )); ReferenceGBVI::getLD(r, lowerBound, S));
} else if( r < diff ){ } else if (r < diff) {
return CpuGBVI::getLD( r, (r + S), S ) - return ReferenceGBVI::getLD(r, (r + S), S) -
CpuGBVI::getLD( r, (r - S), S ) + ReferenceGBVI::getLD(r, (r - S), S) +
pow( R, minusThree ); pow(R, minusThree);
} else { } else {
return zero; return zero;
...@@ -875,7 +785,7 @@ double CpuGBVI::getVolumeD( double r, double R, double S ){ ...@@ -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 ){ ...@@ -895,7 +805,7 @@ double CpuGBVI::getLD( double r, double x, double S ){
double diff2 = (r + S)*(r - 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 ){ ...@@ -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 ){ ...@@ -934,7 +844,7 @@ double CpuGBVI::dL_drD( double r, double x, double S ){
double diff2 = (r + S)*(r - 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 ){ ...@@ -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 ){ ...@@ -970,5 +880,5 @@ double CpuGBVI::dL_dxD( double r, double x, double S ){
double diff = (r + S)*(r - 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 @@ ...@@ -25,14 +25,12 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceHarmonicBondIxn.h" #include "ReferenceHarmonicBondIxn.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -40,7 +38,7 @@ using OpenMM::RealVec; ...@@ -40,7 +38,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceHarmonicBondIxn::ReferenceHarmonicBondIxn( ){ ReferenceHarmonicBondIxn::ReferenceHarmonicBondIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -56,7 +54,7 @@ ReferenceHarmonicBondIxn::ReferenceHarmonicBondIxn( ){ ...@@ -56,7 +54,7 @@ ReferenceHarmonicBondIxn::ReferenceHarmonicBondIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceHarmonicBondIxn::~ReferenceHarmonicBondIxn( ){ ReferenceHarmonicBondIxn::~ReferenceHarmonicBondIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -79,11 +77,11 @@ ReferenceHarmonicBondIxn::~ReferenceHarmonicBondIxn( ){ ...@@ -79,11 +77,11 @@ ReferenceHarmonicBondIxn::~ReferenceHarmonicBondIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceHarmonicBondIxn::calculateBondIxn( int* atomIndices, void ReferenceHarmonicBondIxn::calculateBondIxn(int* atomIndices,
vector<RealVec>& atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, RealOpenMM* parameters,
vector<RealVec>& forces, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const { RealOpenMM* totalEnergy) const {
static const std::string methodName = "\nReferenceHarmonicBondIxn::calculateBondIxn"; static const std::string methodName = "\nReferenceHarmonicBondIxn::calculateBondIxn";
...@@ -101,7 +99,7 @@ void ReferenceHarmonicBondIxn::calculateBondIxn( int* atomIndices, ...@@ -101,7 +99,7 @@ void ReferenceHarmonicBondIxn::calculateBondIxn( int* atomIndices,
int atomAIndex = atomIndices[0]; int atomAIndex = atomIndices[0];
int atomBIndex = atomIndices[1]; int atomBIndex = atomIndices[1];
ReferenceForce::getDeltaR( atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR ); ReferenceForce::getDeltaR(atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR);
// deltaIdeal = r - r_0 // deltaIdeal = r - r_0
......
...@@ -25,14 +25,12 @@ ...@@ -25,14 +25,12 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceLJCoulomb14.h" #include "ReferenceLJCoulomb14.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -40,7 +38,7 @@ using OpenMM::RealVec; ...@@ -40,7 +38,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceLJCoulomb14::ReferenceLJCoulomb14( ) { ReferenceLJCoulomb14::ReferenceLJCoulomb14() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -56,7 +54,7 @@ ReferenceLJCoulomb14::ReferenceLJCoulomb14( ) { ...@@ -56,7 +54,7 @@ ReferenceLJCoulomb14::ReferenceLJCoulomb14( ) {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceLJCoulomb14::~ReferenceLJCoulomb14( ){ ReferenceLJCoulomb14::~ReferenceLJCoulomb14() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -81,9 +79,9 @@ ReferenceLJCoulomb14::~ReferenceLJCoulomb14( ){ ...@@ -81,9 +79,9 @@ ReferenceLJCoulomb14::~ReferenceLJCoulomb14( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, vector<RealVec>& atomCoordinates, void ReferenceLJCoulomb14::calculateBondIxn(int* atomIndices, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, vector<RealVec>& forces, RealOpenMM* parameters, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const { RealOpenMM* totalEnergy) const {
static const std::string methodName = "\nReferenceLJCoulomb14::calculateBondIxn"; static const std::string methodName = "\nReferenceLJCoulomb14::calculateBondIxn";
...@@ -113,7 +111,7 @@ void ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, vector<RealVec>& ...@@ -113,7 +111,7 @@ void ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, vector<RealVec>&
int atomAIndex = atomIndices[0]; int atomAIndex = atomIndices[0];
int atomBIndex = atomIndices[1]; int atomBIndex = atomIndices[1];
ReferenceForce::getDeltaR( atomCoordinates[atomBIndex], atomCoordinates[atomAIndex], deltaR[0] ); ReferenceForce::getDeltaR(atomCoordinates[atomBIndex], atomCoordinates[atomAIndex], deltaR[0]);
RealOpenMM r2 = deltaR[0][ReferenceForce::R2Index]; RealOpenMM r2 = deltaR[0][ReferenceForce::R2Index];
RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]); RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]);
...@@ -121,13 +119,13 @@ void ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, vector<RealVec>& ...@@ -121,13 +119,13 @@ void ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, vector<RealVec>&
sig2 *= sig2; sig2 *= sig2;
RealOpenMM sig6 = sig2*sig2*sig2; RealOpenMM sig6 = sig2*sig2*sig2;
RealOpenMM dEdR = parameters[1]*( twelve*sig6 - six )*sig6; RealOpenMM dEdR = parameters[1]*(twelve*sig6 - six)*sig6;
dEdR += (RealOpenMM) (ONE_4PI_EPS0*parameters[2]*inverseR); dEdR += (RealOpenMM) (ONE_4PI_EPS0*parameters[2]*inverseR);
dEdR *= inverseR*inverseR; dEdR *= inverseR*inverseR;
// accumulate forces // accumulate forces
for( int ii = 0; ii < 3; ii++ ){ for (int ii = 0; ii < 3; ii++) {
RealOpenMM force = dEdR*deltaR[0][ii]; RealOpenMM force = dEdR*deltaR[0][ii];
forces[atomAIndex][ii] += force; forces[atomAIndex][ii] += force;
forces[atomBIndex][ii] -= force; forces[atomBIndex][ii] -= force;
...@@ -136,5 +134,5 @@ void ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, vector<RealVec>& ...@@ -136,5 +134,5 @@ void ReferenceLJCoulomb14::calculateBondIxn( int* atomIndices, vector<RealVec>&
// accumulate energies // accumulate energies
if (totalEnergy != NULL) if (totalEnergy != NULL)
*totalEnergy += parameters[1]*( sig6 - one )*sig6 + (ONE_4PI_EPS0*parameters[2]*inverseR); *totalEnergy += parameters[1]*(sig6 - one)*sig6 + (ONE_4PI_EPS0*parameters[2]*inverseR);
} }
...@@ -27,12 +27,11 @@ ...@@ -27,12 +27,11 @@
#include <complex> #include <complex>
#include <algorithm> #include <algorithm>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceLJCoulombIxn.h" #include "ReferenceLJCoulombIxn.h"
#include "ReferenceForce.h" #include "ReferenceForce.h"
#include "ReferencePME.h" #include "ReferencePME.h"
#include "openmm/OpenMMException.h"
// In case we're using some primitive version of Visual Studio this will // In case we're using some primitive version of Visual Studio this will
// make sure that erf() and erfc() are defined. // make sure that erf() and erfc() are defined.
...@@ -40,7 +39,7 @@ ...@@ -40,7 +39,7 @@
using std::set; using std::set;
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -48,7 +47,7 @@ using OpenMM::RealVec; ...@@ -48,7 +47,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceLJCoulombIxn::ReferenceLJCoulombIxn( ) : cutoff(false), useSwitch(false), periodic(false), ewald(false), pme(false) { ReferenceLJCoulombIxn::ReferenceLJCoulombIxn() : cutoff(false), useSwitch(false), periodic(false), ewald(false), pme(false) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -64,7 +63,7 @@ ReferenceLJCoulombIxn::ReferenceLJCoulombIxn( ) : cutoff(false), useSwitch(false ...@@ -64,7 +63,7 @@ ReferenceLJCoulombIxn::ReferenceLJCoulombIxn( ) : cutoff(false), useSwitch(false
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceLJCoulombIxn::~ReferenceLJCoulombIxn( ){ ReferenceLJCoulombIxn::~ReferenceLJCoulombIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -84,7 +83,7 @@ ReferenceLJCoulombIxn::~ReferenceLJCoulombIxn( ){ ...@@ -84,7 +83,7 @@ ReferenceLJCoulombIxn::~ReferenceLJCoulombIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceLJCoulombIxn::setUseCutoff( RealOpenMM distance, const OpenMM::NeighborList& neighbors, RealOpenMM solventDielectric ) { void ReferenceLJCoulombIxn::setUseCutoff(RealOpenMM distance, const OpenMM::NeighborList& neighbors, RealOpenMM solventDielectric) {
cutoff = true; cutoff = true;
cutoffDistance = distance; cutoffDistance = distance;
...@@ -101,7 +100,7 @@ ReferenceLJCoulombIxn::~ReferenceLJCoulombIxn( ){ ...@@ -101,7 +100,7 @@ ReferenceLJCoulombIxn::~ReferenceLJCoulombIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceLJCoulombIxn::setUseSwitchingFunction( RealOpenMM distance ) { void ReferenceLJCoulombIxn::setUseSwitchingFunction(RealOpenMM distance) {
useSwitch = true; useSwitch = true;
switchingDistance = distance; switchingDistance = distance;
} }
...@@ -210,16 +209,16 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -210,16 +209,16 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
// ************************************************************************************** // **************************************************************************************
if (includeReciprocal) { if (includeReciprocal) {
for( int atomID = 0; atomID < numberOfAtoms; atomID++ ){ for (int atomID = 0; atomID < numberOfAtoms; atomID++) {
RealOpenMM selfEwaldEnergy = (RealOpenMM) (ONE_4PI_EPS0*atomParameters[atomID][QIndex]*atomParameters[atomID][QIndex] * alphaEwald/SQRT_PI); RealOpenMM selfEwaldEnergy = (RealOpenMM) (ONE_4PI_EPS0*atomParameters[atomID][QIndex]*atomParameters[atomID][QIndex] * alphaEwald/SQRT_PI);
totalSelfEwaldEnergy -= selfEwaldEnergy; totalSelfEwaldEnergy -= selfEwaldEnergy;
if( energyByAtom ){ if (energyByAtom) {
energyByAtom[atomID] -= selfEwaldEnergy; energyByAtom[atomID] -= selfEwaldEnergy;
} }
} }
} }
if( totalEnergy ){ if (totalEnergy) {
*totalEnergy += totalSelfEwaldEnergy; *totalEnergy += totalSelfEwaldEnergy;
} }
...@@ -238,11 +237,11 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -238,11 +237,11 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
charges[i] = atomParameters[i][QIndex]; charges[i] = atomParameters[i][QIndex];
pme_exec(pmedata,atomCoordinates,forces,charges,periodicBoxVectors,&recipEnergy); pme_exec(pmedata,atomCoordinates,forces,charges,periodicBoxVectors,&recipEnergy);
if( totalEnergy ) if (totalEnergy)
*totalEnergy += recipEnergy; *totalEnergy += recipEnergy;
if( energyByAtom ) if (energyByAtom)
for(int n = 0; n < numberOfAtoms; n++) for (int n = 0; n < numberOfAtoms; n++)
energyByAtom[n] += recipEnergy; energyByAtom[n] += recipEnergy;
pme_destroy(pmedata); pme_destroy(pmedata);
...@@ -264,22 +263,19 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -264,22 +263,19 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
vector<d_complex> tab_xy(numberOfAtoms); vector<d_complex> tab_xy(numberOfAtoms);
vector<d_complex> tab_qxyz(numberOfAtoms); vector<d_complex> tab_qxyz(numberOfAtoms);
if (kmax < 1) { if (kmax < 1)
std::stringstream message; throw OpenMMException("kmax for Ewald summation < 1");
message << " kmax < 1 , Aborting" << std::endl;
SimTKOpenMMLog::printError( message );
}
for(int i = 0; (i < numberOfAtoms); i++) { for (int i = 0; (i < numberOfAtoms); i++) {
for(int m = 0; (m < 3); m++) for (int m = 0; (m < 3); m++)
EIR(0, i, m) = d_complex(1,0); EIR(0, i, m) = d_complex(1,0);
for(int m=0; (m<3); m++) for (int m=0; (m<3); m++)
EIR(1, i, m) = d_complex(cos(atomCoordinates[i][m]*recipBoxSize[m]), EIR(1, i, m) = d_complex(cos(atomCoordinates[i][m]*recipBoxSize[m]),
sin(atomCoordinates[i][m]*recipBoxSize[m])); sin(atomCoordinates[i][m]*recipBoxSize[m]));
for(int j=2; (j<kmax); j++) for (int j=2; (j<kmax); j++)
for(int m=0; (m<3); m++) for (int m=0; (m<3); m++)
EIR(j, i, m) = EIR(j-1, i, m) * EIR(1, i, m); EIR(j, i, m) = EIR(j-1, i, m) * EIR(1, i, m);
} }
...@@ -288,40 +284,40 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -288,40 +284,40 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
int lowry = 0; int lowry = 0;
int lowrz = 1; int lowrz = 1;
for(int rx = 0; rx < numRx; rx++) { for (int rx = 0; rx < numRx; rx++) {
RealOpenMM kx = rx * recipBoxSize[0]; RealOpenMM kx = rx * recipBoxSize[0];
for(int ry = lowry; ry < numRy; ry++) { for (int ry = lowry; ry < numRy; ry++) {
RealOpenMM ky = ry * recipBoxSize[1]; RealOpenMM ky = ry * recipBoxSize[1];
if(ry >= 0) { if (ry >= 0) {
for(int n = 0; n < numberOfAtoms; n++) for (int n = 0; n < numberOfAtoms; n++)
tab_xy[n] = EIR(rx, n, 0) * EIR(ry, n, 1); tab_xy[n] = EIR(rx, n, 0) * EIR(ry, n, 1);
} }
else { else {
for(int n = 0; n < numberOfAtoms; n++) for (int n = 0; n < numberOfAtoms; n++)
tab_xy[n]= EIR(rx, n, 0) * conj (EIR(-ry, n, 1)); tab_xy[n]= EIR(rx, n, 0) * conj (EIR(-ry, n, 1));
} }
for (int rz = lowrz; rz < numRz; rz++) { for (int rz = lowrz; rz < numRz; rz++) {
if( rz >= 0) { if (rz >= 0) {
for( int n = 0; n < numberOfAtoms; n++) for (int n = 0; n < numberOfAtoms; n++)
tab_qxyz[n] = atomParameters[n][QIndex] * (tab_xy[n] * EIR(rz, n, 2)); tab_qxyz[n] = atomParameters[n][QIndex] * (tab_xy[n] * EIR(rz, n, 2));
} }
else { else {
for( int n = 0; n < numberOfAtoms; n++) for (int n = 0; n < numberOfAtoms; n++)
tab_qxyz[n] = atomParameters[n][QIndex] * (tab_xy[n] * conj(EIR(-rz, n, 2))); tab_qxyz[n] = atomParameters[n][QIndex] * (tab_xy[n] * conj(EIR(-rz, n, 2)));
} }
RealOpenMM cs = 0.0f; RealOpenMM cs = 0.0f;
RealOpenMM ss = 0.0f; RealOpenMM ss = 0.0f;
for( int n = 0; n < numberOfAtoms; n++) { for (int n = 0; n < numberOfAtoms; n++) {
cs += tab_qxyz[n].real(); cs += tab_qxyz[n].real();
ss += tab_qxyz[n].imag(); ss += tab_qxyz[n].imag();
} }
...@@ -330,21 +326,21 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -330,21 +326,21 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
RealOpenMM k2 = kx * kx + ky * ky + kz * kz; RealOpenMM k2 = kx * kx + ky * ky + kz * kz;
RealOpenMM ak = exp(k2*factorEwald) / k2; RealOpenMM ak = exp(k2*factorEwald) / k2;
for(int n = 0; n < numberOfAtoms; n++) { for (int n = 0; n < numberOfAtoms; n++) {
RealOpenMM force = ak * (cs * tab_qxyz[n].imag() - ss * tab_qxyz[n].real()); RealOpenMM force = ak * (cs * tab_qxyz[n].imag() - ss * tab_qxyz[n].real());
forces[n][0] += 2 * recipCoeff * force * kx ; forces[n][0] += 2 * recipCoeff * force * kx ;
forces[n][1] += 2 * recipCoeff * force * ky ; forces[n][1] += 2 * recipCoeff * force * ky ;
forces[n][2] += 2 * recipCoeff * force * kz ; forces[n][2] += 2 * recipCoeff * force * kz ;
} }
recipEnergy = recipCoeff * ak * ( cs * cs + ss * ss); recipEnergy = recipCoeff * ak * (cs * cs + ss * ss);
totalRecipEnergy += recipEnergy; totalRecipEnergy += recipEnergy;
if( totalEnergy ) if (totalEnergy)
*totalEnergy += recipEnergy; *totalEnergy += recipEnergy;
if( energyByAtom ) if (energyByAtom)
for(int n = 0; n < numberOfAtoms; n++) for (int n = 0; n < numberOfAtoms; n++)
energyByAtom[n] += recipEnergy; energyByAtom[n] += recipEnergy;
lowrz = 1 - numRz; lowrz = 1 - numRz;
...@@ -369,7 +365,7 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -369,7 +365,7 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
int jj = pair.second; int jj = pair.second;
RealOpenMM deltaR[2][ReferenceForce::LastDeltaRIndex]; RealOpenMM deltaR[2][ReferenceForce::LastDeltaRIndex];
ReferenceForce::getDeltaRPeriodic( atomCoordinates[jj], atomCoordinates[ii], periodicBoxVectors, deltaR[0] ); ReferenceForce::getDeltaRPeriodic(atomCoordinates[jj], atomCoordinates[ii], periodicBoxVectors, deltaR[0]);
RealOpenMM r = deltaR[0][ReferenceForce::RIndex]; RealOpenMM r = deltaR[0][ReferenceForce::RIndex];
RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]); RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]);
RealOpenMM switchValue = 1, switchDeriv = 0; RealOpenMM switchValue = 1, switchDeriv = 0;
...@@ -382,14 +378,14 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -382,14 +378,14 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
RealOpenMM dEdR = (RealOpenMM) (ONE_4PI_EPS0 * atomParameters[ii][QIndex] * atomParameters[jj][QIndex] * inverseR * inverseR * inverseR); RealOpenMM dEdR = (RealOpenMM) (ONE_4PI_EPS0 * atomParameters[ii][QIndex] * atomParameters[jj][QIndex] * inverseR * inverseR * inverseR);
dEdR = (RealOpenMM) (dEdR * (erfc(alphaR) + 2 * alphaR * exp ( - alphaR * alphaR) / SQRT_PI )); dEdR = (RealOpenMM) (dEdR * (erfc(alphaR) + 2 * alphaR * exp (- alphaR * alphaR) / SQRT_PI));
RealOpenMM sig = atomParameters[ii][SigIndex] + atomParameters[jj][SigIndex]; RealOpenMM sig = atomParameters[ii][SigIndex] + atomParameters[jj][SigIndex];
RealOpenMM sig2 = inverseR*sig; RealOpenMM sig2 = inverseR*sig;
sig2 *= sig2; sig2 *= sig2;
RealOpenMM sig6 = sig2*sig2*sig2; RealOpenMM sig6 = sig2*sig2*sig2;
RealOpenMM eps = atomParameters[ii][EpsIndex]*atomParameters[jj][EpsIndex]; RealOpenMM eps = atomParameters[ii][EpsIndex]*atomParameters[jj][EpsIndex];
dEdR += switchValue*eps*( twelve*sig6 - six )*sig6*inverseR*inverseR; dEdR += switchValue*eps*(twelve*sig6 - six)*sig6*inverseR*inverseR;
vdwEnergy = eps*(sig6-one)*sig6; vdwEnergy = eps*(sig6-one)*sig6;
if (useSwitch) { if (useSwitch) {
dEdR -= vdwEnergy*switchDeriv*inverseR; dEdR -= vdwEnergy*switchDeriv*inverseR;
...@@ -398,7 +394,7 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -398,7 +394,7 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
// accumulate forces // accumulate forces
for( int kk = 0; kk < 3; kk++ ){ for (int kk = 0; kk < 3; kk++) {
RealOpenMM force = dEdR*deltaR[0][kk]; RealOpenMM force = dEdR*deltaR[0][kk];
forces[ii][kk] += force; forces[ii][kk] += force;
forces[jj][kk] -= force; forces[jj][kk] -= force;
...@@ -411,14 +407,14 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -411,14 +407,14 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
totalVdwEnergy += vdwEnergy; totalVdwEnergy += vdwEnergy;
totalRealSpaceEwaldEnergy += realSpaceEwaldEnergy; totalRealSpaceEwaldEnergy += realSpaceEwaldEnergy;
if( energyByAtom ){ if (energyByAtom) {
energyByAtom[ii] += realSpaceEwaldEnergy + vdwEnergy; energyByAtom[ii] += realSpaceEwaldEnergy + vdwEnergy;
energyByAtom[jj] += realSpaceEwaldEnergy + vdwEnergy; energyByAtom[jj] += realSpaceEwaldEnergy + vdwEnergy;
} }
} }
if( totalEnergy ) if (totalEnergy)
*totalEnergy += totalRealSpaceEwaldEnergy + totalVdwEnergy; *totalEnergy += totalRealSpaceEwaldEnergy + totalVdwEnergy;
// Now subtract off the exclusions, since they were implicitly included in the reciprocal space sum. // Now subtract off the exclusions, since they were implicitly included in the reciprocal space sum.
...@@ -431,17 +427,17 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -431,17 +427,17 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
int jj = *iter; int jj = *iter;
RealOpenMM deltaR[2][ReferenceForce::LastDeltaRIndex]; RealOpenMM deltaR[2][ReferenceForce::LastDeltaRIndex];
ReferenceForce::getDeltaR( atomCoordinates[jj], atomCoordinates[ii], deltaR[0] ); ReferenceForce::getDeltaR(atomCoordinates[jj], atomCoordinates[ii], deltaR[0]);
RealOpenMM r = deltaR[0][ReferenceForce::RIndex]; RealOpenMM r = deltaR[0][ReferenceForce::RIndex];
RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]); RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]);
RealOpenMM alphaR = alphaEwald * r; RealOpenMM alphaR = alphaEwald * r;
if (erf(alphaR) > 1e-6) { if (erf(alphaR) > 1e-6) {
RealOpenMM dEdR = (RealOpenMM) (ONE_4PI_EPS0 * atomParameters[ii][QIndex] * atomParameters[jj][QIndex] * inverseR * inverseR * inverseR); RealOpenMM dEdR = (RealOpenMM) (ONE_4PI_EPS0 * atomParameters[ii][QIndex] * atomParameters[jj][QIndex] * inverseR * inverseR * inverseR);
dEdR = (RealOpenMM) (dEdR * (erf(alphaR) - 2 * alphaR * exp ( - alphaR * alphaR) / SQRT_PI )); dEdR = (RealOpenMM) (dEdR * (erf(alphaR) - 2 * alphaR * exp (- alphaR * alphaR) / SQRT_PI));
// accumulate forces // accumulate forces
for( int kk = 0; kk < 3; kk++ ){ for (int kk = 0; kk < 3; kk++) {
RealOpenMM force = dEdR*deltaR[0][kk]; RealOpenMM force = dEdR*deltaR[0][kk];
forces[ii][kk] -= force; forces[ii][kk] -= force;
forces[jj][kk] += force; forces[jj][kk] += force;
...@@ -452,7 +448,7 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -452,7 +448,7 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
realSpaceEwaldEnergy = (RealOpenMM) (ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*inverseR*erf(alphaR)); realSpaceEwaldEnergy = (RealOpenMM) (ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*inverseR*erf(alphaR));
totalExclusionEnergy += realSpaceEwaldEnergy; totalExclusionEnergy += realSpaceEwaldEnergy;
if( energyByAtom ){ if (energyByAtom) {
energyByAtom[ii] -= realSpaceEwaldEnergy; energyByAtom[ii] -= realSpaceEwaldEnergy;
energyByAtom[jj] -= realSpaceEwaldEnergy; energyByAtom[jj] -= realSpaceEwaldEnergy;
} }
...@@ -460,7 +456,7 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec> ...@@ -460,7 +456,7 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
} }
} }
if( totalEnergy ) if (totalEnergy)
*totalEnergy -= totalExclusionEnergy; *totalEnergy -= totalExclusionEnergy;
} }
...@@ -502,10 +498,10 @@ void ReferenceLJCoulombIxn::calculatePairIxn(int numberOfAtoms, vector<RealVec>& ...@@ -502,10 +498,10 @@ void ReferenceLJCoulombIxn::calculatePairIxn(int numberOfAtoms, vector<RealVec>&
} }
} }
else { else {
for( int ii = 0; ii < numberOfAtoms; ii++ ){ for (int ii = 0; ii < numberOfAtoms; ii++) {
// loop over atom pairs // loop over atom pairs
for( int jj = ii+1; jj < numberOfAtoms; jj++ ) for (int jj = ii+1; jj < numberOfAtoms; jj++)
if (exclusions[jj].find(ii) == exclusions[jj].end()) if (exclusions[jj].find(ii) == exclusions[jj].end())
calculateOneIxn(ii, jj, atomCoordinates, atomParameters, forces, energyByAtom, totalEnergy); calculateOneIxn(ii, jj, atomCoordinates, atomParameters, forces, energyByAtom, totalEnergy);
} }
...@@ -526,9 +522,9 @@ void ReferenceLJCoulombIxn::calculatePairIxn(int numberOfAtoms, vector<RealVec>& ...@@ -526,9 +522,9 @@ void ReferenceLJCoulombIxn::calculatePairIxn(int numberOfAtoms, vector<RealVec>&
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& atomCoordinates, void ReferenceLJCoulombIxn::calculateOneIxn(int ii, int jj, vector<RealVec>& atomCoordinates,
RealOpenMM** atomParameters, vector<RealVec>& forces, RealOpenMM** atomParameters, vector<RealVec>& forces,
RealOpenMM* energyByAtom, RealOpenMM* totalEnergy ) const { RealOpenMM* energyByAtom, RealOpenMM* totalEnergy) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -555,9 +551,9 @@ void ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& at ...@@ -555,9 +551,9 @@ void ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& at
// get deltaR, R2, and R between 2 atoms // get deltaR, R2, and R between 2 atoms
if (periodic) if (periodic)
ReferenceForce::getDeltaRPeriodic( atomCoordinates[jj], atomCoordinates[ii], periodicBoxVectors, deltaR[0] ); ReferenceForce::getDeltaRPeriodic(atomCoordinates[jj], atomCoordinates[ii], periodicBoxVectors, deltaR[0]);
else else
ReferenceForce::getDeltaR( atomCoordinates[jj], atomCoordinates[ii], deltaR[0] ); ReferenceForce::getDeltaR(atomCoordinates[jj], atomCoordinates[ii], deltaR[0]);
RealOpenMM r2 = deltaR[0][ReferenceForce::R2Index]; RealOpenMM r2 = deltaR[0][ReferenceForce::R2Index];
RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]); RealOpenMM inverseR = one/(deltaR[0][ReferenceForce::RIndex]);
...@@ -576,7 +572,7 @@ void ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& at ...@@ -576,7 +572,7 @@ void ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& at
RealOpenMM sig6 = sig2*sig2*sig2; RealOpenMM sig6 = sig2*sig2*sig2;
RealOpenMM eps = atomParameters[ii][EpsIndex]*atomParameters[jj][EpsIndex]; RealOpenMM eps = atomParameters[ii][EpsIndex]*atomParameters[jj][EpsIndex];
RealOpenMM dEdR = switchValue*eps*( twelve*sig6 - six )*sig6; RealOpenMM dEdR = switchValue*eps*(twelve*sig6 - six)*sig6;
if (cutoff) if (cutoff)
dEdR += (RealOpenMM) (ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*(inverseR-2.0f*krf*r2)); dEdR += (RealOpenMM) (ONE_4PI_EPS0*atomParameters[ii][QIndex]*atomParameters[jj][QIndex]*(inverseR-2.0f*krf*r2));
else else
...@@ -594,7 +590,7 @@ void ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& at ...@@ -594,7 +590,7 @@ void ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& at
// accumulate forces // accumulate forces
for( int kk = 0; kk < 3; kk++ ){ for (int kk = 0; kk < 3; kk++) {
RealOpenMM force = dEdR*deltaR[0][kk]; RealOpenMM force = dEdR*deltaR[0][kk];
forces[ii][kk] += force; forces[ii][kk] += force;
forces[jj][kk] -= force; forces[jj][kk] -= force;
...@@ -602,9 +598,9 @@ void ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& at ...@@ -602,9 +598,9 @@ void ReferenceLJCoulombIxn::calculateOneIxn( int ii, int jj, vector<RealVec>& at
// accumulate energies // accumulate energies
if( totalEnergy ) if (totalEnergy)
*totalEnergy += energy; *totalEnergy += energy;
if( energyByAtom ){ if (energyByAtom) {
energyByAtom[ii] += energy; energyByAtom[ii] += energy;
energyByAtom[jj] += energy; energyByAtom[jj] += energy;
} }
......
...@@ -24,15 +24,13 @@ ...@@ -24,15 +24,13 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "SimTKOpenMMLog.h"
#include "ReferenceLincsAlgorithm.h" #include "ReferenceLincsAlgorithm.h"
#include "ReferenceDynamics.h" #include "ReferenceDynamics.h"
#include "openmm/OpenMMException.h" #include "openmm/OpenMMException.h"
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -44,9 +42,9 @@ using OpenMM::RealVec; ...@@ -44,9 +42,9 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceLincsAlgorithm::ReferenceLincsAlgorithm( int numberOfConstraints, ReferenceLincsAlgorithm::ReferenceLincsAlgorithm(int numberOfConstraints,
int** atomIndices, int** atomIndices,
RealOpenMM* distance ){ RealOpenMM* distance) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -70,7 +68,7 @@ ReferenceLincsAlgorithm::ReferenceLincsAlgorithm( int numberOfConstraints, ...@@ -70,7 +68,7 @@ ReferenceLincsAlgorithm::ReferenceLincsAlgorithm( int numberOfConstraints,
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceLincsAlgorithm::getNumberOfConstraints( void ) const { int ReferenceLincsAlgorithm::getNumberOfConstraints() const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -89,7 +87,7 @@ int ReferenceLincsAlgorithm::getNumberOfConstraints( void ) const { ...@@ -89,7 +87,7 @@ int ReferenceLincsAlgorithm::getNumberOfConstraints( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceLincsAlgorithm::getNumTerms( void ) const { int ReferenceLincsAlgorithm::getNumTerms() const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -106,7 +104,7 @@ int ReferenceLincsAlgorithm::getNumTerms( void ) const { ...@@ -106,7 +104,7 @@ int ReferenceLincsAlgorithm::getNumTerms( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceLincsAlgorithm::setNumTerms( int terms ){ void ReferenceLincsAlgorithm::setNumTerms(int terms) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -214,14 +212,11 @@ void ReferenceLincsAlgorithm::updateAtomPositions(int numberOfAtoms, vector<Real ...@@ -214,14 +212,11 @@ void ReferenceLincsAlgorithm::updateAtomPositions(int numberOfAtoms, vector<Real
@param atomCoordinatesP atom coordinates prime @param atomCoordinatesP atom coordinates prime
@param inverseMasses 1/mass @param inverseMasses 1/mass
@return SimTKOpenMMCommon::DefaultReturn if converge; else
return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceLincsAlgorithm::apply( int numberOfAtoms, vector<RealVec>& atomCoordinates, void ReferenceLincsAlgorithm::apply(int numberOfAtoms, vector<RealVec>& atomCoordinates,
vector<RealVec>& atomCoordinatesP, vector<RealVec>& atomCoordinatesP,
vector<RealOpenMM>& inverseMasses ){ vector<RealOpenMM>& inverseMasses) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -234,9 +229,9 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, vector<RealVec>& atomCoor ...@@ -234,9 +229,9 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, vector<RealVec>& atomCoor
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
if (_numberOfConstraints == 0) if (_numberOfConstraints == 0)
return SimTKOpenMMCommon::DefaultReturn; return;
if( !_hasInitialized ) if (!_hasInitialized)
initialize(numberOfAtoms, inverseMasses); initialize(numberOfAtoms, inverseMasses);
// Calculate the direction of each constraint, along with the initial RHS and solution vectors. // Calculate the direction of each constraint, along with the initial RHS and solution vectors.
...@@ -288,9 +283,6 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, vector<RealVec>& atomCoor ...@@ -288,9 +283,6 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, vector<RealVec>& atomCoor
} }
solveMatrix(); solveMatrix();
updateAtomPositions(numberOfAtoms, atomCoordinatesP, inverseMasses); updateAtomPositions(numberOfAtoms, atomCoordinatesP, inverseMasses);
return SimTKOpenMMCommon::DefaultReturn;
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -302,12 +294,9 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, vector<RealVec>& atomCoor ...@@ -302,12 +294,9 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, vector<RealVec>& atomCoor
@param velocities atom velocities @param velocities atom velocities
@param inverseMasses 1/mass @param inverseMasses 1/mass
@return SimTKOpenMMCommon::DefaultReturn if converge; else
return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ReferenceLincsAlgorithm::applyToVelocities(int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, void ReferenceLincsAlgorithm::applyToVelocities(int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates,
std::vector<OpenMM::RealVec>& velocities, std::vector<RealOpenMM>& inverseMasses) { std::vector<OpenMM::RealVec>& velocities, std::vector<RealOpenMM>& inverseMasses) {
throw OpenMM::OpenMMException("applyToVelocities is not implemented"); throw OpenMM::OpenMMException("applyToVelocities is not implemented");
} }
...@@ -49,7 +49,7 @@ ReferenceMonteCarloBarostat::ReferenceMonteCarloBarostat(int numAtoms, const vec ...@@ -49,7 +49,7 @@ ReferenceMonteCarloBarostat::ReferenceMonteCarloBarostat(int numAtoms, const vec
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceMonteCarloBarostat::~ReferenceMonteCarloBarostat( ) { ReferenceMonteCarloBarostat::~ReferenceMonteCarloBarostat() {
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
......
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