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

Merge remote-tracking branch 'upstream/master'

parents 62581e9c 7f8c5089
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "ReferenceBondIxn.h" #include "ReferenceBondIxn.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn { class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
...@@ -41,7 +41,7 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn { ...@@ -41,7 +41,7 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceProperDihedralBond( ); ReferenceProperDihedralBond();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -49,7 +49,7 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn { ...@@ -49,7 +49,7 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceProperDihedralBond( ); ~ReferenceProperDihedralBond();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -65,12 +65,12 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn { ...@@ -65,12 +65,12 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateBondIxn( int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces,
RealOpenMM* totalEnergy ) const; RealOpenMM* totalEnergy) const;
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceProperDihedralBond_H__ #endif // __ReferenceProperDihedralBond_H__
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "ReferenceBondIxn.h" #include "ReferenceBondIxn.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn { class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
...@@ -41,7 +41,7 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn { ...@@ -41,7 +41,7 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceRbDihedralBond( ); ReferenceRbDihedralBond();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -49,7 +49,7 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn { ...@@ -49,7 +49,7 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceRbDihedralBond( ); ~ReferenceRbDihedralBond();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -63,12 +63,12 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn { ...@@ -63,12 +63,12 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void calculateBondIxn( int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates, void calculateBondIxn(int* atomIndices, std::vector<OpenMM::RealVec>& atomCoordinates,
RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces, RealOpenMM* parameters, std::vector<OpenMM::RealVec>& forces,
RealOpenMM* totalEnergy ) const; RealOpenMM* totalEnergy) const;
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceRbDihedralBond_H__ #endif // __ReferenceRbDihedralBond_H__
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "ReferenceDynamics.h" #include "ReferenceDynamics.h"
#include "openmm/internal/windowsExport.h" #include "openmm/internal/windowsExport.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics { class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics {
...@@ -51,7 +51,7 @@ class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics { ...@@ -51,7 +51,7 @@ class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceStochasticDynamics( int numberOfAtoms, RealOpenMM deltaT, RealOpenMM tau, RealOpenMM temperature ); ReferenceStochasticDynamics(int numberOfAtoms, RealOpenMM deltaT, RealOpenMM tau, RealOpenMM temperature);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -59,7 +59,7 @@ class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics { ...@@ -59,7 +59,7 @@ class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceStochasticDynamics( ); ~ReferenceStochasticDynamics();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -69,7 +69,7 @@ class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics { ...@@ -69,7 +69,7 @@ class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getTau( void ) const; RealOpenMM getTau() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -100,8 +100,8 @@ class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics { ...@@ -100,8 +100,8 @@ class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
virtual void updatePart1( int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& velocities, virtual void updatePart1(int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& velocities,
std::vector<OpenMM::RealVec>& forces, std::vector<RealOpenMM>& inverseMasses, std::vector<OpenMM::RealVec>& xPrime ); std::vector<OpenMM::RealVec>& forces, std::vector<RealOpenMM>& inverseMasses, std::vector<OpenMM::RealVec>& xPrime);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -115,11 +115,11 @@ class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics { ...@@ -115,11 +115,11 @@ class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
virtual void updatePart2( int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& velocities, virtual void updatePart2(int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& velocities,
std::vector<OpenMM::RealVec>& forces, std::vector<RealOpenMM>& inverseMasses, std::vector<OpenMM::RealVec>& xPrime ); std::vector<OpenMM::RealVec>& forces, std::vector<RealOpenMM>& inverseMasses, std::vector<OpenMM::RealVec>& xPrime);
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceStochasticDynamics_H__ #endif // __ReferenceStochasticDynamics_H__
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "ReferenceDynamics.h" #include "ReferenceDynamics.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ReferenceVariableStochasticDynamics : public ReferenceDynamics { class ReferenceVariableStochasticDynamics : public ReferenceDynamics {
...@@ -50,7 +50,7 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics { ...@@ -50,7 +50,7 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceVariableStochasticDynamics( int numberOfAtoms, RealOpenMM tau, RealOpenMM temperature, RealOpenMM accuracy ); ReferenceVariableStochasticDynamics(int numberOfAtoms, RealOpenMM tau, RealOpenMM temperature, RealOpenMM accuracy);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -58,7 +58,7 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics { ...@@ -58,7 +58,7 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceVariableStochasticDynamics( ); ~ReferenceVariableStochasticDynamics();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -68,7 +68,7 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics { ...@@ -68,7 +68,7 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getTau( void ) const; RealOpenMM getTau() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -78,7 +78,7 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics { ...@@ -78,7 +78,7 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getAccuracy( void ) const; RealOpenMM getAccuracy() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -86,7 +86,7 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics { ...@@ -86,7 +86,7 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setAccuracy( RealOpenMM accuracy ); void setAccuracy(RealOpenMM accuracy);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -120,9 +120,9 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics { ...@@ -120,9 +120,9 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void updatePart1( int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& velocities, void updatePart1(int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& velocities,
std::vector<OpenMM::RealVec>& forces, std::vector<RealOpenMM>& masses, std::vector<RealOpenMM>& inverseMasses, std::vector<OpenMM::RealVec>& forces, std::vector<RealOpenMM>& masses, std::vector<RealOpenMM>& inverseMasses,
std::vector<OpenMM::RealVec>& xPrime, RealOpenMM maxStepSize ); std::vector<OpenMM::RealVec>& xPrime, RealOpenMM maxStepSize);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -136,12 +136,12 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics { ...@@ -136,12 +136,12 @@ class ReferenceVariableStochasticDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void updatePart2( int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& velocities, void updatePart2(int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& velocities,
std::vector<OpenMM::RealVec>& forces, std::vector<RealOpenMM>& inverseMasses, std::vector<OpenMM::RealVec>& forces, std::vector<RealOpenMM>& inverseMasses,
std::vector<OpenMM::RealVec>& xPrime ); std::vector<OpenMM::RealVec>& xPrime);
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceVariableStochasticDynamics_H__ #endif // __ReferenceVariableStochasticDynamics_H__
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "ReferenceDynamics.h" #include "ReferenceDynamics.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ReferenceVariableVerletDynamics : public ReferenceDynamics { class ReferenceVariableVerletDynamics : public ReferenceDynamics {
...@@ -48,7 +48,7 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics { ...@@ -48,7 +48,7 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceVariableVerletDynamics( int numberOfAtoms, RealOpenMM accuracy ); ReferenceVariableVerletDynamics(int numberOfAtoms, RealOpenMM accuracy);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -56,7 +56,7 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics { ...@@ -56,7 +56,7 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceVariableVerletDynamics( ); ~ReferenceVariableVerletDynamics();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -66,7 +66,7 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics { ...@@ -66,7 +66,7 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM getAccuracy( void ) const; RealOpenMM getAccuracy() const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -74,7 +74,7 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics { ...@@ -74,7 +74,7 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void setAccuracy( RealOpenMM accuracy ); void setAccuracy(RealOpenMM accuracy);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -95,6 +95,6 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics { ...@@ -95,6 +95,6 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics {
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceVariableVerletDynamics_H__ #endif // __ReferenceVariableVerletDynamics_H__
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "ReferenceDynamics.h" #include "ReferenceDynamics.h"
// --------------------------------------------------------------------------------------- namespace OpenMM {
class ReferenceVerletDynamics : public ReferenceDynamics { class ReferenceVerletDynamics : public ReferenceDynamics {
...@@ -49,7 +49,7 @@ class ReferenceVerletDynamics : public ReferenceDynamics { ...@@ -49,7 +49,7 @@ class ReferenceVerletDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceVerletDynamics( int numberOfAtoms, RealOpenMM deltaT ); ReferenceVerletDynamics(int numberOfAtoms, RealOpenMM deltaT);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -57,7 +57,7 @@ class ReferenceVerletDynamics : public ReferenceDynamics { ...@@ -57,7 +57,7 @@ class ReferenceVerletDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
~ReferenceVerletDynamics( ); ~ReferenceVerletDynamics();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -77,6 +77,6 @@ class ReferenceVerletDynamics : public ReferenceDynamics { ...@@ -77,6 +77,6 @@ class ReferenceVerletDynamics : public ReferenceDynamics {
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __ReferenceVerletDynamics_H__ #endif // __ReferenceVerletDynamics_H__
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include "RealVec.h" #include "RealVec.h"
#include <vector> #include <vector>
namespace OpenMM {
class OPENMM_EXPORT ReferenceVirtualSites { class OPENMM_EXPORT ReferenceVirtualSites {
public: public:
/** /**
...@@ -48,4 +50,6 @@ public: ...@@ -48,4 +50,6 @@ public:
static void distributeForces(const OpenMM::System& system, const std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& forces); static void distributeForces(const OpenMM::System& system, const std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<OpenMM::RealVec>& forces);
}; };
} // namespace OpenMM
#endif // __ReferenceVirtualSites_H__ #endif // __ReferenceVirtualSites_H__
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __SimTKOpenMMCommon_H__
#define __SimTKOpenMMCommon_H__
// include file containing entries commonly used
// STL includes
#include <vector>
#include <string>
// ---------------------------------------------------------------------------------------
#include "RealVec.h"
// ---------------------------------------------------------------------------------------
typedef std::vector<RealOpenMM> RealOpenMMVector;
typedef RealOpenMMVector::iterator RealOpenMMVectorI;
typedef RealOpenMMVector::const_iterator RealOpenMMVectorCI;
// ---------------------------------------------------------------------------------------
class SimTKOpenMMCommon {
public:
static const std::string NotSet;
static const RealOpenMM BigCutoffValue;
static const std::string Comment;
static const std::string Tab;
static const std::string YesU;
static const std::string YesUl;
static const std::string YesL;
// subroutine returns
static const int DefaultReturn;
static const int ErrorReturn;
};
#endif // __SimTKOpenMMCommon_H__
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __SimTKOpenMMLog_H__
#define __SimTKOpenMMLog_H__
#include <cstdio>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "openmm/internal/windowsExport.h"
/** ---------------------------------------------------------------------------------------
SimTKOpenMMLog class used for logging
--------------------------------------------------------------------------------------- */
class OPENMM_EXPORT SimTKOpenMMLog {
public:
// log levels
enum LogLevels { LogOff, LogLowLevel, LogHighLevel };
private:
// file to write to
FILE* _logFile;
// log level
LogLevels _logLevel;
// global reference
static SimTKOpenMMLog* _simTKOpenMMLog;
public:
/**---------------------------------------------------------------------------------------
SimTKOpenMMLog constructor (Simbios)
@param logFile file reference for logging
--------------------------------------------------------------------------------------- */
SimTKOpenMMLog( FILE* logFile = NULL );
/**---------------------------------------------------------------------------------------
SimTKOpenMMLog destructor (Simbios)
--------------------------------------------------------------------------------------- */
~SimTKOpenMMLog( );
/**---------------------------------------------------------------------------------------
SimTKOpenMMLog log message to log (Simbios)
@param message message to log
--------------------------------------------------------------------------------------- */
void logMessage( const std::stringstream& message ) const;
/**---------------------------------------------------------------------------------------
Get LogFile
@return logFile
--------------------------------------------------------------------------------------- */
FILE* getLogFile( void ) const;
/**---------------------------------------------------------------------------------------
Set LogFile
@param input logFile
--------------------------------------------------------------------------------------- */
void setLogFile( FILE* logFile );
/**---------------------------------------------------------------------------------------
Set LogLevel
@param input logLevel
--------------------------------------------------------------------------------------- */
void setLogLevel( SimTKOpenMMLog::LogLevels logLevel );
/**---------------------------------------------------------------------------------------
Set global simTKLog (Simbios)
@param logFile file to log to
@return new SimTKOpenMMLog
--------------------------------------------------------------------------------------- */
static SimTKOpenMMLog* setSimTKOpenMMLog( FILE* logFile = NULL );
/**---------------------------------------------------------------------------------------
Get global simTKLog -- static method (Simbios)
@return static member
--------------------------------------------------------------------------------------- */
static SimTKOpenMMLog* getSimTKOpenMMLog( void );
/**---------------------------------------------------------------------------------------
Get global simTKLog (Simbios)
@return FILE reference
--------------------------------------------------------------------------------------- */
static FILE* getSimTKOpenMMLogFile( void );
/**---------------------------------------------------------------------------------------
Staitc method to print message (Simbios)
@param message message to log
--------------------------------------------------------------------------------------- */
static void printMessage( const std::stringstream& message );
/**---------------------------------------------------------------------------------------
Staitc method to print warning message (Simbios)
@param message message to log
--------------------------------------------------------------------------------------- */
static void printWarning( const std::stringstream& message );
/**---------------------------------------------------------------------------------------
Static method to print error message and exist program (Simbios)
@param message message to log
--------------------------------------------------------------------------------------- */
static void printError( const std::stringstream& message );
};
#endif //__SimTKOpenMMLog_H__
...@@ -27,12 +27,14 @@ ...@@ -27,12 +27,14 @@
// class of shared, static utility methods // class of shared, static utility methods
#include "SimTKOpenMMCommon.h" #include "RealVec.h"
#include "sfmt/SFMT.h" #include "sfmt/SFMT.h"
#include "openmm/internal/windowsExport.h" #include "openmm/internal/windowsExport.h"
#include <string> #include <string>
namespace OpenMM {
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
Class of static methods to be shared Class of static methods to be shared
...@@ -54,8 +56,8 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -54,8 +56,8 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
// dummy constructor/destructor // dummy constructor/destructor
SimTKOpenMMUtilities(){}; SimTKOpenMMUtilities() {};
~SimTKOpenMMUtilities(){}; ~SimTKOpenMMUtilities() {};
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -73,9 +75,9 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -73,9 +75,9 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM* allocateOneDRealOpenMMArray( int iSize, RealOpenMM* array1D, int initialize, static RealOpenMM* allocateOneDRealOpenMMArray(int iSize, RealOpenMM* array1D, int initialize,
RealOpenMM initialValue, RealOpenMM initialValue,
const std::string& idString = std::string( "1DArray" ) ); const std::string& idString = std::string("1DArray"));
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -94,10 +96,10 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -94,10 +96,10 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM** allocateTwoDRealOpenMMArray( int iSize, int jSize, static RealOpenMM** allocateTwoDRealOpenMMArray(int iSize, int jSize,
RealOpenMM** array2D, int initialize, RealOpenMM** array2D, int initialize,
RealOpenMM initialValue, RealOpenMM initialValue,
const std::string& idString = std::string( "2DArray" ) ); const std::string& idString = std::string("2DArray"));
/* --------------------------------------------------------------------------------------- /* ---------------------------------------------------------------------------------------
...@@ -110,8 +112,8 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -110,8 +112,8 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static void freeOneDRealOpenMMArray( RealOpenMM* array1D, static void freeOneDRealOpenMMArray(RealOpenMM* array1D,
const std::string& idString = std::string( "1DArray" ) ); const std::string& idString = std::string("1DArray"));
/* --------------------------------------------------------------------------------------- /* ---------------------------------------------------------------------------------------
...@@ -124,8 +126,8 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -124,8 +126,8 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static void freeTwoDRealOpenMMArray( RealOpenMM** array2D, static void freeTwoDRealOpenMMArray(RealOpenMM** array2D,
const std::string& idString = std::string( "2DArray" ) ); const std::string& idString = std::string("2DArray"));
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -140,8 +142,8 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -140,8 +142,8 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static void initialize2DRealOpenMMArray( int iSize, int jSize, static void initialize2DRealOpenMMArray(int iSize, int jSize,
RealOpenMM** array2D, RealOpenMM initialValue ); RealOpenMM** array2D, RealOpenMM initialValue);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -157,7 +159,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -157,7 +159,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static void crossProductVector3( RealOpenMM* vectorX, RealOpenMM* vectorY, RealOpenMM* vectorZ ); static void crossProductVector3(RealOpenMM* vectorX, RealOpenMM* vectorY, RealOpenMM* vectorZ);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -167,7 +169,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -167,7 +169,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getNormallyDistributedRandomNumber( void ); static RealOpenMM getNormallyDistributedRandomNumber();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -177,7 +179,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -177,7 +179,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static RealOpenMM getUniformlyDistributedRandomNumber( void ); static RealOpenMM getUniformlyDistributedRandomNumber();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -187,7 +189,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -187,7 +189,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static uint32_t getRandomNumberSeed( void ); static uint32_t getRandomNumberSeed();
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -197,7 +199,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -197,7 +199,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
static void setRandomNumberSeed( uint32_t seed ); static void setRandomNumberSeed(uint32_t seed);
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -219,7 +221,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities { ...@@ -219,7 +221,7 @@ class OPENMM_EXPORT SimTKOpenMMUtilities {
static void loadCheckpoint(std::istream& stream); static void loadCheckpoint(std::istream& stream);
}; };
// --------------------------------------------------------------------------------------- } // namespace OpenMM
#endif // __SimTKOpenMMUtilities_H__ #endif // __SimTKOpenMMUtilities_H__
...@@ -14,14 +14,13 @@ ...@@ -14,14 +14,13 @@
* drop a line to lindahl@cbr.su.se and let me know about it! * drop a line to lindahl@cbr.su.se and let me know about it!
*/ */
#include "SimTKOpenMMCommon.h"
#ifndef _FFTPACK_H_ #ifndef _FFTPACK_H_
#define _FFTPACK_H_ #define _FFTPACK_H_
#include <stdio.h> #include <stdio.h>
#include "RealVec.h"
#include "openmm/internal/windowsExport.h" #include "openmm/internal/windowsExport.h"
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -100,5 +100,5 @@ KernelImpl* ReferenceKernelFactory::createKernelImpl(std::string name, const Pla ...@@ -100,5 +100,5 @@ KernelImpl* ReferenceKernelFactory::createKernelImpl(std::string name, const Pla
return new ReferenceApplyMonteCarloBarostatKernel(name, platform); return new ReferenceApplyMonteCarloBarostatKernel(name, platform);
if (name == RemoveCMMotionKernel::Name()) if (name == RemoveCMMotionKernel::Name())
return new ReferenceRemoveCMMotionKernel(name, platform, data); return new ReferenceRemoveCMMotionKernel(name, platform, data);
throw OpenMMException( (std::string("Tried to create kernel with illegal kernel name '") + name + "'").c_str() ); throw OpenMMException((std::string("Tried to create kernel with illegal kernel name '") + name + "'").c_str());
} }
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "ReferenceKernels.h" #include "ReferenceKernels.h"
#include "CpuObc.h" #include "ReferenceObc.h"
#include "CpuGBVI.h" #include "ReferenceGBVI.h"
#include "ReferenceAndersenThermostat.h" #include "ReferenceAndersenThermostat.h"
#include "ReferenceAngleBondIxn.h" #include "ReferenceAngleBondIxn.h"
#include "ReferenceBondForce.h" #include "ReferenceBondForce.h"
...@@ -197,7 +197,7 @@ void ReferenceCalcForcesAndEnergyKernel::beginComputation(ContextImpl& context, ...@@ -197,7 +197,7 @@ void ReferenceCalcForcesAndEnergyKernel::beginComputation(ContextImpl& context,
savedForces = forceData; savedForces = forceData;
} }
double ReferenceCalcForcesAndEnergyKernel::finishComputation(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double ReferenceCalcForcesAndEnergyKernel::finishComputation(ContextImpl& context, bool includeForces, bool includeEnergy, int groups, bool& valid) {
if (!includeForces) if (!includeForces)
extractForces(context) = savedForces; // Restore the forces so computing the energy doesn't overwrite the forces with incorrect values. extractForces(context) = savedForces; // Restore the forces so computing the energy doesn't overwrite the forces with incorrect values.
else else
...@@ -1105,13 +1105,13 @@ void ReferenceCalcGBSAOBCForceKernel::initialize(const System& system, const GBS ...@@ -1105,13 +1105,13 @@ void ReferenceCalcGBSAOBCForceKernel::initialize(const System& system, const GBS
ObcParameters* obcParameters = new ObcParameters(numParticles, ObcParameters::ObcTypeII); ObcParameters* obcParameters = new ObcParameters(numParticles, ObcParameters::ObcTypeII);
obcParameters->setAtomicRadii(atomicRadii); obcParameters->setAtomicRadii(atomicRadii);
obcParameters->setScaledRadiusFactors(scaleFactors); obcParameters->setScaledRadiusFactors(scaleFactors);
obcParameters->setSolventDielectric( static_cast<RealOpenMM>(force.getSolventDielectric()) ); obcParameters->setSolventDielectric(static_cast<RealOpenMM>(force.getSolventDielectric()));
obcParameters->setSoluteDielectric( static_cast<RealOpenMM>(force.getSoluteDielectric()) ); obcParameters->setSoluteDielectric(static_cast<RealOpenMM>(force.getSoluteDielectric()));
obcParameters->setPi4Asolv(4*M_PI*force.getSurfaceAreaEnergy()); obcParameters->setPi4Asolv(4*M_PI*force.getSurfaceAreaEnergy());
if (force.getNonbondedMethod() != GBSAOBCForce::NoCutoff) if (force.getNonbondedMethod() != GBSAOBCForce::NoCutoff)
obcParameters->setUseCutoff(static_cast<RealOpenMM>(force.getCutoffDistance())); obcParameters->setUseCutoff(static_cast<RealOpenMM>(force.getCutoffDistance()));
isPeriodic = (force.getNonbondedMethod() == GBSAOBCForce::CutoffPeriodic); isPeriodic = (force.getNonbondedMethod() == GBSAOBCForce::CutoffPeriodic);
obc = new CpuObc(obcParameters); obc = new ReferenceObc(obcParameters);
obc->setIncludeAceApproximation(true); obc->setIncludeAceApproximation(true);
} }
...@@ -1152,7 +1152,7 @@ ReferenceCalcGBVIForceKernel::~ReferenceCalcGBVIForceKernel() { ...@@ -1152,7 +1152,7 @@ ReferenceCalcGBVIForceKernel::~ReferenceCalcGBVIForceKernel() {
} }
} }
void ReferenceCalcGBVIForceKernel::initialize(const System& system, const GBVIForce& force, const std::vector<double> & inputScaledRadii ) { void ReferenceCalcGBVIForceKernel::initialize(const System& system, const GBVIForce& force, const std::vector<double> & inputScaledRadii) {
int numParticles = system.getNumParticles(); int numParticles = system.getNumParticles();
...@@ -1185,7 +1185,7 @@ void ReferenceCalcGBVIForceKernel::initialize(const System& system, const GBVIFo ...@@ -1185,7 +1185,7 @@ void ReferenceCalcGBVIForceKernel::initialize(const System& system, const GBVIFo
if (force.getNonbondedMethod() != GBVIForce::NoCutoff) if (force.getNonbondedMethod() != GBVIForce::NoCutoff)
gBVIParameters->setUseCutoff(static_cast<RealOpenMM>(force.getCutoffDistance())); gBVIParameters->setUseCutoff(static_cast<RealOpenMM>(force.getCutoffDistance()));
isPeriodic = (force.getNonbondedMethod() == GBVIForce::CutoffPeriodic); isPeriodic = (force.getNonbondedMethod() == GBVIForce::CutoffPeriodic);
gbvi = new CpuGBVI(gBVIParameters); gbvi = new ReferenceGBVI(gBVIParameters);
} }
double ReferenceCalcGBVIForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) { double ReferenceCalcGBVIForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
...@@ -1201,7 +1201,7 @@ double ReferenceCalcGBVIForceKernel::execute(ContextImpl& context, bool includeF ...@@ -1201,7 +1201,7 @@ double ReferenceCalcGBVIForceKernel::execute(ContextImpl& context, bool includeF
gbvi->computeBornForces(posData, charges, forceData); gbvi->computeBornForces(posData, charges, forceData);
energy = 0.0; energy = 0.0;
} }
if( includeEnergy ){ if (includeEnergy) {
energy = gbvi->computeBornEnergy(posData, charges); energy = gbvi->computeBornEnergy(posData, charges);
} }
return static_cast<double>(energy); return static_cast<double>(energy);
...@@ -1710,7 +1710,7 @@ void ReferenceIntegrateVerletStepKernel::execute(ContextImpl& context, const Ver ...@@ -1710,7 +1710,7 @@ void ReferenceIntegrateVerletStepKernel::execute(ContextImpl& context, const Ver
if (dynamics) if (dynamics)
delete dynamics; delete dynamics;
dynamics = new ReferenceVerletDynamics(context.getSystem().getNumParticles(), static_cast<RealOpenMM>(stepSize) ); dynamics = new ReferenceVerletDynamics(context.getSystem().getNumParticles(), static_cast<RealOpenMM>(stepSize));
dynamics->setReferenceConstraintAlgorithm(&extractConstraints(context)); dynamics->setReferenceConstraintAlgorithm(&extractConstraints(context));
prevStepSize = stepSize; prevStepSize = stepSize;
} }
...@@ -1748,12 +1748,12 @@ void ReferenceIntegrateLangevinStepKernel::execute(ContextImpl& context, const L ...@@ -1748,12 +1748,12 @@ void ReferenceIntegrateLangevinStepKernel::execute(ContextImpl& context, const L
if (dynamics) if (dynamics)
delete dynamics; delete dynamics;
RealOpenMM tau = static_cast<RealOpenMM>( friction == 0.0 ? 0.0 : 1.0/friction ); RealOpenMM tau = static_cast<RealOpenMM>(friction == 0.0 ? 0.0 : 1.0/friction);
dynamics = new ReferenceStochasticDynamics( dynamics = new ReferenceStochasticDynamics(
context.getSystem().getNumParticles(), context.getSystem().getNumParticles(),
static_cast<RealOpenMM>(stepSize), static_cast<RealOpenMM>(stepSize),
static_cast<RealOpenMM>(tau), static_cast<RealOpenMM>(tau),
static_cast<RealOpenMM>(temperature) ); static_cast<RealOpenMM>(temperature));
dynamics->setReferenceConstraintAlgorithm(&extractConstraints(context)); dynamics->setReferenceConstraintAlgorithm(&extractConstraints(context));
prevTemp = temperature; prevTemp = temperature;
prevFriction = friction; prevFriction = friction;
...@@ -1797,7 +1797,7 @@ void ReferenceIntegrateBrownianStepKernel::execute(ContextImpl& context, const B ...@@ -1797,7 +1797,7 @@ void ReferenceIntegrateBrownianStepKernel::execute(ContextImpl& context, const B
context.getSystem().getNumParticles(), context.getSystem().getNumParticles(),
static_cast<RealOpenMM>(stepSize), static_cast<RealOpenMM>(stepSize),
static_cast<RealOpenMM>(friction), static_cast<RealOpenMM>(friction),
static_cast<RealOpenMM>(temperature) ); static_cast<RealOpenMM>(temperature));
dynamics->setReferenceConstraintAlgorithm(&extractConstraints(context)); dynamics->setReferenceConstraintAlgorithm(&extractConstraints(context));
prevTemp = temperature; prevTemp = temperature;
prevFriction = friction; prevFriction = friction;
...@@ -1837,7 +1837,7 @@ double ReferenceIntegrateVariableLangevinStepKernel::execute(ContextImpl& contex ...@@ -1837,7 +1837,7 @@ double ReferenceIntegrateVariableLangevinStepKernel::execute(ContextImpl& contex
if (dynamics) if (dynamics)
delete dynamics; delete dynamics;
RealOpenMM tau = static_cast<RealOpenMM>( friction == 0.0 ? 0.0 : 1.0/friction ); RealOpenMM tau = static_cast<RealOpenMM>(friction == 0.0 ? 0.0 : 1.0/friction);
dynamics = new ReferenceVariableStochasticDynamics(context.getSystem().getNumParticles(), (RealOpenMM) tau, (RealOpenMM) temperature, (RealOpenMM) errorTol); dynamics = new ReferenceVariableStochasticDynamics(context.getSystem().getNumParticles(), (RealOpenMM) tau, (RealOpenMM) temperature, (RealOpenMM) errorTol);
dynamics->setReferenceConstraintAlgorithm(&extractConstraints(context)); dynamics->setReferenceConstraintAlgorithm(&extractConstraints(context));
prevTemp = temperature; prevTemp = temperature;
......
...@@ -28,10 +28,9 @@ ...@@ -28,10 +28,9 @@
#include "openmm/OpenMMException.h" #include "openmm/OpenMMException.h"
#include "GBVIParameters.h" #include "GBVIParameters.h"
#include "SimTKOpenMMCommon.h"
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -41,19 +40,19 @@ using OpenMM::RealVec; ...@@ -41,19 +40,19 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
GBVIParameters::GBVIParameters( int numberOfAtoms ) : _numberOfAtoms(numberOfAtoms), GBVIParameters::GBVIParameters(int numberOfAtoms) : _numberOfAtoms(numberOfAtoms),
_soluteDielectric(1.0), _soluteDielectric(1.0),
_solventDielectric(78.3), _solventDielectric(78.3),
_electricConstant(-0.5*ONE_4PI_EPS0), _electricConstant(-0.5*ONE_4PI_EPS0),
_cutoff(false), _cutoff(false),
_periodic(false), _periodic(false),
_bornRadiusScalingMethod(0), _bornRadiusScalingMethod(0),
_quinticLowerLimitFactor(0.8), _quinticLowerLimitFactor(0.8),
_quinticUpperBornRadiusLimit(5.0) { _quinticUpperBornRadiusLimit(5.0) {
_atomicRadii.resize( numberOfAtoms ); _atomicRadii.resize(numberOfAtoms);
_scaledRadii.resize( numberOfAtoms ); _scaledRadii.resize(numberOfAtoms);
_gammaParameters.resize( numberOfAtoms ); _gammaParameters.resize(numberOfAtoms);
} }
...@@ -63,7 +62,7 @@ GBVIParameters::GBVIParameters( int numberOfAtoms ) : _numberOfAtoms(numberOfAto ...@@ -63,7 +62,7 @@ GBVIParameters::GBVIParameters( int numberOfAtoms ) : _numberOfAtoms(numberOfAto
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
GBVIParameters::~GBVIParameters( ){ GBVIParameters::~GBVIParameters() {
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -74,7 +73,7 @@ GBVIParameters::~GBVIParameters( ){ ...@@ -74,7 +73,7 @@ GBVIParameters::~GBVIParameters( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int GBVIParameters::getNumberOfAtoms( void ) const { int GBVIParameters::getNumberOfAtoms() const {
return _numberOfAtoms; return _numberOfAtoms;
} }
...@@ -86,7 +85,7 @@ int GBVIParameters::getNumberOfAtoms( void ) const { ...@@ -86,7 +85,7 @@ int GBVIParameters::getNumberOfAtoms( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM GBVIParameters::getElectricConstant( void ) const { RealOpenMM GBVIParameters::getElectricConstant() const {
return _electricConstant; return _electricConstant;
} }
...@@ -98,7 +97,7 @@ RealOpenMM GBVIParameters::getElectricConstant( void ) const { ...@@ -98,7 +97,7 @@ RealOpenMM GBVIParameters::getElectricConstant( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM GBVIParameters::getSolventDielectric( void ) const { RealOpenMM GBVIParameters::getSolventDielectric() const {
return _solventDielectric; return _solventDielectric;
} }
...@@ -110,7 +109,7 @@ RealOpenMM GBVIParameters::getSolventDielectric( void ) const { ...@@ -110,7 +109,7 @@ RealOpenMM GBVIParameters::getSolventDielectric( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void GBVIParameters::setSolventDielectric( RealOpenMM solventDielectric ){ void GBVIParameters::setSolventDielectric(RealOpenMM solventDielectric) {
_solventDielectric = solventDielectric; _solventDielectric = solventDielectric;
} }
...@@ -122,7 +121,7 @@ void GBVIParameters::setSolventDielectric( RealOpenMM solventDielectric ){ ...@@ -122,7 +121,7 @@ void GBVIParameters::setSolventDielectric( RealOpenMM solventDielectric ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM GBVIParameters::getSoluteDielectric( void ) const { RealOpenMM GBVIParameters::getSoluteDielectric() const {
return _soluteDielectric; return _soluteDielectric;
} }
...@@ -134,7 +133,7 @@ RealOpenMM GBVIParameters::getSoluteDielectric( void ) const { ...@@ -134,7 +133,7 @@ RealOpenMM GBVIParameters::getSoluteDielectric( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void GBVIParameters::setSoluteDielectric( RealOpenMM soluteDielectric ){ void GBVIParameters::setSoluteDielectric(RealOpenMM soluteDielectric) {
_soluteDielectric = soluteDielectric; _soluteDielectric = soluteDielectric;
} }
...@@ -146,7 +145,7 @@ void GBVIParameters::setSoluteDielectric( RealOpenMM soluteDielectric ){ ...@@ -146,7 +145,7 @@ void GBVIParameters::setSoluteDielectric( RealOpenMM soluteDielectric ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const RealOpenMMVector& GBVIParameters::getAtomicRadii( void ) const { const vector<RealOpenMM>& GBVIParameters::getAtomicRadii() const {
return _atomicRadii; return _atomicRadii;
} }
...@@ -158,10 +157,10 @@ const RealOpenMMVector& GBVIParameters::getAtomicRadii( void ) const { ...@@ -158,10 +157,10 @@ const RealOpenMMVector& GBVIParameters::getAtomicRadii( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void GBVIParameters::setAtomicRadii( const RealOpenMMVector& atomicRadii ){ void GBVIParameters::setAtomicRadii(const vector<RealOpenMM>& atomicRadii) {
if( atomicRadii.size() == _atomicRadii.size() ){ if (atomicRadii.size() == _atomicRadii.size()) {
for( unsigned int ii = 0; ii < atomicRadii.size(); ii++ ){ for (unsigned int ii = 0; ii < atomicRadii.size(); ii++) {
_atomicRadii[ii] = atomicRadii[ii]; _atomicRadii[ii] = atomicRadii[ii];
} }
} else { } else {
...@@ -170,7 +169,7 @@ void GBVIParameters::setAtomicRadii( const RealOpenMMVector& atomicRadii ){ ...@@ -170,7 +169,7 @@ void GBVIParameters::setAtomicRadii( const RealOpenMMVector& atomicRadii ){
msg << atomicRadii.size(); msg << atomicRadii.size();
msg << " current size=" << _atomicRadii.size(); msg << " current size=" << _atomicRadii.size();
throw OpenMM::OpenMMException(msg.str()); throw OpenMM::OpenMMException(msg.str());
} }
} }
...@@ -181,7 +180,7 @@ void GBVIParameters::setAtomicRadii( const RealOpenMMVector& atomicRadii ){ ...@@ -181,7 +180,7 @@ void GBVIParameters::setAtomicRadii( const RealOpenMMVector& atomicRadii ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const RealOpenMMVector& GBVIParameters::getScaledRadii( void ) const { const vector<RealOpenMM>& GBVIParameters::getScaledRadii() const {
return _scaledRadii; return _scaledRadii;
} }
...@@ -193,10 +192,10 @@ const RealOpenMMVector& GBVIParameters::getScaledRadii( void ) const { ...@@ -193,10 +192,10 @@ const RealOpenMMVector& GBVIParameters::getScaledRadii( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void GBVIParameters::setScaledRadii( const RealOpenMMVector& scaledRadii ){ void GBVIParameters::setScaledRadii(const vector<RealOpenMM>& scaledRadii) {
if( scaledRadii.size() == _scaledRadii.size() ){ if (scaledRadii.size() == _scaledRadii.size()) {
for( unsigned int ii = 0; ii < scaledRadii.size(); ii++ ){ for (unsigned int ii = 0; ii < scaledRadii.size(); ii++) {
_scaledRadii[ii] = scaledRadii[ii]; _scaledRadii[ii] = scaledRadii[ii];
} }
} else { } else {
...@@ -218,7 +217,7 @@ void GBVIParameters::setScaledRadii( const RealOpenMMVector& scaledRadii ){ ...@@ -218,7 +217,7 @@ void GBVIParameters::setScaledRadii( const RealOpenMMVector& scaledRadii ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const RealOpenMMVector& GBVIParameters::getGammaParameters( void ) const { const vector<RealOpenMM>& GBVIParameters::getGammaParameters() const {
return _gammaParameters; return _gammaParameters;
} }
...@@ -230,10 +229,10 @@ const RealOpenMMVector& GBVIParameters::getGammaParameters( void ) const { ...@@ -230,10 +229,10 @@ const RealOpenMMVector& GBVIParameters::getGammaParameters( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void GBVIParameters::setGammaParameters( const RealOpenMMVector& gammas ){ void GBVIParameters::setGammaParameters(const vector<RealOpenMM>& gammas) {
if( gammas.size() == _gammaParameters.size() ){ if (gammas.size() == _gammaParameters.size()) {
for( unsigned int ii = 0; ii < gammas.size(); ii++ ){ for (unsigned int ii = 0; ii < gammas.size(); ii++) {
_gammaParameters[ii] = gammas[ii]; _gammaParameters[ii] = gammas[ii];
} }
} else { } else {
...@@ -254,7 +253,7 @@ void GBVIParameters::setGammaParameters( const RealOpenMMVector& gammas ){ ...@@ -254,7 +253,7 @@ void GBVIParameters::setGammaParameters( const RealOpenMMVector& gammas ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void GBVIParameters::setUseCutoff( RealOpenMM distance ) { void GBVIParameters::setUseCutoff(RealOpenMM distance) {
_cutoff = true; _cutoff = true;
_cutoffDistance = distance; _cutoffDistance = distance;
...@@ -330,7 +329,7 @@ const OpenMM::RealVec* GBVIParameters::getPeriodicBox() { ...@@ -330,7 +329,7 @@ const OpenMM::RealVec* GBVIParameters::getPeriodicBox() {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM GBVIParameters::getTau( void ) const { RealOpenMM GBVIParameters::getTau() const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -340,7 +339,7 @@ RealOpenMM GBVIParameters::getTau( void ) const { ...@@ -340,7 +339,7 @@ RealOpenMM GBVIParameters::getTau( void ) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
RealOpenMM tau; RealOpenMM tau;
if( getSoluteDielectric() != zero && getSolventDielectric() != zero ){ if (getSoluteDielectric() != zero && getSolventDielectric() != zero) {
tau = (one/getSoluteDielectric()) - (one/getSolventDielectric()); tau = (one/getSoluteDielectric()) - (one/getSolventDielectric());
} else { } else {
tau = zero; tau = zero;
...@@ -357,7 +356,7 @@ RealOpenMM GBVIParameters::getTau( void ) const { ...@@ -357,7 +356,7 @@ RealOpenMM GBVIParameters::getTau( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int GBVIParameters::getBornRadiusScalingMethod( void ) const { int GBVIParameters::getBornRadiusScalingMethod() const {
return _bornRadiusScalingMethod; return _bornRadiusScalingMethod;
} }
...@@ -369,7 +368,7 @@ int GBVIParameters::getBornRadiusScalingMethod( void ) const { ...@@ -369,7 +368,7 @@ int GBVIParameters::getBornRadiusScalingMethod( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void GBVIParameters::setBornRadiusScalingMethod( int bornRadiusScalingMethod ){ void GBVIParameters::setBornRadiusScalingMethod(int bornRadiusScalingMethod) {
_bornRadiusScalingMethod = bornRadiusScalingMethod; _bornRadiusScalingMethod = bornRadiusScalingMethod;
} }
...@@ -381,7 +380,7 @@ void GBVIParameters::setBornRadiusScalingMethod( int bornRadiusScalingMethod ){ ...@@ -381,7 +380,7 @@ void GBVIParameters::setBornRadiusScalingMethod( int bornRadiusScalingMethod ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM GBVIParameters::getQuinticLowerLimitFactor( void ) const { RealOpenMM GBVIParameters::getQuinticLowerLimitFactor() const {
return _quinticLowerLimitFactor; return _quinticLowerLimitFactor;
} }
...@@ -393,7 +392,7 @@ RealOpenMM GBVIParameters::getQuinticLowerLimitFactor( void ) const { ...@@ -393,7 +392,7 @@ RealOpenMM GBVIParameters::getQuinticLowerLimitFactor( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void GBVIParameters::setQuinticLowerLimitFactor( RealOpenMM quinticLowerLimitFactor ){ void GBVIParameters::setQuinticLowerLimitFactor(RealOpenMM quinticLowerLimitFactor) {
_quinticLowerLimitFactor = quinticLowerLimitFactor; _quinticLowerLimitFactor = quinticLowerLimitFactor;
} }
...@@ -405,7 +404,7 @@ void GBVIParameters::setQuinticLowerLimitFactor( RealOpenMM quinticLowerLimitFac ...@@ -405,7 +404,7 @@ void GBVIParameters::setQuinticLowerLimitFactor( RealOpenMM quinticLowerLimitFac
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM GBVIParameters::getQuinticUpperBornRadiusLimit( void ) const { RealOpenMM GBVIParameters::getQuinticUpperBornRadiusLimit() const {
return _quinticUpperBornRadiusLimit; return _quinticUpperBornRadiusLimit;
} }
...@@ -417,6 +416,6 @@ RealOpenMM GBVIParameters::getQuinticUpperBornRadiusLimit( void ) const { ...@@ -417,6 +416,6 @@ RealOpenMM GBVIParameters::getQuinticUpperBornRadiusLimit( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void GBVIParameters::setQuinticUpperBornRadiusLimit( RealOpenMM quinticUpperBornRadiusLimit ){ void GBVIParameters::setQuinticUpperBornRadiusLimit(RealOpenMM quinticUpperBornRadiusLimit) {
_quinticUpperBornRadiusLimit = quinticUpperBornRadiusLimit; _quinticUpperBornRadiusLimit = quinticUpperBornRadiusLimit;
} }
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
#include "openmm/OpenMMException.h" #include "openmm/OpenMMException.h"
#include "ObcParameters.h" #include "ObcParameters.h"
#include "SimTKOpenMMCommon.h"
using std::vector; using std::vector;
using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -41,21 +41,21 @@ using std::vector; ...@@ -41,21 +41,21 @@ using std::vector;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ObcParameters::ObcParameters( int numberOfAtoms, ObcParameters::ObcType obcType ) : ObcParameters::ObcParameters(int numberOfAtoms, ObcParameters::ObcType obcType) :
_numberOfAtoms(numberOfAtoms), _numberOfAtoms(numberOfAtoms),
_solventDielectric( 78.3 ), _solventDielectric(78.3),
_soluteDielectric( 1.0 ), _soluteDielectric(1.0),
_electricConstant(-0.5*ONE_4PI_EPS0), _electricConstant(-0.5*ONE_4PI_EPS0),
_probeRadius(0.14), _probeRadius(0.14),
_pi4Asolv( 28.3919551), _pi4Asolv(28.3919551),
_dielectricOffset( 0.009 ), _dielectricOffset(0.009),
_obcType( obcType ), _obcType(obcType),
_cutoff(false), _cutoff(false),
_periodic(false) { _periodic(false) {
_atomicRadii.resize( numberOfAtoms ); _atomicRadii.resize(numberOfAtoms);
_scaledRadiusFactors.resize( numberOfAtoms ); _scaledRadiusFactors.resize(numberOfAtoms);
setObcTypeParameters( obcType ); setObcTypeParameters(obcType);
} }
...@@ -65,7 +65,7 @@ ObcParameters::ObcParameters( int numberOfAtoms, ObcParameters::ObcType obcType ...@@ -65,7 +65,7 @@ ObcParameters::ObcParameters( int numberOfAtoms, ObcParameters::ObcType obcType
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ObcParameters::~ObcParameters( ){ ObcParameters::~ObcParameters() {
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -76,7 +76,7 @@ ObcParameters::~ObcParameters( ){ ...@@ -76,7 +76,7 @@ ObcParameters::~ObcParameters( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
int ObcParameters::getNumberOfAtoms( void ) const { int ObcParameters::getNumberOfAtoms() const {
return _numberOfAtoms; return _numberOfAtoms;
} }
...@@ -88,7 +88,7 @@ int ObcParameters::getNumberOfAtoms( void ) const { ...@@ -88,7 +88,7 @@ int ObcParameters::getNumberOfAtoms( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ObcParameters::ObcType ObcParameters::getObcType( void ) const { ObcParameters::ObcType ObcParameters::getObcType() const {
return _obcType; return _obcType;
} }
...@@ -100,8 +100,8 @@ ObcParameters::ObcType ObcParameters::getObcType( void ) const { ...@@ -100,8 +100,8 @@ ObcParameters::ObcType ObcParameters::getObcType( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ObcParameters::setObcTypeParameters( ObcParameters::ObcType obcType ){ void ObcParameters::setObcTypeParameters(ObcParameters::ObcType obcType) {
if( obcType == ObcTypeI ){ if (obcType == ObcTypeI) {
_alphaObc = 0.8f; _alphaObc = 0.8f;
_betaObc = 0.0f; _betaObc = 0.0f;
_gammaObc = 2.91f; _gammaObc = 2.91f;
...@@ -121,7 +121,7 @@ void ObcParameters::setObcTypeParameters( ObcParameters::ObcType obcType ){ ...@@ -121,7 +121,7 @@ void ObcParameters::setObcTypeParameters( ObcParameters::ObcType obcType ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ObcParameters::getDielectricOffset( void ) const { RealOpenMM ObcParameters::getDielectricOffset() const {
return _dielectricOffset; return _dielectricOffset;
} }
...@@ -133,7 +133,7 @@ RealOpenMM ObcParameters::getDielectricOffset( void ) const { ...@@ -133,7 +133,7 @@ RealOpenMM ObcParameters::getDielectricOffset( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ObcParameters::getAlphaObc( void ) const { RealOpenMM ObcParameters::getAlphaObc() const {
return _alphaObc; return _alphaObc;
} }
...@@ -145,7 +145,7 @@ RealOpenMM ObcParameters::getAlphaObc( void ) const { ...@@ -145,7 +145,7 @@ RealOpenMM ObcParameters::getAlphaObc( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ObcParameters::getBetaObc( void ) const { RealOpenMM ObcParameters::getBetaObc() const {
return _betaObc; return _betaObc;
} }
...@@ -157,7 +157,7 @@ RealOpenMM ObcParameters::getBetaObc( void ) const { ...@@ -157,7 +157,7 @@ RealOpenMM ObcParameters::getBetaObc( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ObcParameters::getGammaObc( void ) const { RealOpenMM ObcParameters::getGammaObc() const {
return _gammaObc; return _gammaObc;
} }
...@@ -169,7 +169,7 @@ RealOpenMM ObcParameters::getGammaObc( void ) const { ...@@ -169,7 +169,7 @@ RealOpenMM ObcParameters::getGammaObc( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ObcParameters::getSolventDielectric( void ) const { RealOpenMM ObcParameters::getSolventDielectric() const {
return _solventDielectric; return _solventDielectric;
} }
...@@ -181,7 +181,7 @@ RealOpenMM ObcParameters::getSolventDielectric( void ) const { ...@@ -181,7 +181,7 @@ RealOpenMM ObcParameters::getSolventDielectric( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ObcParameters::setSolventDielectric( RealOpenMM solventDielectric ){ void ObcParameters::setSolventDielectric(RealOpenMM solventDielectric) {
_solventDielectric = solventDielectric; _solventDielectric = solventDielectric;
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -192,7 +192,7 @@ void ObcParameters::setSolventDielectric( RealOpenMM solventDielectric ){ ...@@ -192,7 +192,7 @@ void ObcParameters::setSolventDielectric( RealOpenMM solventDielectric ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ObcParameters::getSoluteDielectric( void ) const { RealOpenMM ObcParameters::getSoluteDielectric() const {
return _soluteDielectric; return _soluteDielectric;
} }
...@@ -204,7 +204,7 @@ RealOpenMM ObcParameters::getSoluteDielectric( void ) const { ...@@ -204,7 +204,7 @@ RealOpenMM ObcParameters::getSoluteDielectric( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ObcParameters::setSoluteDielectric( RealOpenMM soluteDielectric ){ void ObcParameters::setSoluteDielectric(RealOpenMM soluteDielectric) {
_soluteDielectric = soluteDielectric; _soluteDielectric = soluteDielectric;
} }
...@@ -216,7 +216,7 @@ void ObcParameters::setSoluteDielectric( RealOpenMM soluteDielectric ){ ...@@ -216,7 +216,7 @@ void ObcParameters::setSoluteDielectric( RealOpenMM soluteDielectric ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ObcParameters::getElectricConstant( void ) const { RealOpenMM ObcParameters::getElectricConstant() const {
return _electricConstant; return _electricConstant;
} }
...@@ -228,7 +228,7 @@ RealOpenMM ObcParameters::getElectricConstant( void ) const { ...@@ -228,7 +228,7 @@ RealOpenMM ObcParameters::getElectricConstant( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ObcParameters::getProbeRadius( void ) const { RealOpenMM ObcParameters::getProbeRadius() const {
return _probeRadius; return _probeRadius;
} }
...@@ -240,7 +240,7 @@ RealOpenMM ObcParameters::getProbeRadius( void ) const { ...@@ -240,7 +240,7 @@ RealOpenMM ObcParameters::getProbeRadius( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ObcParameters::setProbeRadius( RealOpenMM probeRadius ){ void ObcParameters::setProbeRadius(RealOpenMM probeRadius) {
_probeRadius = probeRadius; _probeRadius = probeRadius;
} }
...@@ -254,7 +254,7 @@ void ObcParameters::setProbeRadius( RealOpenMM probeRadius ){ ...@@ -254,7 +254,7 @@ void ObcParameters::setProbeRadius( RealOpenMM probeRadius ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ObcParameters::getPi4Asolv( void ) const { RealOpenMM ObcParameters::getPi4Asolv() const {
return _pi4Asolv; return _pi4Asolv;
} }
...@@ -270,7 +270,7 @@ void ObcParameters::setPi4Asolv(RealOpenMM pi4Asolv) { ...@@ -270,7 +270,7 @@ void ObcParameters::setPi4Asolv(RealOpenMM pi4Asolv) {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const RealOpenMMVector& ObcParameters::getAtomicRadii( void ) const { const vector<RealOpenMM>& ObcParameters::getAtomicRadii() const {
return _atomicRadii; return _atomicRadii;
} }
...@@ -282,10 +282,10 @@ const RealOpenMMVector& ObcParameters::getAtomicRadii( void ) const { ...@@ -282,10 +282,10 @@ const RealOpenMMVector& ObcParameters::getAtomicRadii( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ObcParameters::setAtomicRadii( const RealOpenMMVector& atomicRadii ){ void ObcParameters::setAtomicRadii(const vector<RealOpenMM>& atomicRadii) {
if( atomicRadii.size() == _atomicRadii.size() ){ if (atomicRadii.size() == _atomicRadii.size()) {
for( unsigned int ii = 0; ii < atomicRadii.size(); ii++ ){ for (unsigned int ii = 0; ii < atomicRadii.size(); ii++) {
_atomicRadii[ii] = atomicRadii[ii]; _atomicRadii[ii] = atomicRadii[ii];
} }
} else { } else {
...@@ -306,7 +306,7 @@ void ObcParameters::setAtomicRadii( const RealOpenMMVector& atomicRadii ){ ...@@ -306,7 +306,7 @@ void ObcParameters::setAtomicRadii( const RealOpenMMVector& atomicRadii ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
const RealOpenMMVector& ObcParameters::getScaledRadiusFactors( void ) const { const vector<RealOpenMM>& ObcParameters::getScaledRadiusFactors() const {
return _scaledRadiusFactors; return _scaledRadiusFactors;
} }
...@@ -318,10 +318,10 @@ const RealOpenMMVector& ObcParameters::getScaledRadiusFactors( void ) const { ...@@ -318,10 +318,10 @@ const RealOpenMMVector& ObcParameters::getScaledRadiusFactors( void ) const {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ObcParameters::setScaledRadiusFactors( const RealOpenMMVector& scaledRadiusFactors ){ void ObcParameters::setScaledRadiusFactors(const vector<RealOpenMM>& scaledRadiusFactors) {
if( scaledRadiusFactors.size() == _scaledRadiusFactors.size() ){ if (scaledRadiusFactors.size() == _scaledRadiusFactors.size()) {
for( unsigned int ii = 0; ii < scaledRadiusFactors.size(); ii++ ){ for (unsigned int ii = 0; ii < scaledRadiusFactors.size(); ii++) {
_scaledRadiusFactors[ii] = scaledRadiusFactors[ii]; _scaledRadiusFactors[ii] = scaledRadiusFactors[ii];
} }
} else { } else {
...@@ -342,7 +342,7 @@ void ObcParameters::setScaledRadiusFactors( const RealOpenMMVector& scaledRadius ...@@ -342,7 +342,7 @@ void ObcParameters::setScaledRadiusFactors( const RealOpenMMVector& scaledRadius
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ObcParameters::setUseCutoff( RealOpenMM distance ) { void ObcParameters::setUseCutoff(RealOpenMM distance) {
_cutoff = true; _cutoff = true;
_cutoffDistance = distance; _cutoffDistance = distance;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "ReferenceAndersenThermostat.h" #include "ReferenceAndersenThermostat.h"
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -37,7 +37,7 @@ using OpenMM::RealVec; ...@@ -37,7 +37,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceAndersenThermostat::ReferenceAndersenThermostat( ) { ReferenceAndersenThermostat::ReferenceAndersenThermostat() {
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -46,7 +46,7 @@ using OpenMM::RealVec; ...@@ -46,7 +46,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceAndersenThermostat::~ReferenceAndersenThermostat( ) { ReferenceAndersenThermostat::~ReferenceAndersenThermostat() {
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -61,8 +61,8 @@ using OpenMM::RealVec; ...@@ -61,8 +61,8 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceAndersenThermostat::applyThermostat( const vector<vector<int> >& atomGroups, vector<RealVec>& atomVelocities, vector<RealOpenMM>& atomMasses, void ReferenceAndersenThermostat::applyThermostat(const vector<vector<int> >& atomGroups, vector<RealVec>& atomVelocities, vector<RealOpenMM>& atomMasses,
RealOpenMM temperature, RealOpenMM collisionFrequency, RealOpenMM stepSize ) const { RealOpenMM temperature, RealOpenMM collisionFrequency, RealOpenMM stepSize) const {
const RealOpenMM collisionProbability = 1.0f - EXP(-collisionFrequency*stepSize); const RealOpenMM collisionProbability = 1.0f - EXP(-collisionFrequency*stepSize);
for (int i = 0; i < (int) atomGroups.size(); ++i) { for (int i = 0; i < (int) atomGroups.size(); ++i) {
......
...@@ -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 "ReferenceAngleBondIxn.h" #include "ReferenceAngleBondIxn.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;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceAngleBondIxn::ReferenceAngleBondIxn( ){ ReferenceAngleBondIxn::ReferenceAngleBondIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -56,7 +54,7 @@ ReferenceAngleBondIxn::ReferenceAngleBondIxn( ){ ...@@ -56,7 +54,7 @@ ReferenceAngleBondIxn::ReferenceAngleBondIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceAngleBondIxn::~ReferenceAngleBondIxn( ){ ReferenceAngleBondIxn::~ReferenceAngleBondIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -78,8 +76,8 @@ ReferenceAngleBondIxn::~ReferenceAngleBondIxn( ){ ...@@ -78,8 +76,8 @@ ReferenceAngleBondIxn::~ReferenceAngleBondIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine( RealOpenMM cosine, RealOpenMM* angleParameters, void ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine(RealOpenMM cosine, RealOpenMM* angleParameters,
RealOpenMM* dEdR, RealOpenMM* energyTerm ) const { RealOpenMM* dEdR, RealOpenMM* energyTerm) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -92,9 +90,9 @@ void ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine( RealOpenMM cosine, Re ...@@ -92,9 +90,9 @@ void ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine( RealOpenMM cosine, Re
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
RealOpenMM angle; RealOpenMM angle;
if( cosine >= one ){ if (cosine >= one) {
angle = zero; angle = zero;
} else if( cosine <= -one ){ } else if (cosine <= -one) {
angle = PI_M; angle = PI_M;
} else { } else {
angle = ACOS(cosine); angle = ACOS(cosine);
...@@ -120,11 +118,11 @@ void ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine( RealOpenMM cosine, Re ...@@ -120,11 +118,11 @@ void ReferenceAngleBondIxn::getPrefactorsGivenAngleCosine( RealOpenMM cosine, Re
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceAngleBondIxn::calculateBondIxn( int* atomIndices, void ReferenceAngleBondIxn::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 {
// constants -- reduce Visual Studio warnings regarding conversions between float & double // constants -- reduce Visual Studio warnings regarding conversions between float & double
...@@ -147,31 +145,31 @@ void ReferenceAngleBondIxn::calculateBondIxn( int* atomIndices, ...@@ -147,31 +145,31 @@ void ReferenceAngleBondIxn::calculateBondIxn( int* atomIndices,
int atomAIndex = atomIndices[0]; int atomAIndex = atomIndices[0];
int atomBIndex = atomIndices[1]; int atomBIndex = atomIndices[1];
int atomCIndex = atomIndices[2]; int atomCIndex = atomIndices[2];
ReferenceForce::getDeltaR( atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR[0] ); ReferenceForce::getDeltaR(atomCoordinates[atomAIndex], atomCoordinates[atomBIndex], deltaR[0]);
ReferenceForce::getDeltaR( atomCoordinates[atomCIndex], atomCoordinates[atomBIndex], deltaR[1] ); ReferenceForce::getDeltaR(atomCoordinates[atomCIndex], atomCoordinates[atomBIndex], deltaR[1]);
RealOpenMM pVector[threeI]; RealOpenMM pVector[threeI];
SimTKOpenMMUtilities::crossProductVector3( deltaR[0], deltaR[1], pVector ); SimTKOpenMMUtilities::crossProductVector3(deltaR[0], deltaR[1], pVector);
RealOpenMM rp = DOT3( pVector, pVector ); RealOpenMM rp = DOT3(pVector, pVector);
rp = SQRT( rp ); rp = SQRT(rp);
if( rp < 1.0e-06 ){ if (rp < 1.0e-06) {
rp = (RealOpenMM) 1.0e-06; rp = (RealOpenMM) 1.0e-06;
} }
RealOpenMM dot = DOT3( deltaR[0], deltaR[1] ); RealOpenMM dot = DOT3(deltaR[0], deltaR[1]);
RealOpenMM cosine = dot/SQRT( (deltaR[0][ReferenceForce::R2Index]*deltaR[1][ReferenceForce::R2Index]) ); RealOpenMM cosine = dot/SQRT((deltaR[0][ReferenceForce::R2Index]*deltaR[1][ReferenceForce::R2Index]));
RealOpenMM dEdR; RealOpenMM dEdR;
RealOpenMM energy; RealOpenMM energy;
getPrefactorsGivenAngleCosine( cosine, parameters, &dEdR, &energy ); getPrefactorsGivenAngleCosine(cosine, parameters, &dEdR, &energy);
RealOpenMM termA = dEdR/(deltaR[0][ReferenceForce::R2Index]*rp); RealOpenMM termA = dEdR/(deltaR[0][ReferenceForce::R2Index]*rp);
RealOpenMM termC = -dEdR/(deltaR[1][ReferenceForce::R2Index]*rp); RealOpenMM termC = -dEdR/(deltaR[1][ReferenceForce::R2Index]*rp);
RealOpenMM deltaCrossP[LastAtomIndex][threeI]; RealOpenMM deltaCrossP[LastAtomIndex][threeI];
SimTKOpenMMUtilities::crossProductVector3( deltaR[0], pVector, deltaCrossP[0] ); SimTKOpenMMUtilities::crossProductVector3(deltaR[0], pVector, deltaCrossP[0]);
SimTKOpenMMUtilities::crossProductVector3( deltaR[1], pVector, deltaCrossP[2] ); SimTKOpenMMUtilities::crossProductVector3(deltaR[1], pVector, deltaCrossP[2]);
for( int ii = 0; ii < threeI; ii++ ){ for (int ii = 0; ii < threeI; ii++) {
deltaCrossP[0][ii] *= termA; deltaCrossP[0][ii] *= termA;
deltaCrossP[2][ii] *= termC; deltaCrossP[2][ii] *= termC;
deltaCrossP[1][ii] = oneM*(deltaCrossP[0][ii] + deltaCrossP[2][ii]); deltaCrossP[1][ii] = oneM*(deltaCrossP[0][ii] + deltaCrossP[2][ii]);
...@@ -179,8 +177,8 @@ void ReferenceAngleBondIxn::calculateBondIxn( int* atomIndices, ...@@ -179,8 +177,8 @@ void ReferenceAngleBondIxn::calculateBondIxn( int* atomIndices,
// accumulate forces // accumulate forces
for( int jj = 0; jj < LastAtomIndex; jj++ ){ for (int jj = 0; jj < LastAtomIndex; jj++) {
for( int ii = 0; ii < threeI; ii++ ){ for (int ii = 0; ii < threeI; ii++) {
forces[atomIndices[jj]][ii] += deltaCrossP[jj][ii]; forces[atomIndices[jj]][ii] += deltaCrossP[jj][ii];
} }
} }
......
...@@ -25,13 +25,11 @@ ...@@ -25,13 +25,11 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceBondForce.h" #include "ReferenceBondForce.h"
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -39,7 +37,7 @@ using OpenMM::RealVec; ...@@ -39,7 +37,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceBondForce::ReferenceBondForce( ){ ReferenceBondForce::ReferenceBondForce() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -55,7 +53,7 @@ ReferenceBondForce::ReferenceBondForce( ){ ...@@ -55,7 +53,7 @@ ReferenceBondForce::ReferenceBondForce( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceBondForce::~ReferenceBondForce( ){ ReferenceBondForce::~ReferenceBondForce() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -80,12 +78,12 @@ ReferenceBondForce::~ReferenceBondForce( ){ ...@@ -80,12 +78,12 @@ ReferenceBondForce::~ReferenceBondForce( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceBondForce::calculateForce( int numberOfBonds, int** atomIndices, void ReferenceBondForce::calculateForce(int numberOfBonds, int** atomIndices,
vector<RealVec>& atomCoordinates, vector<RealVec>& atomCoordinates,
RealOpenMM** parameters, RealOpenMM** parameters,
vector<RealVec>& forces, vector<RealVec>& forces,
RealOpenMM *totalEnergy, RealOpenMM *totalEnergy,
ReferenceBondIxn& referenceBondIxn ){ ReferenceBondIxn& referenceBondIxn) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -94,12 +92,12 @@ void ReferenceBondForce::calculateForce( int numberOfBonds, int** atomIndices, ...@@ -94,12 +92,12 @@ void ReferenceBondForce::calculateForce( int numberOfBonds, int** atomIndices,
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
for( int ii = 0; ii < numberOfBonds; ii++ ){ for (int ii = 0; ii < numberOfBonds; ii++) {
// calculate bond ixn // calculate bond ixn
referenceBondIxn.calculateBondIxn( atomIndices[ii], atomCoordinates, parameters[ii], referenceBondIxn.calculateBondIxn(atomIndices[ii], atomCoordinates, parameters[ii],
forces, totalEnergy ); forces, totalEnergy);
} }
} }
...@@ -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 "ReferenceForce.h" #include "ReferenceForce.h"
#include "ReferenceBondIxn.h" #include "ReferenceBondIxn.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;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceBondIxn::ReferenceBondIxn( ){ ReferenceBondIxn::ReferenceBondIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -56,7 +54,7 @@ ReferenceBondIxn::ReferenceBondIxn( ){ ...@@ -56,7 +54,7 @@ ReferenceBondIxn::ReferenceBondIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceBondIxn::~ReferenceBondIxn( ){ ReferenceBondIxn::~ReferenceBondIxn() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -78,9 +76,9 @@ ReferenceBondIxn::~ReferenceBondIxn( ){ ...@@ -78,9 +76,9 @@ ReferenceBondIxn::~ReferenceBondIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void ReferenceBondIxn::calculateBondIxn( int* atomIndices, vector<RealVec>& atomCoordinates, void ReferenceBondIxn::calculateBondIxn(int* atomIndices, vector<RealVec>& atomCoordinates,
RealOpenMM* parameters, vector<RealVec>& forces, RealOpenMM* parameters, vector<RealVec>& forces,
RealOpenMM* totalEnergy ) const { RealOpenMM* totalEnergy) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nReferenceBondIxn::calculateBondIxn"; // static const std::string methodName = "\nReferenceBondIxn::calculateBondIxn";
...@@ -104,8 +102,8 @@ ReferenceBondIxn::~ReferenceBondIxn( ){ ...@@ -104,8 +102,8 @@ ReferenceBondIxn::~ReferenceBondIxn( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenMM* vector2, RealOpenMM ReferenceBondIxn::getNormedDotProduct(RealOpenMM* vector1, RealOpenMM* vector2,
int hasREntry = 0 ) { int hasREntry = 0) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -124,35 +122,35 @@ RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenM ...@@ -124,35 +122,35 @@ RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenM
#if defined USE_DOUBLE_FOR_NORMED_DOT_PRODUCT #if defined USE_DOUBLE_FOR_NORMED_DOT_PRODUCT
double v1D[3]; double v1D[3];
double v2D[3]; double v2D[3];
v1D[0] = static_cast<double>( vector1[0] ); v1D[0] = static_cast<double>(vector1[0]);
v1D[1] = static_cast<double>( vector1[1] ); v1D[1] = static_cast<double>(vector1[1]);
v1D[2] = static_cast<double>( vector1[2] ); v1D[2] = static_cast<double>(vector1[2]);
v2D[0] = static_cast<double>( vector2[0] ); v2D[0] = static_cast<double>(vector2[0]);
v2D[1] = static_cast<double>( vector2[1] ); v2D[1] = static_cast<double>(vector2[1]);
v2D[2] = static_cast<double>( vector2[2] ); v2D[2] = static_cast<double>(vector2[2]);
double dotProductD = DOT3( v1D, v2D ); double dotProductD = DOT3(v1D, v2D);
if( dotProductD != 0.0 ){ if (dotProductD != 0.0) {
if( hasREntry ){ if (hasREntry) {
dotProductD /= ( static_cast<double>(vector1[ReferenceForce::RIndex])*static_cast<double>(vector2[ReferenceForce::RIndex]) ); dotProductD /= (static_cast<double>(vector1[ReferenceForce::RIndex])*static_cast<double>(vector2[ReferenceForce::RIndex]));
} else { } else {
double norm1 = DOT3( v1D, v1D ); double norm1 = DOT3(v1D, v1D);
double norm2 = DOT3( v2D, v2D); double norm2 = DOT3(v2D, v2D);
dotProductD /= sqrt( norm1*norm2 ); dotProductD /= sqrt(norm1*norm2);
} }
} }
RealOpenMM dotProduct = static_cast<RealOpenMM>(dotProductD); RealOpenMM dotProduct = static_cast<RealOpenMM>(dotProductD);
#else #else
RealOpenMM dotProduct = DOT3( vector1, vector2 ); RealOpenMM dotProduct = DOT3(vector1, vector2);
if( dotProduct != zero ){ if (dotProduct != zero) {
if( hasREntry ){ if (hasREntry) {
dotProduct /= ( vector1[ReferenceForce::RIndex]*vector2[ReferenceForce::RIndex] ); dotProduct /= (vector1[ReferenceForce::RIndex]*vector2[ReferenceForce::RIndex]);
} else { } else {
RealOpenMM norm1 = DOT3( vector1, vector1 ); RealOpenMM norm1 = DOT3(vector1, vector1);
RealOpenMM norm2 = DOT3( vector2, vector2 ); RealOpenMM norm2 = DOT3(vector2, vector2);
dotProduct /= SQRT( norm1*norm2 ); dotProduct /= SQRT(norm1*norm2);
} }
} }
...@@ -161,9 +159,9 @@ RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenM ...@@ -161,9 +159,9 @@ RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenM
// clamp dot product to [-1,1] // clamp dot product to [-1,1]
if( dotProduct > one ){ if (dotProduct > one) {
dotProduct = one; dotProduct = one;
} else if( dotProduct < -one ){ } else if (dotProduct < -one) {
dotProduct = -one; dotProduct = -one;
} }
...@@ -185,9 +183,9 @@ RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenM ...@@ -185,9 +183,9 @@ RealOpenMM ReferenceBondIxn::getNormedDotProduct( RealOpenMM* vector1, RealOpenM
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, RealOpenMM* vector2, RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors(RealOpenMM* vector1, RealOpenMM* vector2,
RealOpenMM* outputDotProduct = NULL, RealOpenMM* outputDotProduct = NULL,
int hasREntry = 0 ) { int hasREntry = 0) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -200,7 +198,7 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea ...@@ -200,7 +198,7 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea
// get dot product betweenn vectors and then angle // get dot product betweenn vectors and then angle
RealOpenMM dotProduct = getNormedDotProduct( vector1, vector2, hasREntry ); RealOpenMM dotProduct = getNormedDotProduct(vector1, vector2, hasREntry);
RealOpenMM angle; RealOpenMM angle;
if (dotProduct > (RealOpenMM) 0.99 || dotProduct < (RealOpenMM) -0.99) { if (dotProduct > (RealOpenMM) 0.99 || dotProduct < (RealOpenMM) -0.99) {
...@@ -216,7 +214,7 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea ...@@ -216,7 +214,7 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea
angle = ACOS(dotProduct); angle = ACOS(dotProduct);
} }
if( outputDotProduct ){ if (outputDotProduct) {
*outputDotProduct = dotProduct; *outputDotProduct = dotProduct;
} }
...@@ -242,14 +240,14 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea ...@@ -242,14 +240,14 @@ RealOpenMM ReferenceBondIxn::getAngleBetweenTwoVectors( RealOpenMM* vector1, Rea
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ReferenceBondIxn::getDihedralAngleBetweenThreeVectors( RealOpenMM* vector1, RealOpenMM ReferenceBondIxn::getDihedralAngleBetweenThreeVectors(RealOpenMM* vector1,
RealOpenMM* vector2, RealOpenMM* vector2,
RealOpenMM* vector3, RealOpenMM* vector3,
RealOpenMM** outputCrossProduct = NULL, RealOpenMM** outputCrossProduct = NULL,
RealOpenMM* cosineOfAngle = NULL, RealOpenMM* cosineOfAngle = NULL,
RealOpenMM* signVector = NULL, RealOpenMM* signVector = NULL,
RealOpenMM* signOfAngle = NULL, RealOpenMM* signOfAngle = NULL,
int hasREntry = 0 ) { int hasREntry = 0) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -265,7 +263,7 @@ RealOpenMM ReferenceBondIxn::getDihedralAngleBetweenThreeVectors( RealOpenMM* v ...@@ -265,7 +263,7 @@ RealOpenMM ReferenceBondIxn::getDihedralAngleBetweenThreeVectors( RealOpenMM* v
// get cross products between vectors and then angle between cross product vectors // get cross products between vectors and then angle between cross product vectors
RealOpenMM* crossProduct[2]; RealOpenMM* crossProduct[2];
if( outputCrossProduct ){ if (outputCrossProduct) {
crossProduct[0] = outputCrossProduct[0]; crossProduct[0] = outputCrossProduct[0];
crossProduct[1] = outputCrossProduct[1]; crossProduct[1] = outputCrossProduct[1];
} else { } else {
...@@ -273,17 +271,17 @@ RealOpenMM ReferenceBondIxn::getDihedralAngleBetweenThreeVectors( RealOpenMM* v ...@@ -273,17 +271,17 @@ RealOpenMM ReferenceBondIxn::getDihedralAngleBetweenThreeVectors( RealOpenMM* v
crossProduct[1] = tempVectors + 3; crossProduct[1] = tempVectors + 3;
} }
SimTKOpenMMUtilities::crossProductVector3( vector1, vector2, crossProduct[0] ); SimTKOpenMMUtilities::crossProductVector3(vector1, vector2, crossProduct[0]);
SimTKOpenMMUtilities::crossProductVector3( vector2, vector3, crossProduct[1] ); SimTKOpenMMUtilities::crossProductVector3(vector2, vector3, crossProduct[1]);
RealOpenMM angle = getAngleBetweenTwoVectors( crossProduct[0], crossProduct[1], cosineOfAngle, 0 ); RealOpenMM angle = getAngleBetweenTwoVectors(crossProduct[0], crossProduct[1], cosineOfAngle, 0);
// take care of sign of angle // take care of sign of angle
if( signVector ){ if (signVector) {
RealOpenMM dotProduct = DOT3( signVector, crossProduct[1] ); RealOpenMM dotProduct = DOT3(signVector, crossProduct[1]);
RealOpenMM sign = dotProduct < zero ? -one : one; RealOpenMM sign = dotProduct < zero ? -one : one;
if( signOfAngle ){ if (signOfAngle) {
*signOfAngle = sign; *signOfAngle = sign;
} }
angle *= sign; angle *= sign;
......
...@@ -25,16 +25,15 @@ ...@@ -25,16 +25,15 @@
#include <cstring> #include <cstring>
#include <sstream> #include <sstream>
#include "SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h" #include "SimTKOpenMMUtilities.h"
#include "ReferenceBrownianDynamics.h" #include "ReferenceBrownianDynamics.h"
#include "ReferenceVirtualSites.h" #include "ReferenceVirtualSites.h"
#include "openmm/OpenMMException.h"
#include <cstdio> #include <cstdio>
using std::vector; using std::vector;
using OpenMM::RealVec; using namespace OpenMM;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -47,29 +46,15 @@ using OpenMM::RealVec; ...@@ -47,29 +46,15 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceBrownianDynamics::ReferenceBrownianDynamics( int numberOfAtoms, ReferenceBrownianDynamics::ReferenceBrownianDynamics(int numberOfAtoms,
RealOpenMM deltaT, RealOpenMM friction, RealOpenMM deltaT, RealOpenMM friction,
RealOpenMM temperature ) : RealOpenMM temperature) :
ReferenceDynamics( numberOfAtoms, deltaT, temperature ), friction( friction ) { ReferenceDynamics(numberOfAtoms, deltaT, temperature), friction(friction) {
// ---------------------------------------------------------------------------------------
static const char* methodName = "\nReferenceBrownianDynamics::ReferenceBrownianDynamics";
static const RealOpenMM zero = 0.0;
static const RealOpenMM one = 1.0;
// ---------------------------------------------------------------------------------------
if( friction <= zero ){
if (friction <= 0) {
std::stringstream message; std::stringstream message;
message << methodName; message << "illegal friction value: " << friction;
message << " input frction value=" << friction << " is invalid -- setting to 1."; throw OpenMMException(message.str());
SimTKOpenMMLog::printError( message );
this->friction = one;
} }
xPrime.resize(numberOfAtoms); xPrime.resize(numberOfAtoms);
inverseMasses.resize(numberOfAtoms); inverseMasses.resize(numberOfAtoms);
...@@ -81,7 +66,7 @@ ReferenceBrownianDynamics::ReferenceBrownianDynamics( int numberOfAtoms, ...@@ -81,7 +66,7 @@ ReferenceBrownianDynamics::ReferenceBrownianDynamics( int numberOfAtoms,
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
ReferenceBrownianDynamics::~ReferenceBrownianDynamics( ){ ReferenceBrownianDynamics::~ReferenceBrownianDynamics() {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -99,7 +84,7 @@ ReferenceBrownianDynamics::~ReferenceBrownianDynamics( ){ ...@@ -99,7 +84,7 @@ ReferenceBrownianDynamics::~ReferenceBrownianDynamics( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
RealOpenMM ReferenceBrownianDynamics::getFriction( void ) const { RealOpenMM ReferenceBrownianDynamics::getFriction() const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -139,10 +124,10 @@ void ReferenceBrownianDynamics::update(const OpenMM::System& system, vector<Real ...@@ -139,10 +124,10 @@ void ReferenceBrownianDynamics::update(const OpenMM::System& system, vector<Real
// first-time-through initialization // first-time-through initialization
int numberOfAtoms = system.getNumParticles(); int numberOfAtoms = system.getNumParticles();
if( getTimeStep() == 0 ){ if (getTimeStep() == 0) {
// invert masses // invert masses
for( int ii = 0; ii < numberOfAtoms; ii++ ){ for (int ii = 0; ii < numberOfAtoms; ii++) {
if (masses[ii] == zero) if (masses[ii] == zero)
inverseMasses[ii] = zero; inverseMasses[ii] = zero;
else else
...@@ -152,7 +137,7 @@ void ReferenceBrownianDynamics::update(const OpenMM::System& system, vector<Real ...@@ -152,7 +137,7 @@ void ReferenceBrownianDynamics::update(const OpenMM::System& system, vector<Real
// Perform the integration. // Perform the integration.
const RealOpenMM noiseAmplitude = static_cast<RealOpenMM>( sqrt(2.0*BOLTZ*getTemperature()*getDeltaT()/getFriction()) ); const RealOpenMM noiseAmplitude = static_cast<RealOpenMM>(sqrt(2.0*BOLTZ*getTemperature()*getDeltaT()/getFriction()));
const RealOpenMM forceScale = getDeltaT()/getFriction(); const RealOpenMM forceScale = getDeltaT()/getFriction();
for (int i = 0; i < numberOfAtoms; ++i) { for (int i = 0; i < numberOfAtoms; ++i) {
if (masses[i] != zero) if (masses[i] != zero)
...@@ -166,7 +151,7 @@ void ReferenceBrownianDynamics::update(const OpenMM::System& system, vector<Real ...@@ -166,7 +151,7 @@ void ReferenceBrownianDynamics::update(const OpenMM::System& system, vector<Real
// Update the positions and velocities. // Update the positions and velocities.
RealOpenMM velocityScale = static_cast<RealOpenMM>( 1.0/getDeltaT() ); RealOpenMM velocityScale = static_cast<RealOpenMM>(1.0/getDeltaT());
for (int i = 0; i < numberOfAtoms; ++i) { for (int i = 0; i < numberOfAtoms; ++i) {
if (masses[i] != zero) if (masses[i] != zero)
for (int j = 0; j < 3; ++j) { for (int j = 0; j < 3; ++j) {
......
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