Commit 1db349e5 authored by Peter Eastman's avatar Peter Eastman
Browse files

Major cleanup of the AMOEBA API

parent a919f305
...@@ -33,10 +33,8 @@ ...@@ -33,10 +33,8 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "openmm/AmoebaHarmonicBondForce.h" #include "openmm/AmoebaHarmonicBondForce.h"
#include "openmm/AmoebaUreyBradleyForce.h"
#include "openmm/AmoebaHarmonicAngleForce.h" #include "openmm/AmoebaHarmonicAngleForce.h"
#include "openmm/AmoebaHarmonicInPlaneAngleForce.h" #include "openmm/AmoebaHarmonicInPlaneAngleForce.h"
#include "openmm/AmoebaTorsionForce.h"
#include "openmm/AmoebaPiTorsionForce.h" #include "openmm/AmoebaPiTorsionForce.h"
#include "openmm/AmoebaStretchBendForce.h" #include "openmm/AmoebaStretchBendForce.h"
#include "openmm/AmoebaOutOfPlaneBendForce.h" #include "openmm/AmoebaOutOfPlaneBendForce.h"
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements an implicit solvation force using the generalized Kirkwood/OBC model. * This class implements an implicit solvation force using the generalized Kirkwood/Grycuk model.
* <p> * <p>
* To use this class, create a AmoebaGeneralizedKirkwoodForce object, then call addParticle() once for each particle in the * To use this class, create an AmoebaGeneralizedKirkwoodForce object, then call addParticle() once for each particle in the
* System to define its parameters. The number of particles for which you define GBSA parameters must * System to define its parameters. The number of particles for which you define parameters must
* be equal to the number of particles in the System, or else an exception will be thrown when you * be equal to the number of particles in the System, or else an exception will be thrown when you
* try to create a Context. After a particle has been added, you can modify its force field parameters * try to create a Context. After a particle has been added, you can modify its force field parameters
* by calling setParticleParameters(). * by calling setParticleParameters().
...@@ -53,7 +53,7 @@ class OPENMM_EXPORT AmoebaGeneralizedKirkwoodForce : public Force { ...@@ -53,7 +53,7 @@ class OPENMM_EXPORT AmoebaGeneralizedKirkwoodForce : public Force {
public: public:
/* /*
* Create a AmoebaGeneralizedKirkwoodForce. * Create an AmoebaGeneralizedKirkwoodForce.
*/ */
AmoebaGeneralizedKirkwoodForce(); AmoebaGeneralizedKirkwoodForce();
...@@ -69,8 +69,8 @@ public: ...@@ -69,8 +69,8 @@ public:
* in the System. When it is called for the i'th time, it specifies the parameters for the i'th particle. * in the System. When it is called for the i'th time, it specifies the parameters for the i'th particle.
* *
* @param charge the charge of the particle, measured in units of the proton charge * @param charge the charge of the particle, measured in units of the proton charge
* @param radius the GBSA radius of the particle, measured in nm * @param radius the atomic radius of the particle, measured in nm
* @param scalingFactor the OBC scaling factor for the particle * @param scalingFactor the scaling factor for the particle
* @return the index of the particle that was added * @return the index of the particle that was added
*/ */
int addParticle(double charge, double radius, double scalingFactor); int addParticle(double charge, double radius, double scalingFactor);
...@@ -80,8 +80,8 @@ public: ...@@ -80,8 +80,8 @@ public:
* *
* @param index the index of the particle for which to get parameters * @param index the index of the particle for which to get parameters
* @param charge the charge of the particle, measured in units of the proton charge * @param charge the charge of the particle, measured in units of the proton charge
* @param radius the GBSA radius of the particle, measured in nm * @param radius the atomic radius of the particle, measured in nm
* @param scalingFactor the OBC scaling factor for the particle * @param scalingFactor the scaling factor for the particle
*/ */
void getParticleParameters(int index, double& charge, double& radius, double& scalingFactor) const; void getParticleParameters(int index, double& charge, double& radius, double& scalingFactor) const;
...@@ -90,8 +90,8 @@ public: ...@@ -90,8 +90,8 @@ public:
* *
* @param index the index of the particle for which to set parameters * @param index the index of the particle for which to set parameters
* @param charge the charge of the particle, measured in units of the proton charge * @param charge the charge of the particle, measured in units of the proton charge
* @param radius the GBSA radius of the particle, measured in nm * @param radius the atomic radius of the particle, measured in nm
* @param scalingFactor the OBC scaling factor for the particle * @param scalingFactor the scaling factor for the particle
*/ */
void setParticleParameters(int index, double charge, double radius, double scalingFactor); void setParticleParameters(int index, double charge, double radius, double scalingFactor);
...@@ -124,22 +124,12 @@ public: ...@@ -124,22 +124,12 @@ public:
} }
/** /**
* Get the dielectric offset (nm) used in OBC * Get the flag signaling whether the cavity term should be included
*/
//double getDielectricOffset() const;
/**
* Set the dielectric offset (nm) used in OBC
*/
//void setDielectricOffset(double dielectricOffset);
/**
* Get the flag signalling whether the cavity term should be included
*/ */
int getIncludeCavityTerm( ) const; int getIncludeCavityTerm( ) const;
/** /**
* Set the flag signalling whether the cavity term should be included * Set the flag signaling whether the cavity term should be included
*/ */
void setIncludeCavityTerm(int includeCavityTerm); void setIncludeCavityTerm(int includeCavityTerm);
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -39,9 +39,13 @@ ...@@ -39,9 +39,13 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements an interaction between triplets of particles that varies harmonically with the angle * This class implements an interaction between triplets of particles that varies with the angle
* between them. To use it, create a AmoebaHarmonicAngleForce object then call addAngle() once for each angle. After * between them. The interaction is defined by a 6th order polynomial. Only the quadratic term
* a angle has been added, you can modify its force field parameters by calling setAngleParameters(). * is set per-angle. The coefficients of the higher order terms each have a single value that
* is set globally.
*
* To use it, create an AmoebaHarmonicAngleForce object then call addAngle() once for each angle. After
* an angle has been added, you can modify its force field parameters by calling setAngleParameters().
*/ */
class OPENMM_EXPORT AmoebaHarmonicAngleForce : public Force { class OPENMM_EXPORT AmoebaHarmonicAngleForce : public Force {
...@@ -49,7 +53,7 @@ class OPENMM_EXPORT AmoebaHarmonicAngleForce : public Force { ...@@ -49,7 +53,7 @@ class OPENMM_EXPORT AmoebaHarmonicAngleForce : public Force {
public: public:
/** /**
* Create a Amoeba HarmonicAngleForce. * Create an AmoebaHarmonicAngleForce.
*/ */
AmoebaHarmonicAngleForce(); AmoebaHarmonicAngleForce();
...@@ -63,7 +67,7 @@ public: ...@@ -63,7 +67,7 @@ public:
/** /**
* Set the global cubic term * Set the global cubic term
* *
* @param cubicK the cubic harmonic force constant for the angle * @param cubicK the cubic force constant for the angle
*/ */
void setAmoebaGlobalHarmonicAngleCubic( double cubicK ); void setAmoebaGlobalHarmonicAngleCubic( double cubicK );
...@@ -75,9 +79,9 @@ public: ...@@ -75,9 +79,9 @@ public:
double getAmoebaGlobalHarmonicAngleCubic( void ) const; double getAmoebaGlobalHarmonicAngleCubic( void ) const;
/** /**
* Set the global cubic term * Set the global quartic term
* *
* @param quarticK the quartic harmonic force constant for the angle * @param quarticK the quartic force constant for the angle
*/ */
void setAmoebaGlobalHarmonicAngleQuartic( double quarticK ); void setAmoebaGlobalHarmonicAngleQuartic( double quarticK );
...@@ -91,7 +95,7 @@ public: ...@@ -91,7 +95,7 @@ public:
/** /**
* Set the global pentic term * Set the global pentic term
* *
* @param penticK the pentic harmonic force constant for the angle * @param penticK the pentic force constant for the angle
*/ */
void setAmoebaGlobalHarmonicAnglePentic( double penticK ); void setAmoebaGlobalHarmonicAnglePentic( double penticK );
...@@ -105,50 +109,50 @@ public: ...@@ -105,50 +109,50 @@ public:
/** /**
* Set the global sextic term * Set the global sextic term
* *
* @param sexticK the sextic harmonic force constant for the angle * @param sexticK the sextic force constant for the angle
*/ */
void setAmoebaGlobalHarmonicAngleSextic( double sexticK ); void setAmoebaGlobalHarmonicAngleSextic( double sexticK );
/** /**
* Get the global sextic term * Get the global sextic term
* *
* @return global sextic term * @return global sextic term
*/ */
double getAmoebaGlobalHarmonicAngleSextic( void ) const; double getAmoebaGlobalHarmonicAngleSextic( void ) const;
/** /**
* Add a angle term to the force field. * Add an angle term to the force field.
* *
* @param particle1 the index of the first particle connected by the angle * @param particle1 the index of the first particle connected by the angle
* @param particle2 the index of the second particle connected by the angle * @param particle2 the index of the second particle connected by the angle
* @param particle3 the index of the third particle connected by the angle * @param particle3 the index of the third particle connected by the angle
* @param length the angle measured in degrees * @param length the angle measured in degrees
* @param quadratic k the quadratic harmonic force constant for the angle, measured in kJ/mol/radian^2 * @param quadratic k the quadratic force constant for the angle, measured in kJ/mol/radian^2
* @return the index of the angle that was added * @return the index of the angle that was added
*/ */
int addAngle(int particle1, int particle2, int particle3, double length, double quadraticK ); int addAngle(int particle1, int particle2, int particle3, double length, double quadraticK );
/** /**
* Get the force field parameters for a angle term. * Get the force field parameters for an angle term.
* *
* @param index the index of the angle for which to get parameters * @param index the index of the angle for which to get parameters
* @param particle1 the index of the first particle connected by the angle * @param particle1 the index of the first particle connected by the angle
* @param particle2 the index of the second particle connected by the angle * @param particle2 the index of the second particle connected by the angle
* @param particle3 the index of the third particle connected by the angle * @param particle3 the index of the third particle connected by the angle
* @param length the equilibrium angle, measured in degress * @param length the equilibrium angle, measured in degress
* @param quadratic k the quadratic harmonic force constant for the angle, measured in kJ/mol/radian^2 * @param quadratic k the quadratic force constant for the angle, measured in kJ/mol/radian^2
*/ */
void getAngleParameters(int index, int& particle1, int& particle2, int& particle3, double& length, double& quadraticK ) const; void getAngleParameters(int index, int& particle1, int& particle2, int& particle3, double& length, double& quadraticK ) const;
/** /**
* Set the force field parameters for a angle term. * Set the force field parameters for an angle term.
* *
* @param index the index of the angle for which to set parameters * @param index the index of the angle for which to set parameters
* @param particle1 the index of the first particle connected by the angle * @param particle1 the index of the first particle connected by the angle
* @param particle2 the index of the second particle connected by the angle * @param particle2 the index of the second particle connected by the angle
* @param particle3 the index of the third particle connected by the angle * @param particle3 the index of the third particle connected by the angle
* @param length the equilibrium angle, measured in degrees * @param length the equilibrium angle, measured in degrees
* @param quadratic k the quadratic harmonic force constant for the angle, measured in kJ/mol/radian^2 * @param quadratic k the quadratic force constant for the angle, measured in kJ/mol/radian^2
*/ */
void setAngleParameters(int index, int particle1, int particle2, int particle3, double length, double quadraticK ); void setAngleParameters(int index, int particle1, int particle2, int particle3, double length, double quadraticK );
...@@ -156,21 +160,8 @@ protected: ...@@ -156,21 +160,8 @@ protected:
ForceImpl* createImpl(); ForceImpl* createImpl();
double _globalCubicK, _globalQuarticK, _globalPenticK, _globalSexticK; double _globalCubicK, _globalQuarticK, _globalPenticK, _globalSexticK;
private: private:
class AngleInfo; class AngleInfo;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<AngleInfo> angles; std::vector<AngleInfo> angles;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}; };
class AmoebaHarmonicAngleForce::AngleInfo { class AmoebaHarmonicAngleForce::AngleInfo {
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -41,8 +41,12 @@ ...@@ -41,8 +41,12 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements an interaction between pairs of particles that varies harmonically with the distance * This class implements an interaction between pairs of particles that varies with the distance
* between them. To use it, create a AmoebaHarmonicBondForce object then call addBond() once for each bond. After * between them. The interaction is defined by a 4th order polynomial. Only the quadratic term
* is set per-bond. The coefficients of the higher order terms each have a single value that
* is set globally.
*
* To use it, create an AmoebaHarmonicBondForce object then call addBond() once for each bond. After
* a bond has been added, you can modify its force field parameters by calling setBondParameters(). * a bond has been added, you can modify its force field parameters by calling setBondParameters().
*/ */
...@@ -51,11 +55,11 @@ class OPENMM_EXPORT AmoebaHarmonicBondForce : public Force { ...@@ -51,11 +55,11 @@ class OPENMM_EXPORT AmoebaHarmonicBondForce : public Force {
public: public:
/** /**
* Create a Amoeba HarmonicBondForce. * Create an AmoebaHarmonicBondForce.
*/ */
AmoebaHarmonicBondForce(); AmoebaHarmonicBondForce();
/** /**
* Get the number of harmonic bond stretch terms in the potential function * Get the number of bond stretch terms in the potential function
*/ */
int getNumBonds() const { int getNumBonds() const {
return bonds.size(); return bonds.size();
...@@ -64,7 +68,7 @@ public: ...@@ -64,7 +68,7 @@ public:
/** /**
* Set the global cubic term * Set the global cubic term
* *
* @param cubicK the cubic harmonic force constant for the bond * @param cubicK the cubic force constant for the bond
*/ */
void setAmoebaGlobalHarmonicBondCubic( double cubicK ); void setAmoebaGlobalHarmonicBondCubic( double cubicK );
...@@ -76,9 +80,9 @@ public: ...@@ -76,9 +80,9 @@ public:
double getAmoebaGlobalHarmonicBondCubic( void ) const; double getAmoebaGlobalHarmonicBondCubic( void ) const;
/** /**
* Set the global cubic term * Set the global quartic term
* *
* @param quarticK the quartic harmonic force constant for the bond * @param quarticK the quartic force constant for the bond
*/ */
void setAmoebaGlobalHarmonicBondQuartic( double quarticK ); void setAmoebaGlobalHarmonicBondQuartic( double quarticK );
...@@ -95,7 +99,7 @@ public: ...@@ -95,7 +99,7 @@ public:
* @param particle1 the index of the first particle connected by the bond * @param particle1 the index of the first particle connected by the bond
* @param particle2 the index of the second particle connected by the bond * @param particle2 the index of the second particle connected by the bond
* @param length the equilibrium length of the bond, measured in nm * @param length the equilibrium length of the bond, measured in nm
* @param k the quadratic harmonic force constant for the bond * @param k the quadratic force constant for the bond
* @return the index of the bond that was added * @return the index of the bond that was added
*/ */
...@@ -108,7 +112,7 @@ public: ...@@ -108,7 +112,7 @@ public:
* @param particle1 the index of the first particle connected by the bond * @param particle1 the index of the first particle connected by the bond
* @param particle2 the index of the second particle connected by the bond * @param particle2 the index of the second particle connected by the bond
* @param length the equilibrium length of the bond, measured in nm * @param length the equilibrium length of the bond, measured in nm
* @param quadratic k the quadratic harmonic force constant for the bond * @param quadratic k the quadratic force constant for the bond
*/ */
void getBondParameters(int index, int& particle1, int& particle2, double& length, double& quadraticK ) const; void getBondParameters(int index, int& particle1, int& particle2, double& length, double& quadraticK ) const;
...@@ -120,7 +124,7 @@ public: ...@@ -120,7 +124,7 @@ public:
* @param particle1 the index of the first particle connected by the bond * @param particle1 the index of the first particle connected by the bond
* @param particle2 the index of the second particle connected by the bond * @param particle2 the index of the second particle connected by the bond
* @param length the equilibrium length of the bond, measured in nm * @param length the equilibrium length of the bond, measured in nm
* @param k the quadratic harmonic force constant for the bond * @param k the quadratic force constant for the bond
*/ */
void setBondParameters(int index, int particle1, int particle2, double length, double quadraticK ); void setBondParameters(int index, int particle1, int particle2, double length, double quadraticK );
...@@ -128,21 +132,8 @@ protected: ...@@ -128,21 +132,8 @@ protected:
double _globalQuarticK, _globalCubicK; double _globalQuarticK, _globalCubicK;
ForceImpl* createImpl(); ForceImpl* createImpl();
private: private:
class BondInfo; class BondInfo;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<BondInfo> bonds; std::vector<BondInfo> bonds;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}; };
class AmoebaHarmonicBondForce::BondInfo { class AmoebaHarmonicBondForce::BondInfo {
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -40,9 +40,12 @@ namespace OpenMM { ...@@ -40,9 +40,12 @@ namespace OpenMM {
/** /**
* This class implements an interaction at trigonal centers corresponding to the projected in-plane angle bend energy * This class implements an interaction at trigonal centers corresponding to the projected in-plane angle bend energy
* between four particles; the energy varies harmonically with the angle * between four particles. The interaction is defined by a 6th order polynomial in the angle between them. Only the
* between them. To use it, create a AmoebaHarmonicInPlaneAngle object then call addAngle() once for each angle. After * quadratic term is set per-angle. The coefficients of the higher order terms each have a single value that
* a angle has been added, you can modify its force field parameters by calling setAngleParameters(). * is set globally.
*
* To use it, create an AmoebaHarmonicInPlaneAngle object then call addAngle() once for each angle. After
* an angle has been added, you can modify its force field parameters by calling setAngleParameters().
*/ */
class OPENMM_EXPORT AmoebaHarmonicInPlaneAngleForce : public Force { class OPENMM_EXPORT AmoebaHarmonicInPlaneAngleForce : public Force {
...@@ -50,12 +53,12 @@ class OPENMM_EXPORT AmoebaHarmonicInPlaneAngleForce : public Force { ...@@ -50,12 +53,12 @@ class OPENMM_EXPORT AmoebaHarmonicInPlaneAngleForce : public Force {
public: public:
/** /**
* Create a Amoeba HarmonicAngleForce. * Create an AmoebaHarmonicAngleForce.
*/ */
AmoebaHarmonicInPlaneAngleForce(); AmoebaHarmonicInPlaneAngleForce();
/** /**
* Get the number of harmonic angle stretch terms in the potential function * Get the number of in-plane angle terms in the potential function
*/ */
int getNumAngles() const { int getNumAngles() const {
return angles.size(); return angles.size();
...@@ -64,7 +67,7 @@ public: ...@@ -64,7 +67,7 @@ public:
/** /**
* Set the global cubic term * Set the global cubic term
* *
* @param cubicK the cubic harmonic force constant for the angle * @param cubicK the cubic force constant for the angle
*/ */
void setAmoebaGlobalHarmonicInPlaneAngleCubic( double cubicK ); void setAmoebaGlobalHarmonicInPlaneAngleCubic( double cubicK );
...@@ -78,7 +81,7 @@ public: ...@@ -78,7 +81,7 @@ public:
/** /**
* Set the global quartic term * Set the global quartic term
* *
* @param quarticK the quartic harmonic force constant for the angle * @param quarticK the quartic force constant for the angle
*/ */
void setAmoebaGlobalHarmonicInPlaneAngleQuartic( double quarticK ); void setAmoebaGlobalHarmonicInPlaneAngleQuartic( double quarticK );
...@@ -92,7 +95,7 @@ public: ...@@ -92,7 +95,7 @@ public:
/** /**
* Set the global pentic term * Set the global pentic term
* *
* @param penticK the pentic harmonic force constant for the angle * @param penticK the pentic force constant for the angle
*/ */
void setAmoebaGlobalHarmonicInPlaneAnglePentic( double penticK ); void setAmoebaGlobalHarmonicInPlaneAnglePentic( double penticK );
...@@ -106,7 +109,7 @@ public: ...@@ -106,7 +109,7 @@ public:
/** /**
* Set the global sextic term * Set the global sextic term
* *
* @param sexticK the sextic harmonic force constant for the angle * @param sexticK the sextic force constant for the angle
*/ */
void setAmoebaGlobalHarmonicInPlaneAngleSextic( double sexticK ); void setAmoebaGlobalHarmonicInPlaneAngleSextic( double sexticK );
...@@ -118,21 +121,21 @@ public: ...@@ -118,21 +121,21 @@ public:
double getAmoebaGlobalHarmonicInPlaneAngleSextic( void ) const; double getAmoebaGlobalHarmonicInPlaneAngleSextic( void ) const;
/** /**
* Add a angle term to the force field. * Add an angle term to the force field.
* *
* @param particle1 the index of the first particle connected by the angle * @param particle1 the index of the first particle connected by the angle
* @param particle2 the index of the second particle connected by the angle * @param particle2 the index of the second particle connected by the angle
* @param particle3 the index of the third particle connected by the angle * @param particle3 the index of the third particle connected by the angle
* @param particle4 the index of the fourth particle connected by the angle * @param particle4 the index of the fourth particle connected by the angle
* @param length the equilibrium angle, measured in radians * @param length the equilibrium angle, measured in radians
* @param quadratic k the quadratic harmonic force constant for the angle measured in kJ/mol/radian^2 * @param quadratic k the quadratic force constant for the angle measured in kJ/mol/radian^2
* @return the index of the angle that was added * @return the index of the angle that was added
*/ */
int addAngle(int particle1, int particle2, int particle3, int particle4, double length, int addAngle(int particle1, int particle2, int particle3, int particle4, double length,
double quadraticK ); double quadraticK );
/** /**
* Get the force field parameters for a angle term. * Get the force field parameters for an angle term.
* *
* @param index the index of the angle for which to get parameters * @param index the index of the angle for which to get parameters
* @param particle1 the index of the first particle connected by the angle * @param particle1 the index of the first particle connected by the angle
...@@ -140,13 +143,13 @@ public: ...@@ -140,13 +143,13 @@ public:
* @param particle3 the index of the third particle connected by the angle * @param particle3 the index of the third particle connected by the angle
* @param particle4 the index of the fourth particle connected by the angle * @param particle4 the index of the fourth particle connected by the angle
* @param length the equilibrium angle, measured in radians * @param length the equilibrium angle, measured in radians
* @param quadratic k the quadratic harmonic force constant for the angle measured in kJ/mol/radian^2 * @param quadratic k the quadratic force constant for the angle measured in kJ/mol/radian^2
*/ */
void getAngleParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, double& length, void getAngleParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, double& length,
double& quadraticK ) const; double& quadraticK ) const;
/** /**
* Set the force field parameters for a angle term. * Set the force field parameters for an angle term.
* *
* @param index the index of the angle for which to set parameters * @param index the index of the angle for which to set parameters
* @param particle1 the index of the first particle connected by the angle * @param particle1 the index of the first particle connected by the angle
...@@ -154,7 +157,7 @@ public: ...@@ -154,7 +157,7 @@ public:
* @param particle3 the index of the third particle connected by the angle * @param particle3 the index of the third particle connected by the angle
* @param particle4 the index of the fourth particle connected by the angle * @param particle4 the index of the fourth particle connected by the angle
* @param length the equilibrium angle, measured in radians * @param length the equilibrium angle, measured in radians
* @param quadratic k the quadratic harmonic force constant for the angle, measured in kJ/mol/radian^2 * @param quadratic k the quadratic force constant for the angle, measured in kJ/mol/radian^2
*/ */
void setAngleParameters(int index, int particle1, int particle2, int particle3, int particle4, double length, double quadraticK ); void setAngleParameters(int index, int particle1, int particle2, int particle3, int particle4, double length, double quadraticK );
...@@ -162,21 +165,8 @@ protected: ...@@ -162,21 +165,8 @@ protected:
ForceImpl* createImpl(); ForceImpl* createImpl();
double _globalCubicK, _globalQuarticK, _globalPenticK, _globalSexticK; double _globalCubicK, _globalQuarticK, _globalPenticK, _globalSexticK;
private: private:
class AngleInfo; class AngleInfo;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<AngleInfo> angles; std::vector<AngleInfo> angles;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}; };
class AmoebaHarmonicInPlaneAngleForce::AngleInfo { class AmoebaHarmonicInPlaneAngleForce::AngleInfo {
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -43,18 +43,19 @@ ...@@ -43,18 +43,19 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements the Amoeba multipole interaction * This class implements the Amoeba multipole interaction.
* To use it, create a MultipoleForce object then call addMultipole() once for each atom. After *
* a entry has been added, you can modify its force field parameters by calling setMultipoleParameters(). * To use it, create an AmoebaMultipoleForce object then call addMultipole() once for each atom. After
* an entry has been added, you can modify its force field parameters by calling setMultipoleParameters().
*/ */
class OPENMM_EXPORT AmoebaMultipoleForce : public Force { class OPENMM_EXPORT AmoebaMultipoleForce : public Force {
public: public:
enum AmoebaNonbondedMethod {
/** enum NonbondedMethod {
/**
* No cutoff is applied to nonbonded interactions. The full set of N^2 interactions is computed exactly. * No cutoff is applied to nonbonded interactions. The full set of N^2 interactions is computed exactly.
* This necessarily means that periodic boundary conditions cannot be used. This is the default. * This necessarily means that periodic boundary conditions cannot be used. This is the default.
*/ */
...@@ -64,36 +65,30 @@ public: ...@@ -64,36 +65,30 @@ public:
* Periodic boundary conditions are used, and Particle-Mesh Ewald (PME) summation is used to compute the interaction of each particle * Periodic boundary conditions are used, and Particle-Mesh Ewald (PME) summation is used to compute the interaction of each particle
* with all periodic copies of every other particle. * with all periodic copies of every other particle.
*/ */
PME = 1 PME = 1
}; };
enum AmoebaPolarizationType { enum PolarizationType {
/** /**
* Mutual polarization * Mutual polarization
*/ */
Mutual = 0, Mutual = 0,
/** /**
* Direct polarization * Direct polarization
*/ */
Direct = 1 Direct = 1
}; };
enum MultipoleAxisTypes { ZThenX = 0, Bisector = 1, ZBisect = 2, ThreeFold = 3, ZOnly = 4, NoAxisType = 5, LastAxisTypeIndex = 6 }; enum MultipoleAxisTypes { ZThenX = 0, Bisector = 1, ZBisect = 2, ThreeFold = 3, ZOnly = 4, NoAxisType = 5, LastAxisTypeIndex = 6 };
// Algorithm used to converge mutual induced dipoles: enum CovalentType {
// SOR: successive-over-relaxation Covalent12 = 0, Covalent13 = 1, Covalent14 = 2, Covalent15 = 3,
//enum MutualInducedIterationMethod { SOR, ConjugateGradient };
enum MutualInducedIterationMethod { SOR = 0 };
enum CovalentType {
Covalent12 = 0, Covalent13 = 1, Covalent14 = 2, Covalent15 = 3,
PolarizationCovalent11 = 4, PolarizationCovalent12 = 5, PolarizationCovalent13 = 6, PolarizationCovalent14 = 7, CovalentEnd = 8 }; PolarizationCovalent11 = 4, PolarizationCovalent12 = 5, PolarizationCovalent13 = 6, PolarizationCovalent14 = 7, CovalentEnd = 8 };
/** /**
* Create a Amoeba MultipoleForce. * Create an AmoebaMultipoleForce.
*/ */
AmoebaMultipoleForce(); AmoebaMultipoleForce();
...@@ -107,22 +102,22 @@ public: ...@@ -107,22 +102,22 @@ public:
/** /**
* Get the method used for handling long-range nonbonded interactions. * Get the method used for handling long-range nonbonded interactions.
*/ */
AmoebaNonbondedMethod getNonbondedMethod( void ) const; NonbondedMethod getNonbondedMethod() const;
/** /**
* Set the method used for handling long-range nonbonded interactions. * Set the method used for handling long-range nonbonded interactions.
*/ */
void setNonbondedMethod(AmoebaNonbondedMethod method); void setNonbondedMethod(NonbondedMethod method);
/** /**
* Get polarization type * Get polarization type
*/ */
AmoebaPolarizationType getPolarizationType( void ) const; PolarizationType getPolarizationType() const;
/** /**
* Set the polarization type * Set the polarization type
*/ */
void setPolarizationType(AmoebaPolarizationType type ); void setPolarizationType(PolarizationType type);
/** /**
* Get the cutoff distance (in nm) being used for nonbonded interactions. If the NonbondedMethod in use * Get the cutoff distance (in nm) being used for nonbonded interactions. If the NonbondedMethod in use
...@@ -130,7 +125,7 @@ public: ...@@ -130,7 +125,7 @@ public:
* *
* @return the cutoff distance, measured in nm * @return the cutoff distance, measured in nm
*/ */
double getCutoffDistance( void ) const; double getCutoffDistance(void) const;
/** /**
* Set the cutoff distance (in nm) being used for nonbonded interactions. If the NonbondedMethod in use * Set the cutoff distance (in nm) being used for nonbonded interactions. If the NonbondedMethod in use
...@@ -140,55 +135,52 @@ public: ...@@ -140,55 +135,52 @@ public:
*/ */
void setCutoffDistance(double distance); void setCutoffDistance(double distance);
/** /**
* Get the aEwald parameter * Get the Ewald alpha parameter. If this is 0 (the default), a value is chosen automatically
* * based on the Ewald error tolerance.
* @return the Ewald parameter *
*/ * @return the Ewald alpha parameter
double getAEwald() const; */
double getAEwald() const;
/**
* Set the aEwald parameter /**
* * Set the Ewald alpha parameter. If this is 0 (the default), a value is chosen automatically
* @param Ewald parameter * based on the Ewald error tolerance.
*/ *
void setAEwald(double aewald); * @param Ewald alpha parameter
*/
/** void setAEwald(double aewald);
* Get the B-spline order parameter
* /**
* @return the B-spline order parameter * Get the B-spline order to use for PME charge spreading
*/ *
int getPmeBSplineOrder( ) const; * @return the B-spline order
*/
/** int getPmeBSplineOrder() const;
* Set the B-spline order parameter
* /**
* @param the B-spline order parameter * Get the PME grid dimensions. If Ewald alpha is 0 (the default), this is ignored and grid dimensions
*/ * are chosen automatically based on the Ewald error tolerance.
//void setPmeBSplineOrder(int inputBSplineOrder); *
/**
* Get the PME grid dimensions
*
* @return the PME grid dimensions * @return the PME grid dimensions
*/ */
void getPmeGridDimensions( std::vector<int>& gridDimension ) const; void getPmeGridDimensions(std::vector<int>& gridDimension) const;
/** /**
* Set the PME grid dimensions * Set the PME grid dimensions. If Ewald alpha is 0 (the default), this is ignored and grid dimensions
* * are chosen automatically based on the Ewald error tolerance.
*
* @param the PME grid dimensions * @param the PME grid dimensions
*/ */
void setPmeGridDimensions( const std::vector<int>& gridDimension ); void setPmeGridDimensions(const std::vector<int>& gridDimension);
/** /**
* Add multipole-related info for a particle * Add multipole-related info for a particle
* *
* @param charge the particle's charge * @param charge the particle's charge
* @param molecularDipole the particle's molecular dipole (vector of size 3) * @param molecularDipole the particle's molecular dipole (vector of size 3)
* @param molecularQuadrupole the particle's molecular quadrupole (vector of size 9) * @param molecularQuadrupole the particle's molecular quadrupole (vector of size 9)
* @param axisType the particle's axis type ( ZThenX, Bisector ) * @param axisType the particle's axis type
* @param multipoleAtomZ index of first atom used in constructing lab<->molecular frames * @param multipoleAtomZ index of first atom used in constructing lab<->molecular frames
* @param multipoleAtomX index of second atom used in constructing lab<->molecular frames * @param multipoleAtomX index of second atom used in constructing lab<->molecular frames
* @param multipoleAtomY index of second atom used in constructing lab<->molecular frames * @param multipoleAtomY index of second atom used in constructing lab<->molecular frames
...@@ -198,17 +190,17 @@ public: ...@@ -198,17 +190,17 @@ public:
* *
* @return the index of the particle that was added * @return the index of the particle that was added
*/ */
int addParticle( double charge, const std::vector<double>& molecularDipole, const std::vector<double>& molecularQuadrupole, int axisType, int addParticle(double charge, const std::vector<double>& molecularDipole, const std::vector<double>& molecularQuadrupole, int axisType,
int multipoleAtomZ, int multipoleAtomX, int multipoleAtomY, double thole, double dampingFactor, double polarity ); int multipoleAtomZ, int multipoleAtomX, int multipoleAtomY, double thole, double dampingFactor, double polarity);
/** /**
* Get the multipole parameters for a particle. * Get the multipole parameters for a particle.
* *
* @param index the index of the atom for which to get parameters * @param index the index of the atom for which to get parameters
* @param charge the particle's charge * @param charge the particle's charge
* @param molecularDipole the particle's molecular dipole (vector of size 3) * @param molecularDipole the particle's molecular dipole (vector of size 3)
* @param molecularQuadrupole the particle's molecular quadrupole (vector of size 9) * @param molecularQuadrupole the particle's molecular quadrupole (vector of size 9)
* @param axisType the particle's axis type ( ZThenX, Bisector ) * @param axisType the particle's axis type
* @param multipoleAtomZ index of first atom used in constructing lab<->molecular frames * @param multipoleAtomZ index of first atom used in constructing lab<->molecular frames
* @param multipoleAtomX index of second atom used in constructing lab<->molecular frames * @param multipoleAtomX index of second atom used in constructing lab<->molecular frames
* @param multipoleAtomY index of second atom used in constructing lab<->molecular frames * @param multipoleAtomY index of second atom used in constructing lab<->molecular frames
...@@ -217,16 +209,16 @@ public: ...@@ -217,16 +209,16 @@ public:
* @param polarity polarity parameter * @param polarity polarity parameter
*/ */
void getMultipoleParameters(int index, double& charge, std::vector<double>& molecularDipole, std::vector<double>& molecularQuadrupole, void getMultipoleParameters(int index, double& charge, std::vector<double>& molecularDipole, std::vector<double>& molecularQuadrupole,
int& axisType, int& multipoleAtomZ, int& multipoleAtomX, int& multipoleAtomY, double& thole, double& dampingFactor, double& polarity ) const; int& axisType, int& multipoleAtomZ, int& multipoleAtomX, int& multipoleAtomY, double& thole, double& dampingFactor, double& polarity) const;
/** /**
* Set the multipole parameters for a particle. * Set the multipole parameters for a particle.
* *
* @param index the index of the atom for which to set parameters * @param index the index of the atom for which to set parameters
* @param charge the particle's charge * @param charge the particle's charge
* @param molecularDipole the particle's molecular dipole (vector of size 3) * @param molecularDipole the particle's molecular dipole (vector of size 3)
* @param molecularQuadrupole the particle's molecular quadrupole (vector of size 9) * @param molecularQuadrupole the particle's molecular quadrupole (vector of size 9)
* @param axisType the particle's axis type ( ZThenX, Bisector ) * @param axisType the particle's axis type
* @param multipoleAtomZ index of first atom used in constructing lab<->molecular frames * @param multipoleAtomZ index of first atom used in constructing lab<->molecular frames
* @param multipoleAtomX index of second atom used in constructing lab<->molecular frames * @param multipoleAtomX index of second atom used in constructing lab<->molecular frames
* @param multipoleAtomY index of second atom used in constructing lab<->molecular frames * @param multipoleAtomY index of second atom used in constructing lab<->molecular frames
...@@ -237,84 +229,74 @@ public: ...@@ -237,84 +229,74 @@ public:
/** /**
* Set the CovalentMap for an atom * Set the CovalentMap for an atom
* *
* @param index the index of the atom for which to set parameters * @param index the index of the atom for which to set parameters
* @param typeId CovalentTypes type * @param typeId CovalentTypes type
* @param covalentAtoms vector of covalent atoms associated w/ the specfied CovalentType * @param covalentAtoms vector of covalent atoms associated w/ the specfied CovalentType
*/ */
void setCovalentMap(int index, CovalentType typeId, const std::vector<int>& covalentAtoms ); void setCovalentMap(int index, CovalentType typeId, const std::vector<int>& covalentAtoms);
/** /**
* Get the CovalentMap for an atom * Get the CovalentMap for an atom
* *
* @param index the index of the atom for which to set parameters * @param index the index of the atom for which to set parameters
* @param typeId CovalentTypes type * @param typeId CovalentTypes type
* @param covalentAtoms output vector of covalent atoms associated w/ the specfied CovalentType * @param covalentAtoms output vector of covalent atoms associated w/ the specfied CovalentType
*/ */
void getCovalentMap(int index, CovalentType typeId, std::vector<int>& covalentAtoms ) const; void getCovalentMap(int index, CovalentType typeId, std::vector<int>& covalentAtoms) const;
/** /**
* Get the CovalentMap for an atom * Get the CovalentMap for an atom
* *
* @param index the index of the atom for which to set parameters * @param index the index of the atom for which to set parameters
* @param covalentLists output vector of covalent lists of atoms * @param covalentLists output vector of covalent lists of atoms
*/ */
void getCovalentMaps(int index, std::vector < std::vector<int> >& covalentLists ) const; void getCovalentMaps(int index, std::vector < std::vector<int> >& covalentLists) const;
/**
* Get the iteration method to be used for calculating the mutual induced dipoles
*
* @return iteration method to be used for calculating the mutual induced dipole
*/
//MutualInducedIterationMethod getMutualInducedIterationMethod( void ) const;
/**
* Set the iteration method to be used for calculating the mutual induced dipoles
*
* @param iteration method to be used for calculating the mutual induced dipole
*/
//void setMutualInducedIterationMethod( MutualInducedIterationMethod inputMutualInducedIterationMethod );
/** /**
* Get the max number of iterations to be used in calculating the mutual induced dipoles * Get the max number of iterations to be used in calculating the mutual induced dipoles
* *
* @return max number of iterations * @return max number of iterations
*/ */
int getMutualInducedMaxIterations( void ) const; int getMutualInducedMaxIterations(void) const;
/** /**
* Set the max number of iterations to be used in calculating the mutual induced dipoles * Set the max number of iterations to be used in calculating the mutual induced dipoles
* *
* @param max number of iterations * @param max number of iterations
*/ */
void setMutualInducedMaxIterations( int inputMutualInducedMaxIterations ); void setMutualInducedMaxIterations(int inputMutualInducedMaxIterations);
/** /**
* Get the target epsilon to be used to test for convergence of iterative method used in calculating the mutual induced dipoles * Get the target epsilon to be used to test for convergence of iterative method used in calculating the mutual induced dipoles
* *
* @return target epsilon * @return target epsilon
*/ */
double getMutualInducedTargetEpsilon( void ) const; double getMutualInducedTargetEpsilon(void) const;
/** /**
* Set the target epsilon to be used to test for convergence of iterative method used in calculating the mutual induced dipoles * Set the target epsilon to be used to test for convergence of iterative method used in calculating the mutual induced dipoles
* *
* @param target epsilon * @param target epsilon
*/ */
void setMutualInducedTargetEpsilon( double inputMutualInducedTargetEpsilon ); void setMutualInducedTargetEpsilon(double inputMutualInducedTargetEpsilon);
/** /**
* Get the error tolerance for Ewald summation. This corresponds to the fractional error in the forces * Get the error tolerance for Ewald summation. This corresponds to the fractional error in the forces
* which is acceptable. This value is used to select the reciprocal space cutoff and separation * which is acceptable. This value is used to select the grid dimensions and separation (alpha)
* parameter so that the average error level will be less than the tolerance. There is not a * parameter so that the average error level will be less than the tolerance. There is not a
* rigorous guarantee that all forces on all atoms will be less than the tolerance, however. * rigorous guarantee that all forces on all atoms will be less than the tolerance, however.
*
* This can be overridden by explicitly setting an alpha parameter and grid dimensions to use.
*/ */
double getEwaldErrorTolerance() const; double getEwaldErrorTolerance() const;
/** /**
* Get the error tolerance for Ewald summation. This corresponds to the fractional error in the forces * Get the error tolerance for Ewald summation. This corresponds to the fractional error in the forces
* which is acceptable. This value is used to select the reciprocal space cutoff and separation * which is acceptable. This value is used to select the grid dimensions and separation (alpha)
* parameter so that the average error level will be less than the tolerance. There is not a * parameter so that the average error level will be less than the tolerance. There is not a
* rigorous guarantee that all forces on all atoms will be less than the tolerance, however. * rigorous guarantee that all forces on all atoms will be less than the tolerance, however.
*
* This can be overridden by explicitly setting an alpha parameter and grid dimensions to use.
*/ */
void setEwaldErrorTolerance(double tol); void setEwaldErrorTolerance(double tol);
...@@ -323,44 +305,46 @@ public: ...@@ -323,44 +305,46 @@ public:
* *
* @param inputGrid input grid points over which the potential is to be evaluated * @param inputGrid input grid points over which the potential is to be evaluated
* @param context context * @param context context
* @param outputElectrostaticPotential output potential * @param outputElectrostaticPotential output potential
*/ */
void getElectrostaticPotential( const std::vector< Vec3 >& inputGrid, void getElectrostaticPotential(const std::vector< Vec3 >& inputGrid,
Context& context, std::vector< double >& outputElectrostaticPotential ); Context& context, std::vector< double >& outputElectrostaticPotential);
/** /**
* Get the system multipole moments * Get the system multipole moments.
*
* This method is most useful for non-periodic systems. When called for a periodic system, only the
* <i>lowest nonvanishing moment</i> has a well defined value. This means that if the system has a net
* nonzero charge, the dipole and quadrupole moments are not well defined and should be ignored. If the
* net charge is zero, the dipole moment is well defined (and really represents a dipole density), but
* the quadrupole moment is still undefined and should be ignored.
* *
* @param origin origin
* @param context context * @param context context
* @param outputMultipoleMonents (charge, * @param outputMultipoleMonents (charge,
dipole_x, dipole_y, dipole_z, dipole_x, dipole_y, dipole_z,
quadrupole_xx, quadrupole_xy, quadrupole_xz, quadrupole_xx, quadrupole_xy, quadrupole_xz,
quadrupole_yx, quadrupole_yy, quadrupole_yz, quadrupole_yx, quadrupole_yy, quadrupole_yz,
quadrupole_zx, quadrupole_zy, quadrupole_zz ) quadrupole_zx, quadrupole_zy, quadrupole_zz)
*/ */
void getSystemMultipoleMoments( const Vec3& origin, Context& context, std::vector< double >& outputMultipoleMonents ); void getSystemMultipoleMoments(Context& context, std::vector< double >& outputMultipoleMonents);
protected: protected:
ForceImpl* createImpl(); ForceImpl* createImpl();
private: private:
NonbondedMethod nonbondedMethod;
AmoebaNonbondedMethod nonbondedMethod; PolarizationType polarizationType;
AmoebaPolarizationType polarizationType;
double cutoffDistance; double cutoffDistance;
double aewald; double aewald;
int pmeBSplineOrder; int pmeBSplineOrder;
std::vector<int> pmeGridDimension; std::vector<int> pmeGridDimension;
MutualInducedIterationMethod mutualInducedIterationMethod;
int mutualInducedMaxIterations; int mutualInducedMaxIterations;
double mutualInducedTargetEpsilon; double mutualInducedTargetEpsilon;
double scalingDistanceCutoff; double scalingDistanceCutoff;
double electricConstant; double electricConstant;
double ewaldErrorTol; double ewaldErrorTol;
class MultipoleInfo; class MultipoleInfo;
std::vector<MultipoleInfo> multipoles; std::vector<MultipoleInfo> multipoles;
}; };
...@@ -379,24 +363,24 @@ public: ...@@ -379,24 +363,24 @@ public:
axisType = multipoleAtomZ = multipoleAtomX = multipoleAtomY = -1; axisType = multipoleAtomZ = multipoleAtomX = multipoleAtomY = -1;
charge = thole = dampingFactor = 0.0; charge = thole = dampingFactor = 0.0;
molecularDipole.resize( 3 ); molecularDipole.resize(3);
molecularQuadrupole.resize( 9 ); molecularQuadrupole.resize(9);
} }
MultipoleInfo( double charge, const std::vector<double>& inputMolecularDipole, const std::vector<double>& inputMolecularQuadrupole, MultipoleInfo(double charge, const std::vector<double>& inputMolecularDipole, const std::vector<double>& inputMolecularQuadrupole,
int axisType, int multipoleAtomZ, int multipoleAtomX, int multipoleAtomY, double thole, double dampingFactor, double polarity) : int axisType, int multipoleAtomZ, int multipoleAtomX, int multipoleAtomY, double thole, double dampingFactor, double polarity) :
charge(charge), axisType(axisType), multipoleAtomZ(multipoleAtomZ), multipoleAtomX(multipoleAtomX), multipoleAtomY(multipoleAtomY), charge(charge), axisType(axisType), multipoleAtomZ(multipoleAtomZ), multipoleAtomX(multipoleAtomX), multipoleAtomY(multipoleAtomY),
thole(thole), dampingFactor(dampingFactor), polarity(polarity) { thole(thole), dampingFactor(dampingFactor), polarity(polarity) {
covalentInfo.resize( CovalentEnd ); covalentInfo.resize(CovalentEnd);
molecularDipole.resize( 3 ); molecularDipole.resize(3);
molecularDipole[0] = inputMolecularDipole[0]; molecularDipole[0] = inputMolecularDipole[0];
molecularDipole[1] = inputMolecularDipole[1]; molecularDipole[1] = inputMolecularDipole[1];
molecularDipole[2] = inputMolecularDipole[2]; molecularDipole[2] = inputMolecularDipole[2];
molecularQuadrupole.resize( 9 ); molecularQuadrupole.resize(9);
molecularQuadrupole[0] = inputMolecularQuadrupole[0]; molecularQuadrupole[0] = inputMolecularQuadrupole[0];
molecularQuadrupole[1] = inputMolecularQuadrupole[1]; molecularQuadrupole[1] = inputMolecularQuadrupole[1];
molecularQuadrupole[2] = inputMolecularQuadrupole[2]; molecularQuadrupole[2] = inputMolecularQuadrupole[2];
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -39,9 +39,10 @@ ...@@ -39,9 +39,10 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements the Amoeba Out-of-plane bend interaction * This class implements the Amoeba out-of-plane bend interaction.
* To use it, create a OutOfPlaneBendForce object then call addOutOfPlaneBend() once for each outOfPlaneBend. After *
* a outOfPlaneBend has been added, you can modify its force field parameters by calling setOutOfPlaneBendParameters(). * To use it, create an OutOfPlaneBendForce object then call addOutOfPlaneBend() once for each outOfPlaneBend. After
* an out-of-plane bend has been added, you can modify its force field parameters by calling setOutOfPlaneBendParameters().
*/ */
class OPENMM_EXPORT AmoebaOutOfPlaneBendForce : public Force { class OPENMM_EXPORT AmoebaOutOfPlaneBendForce : public Force {
...@@ -49,12 +50,12 @@ class OPENMM_EXPORT AmoebaOutOfPlaneBendForce : public Force { ...@@ -49,12 +50,12 @@ class OPENMM_EXPORT AmoebaOutOfPlaneBendForce : public Force {
public: public:
/** /**
* Create a Amoeba OutOfPlaneBendForce. * Create an AmoebaOutOfPlaneBendForce.
*/ */
AmoebaOutOfPlaneBendForce(); AmoebaOutOfPlaneBendForce();
/** /**
* Get the number of outOfPlaneBend terms in the potential function * Get the number of out-of-plane bend terms in the potential function
*/ */
int getNumOutOfPlaneBends() const { int getNumOutOfPlaneBends() const {
return outOfPlaneBends.size(); return outOfPlaneBends.size();
...@@ -63,114 +64,101 @@ public: ...@@ -63,114 +64,101 @@ public:
/** /**
* Set the global cubic term * Set the global cubic term
* *
* @param cubicK the cubic harmonic force constant for the angle * @param cubicK the cubic force constant for the angle
*/ */
void setAmoebaGlobalOutOfPlaneBendCubic( double cubicK ); void setAmoebaGlobalOutOfPlaneBendCubic(double cubicK);
/** /**
* Get the global cubic term * Get the global cubic term
* *
* @return global cubicK term * @return global cubicK term
*/ */
double getAmoebaGlobalOutOfPlaneBendCubic( void ) const; double getAmoebaGlobalOutOfPlaneBendCubic(void) const;
/** /**
* Set the global cubic term * Set the global cubic term
* *
* @param quarticK the quartic harmonic force constant for the angle * @param quarticK the quartic force constant for the angle
*/ */
void setAmoebaGlobalOutOfPlaneBendQuartic( double quarticK ); void setAmoebaGlobalOutOfPlaneBendQuartic(double quarticK);
/** /**
* Get the global quartic term * Get the global quartic term
* *
* @return global quartic term * @return global quartic term
*/ */
double getAmoebaGlobalOutOfPlaneBendQuartic( void ) const; double getAmoebaGlobalOutOfPlaneBendQuartic(void) const;
/** /**
* Set the global pentic term * Set the global pentic term
* *
* @param penticK the pentic harmonic force constant for the angle * @param penticK the pentic force constant for the angle
*/ */
void setAmoebaGlobalOutOfPlaneBendPentic( double penticK ); void setAmoebaGlobalOutOfPlaneBendPentic(double penticK);
/** /**
* Get the global pentic term * Get the global pentic term
* *
* @return global penticK term * @return global penticK term
*/ */
double getAmoebaGlobalOutOfPlaneBendPentic( void ) const; double getAmoebaGlobalOutOfPlaneBendPentic(void) const;
/** /**
* Set the global sextic term * Set the global sextic term
* *
* @param sexticK the sextic harmonic force constant for the angle * @param sexticK the sextic force constant for the angle
*/ */
void setAmoebaGlobalOutOfPlaneBendSextic( double sexticK ); void setAmoebaGlobalOutOfPlaneBendSextic(double sexticK);
/** /**
* Get the global sextic term * Get the global sextic term
* *
* @return global sexticK term * @return global sexticK term
*/ */
double getAmoebaGlobalOutOfPlaneBendSextic( void ) const; double getAmoebaGlobalOutOfPlaneBendSextic(void) const;
/** /**
* Add a outOfPlaneBend term to the force field. * Add an out-of-plane bend term to the force field.
* *
* @param particle1 the index of the first particle connected by the outOfPlaneBend * @param particle1 the index of the first particle connected by the outOfPlaneBend
* @param particle2 the index of the second particle connected by the outOfPlaneBend * @param particle2 the index of the second particle connected by the outOfPlaneBend
* @param particle3 the index of the third particle connected by the outOfPlaneBend * @param particle3 the index of the third particle connected by the outOfPlaneBend
* @param particle4 the index of the fourth particle connected by the outOfPlaneBend * @param particle4 the index of the fourth particle connected by the outOfPlaneBend
* @param k the force constant for the outOfPlaneBend * @param k the force constant for the out-of-plane bend
* @return the index of the outOfPlaneBend that was added * @return the index of the out-of-plane bend that was added
*/ */
int addOutOfPlaneBend(int particle1, int particle2, int particle3, int particle4, double k ); int addOutOfPlaneBend(int particle1, int particle2, int particle3, int particle4, double k);
/** /**
* Get the force field parameters for a outOfPlaneBend term. * Get the force field parameters for an out-of-plane bend term.
* *
* @param index the index of the outOfPlaneBend for which to get parameters * @param index the index of the outOfPlaneBend for which to get parameters
* @param particle1 the index of the first particle connected by the outOfPlaneBend * @param particle1 the index of the first particle connected by the outOfPlaneBend
* @param particle2 the index of the second particle connected by the outOfPlaneBend * @param particle2 the index of the second particle connected by the outOfPlaneBend
* @param particle3 the index of the third particle connected by the outOfPlaneBend * @param particle3 the index of the third particle connected by the outOfPlaneBend
* @param particle4 the index of the fourth particle connected by the outOfPlaneBend * @param particle4 the index of the fourth particle connected by the outOfPlaneBend
* @param k the force constant for the outOfPlaneBend * @param k the force constant for the out-of-plane bend
*/ */
void getOutOfPlaneBendParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, double& k ) const; void getOutOfPlaneBendParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, double& k) const;
/** /**
* Set the force field parameters for a outOfPlaneBend term. * Set the force field parameters for an out-of-plane bend term.
* *
* @param index the index of the outOfPlaneBend for which to set parameters * @param index the index of the outOfPlaneBend for which to set parameters
* @param particle1 the index of the first particle connected by the outOfPlaneBend * @param particle1 the index of the first particle connected by the outOfPlaneBend
* @param particle2 the index of the second particle connected by the outOfPlaneBend * @param particle2 the index of the second particle connected by the outOfPlaneBend
* @param particle3 the index of the third particle connected by the outOfPlaneBend * @param particle3 the index of the third particle connected by the outOfPlaneBend
* @param particle4 the index of the fourth particle connected by the outOfPlaneBend * @param particle4 the index of the fourth particle connected by the outOfPlaneBend
* @param k the force constant for the outOfPlaneBend * @param k the force constant for the out-of-plane bend
*/ */
void setOutOfPlaneBendParameters(int index, int particle1, int particle2, int particle3, int particle4, double k ); void setOutOfPlaneBendParameters(int index, int particle1, int particle2, int particle3, int particle4, double k);
protected: protected:
ForceImpl* createImpl(); ForceImpl* createImpl();
double _globalCubicK, _globalQuarticK, _globalPenticK, _globalSexticK; double _globalCubicK, _globalQuarticK, _globalPenticK, _globalSexticK;
private: private:
class OutOfPlaneBendInfo; class OutOfPlaneBendInfo;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<OutOfPlaneBendInfo> outOfPlaneBends; std::vector<OutOfPlaneBendInfo> outOfPlaneBends;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}; };
class AmoebaOutOfPlaneBendForce::OutOfPlaneBendInfo { class AmoebaOutOfPlaneBendForce::OutOfPlaneBendInfo {
...@@ -182,7 +170,7 @@ public: ...@@ -182,7 +170,7 @@ public:
k = 0.0; k = 0.0;
} }
OutOfPlaneBendInfo(int particle1, int particle2, int particle3, int particle4, OutOfPlaneBendInfo(int particle1, int particle2, int particle3, int particle4,
double k ) : double k) :
particle1(particle1), particle2(particle2), particle3(particle3), particle4(particle4), k(k) { particle1(particle1), particle2(particle2), particle3(particle3), particle4(particle4), k(k) {
} }
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -39,8 +39,9 @@ ...@@ -39,8 +39,9 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements the Amoeba pi-torsion interaction * This class implements the Amoeba pi-torsion interaction.
* To use it, create a PiTorsionForce object then call addPiTorsion() once for each torsion. After *
* To use it, create an AmoebaPiTorsionForce object then call addPiTorsion() once for each torsion. After
* a torsion has been added, you can modify its force field parameters by calling setPiTorsionParameters(). * a torsion has been added, you can modify its force field parameters by calling setPiTorsionParameters().
*/ */
...@@ -49,7 +50,7 @@ class OPENMM_EXPORT AmoebaPiTorsionForce : public Force { ...@@ -49,7 +50,7 @@ class OPENMM_EXPORT AmoebaPiTorsionForce : public Force {
public: public:
/** /**
* Create a Amoeba PiTorsionForce. * Create an AmoebaPiTorsionForce.
*/ */
AmoebaPiTorsionForce(); AmoebaPiTorsionForce();
...@@ -72,7 +73,7 @@ public: ...@@ -72,7 +73,7 @@ public:
* @param k the force constant for the torsion * @param k the force constant for the torsion
* @return the index of the torsion that was added * @return the index of the torsion that was added
*/ */
int addPiTorsion(int particle1, int particle2, int particle3, int particle4, int particle5, int particle6, double k ); int addPiTorsion(int particle1, int particle2, int particle3, int particle4, int particle5, int particle6, double k);
/** /**
* Get the force field parameters for a torsion term. * Get the force field parameters for a torsion term.
...@@ -86,7 +87,7 @@ public: ...@@ -86,7 +87,7 @@ public:
* @param particle6 the index of the sixth particle connected by the torsion * @param particle6 the index of the sixth particle connected by the torsion
* @param k the force constant for the torsion * @param k the force constant for the torsion
*/ */
void getPiTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, int& particle5, int& particle6, double& k ) const; void getPiTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, int& particle5, int& particle6, double& k) const;
/** /**
* Set the force field parameters for a pi torsion term. * Set the force field parameters for a pi torsion term.
...@@ -100,26 +101,13 @@ public: ...@@ -100,26 +101,13 @@ public:
* @param particle6 the index of the sixth particle connected by the torsion * @param particle6 the index of the sixth particle connected by the torsion
* @param k the force constant for the torsion * @param k the force constant for the torsion
*/ */
void setPiTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, int particle5, int particle6, double k ); void setPiTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, int particle5, int particle6, double k);
protected: protected:
ForceImpl* createImpl(); ForceImpl* createImpl();
private: private:
class PiTorsionInfo; class PiTorsionInfo;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<PiTorsionInfo> piTorsions; std::vector<PiTorsionInfo> piTorsions;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}; };
class AmoebaPiTorsionForce::PiTorsionInfo { class AmoebaPiTorsionForce::PiTorsionInfo {
...@@ -130,7 +118,7 @@ public: ...@@ -130,7 +118,7 @@ public:
particle1 = particle2 = particle3 = particle4 = particle5 = particle6 = -1; particle1 = particle2 = particle3 = particle4 = particle5 = particle6 = -1;
k = 0.0; k = 0.0;
} }
PiTorsionInfo(int particle1, int particle2, int particle3, int particle4, int particle5, int particle6, double k ) : PiTorsionInfo(int particle1, int particle2, int particle3, int particle4, int particle5, int particle6, double k) :
particle1(particle1), particle2(particle2), particle3(particle3), particle4(particle4), particle5(particle5), particle6(particle6), k(k) { particle1(particle1), particle2(particle2), particle3(particle3), particle4(particle4), particle5(particle5), particle6(particle6), k(k) {
} }
}; };
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -39,9 +39,10 @@ ...@@ -39,9 +39,10 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements the Amoeba stretch bend interaction * This class implements the Amoeba stretch-bend interaction.
* To use it, create a StretchBendForce object then call addStretchBend() once for each stretchBend. After *
* a stretchBend has been added, you can modify its force field parameters by calling setStretchBendParameters(). * To use it, create a StretchBendForce object then call addStretchBend() once for each stretch-bend. After
* a stretch-bend has been added, you can modify its force field parameters by calling setStretchBendParameters().
*/ */
class OPENMM_EXPORT AmoebaStretchBendForce : public Force { class OPENMM_EXPORT AmoebaStretchBendForce : public Force {
...@@ -49,58 +50,58 @@ class OPENMM_EXPORT AmoebaStretchBendForce : public Force { ...@@ -49,58 +50,58 @@ class OPENMM_EXPORT AmoebaStretchBendForce : public Force {
public: public:
/** /**
* Create a Amoeba StretchBendForce. * Create an AmoebaStretchBendForce.
*/ */
AmoebaStretchBendForce(); AmoebaStretchBendForce();
/** /**
* Get the number of stretchBend terms in the potential function * Get the number of stretch-bend terms in the potential function
*/ */
int getNumStretchBends() const { int getNumStretchBends() const {
return stretchBends.size(); return stretchBends.size();
} }
/** /**
* Add a stretchBend term to the force field. * Add a stretch-bend term to the force field.
* *
* @param particle1 the index of the first particle connected by the stretchBend * @param particle1 the index of the first particle connected by the stretch-bend
* @param particle2 the index of the second particle connected by the stretchBend * @param particle2 the index of the second particle connected by the stretch-bend
* @param particle3 the index of the third particle connected by the stretchBend * @param particle3 the index of the third particle connected by the stretch-bend
* @param lengthAB the equilibrium length of the stretchBend in bond ab [particle1, particle2], measured in nm * @param lengthAB the equilibrium length of the stretch-bend in bond ab [particle1, particle2], measured in nm
* @param lengthCB the equilibrium length of the stretchBend in bond cb [particle3, particle2], measured in nm * @param lengthCB the equilibrium length of the stretch-bend in bond cb [particle3, particle2], measured in nm
* @param angle the equilibrium angle in radians * @param angle the equilibrium angle in radians
* @param k the force constant for the stretchBend * @param k the force constant for the stretch-bend
* @return the index of the stretchBend that was added * @return the index of the stretch-bend that was added
*/ */
int addStretchBend(int particle1, int particle2, int particle3, double lengthAB, double lengthCB, double angle, int addStretchBend(int particle1, int particle2, int particle3, double lengthAB, double lengthCB, double angle,
double k ); double k );
/** /**
* Get the force field parameters for a stretchBend term. * Get the force field parameters for a stretch-bend term.
* *
* @param index the index of the stretchBend for which to get parameters * @param index the index of the stretch-bend for which to get parameters
* @param particle1 the index of the first particle connected by the stretchBend * @param particle1 the index of the first particle connected by the stretch-bend
* @param particle2 the index of the second particle connected by the stretchBend * @param particle2 the index of the second particle connected by the stretch-bend
* @param particle3 the index of the third particle connected by the stretchBend * @param particle3 the index of the third particle connected by the stretch-bend
* @param lengthAB the equilibrium length of the stretchBend in bond ab [particle1, particle2], measured in nm * @param lengthAB the equilibrium length of the stretch-bend in bond ab [particle1, particle2], measured in nm
* @param lengthCB the equilibrium length of the stretchBend in bond cb [particle3, particle2], measured in nm * @param lengthCB the equilibrium length of the stretch-bend in bond cb [particle3, particle2], measured in nm
* @param angle the equilibrium angle in radians * @param angle the equilibrium angle in radians
* @param k the force constant for the stretchBend * @param k the force constant for the stretch-bend
*/ */
void getStretchBendParameters(int index, int& particle1, int& particle2, int& particle3, void getStretchBendParameters(int index, int& particle1, int& particle2, int& particle3,
double& lengthAB, double& lengthCB, double& angle, double& k ) const; double& lengthAB, double& lengthCB, double& angle, double& k ) const;
/** /**
* Set the force field parameters for a stretchBend term. * Set the force field parameters for a stretch-bend term.
* *
* @param index the index of the stretchBend for which to set parameters * @param index the index of the stretch-bend for which to set parameters
* @param particle1 the index of the first particle connected by the stretchBend * @param particle1 the index of the first particle connected by the stretch-bend
* @param particle2 the index of the second particle connected by the stretchBend * @param particle2 the index of the second particle connected by the stretch-bend
* @param particle3 the index of the third particle connected by the stretchBend * @param particle3 the index of the third particle connected by the stretch-bend
* @param lengthAB the equilibrium length of the stretchBend in bond ab [particle1, particle2], measured in nm * @param lengthAB the equilibrium length of the stretch-bend in bond ab [particle1, particle2], measured in nm
* @param lengthCB the equilibrium length of the stretchBend in bond cb [particle3, particle2], measured in nm * @param lengthCB the equilibrium length of the stretch-bend in bond cb [particle3, particle2], measured in nm
* @param angle the equilibrium angle in radians * @param angle the equilibrium angle in radians
* @param k the force constant for the stretchBend * @param k the force constant for the stretch-bend
*/ */
void setStretchBendParameters(int index, int particle1, int particle2, int particle3, void setStretchBendParameters(int index, int particle1, int particle2, int particle3,
double lengthAB, double lengthCB, double angle, double k ); double lengthAB, double lengthCB, double angle, double k );
...@@ -108,21 +109,8 @@ public: ...@@ -108,21 +109,8 @@ public:
protected: protected:
ForceImpl* createImpl(); ForceImpl* createImpl();
private: private:
class StretchBendInfo; class StretchBendInfo;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<StretchBendInfo> stretchBends; std::vector<StretchBendInfo> stretchBends;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}; };
class AmoebaStretchBendForce::StretchBendInfo { class AmoebaStretchBendForce::StretchBendInfo {
......
#ifndef OPENMM_AMOEBA_TORSION_FORCE_H_
#define OPENMM_AMOEBA_TORSION_FORCE_H_
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* 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. *
* -------------------------------------------------------------------------- */
#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
#include "openmm/internal/windowsExport.h"
#include <vector>
#include <sstream>
namespace OpenMM {
/**
* This class implements an torsion interaction among four particles.
* To use it, create a TorsionForce object then call addTorsion() once for each angle. After
* a angle has been added, you can modify its force field parameters by calling setTorsionParameters().
*/
class OPENMM_EXPORT AmoebaTorsionForce : public Force {
public:
static const unsigned int ParametersPerTorsion = 2;
/**
* Create a Amoeba TorsionForce.
*/
AmoebaTorsionForce();
/**
* Get the number of torsion terms in the potential function
*/
int getNumTorsions() const {
return torsions.size();
}
/**
* Add a torsion term to the force field.
*
* @param particle1 the index of the first particle connected by the torsion
* @param particle2 the index of the second particle connected by the torsion
* @param particle3 the index of the third particle connected by the torsion
* @param particle4 the index of the fourth particle connected by the torsion
* @param torsion1 the vector of torsion params for first index (amplitude, phase, fold)
* @param torsion2 the vector of torsion params for second index (amplitude, phase, fold)
* @param torsion3 the vector of torsion params for third index (amplitude, phase, fold)
* @return the index of the torsion that was added
*/
int addTorsion(int particle1, int particle2, int particle3, int particle4,
const std::vector<double>& torsion1, const std::vector<double>& torsion2, const std::vector<double>& torsion3 );
/**
* Get the force field parameters for a torsion term.
*
* @param index the index of the torsion for which to get parameters
* @param particle1 the index of the first particle connected by the torsion
* @param particle2 the index of the second particle connected by the torsion
* @param particle3 the index of the third particle connected by the torsion
* @param particle4 the index of the fourth particle connected by the torsion
* @param torsion1 the vector of torsion params for first index (amplitude, phase, fold)
* @param torsion2 the vector of torsion params for second index (amplitude, phase, fold)
* @param torsion3 the vector of torsion params for third index (amplitude, phase, fold)
*/
void getTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4,
std::vector<double>& torsion1, std::vector<double>& torsion2, std::vector<double>& torsion3 ) const;
/**
* Set the force field parameters for a torsion term.
*
* @param index the index of the torsion for which to set parameters
* @param particle1 the index of the first particle connected by the torsion
* @param particle2 the index of the second particle connected by the torsion
* @param particle3 the index of the third particle connected by the torsion
* @param particle4 the index of the fourth particle connected by the torsion
* @param torsion1 the vector of torsion params for first index (amplitude, phase, fold)
* @param torsion2 the vector of torsion params for second index (amplitude, phase, fold)
* @param torsion3 the vector of torsion params for third index (amplitude, phase, fold)
*/
void setTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4,
const std::vector<double>& torsion1, const std::vector<double>& torsion2, const std::vector<double>& torsion3 );
protected:
ForceImpl* createImpl();
private:
class TorsionInfo;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<TorsionInfo> torsions;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
};
class AmoebaTorsionForce::TorsionInfo {
private:
// max number of torsion sets of parameters; in current amoebapro.prm max is 3
// but code goes up to 6
static const unsigned int maxTorsions = 3;
void _initialize() {
torsionParameters.resize( maxTorsions );
for( unsigned int ii = 0; ii < torsionParameters.size(); ii++ ){
torsionParameters[ii].resize( AmoebaTorsionForce::ParametersPerTorsion );
for( unsigned int jj = 0; jj < AmoebaTorsionForce::ParametersPerTorsion; jj++ ){
torsionParameters[ii][jj] = 0.0;
}
}
}
public:
int particle1, particle2, particle3, particle4;
std::vector< std::vector<double> > torsionParameters;
TorsionInfo() {
particle1 = particle2 = particle3 = particle4 = -1;
_initialize();
}
TorsionInfo(int particle1, int particle2, int particle3, int particle4, const std::vector<double>& torsion1, const std::vector<double>& torsion2, const std::vector<double>& torsion3 ) :
particle1(particle1), particle2(particle2), particle3(particle3), particle4(particle4) {
if( torsion1.size() != AmoebaTorsionForce::ParametersPerTorsion ){
std::stringstream buffer;
buffer << "TorsionInfo::TorsionInfo: torsion1 size(=" << torsion1.size() << ") is not " << AmoebaTorsionForce::ParametersPerTorsion;
throw OpenMMException( buffer.str() );
}
if( torsion2.size() != AmoebaTorsionForce::ParametersPerTorsion ){
std::stringstream buffer;
buffer << "TorsionInfo::TorsionInfo: torsion2 size(=" << torsion2.size() << ") is not " << AmoebaTorsionForce::ParametersPerTorsion;
throw OpenMMException( buffer.str() );
}
if( torsion3.size() != AmoebaTorsionForce::ParametersPerTorsion ){
std::stringstream buffer;
buffer << "TorsionInfo::TorsionInfo: torsion3 size(=" << torsion3.size() << ") is not " << AmoebaTorsionForce::ParametersPerTorsion;
throw OpenMMException( buffer.str() );
}
_initialize();
for( unsigned int ii = 0; ii < AmoebaTorsionForce::ParametersPerTorsion; ii++ ){
torsionParameters[0][ii] = torsion1[ii];
torsionParameters[1][ii] = torsion2[ii];
torsionParameters[2][ii] = torsion3[ii];
}
}
int copyTorsionParameter(int index, const std::vector<double>& torsionParameter ) {
if( torsionParameter.size() != AmoebaTorsionForce::ParametersPerTorsion ){
std::stringstream buffer;
buffer << "TorsionInfo::copyTorsionParameter: input torsionParameter size(=" << torsionParameter.size() << ") is not " << AmoebaTorsionForce::ParametersPerTorsion;
throw OpenMMException( buffer.str() );
}
if( index >= 0 && index < maxTorsions ){
for( unsigned int ii = 0; ii < AmoebaTorsionForce::ParametersPerTorsion; ii++ ){
torsionParameters[index][ii] = torsionParameter[ii];
}
} else {
std::stringstream buffer;
buffer << "TorsionInfo::copyTorsionParameter: input torsionParameter index(=" << index << ") is not in range [0," << maxTorsions << ")!";
throw OpenMMException( buffer.str() );
}
return 0;
}
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_TORSION_FORCE_H_*/
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -44,119 +44,105 @@ typedef std::vector< std::vector< std::vector<double> > > TorsionTorsionGrid; ...@@ -44,119 +44,105 @@ typedef std::vector< std::vector< std::vector<double> > > TorsionTorsionGrid;
typedef std::vector< std::vector< std::vector<float> > > TorsionTorsionGridFloat; typedef std::vector< std::vector< std::vector<float> > > TorsionTorsionGridFloat;
/** /**
* This class implements the Amoeba torsion-torsion interaction * This class implements the Amoeba torsion-torsion interaction.
* To use it, create a TorsionTorsionForce object then call addTorsionTorsion() once for each torsionTorsion. After *
* a torsionTorsion has been added, you can modify its force field parameters by calling setTorsionTorsionParameters(). * To use it, create an AmoebaTorsionTorsionForce object then call addTorsionTorsion() once for each torsion-torsion. After
* a torsion-torsion has been added, you can modify its force field parameters by calling setTorsionTorsionParameters().
*/ */
class OPENMM_EXPORT AmoebaTorsionTorsionForce : public Force { class OPENMM_EXPORT AmoebaTorsionTorsionForce : public Force {
public: public:
/** /**
* Create a Amoeba TorsionTorsionForce. * Create an AmoebaTorsionTorsionForce.
*/ */
AmoebaTorsionTorsionForce( void ); AmoebaTorsionTorsionForce(void);
/** /**
* Get the number of torsionTorsion terms in the potential function * Get the number of torsion-torsion terms in the potential function
*/ */
int getNumTorsionTorsions( void ) const { int getNumTorsionTorsions(void) const {
return torsionTorsions.size(); return torsionTorsions.size();
} }
/** /**
* Get the number of torsionTorsion grids * Get the number of torsion-torsion grids
*/ */
int getNumTorsionTorsionGrids( void ) const { int getNumTorsionTorsionGrids(void) const {
return torsionTorsionGrids.size(); return torsionTorsionGrids.size();
} }
/** /**
* Add a torsionTorsion term to the force field. * Add a torsion-torsion term to the force field.
* *
* @param particle1 the index of the first particle connected by the torsionTorsion * @param particle1 the index of the first particle connected by the torsion-torsion
* @param particle2 the index of the second particle connected by the torsionTorsion * @param particle2 the index of the second particle connected by the torsion-torsion
* @param particle3 the index of the third particle connected by the torsionTorsion * @param particle3 the index of the third particle connected by the torsion-torsion
* @param particle4 the index of the fourth particle connected by the torsionTorsion * @param particle4 the index of the fourth particle connected by the torsion-torsion
* @param particle5 the index of the fifth particle connected by the torsionTorsion * @param particle5 the index of the fifth particle connected by the torsion-torsion
* @param chiralCheckAtomIndex the index of the particle connected to particle3, but not particle2 or particle4 to be used in chirality check * @param chiralCheckAtomIndex the index of the particle connected to particle3, but not particle2 or particle4 to be used in chirality check
* @param gridIndex the index to the grid to be used * @param gridIndex the index to the grid to be used
* @return the index of the torsionTorsion that was added * @return the index of the torsion-torsion that was added
*/ */
int addTorsionTorsion(int particle1, int particle2, int particle3, int particle4, int particle5, int chiralCheckAtomIndex, int gridIndex ); int addTorsionTorsion(int particle1, int particle2, int particle3, int particle4, int particle5, int chiralCheckAtomIndex, int gridIndex);
/** /**
* Get the force field parameters for a torsionTorsion term. * Get the force field parameters for a torsion-torsion term.
* *
* @param index the index of the torsionTorsion for which to get parameters * @param index the index of the torsion-torsion for which to get parameters
* @param particle1 the index of the first particle connected by the torsionTorsion * @param particle1 the index of the first particle connected by the torsion-torsion
* @param particle2 the index of the second particle connected by the torsionTorsion * @param particle2 the index of the second particle connected by the torsion-torsion
* @param particle3 the index of the third particle connected by the torsionTorsion * @param particle3 the index of the third particle connected by the torsion-torsion
* @param particle4 the index of the fourth particle connected by the torsionTorsion * @param particle4 the index of the fourth particle connected by the torsion-torsion
* @param particle5 the index of the fifth particle connected by the torsionTorsion * @param particle5 the index of the fifth particle connected by the torsion-torsion
* @param chiralCheckAtomIndex the index of the particle connected to particle3, but not particle2 or particle4 to be used in chirality check * @param chiralCheckAtomIndex the index of the particle connected to particle3, but not particle2 or particle4 to be used in chirality check
* @param gridIndex the grid index * @param gridIndex the grid index
*/ */
void getTorsionTorsionParameters( int index, int& particle1, int& particle2, int& particle3, int& particle4, int& particle5, int& chiralCheckAtomIndex, int& gridIndex ) const; void getTorsionTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, int& particle5, int& chiralCheckAtomIndex, int& gridIndex) const;
/** /**
* Set the force field parameters for a torsionTorsion term. * Set the force field parameters for a torsion-torsion term.
* *
* @param index the index of the torsionTorsion for which to set parameters * @param index the index of the torsion-torsion for which to set parameters
* @param particle1 the index of the first particle connected by the torsionTorsion * @param particle1 the index of the first particle connected by the torsion-torsion
* @param particle2 the index of the second particle connected by the torsionTorsion * @param particle2 the index of the second particle connected by the torsion-torsion
* @param particle3 the index of the third particle connected by the torsionTorsion * @param particle3 the index of the third particle connected by the torsion-torsion
* @param particle4 the index of the fourth particle connected by the torsionTorsion * @param particle4 the index of the fourth particle connected by the torsion-torsion
* @param particle5 the index of the fifth particle connected by the torsionTorsion * @param particle5 the index of the fifth particle connected by the torsion-torsion
* @param chiralCheckAtomIndex the index of the particle connected to particle3, but not particle2 or particle4 to be used in chirality check * @param chiralCheckAtomIndex the index of the particle connected to particle3, but not particle2 or particle4 to be used in chirality check
* @param gridIndex the grid index * @param gridIndex the grid index
*/ */
void setTorsionTorsionParameters( int index, int particle1, int particle2, int particle3, int particle4, int particle5, int chiralCheckAtomIndex, int gridIndex ); void setTorsionTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, int particle5, int chiralCheckAtomIndex, int gridIndex);
/** /**
* Get the torsion-torsion grid at the specified index * Get the torsion-torsion grid at the specified index
* *
* @param gridIndex the grid index * @param gridIndex the grid index
* @return grid return grid reference * @return grid return grid reference
*/ */
//const TorsionTorsionGrid& getTorsionTorsionGrid( int index ) const; const std::vector<std::vector<std::vector<double> > >& getTorsionTorsionGrid(int index) const;
const std::vector< std::vector< std::vector<double> > >& getTorsionTorsionGrid( int index ) const;
/** /**
* Set the torsion-torsion grid at the specified index * Set the torsion-torsion grid at the specified index
* *
* @param index the index of the torsionTorsion for which to get parameters * @param index the index of the torsion-torsion for which to get parameters
* @param grid grid * @param grid grid
* grid[x][y][0] = x value * grid[x][y][0] = x value
* grid[x][y][1] = y value * grid[x][y][1] = y value
* grid[x][y][2] = function value * grid[x][y][2] = function value
* grid[x][y][3] = dfdx value * grid[x][y][3] = dfdx value
* grid[x][y][4] = dfdy value * grid[x][y][4] = dfdy value
* grid[x][y][5] = dfd(xy) value * grid[x][y][5] = dfd(xy) value
*/ */
//void setTorsionTorsionGrid(int index, TorsionTorsionGrid& grid ); void setTorsionTorsionGrid(int index, const std::vector<std::vector<std::vector<double> > >& grid);
void setTorsionTorsionGrid(int index, const std::vector< std::vector< std::vector<double> > >& grid );
protected: protected:
ForceImpl* createImpl(); ForceImpl* createImpl();
private: private:
class TorsionTorsionInfo; class TorsionTorsionInfo;
class TorsionTorsionGridInfo; class TorsionTorsionGridInfo;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<TorsionTorsionInfo> torsionTorsions; std::vector<TorsionTorsionInfo> torsionTorsions;
std::vector<TorsionTorsionGridInfo> torsionTorsionGrids; std::vector<TorsionTorsionGridInfo> torsionTorsionGrids;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}; };
class AmoebaTorsionTorsionForce::TorsionTorsionInfo { class AmoebaTorsionTorsionForce::TorsionTorsionInfo {
...@@ -170,10 +156,10 @@ public: ...@@ -170,10 +156,10 @@ public:
particle1 = particle2 = particle3 = particle4 = particle5 = chiralCheckAtomIndex = -1; particle1 = particle2 = particle3 = particle4 = particle5 = chiralCheckAtomIndex = -1;
gridIndex = 0; gridIndex = 0;
} }
TorsionTorsionInfo(int particle1, int particle2, int particle3, int particle4, int particle5, int chiralCheckAtomIndex, int gridIndex ) : TorsionTorsionInfo(int particle1, int particle2, int particle3, int particle4, int particle5, int chiralCheckAtomIndex, int gridIndex) :
particle1(particle1), particle2(particle2), particle3(particle3), particle1(particle1), particle2(particle2), particle3(particle3),
particle4(particle4), particle5(particle5), gridIndex(gridIndex), chiralCheckAtomIndex(chiralCheckAtomIndex) { particle4(particle4), particle5(particle5), gridIndex(gridIndex), chiralCheckAtomIndex(chiralCheckAtomIndex) {
} }
}; };
...@@ -181,37 +167,28 @@ class AmoebaTorsionTorsionForce::TorsionTorsionGridInfo { ...@@ -181,37 +167,28 @@ class AmoebaTorsionTorsionForce::TorsionTorsionGridInfo {
public: public:
TorsionTorsionGridInfo( ) { TorsionTorsionGridInfo() {
_size[0] = _size[1] = 0; _size[0] = _size[1] = 0;
_startValues[0] = _startValues[1] = 0.0; _startValues[0] = _startValues[1] = 0.0;
_spacing[0] = _spacing[1] = 1.0; _spacing[0] = _spacing[1] = 1.0;
} }
TorsionTorsionGridInfo( const TorsionTorsionGrid& grid ) { TorsionTorsionGridInfo(const TorsionTorsionGrid& grid) {
_grid.resize( grid.size() ); _grid.resize(grid.size());
for( unsigned int kk = 0; kk < grid.size(); kk++ ){ for(unsigned int kk = 0; kk < grid.size(); kk++){
_grid[kk].resize( grid[kk].size() ); _grid[kk].resize(grid[kk].size());
for( unsigned int jj = 0; jj < grid[kk].size(); jj++ ){ for(unsigned int jj = 0; jj < grid[kk].size(); jj++){
_grid[kk][jj].resize( grid[kk][jj].size() ); _grid[kk][jj].resize(grid[kk][jj].size());
for( unsigned int ii = 0; ii < grid[kk][jj].size(); ii++ ){ for(unsigned int ii = 0; ii < grid[kk][jj].size(); ii++){
_grid[kk][jj][ii] = grid[kk][jj][ii]; _grid[kk][jj][ii] = grid[kk][jj][ii];
} }
} }
}
/*
for( unsigned int kk = 0; kk < grid.size(); kk++ ){
for( unsigned int jj = 0; jj < grid[kk].size(); jj++ ){
fprintf( stderr, "xGrid %4d %4d %12.3f %12.3f %15.7e %15.7e\n", kk, jj, grid[kk][jj][0], grid[kk][jj][1], grid[kk][jj][2], grid[kk][jj][2]/4.184 );
}
} }
*/
_startValues[0] = _grid[0][0][0]; _startValues[0] = _grid[0][0][0];
_startValues[1] = _grid[0][0][1]; _startValues[1] = _grid[0][0][1];
//_spacing[0] = fabs( _grid[1][0][0] - _grid[0][0][0] );
//_spacing[1] = fabs( _grid[0][1][1] - _grid[0][0][1] );
_spacing[0] = static_cast<double>(_grid.size()-1)/360.0; _spacing[0] = static_cast<double>(_grid.size()-1)/360.0;
_spacing[1] = static_cast<double>(grid.size()-1)/360.0; _spacing[1] = static_cast<double>(grid.size()-1)/360.0;
...@@ -220,16 +197,16 @@ public: ...@@ -220,16 +197,16 @@ public:
} }
const TorsionTorsionGrid& getTorsionTorsionGrid( void ) const { const TorsionTorsionGrid& getTorsionTorsionGrid(void) const {
return _grid; return _grid;
} }
int getDimensionSize( int index ) const { int getDimensionSize(int index) const {
return _size[index]; return _size[index];
} }
double getStartValue( int index ) const { double getStartValue(int index) const {
return _startValues[index]; return _startValues[index];
} }
double getSpacing( int index ) const { double getSpacing(int index) const {
return _spacing[index]; return _spacing[index];
} }
......
#ifndef OPENMM_AMOEBA_UREY_BRADLEY_FORCE_H_
#define OPENMM_AMOEBA_UREY_BRADLEY_FORCE_H_
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* 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. *
* -------------------------------------------------------------------------- */
#include "openmm/Force.h"
#include "openmm/Vec3.h"
#include "openmm/internal/windowsExport.h"
#include <map>
#include <vector>
namespace OpenMM {
/**
* This class implements an interaction between pairs of particles that varies harmonically with the distance
* between them. To use it, create a AmoebaUreyBradleyForce object then call addUreyBradley() once for each bond. After
* a bond has been added, you can modify its force field parameters by calling setUreyBradleyParameters().
*/
class OPENMM_EXPORT AmoebaUreyBradleyForce : public Force {
public:
/**
* Create a Amoeba UreyBradleyForce.
*/
AmoebaUreyBradleyForce();
/**
* Get the number of UB terms in the potential function
*/
int getNumInteractions() const {
return bonds.size();
}
/**
* Set the global cubic term
*
* @param cubicK the cubic force constant
*/
void setAmoebaGlobalUreyBradleyCubic( double cubicK );
/**
* Get the global cubic term
*
* @return global cubicK term
*/
double getAmoebaGlobalUreyBradleyCubic( void ) const;
/**
* Set the global cubic term
*
* @param quarticK the quartic force constant
*/
void setAmoebaGlobalUreyBradleyQuartic( double quarticK );
/**
* Get the global quartic term
*
* @return global quartic term
*/
double getAmoebaGlobalUreyBradleyQuartic( void ) const;
/**
* Add a UB term to the force field.
*
* @param particle1 the index of the first particle
* @param particle2 the index of the second particle
* @param length the equilibrium length, measured in nm
* @param k the quadratic harmonic force constant
* @return the index of the bond that was added
*/
int addUreyBradley(int particle1, int particle2, double length, double quadraticK );
/**
* Get the force field parameters for a bond term.
*
* @param index the index of the ixn for which to get parameters
* @param particle1 the index of the first particle
* @param particle2 the index of the second particle
* @param length the equilibrium distance, measured in nm
* @param quadratic k the quadratic harmonic force constant
*/
void getUreyBradleyParameters(int index, int& particle1, int& particle2, double& length, double& quadraticK ) const;
/**
* Set the force field parameters for a UB term.
*
* @param index the index of the ixn for which to set parameters
* @param particle1 the index of the first particle
* @param particle2 the index of the second particle
* @param length the equilibrium distance, measured in nm
* @param k the quadratic harmonic force constant for the bond
*/
void setUreyBradleyParameters(int index, int particle1, int particle2, double length, double quadraticK );
protected:
double _globalQuarticK, _globalCubicK;
ForceImpl* createImpl();
private:
class UreyBradleyInfo;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<UreyBradleyInfo> bonds;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
};
class AmoebaUreyBradleyForce::UreyBradleyInfo {
public:
int particle1, particle2;
double length, quadraticK;
UreyBradleyInfo() {
particle1 = particle2 = -1;
length = quadraticK = 0.0;
}
UreyBradleyInfo(int particle1, int particle2, double length, double quadraticK ) :
particle1(particle1), particle2(particle2), length(length), quadraticK(quadraticK) {
}
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_UREY_BRADLEY_FORCE_H_*/
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -39,17 +39,38 @@ ...@@ -39,17 +39,38 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements an interaction between pairs of particles that varies harmonically with the distance * This class implements a buffered 14-7 potential used to model van der Waals forces.
* between them. To use it, create a VdwForce object then call addAngle() once for each angle. After *
* a angle has been added, you can modify its force field parameters by calling setAngleParameters(). * To use it, create an AmoebaVdwForce object then call addParticle() once for each particle. After
* a particle has been added, you can modify its force field parameters by calling setParticleParameters().
*
* A unique feature of this class is that the interaction site for a particle does not need to be
* exactly at the particle's location. Instead, it can be placed a fraction of the distance from that
* particle to another one. This is typically done for hydrogens to place the interaction site slightly
* closer to the parent atom. The fraction is known as the "reduction factor", since it reduces the distance
* from the parent atom to the interaction site.
*/ */
class OPENMM_EXPORT AmoebaVdwForce : public Force { class OPENMM_EXPORT AmoebaVdwForce : public Force {
public: public:
/**
* This is an enumeration of the different methods that may be used for handling long range nonbonded forces.
*/
enum NonbondedMethod {
/**
* No cutoff is applied to nonbonded interactions. The full set of N^2 interactions is computed exactly.
* This necessarily means that periodic boundary conditions cannot be used. This is the default.
*/
NoCutoff = 0,
/**
* Periodic boundary conditions are used, so that each particle interacts only with the nearest periodic copy of
* each other particle. Interactions beyond the cutoff distance are ignored.
*/
CutoffPeriodic = 1,
};
/** /**
* Create a Amoeba VdwForce. * Create an Amoeba VdwForce.
*/ */
AmoebaVdwForce(); AmoebaVdwForce();
...@@ -64,73 +85,69 @@ public: ...@@ -64,73 +85,69 @@ public:
* Set the force field parameters for a vdw particle. * Set the force field parameters for a vdw particle.
* *
* @param particleIndex the particle index * @param particleIndex the particle index
* @param ivIndex the iv index * @param parentIndex the index of the parent particle
* @param classIndex the class index into the sig-eps table
* @param sigma vdw sigma * @param sigma vdw sigma
* @param epsilon vdw epsilon * @param epsilon vdw epsilon
* @param reductionFactor the reduction factor * @param reductionFactor the fraction of the distance along the line from the parent particle to this particle
* at which the interaction site should be placed
*/ */
void setParticleParameters(int particleIndex, int ivIndex, int classIndex, void setParticleParameters(int particleIndex, int parentIndex, double sigma, double epsilon, double reductionFactor);
double sigma, double epsilon, double reductionFactor );
/** /**
* Get the force field parameters for a vdw particle. * Get the force field parameters for a vdw particle.
* *
* @param particleIndex the particle index * @param particleIndex the particle index
* @param ivIndex the iv index * @param parentIndex the index of the parent particle
* @param classIndex the class index into the sig-eps table
* @param sigma vdw sigma * @param sigma vdw sigma
* @param epsilon vdw epsilon * @param epsilon vdw epsilon
* @param reductionFactor the reduction factor * @param reductionFactor the fraction of the distance along the line from the parent particle to this particle
* at which the interaction site should be placed
*/ */
void getParticleParameters(int particleIndex, int& ivIndex, int& classIndex, void getParticleParameters(int particleIndex, int& parentIndex, double& sigma, double& epsilon, double& reductionFactor) const;
double& sigma, double& epsilon, double& reductionFactor ) const;
/** /**
* Set the force field parameters for a vdw particle. * Add the force field parameters for a vdw particle.
* *
* @param particleIndex the particle index * @param parentIndex the index of the parent particle
* @param ivIndex the iv index
* @param classIndex the class index into the sig-eps table
* @param sigma vdw sigma * @param sigma vdw sigma
* @param epsilon vdw epsilon * @param epsilon vdw epsilon
* @param reductionFactor the reduction factor * @param reductionFactor the fraction of the distance along the line from the parent particle to this particle
* at which the interaction site should be placed
* @return index of added particle * @return index of added particle
*/ */
int addParticle(int ivIndex, int classIndex, int addParticle(int parentIndex, double sigma, double epsilon, double reductionFactor);
double sigma, double epsilon, double reductionFactor );
/** /**
* Set sigma combining rule * Set sigma combining rule
* *
* @param sigmaCombiningRule sigma combining rule: 'ARITHMETIC', 'GEOMETRIC'. 'CUBIC-MEAN' * @param sigmaCombiningRule sigma combining rule: 'ARITHMETIC', 'GEOMETRIC'. 'CUBIC-MEAN'
*/ */
void setSigmaCombiningRule( const std::string& sigmaCombiningRule ); void setSigmaCombiningRule(const std::string& sigmaCombiningRule);
/** /**
* Get sigma combining rule * Get sigma combining rule
* *
* @return sigmaCombiningRule sigma combining rule: 'ARITHMETIC', 'GEOMETRIC'. 'CUBIC-MEAN' * @return sigmaCombiningRule sigma combining rule: 'ARITHMETIC', 'GEOMETRIC'. 'CUBIC-MEAN'
*/ */
const std::string& getSigmaCombiningRule( void ) const; const std::string& getSigmaCombiningRule(void) const;
/** /**
* Set epsilon combining rule * Set epsilon combining rule
* *
* @param epsilonCombiningRule epsilon combining rule: 'ARITHMETIC', 'GEOMETRIC'. 'HARMONIC', 'HHG' * @param epsilonCombiningRule epsilon combining rule: 'ARITHMETIC', 'GEOMETRIC'. 'HARMONIC', 'HHG'
*/ */
void setEpsilonCombiningRule( const std::string& epsilonCombiningRule ); void setEpsilonCombiningRule(const std::string& epsilonCombiningRule);
/** /**
* Get epsilon combining rule * Get epsilon combining rule
* *
* @return epsilonCombiningRule epsilon combining rule: 'ARITHMETIC', 'GEOMETRIC'. 'HARMONIC', 'HHG' * @return epsilonCombiningRule epsilon combining rule: 'ARITHMETIC', 'GEOMETRIC'. 'HARMONIC', 'HHG'
*/ */
const std::string& getEpsilonCombiningRule( void ) const; const std::string& getEpsilonCombiningRule(void) const;
/** /**
* LPW: Get whether to add a contribution to the energy that approximately represents the effect of VdW * Get whether to add a contribution to the energy that approximately represents the effect of VdW
* interactions beyond the cutoff distance. The energy depends on the volume of the periodic box, and is only * interactions beyond the cutoff distance. The energy depends on the volume of the periodic box, and is only
* applicable when periodic boundary conditions are used. When running simulations at constant pressure, adding * applicable when periodic boundary conditions are used. When running simulations at constant pressure, adding
* this contribution can improve the quality of results. * this contribution can improve the quality of results.
...@@ -153,67 +170,44 @@ public: ...@@ -153,67 +170,44 @@ public:
* Set exclusions for specified particle * Set exclusions for specified particle
* *
* @param particleIndex particle index * @param particleIndex particle index
* @param exclusions output vector of exclusions * @param exclusions vector of exclusions
*/ */
void setParticleExclusions( int particleIndex, const std::vector< int >& exclusions ); void setParticleExclusions(int particleIndex, const std::vector<int>& exclusions);
/** /**
* Get exclusions for specified particle * Get exclusions for specified particle
* *
* @param particleIndex particle index * @param particleIndex particle index
* @param exclusions output vector of exclusions * @param exclusions vector of exclusions
*/ */
void getParticleExclusions( int particleIndex, std::vector< int >& exclusions ) const; void getParticleExclusions(int particleIndex, std::vector<int>& exclusions) const;
/** /**
* Set cutoff * Set the cutoff distance.
*
* @param cutoff cutoff
*/ */
void setCutoff( double cutoff ); void setCutoff(double cutoff);
/** /**
* Get cutoff * Get the cutoff distance.
*
* @return cutoff
*/ */
double getCutoff( void ) const; double getCutoff(void) const;
/** /**
* Set flag for using neighbor list for vdw ixn * Get the method used for handling long range nonbonded interactions.
*
* @param neighboristFlag neighbor list flag
*/ */
void setUseNeighborList( int neighborListFlag ); NonbondedMethod getNonbondedMethod() const;
/** /**
* Get neighbor list flag for vdw ixn * Set the method used for handling long range nonbonded interactions.
*
* @return neighbor list flag
*/ */
int getUseNeighborList( void ) const; void setNonbondedMethod(NonbondedMethod method);
/**
* Set flag for employing periodic boundary conditions
*
* @param pbcFlag if nonozero, use periodic boundary conditions
*/
void setPBC( int pbcFlag );
/**
* Get periodic boundary conditions flag
*
* @return periodic boundary conditions flag (nonzero -> use PBC)
*/
int getPBC( void ) const;
protected: protected:
ForceImpl* createImpl(); ForceImpl* createImpl();
private: private:
class VdwInfo; class VdwInfo;
int usePBC; NonbondedMethod nonbondedMethod;
int useNeighborList;
double cutoff; double cutoff;
bool useDispersionCorrection; bool useDispersionCorrection;
...@@ -221,34 +215,22 @@ private: ...@@ -221,34 +215,22 @@ private:
std::string epsilonCombiningRule; std::string epsilonCombiningRule;
std::vector< std::vector<int> > exclusions; std::vector< std::vector<int> > exclusions;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<VdwInfo> parameters; std::vector<VdwInfo> parameters;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
std::vector< std::vector< std::vector<double> > > sigEpsTable; std::vector< std::vector< std::vector<double> > > sigEpsTable;
}; };
class AmoebaVdwForce::VdwInfo { class AmoebaVdwForce::VdwInfo {
public: public:
int ivIndex, classIndex; int parentIndex;
double reductionFactor, sigma, epsilon, cutoff; double reductionFactor, sigma, epsilon, cutoff;
VdwInfo() { VdwInfo() {
ivIndex = classIndex = -1; parentIndex = -1;
reductionFactor = 0.0; reductionFactor = 0.0;
sigma = 1.0; sigma = 1.0;
epsilon = 0.0; epsilon = 0.0;
} }
VdwInfo(int ivIndex, int classIndex, double sigma, double epsilon, double reductionFactor ) : VdwInfo(int parentIndex, double sigma, double epsilon, double reductionFactor) :
ivIndex(ivIndex), classIndex(classIndex), sigma(sigma), epsilon(epsilon), reductionFactor(reductionFactor) { parentIndex(parentIndex), sigma(sigma), epsilon(epsilon), reductionFactor(reductionFactor) {
} }
}; };
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: * * Authors: Mark Friedrichs, Peter Eastman *
* Contributors: * * Contributors: *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
...@@ -39,9 +39,11 @@ ...@@ -39,9 +39,11 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements an interaction between pairs of particles that varies harmonically with the distance * This class implements a nonbonded interaction between pairs of particles typically used along with
* between them. To use it, create a WcaDispersionForce object then call addAngle() once for each angle. After * AmoebaGeneralizedKirkwoodForce as part of an implicit solvent model.
* a angle has been added, you can modify its force field parameters by calling setAngleParameters(). *
* To use it, create an AmoebaWcaDispersionForce object then call addParticle() once for each particle. After
* a particle has been added, you can modify its force field parameters by calling setParticleParameters().
*/ */
class OPENMM_EXPORT AmoebaWcaDispersionForce : public Force { class OPENMM_EXPORT AmoebaWcaDispersionForce : public Force {
...@@ -49,7 +51,7 @@ class OPENMM_EXPORT AmoebaWcaDispersionForce : public Force { ...@@ -49,7 +51,7 @@ class OPENMM_EXPORT AmoebaWcaDispersionForce : public Force {
public: public:
/** /**
* Create a Amoeba WcaDispersionForce. * Create an AmoebaWcaDispersionForce.
*/ */
AmoebaWcaDispersionForce(); AmoebaWcaDispersionForce();
...@@ -61,16 +63,16 @@ public: ...@@ -61,16 +63,16 @@ public:
} }
/** /**
* Set the force field parameters for a wca dispersion particle. * Set the force field parameters for a WCA dispersion particle.
* *
* @param particleIndex the particle index * @param particleIndex the particle index
* @param radius radius * @param radius radius
* @param epsilon epsilon * @param epsilon epsilon
*/ */
void setParticleParameters(int particleIndex, double radius, double epsilon ); void setParticleParameters(int particleIndex, double radius, double epsilon);
/** /**
* Get the force field parameters for a wca dispersion particle. * Get the force field parameters for a WCA dispersion particle.
* *
* @param particleIndex the particle index * @param particleIndex the particle index
* @param radius radius * @param radius radius
...@@ -79,42 +81,40 @@ public: ...@@ -79,42 +81,40 @@ public:
void getParticleParameters(int particleIndex, double& radius, double& epsilon) const; void getParticleParameters(int particleIndex, double& radius, double& epsilon) const;
/** /**
* Set the force field parameters for a wca dispersion particle. * Set the force field parameters for a WCA dispersion particle.
* *
* @param radius radius * @param radius radius
* @param epsilon epsilon * @param epsilon epsilon
* @return index of added particle * @return index of added particle
*/ */
int addParticle( double radius, double epsilon ); int addParticle(double radius, double epsilon);
/* /*
* Constants * Constants
*/ */
double getEpso( void ) const; double getEpso() const;
double getEpsh( void ) const; double getEpsh() const;
double getRmino( void ) const; double getRmino() const;
double getRminh( void ) const; double getRminh() const;
double getAwater( void ) const; double getAwater() const;
double getShctd( void ) const; double getShctd() const;
double getDispoff( void ) const; double getDispoff() const;
double getSlevy( void ) const; double getSlevy() const;
void setEpso( double inputValue ); void setEpso(double inputValue);
void setEpsh( double inputValue ); void setEpsh(double inputValue);
void setRmino( double inputValue ); void setRmino(double inputValue);
void setRminh( double inputValue ); void setRminh(double inputValue);
void setAwater( double inputValue ); void setAwater(double inputValue);
void setShctd( double inputValue ); void setShctd(double inputValue);
void setDispoff( double inputValue ); void setDispoff(double inputValue);
void setSlevy( double inputValue ); void setSlevy(double inputValue);
protected: protected:
ForceImpl* createImpl(); ForceImpl* createImpl();
private: private:
class WcaDispersionInfo; class WcaDispersionInfo;
double epso; double epso;
double epsh; double epsh;
double rmino; double rmino;
...@@ -123,19 +123,7 @@ private: ...@@ -123,19 +123,7 @@ private:
double slevy; double slevy;
double shctd; double shctd;
double dispoff; double dispoff;
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std::vector<WcaDispersionInfo> parameters; std::vector<WcaDispersionInfo> parameters;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}; };
class AmoebaWcaDispersionForce::WcaDispersionInfo { class AmoebaWcaDispersionForce::WcaDispersionInfo {
...@@ -145,7 +133,7 @@ public: ...@@ -145,7 +133,7 @@ public:
radius = 1.0; radius = 1.0;
epsilon = 0.0; epsilon = 0.0;
} }
WcaDispersionInfo( double radius, double epsilon ) : radius(radius), epsilon(epsilon) { WcaDispersionInfo(double radius, double epsilon) : radius(radius), epsilon(epsilon) {
} }
}; };
......
...@@ -77,37 +77,6 @@ public: ...@@ -77,37 +77,6 @@ public:
}; };
class CalcAmoebaUreyBradleyForceKernel : public KernelImpl {
public:
static std::string Name() {
return "CalcAmoebaUreyBradleyForce";
}
CalcAmoebaUreyBradleyForceKernel(std::string name, const Platform& platform) : KernelImpl(name, platform) {
}
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
* @param force the AmoebaUreyBradleyForce this kernel will be used for
*/
virtual void initialize(const System& system, const AmoebaUreyBradleyForce& force) = 0;
/**
* Execute the kernel to calculate the forces and/or energy.
*
* @param context the context in which to execute this kernel
* @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
};
/** /**
* This kernel is invoked by AmoebaHarmonicAngleForce to calculate the forces acting on the system and the energy of the system. * This kernel is invoked by AmoebaHarmonicAngleForce to calculate the forces acting on the system and the energy of the system.
*/ */
...@@ -174,39 +143,6 @@ public: ...@@ -174,39 +143,6 @@ public:
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0; virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
}; };
/**
* This kernel is invoked by AmoebaTorsionForce to calculate the forces acting on the system and the energy of the system.
*/
class CalcAmoebaTorsionForceKernel : public KernelImpl {
public:
static std::string Name() {
return "CalcAmoebaTorsionForce";
}
CalcAmoebaTorsionForceKernel(std::string name, const Platform& platform) : KernelImpl(name, platform) {
}
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
* @param force the TorsionForce this kernel will be used for
*/
virtual void initialize(const System& system, const AmoebaTorsionForce& force) = 0;
/**
* Execute the kernel to calculate the forces and/or energy.
*
* @param context the context in which to execute this kernel
* @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
};
/** /**
* This kernel is invoked by AmoebaTorsionForce to calculate the forces acting on the system and the energy of the system. * This kernel is invoked by AmoebaTorsionForce to calculate the forces acting on the system and the energy of the system.
*/ */
...@@ -374,7 +310,7 @@ public: ...@@ -374,7 +310,7 @@ public:
virtual void getElectrostaticPotential( ContextImpl& context, const std::vector< Vec3 >& inputGrid, virtual void getElectrostaticPotential( ContextImpl& context, const std::vector< Vec3 >& inputGrid,
std::vector< double >& outputElectrostaticPotential ) = 0; std::vector< double >& outputElectrostaticPotential ) = 0;
virtual void getSystemMultipoleMoments( ContextImpl& context, const Vec3& origin, std::vector< double >& outputMultipoleMonents ) = 0; virtual void getSystemMultipoleMoments( ContextImpl& context, std::vector< double >& outputMultipoleMonents ) = 0;
}; };
......
...@@ -85,7 +85,7 @@ public: ...@@ -85,7 +85,7 @@ public:
void getElectrostaticPotential( ContextImpl& context, const std::vector< Vec3 >& inputGrid, void getElectrostaticPotential( ContextImpl& context, const std::vector< Vec3 >& inputGrid,
std::vector< double >& outputElectrostaticPotential ); std::vector< double >& outputElectrostaticPotential );
void getSystemMultipoleMoments( ContextImpl& context, const Vec3& origin, std::vector< double >& outputMultipoleMonents ); void getSystemMultipoleMoments( ContextImpl& context, std::vector< double >& outputMultipoleMonents );
private: private:
......
#ifndef OPENMM_AMOEBA_TORSION_FORCE_IMPL_H_
#define OPENMM_AMOEBA_TORSION_FORCE_IMPL_H_
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* 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. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/ForceImpl.h"
#include "openmm/AmoebaTorsionForce.h"
#include "openmm/Kernel.h"
#include <utility>
#include <set>
#include <map>
#include <string>
namespace OpenMM {
/**
* This is the internal implementation of AmoebaTorsionForce.
*/
class AmoebaTorsionForceImpl : public ForceImpl {
public:
AmoebaTorsionForceImpl(AmoebaTorsionForce& owner);
~AmoebaTorsionForceImpl();
void initialize(ContextImpl& context);
AmoebaTorsionForce& getOwner() {
return owner;
}
void updateContextState(ContextImpl& context) {
// This force field doesn't update the state directly.
}
double calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups);
std::map<std::string, double> getDefaultParameters() {
return std::map<std::string, double>(); // This force field doesn't define any parameters.
}
std::vector<std::string> getKernelNames();
private:
AmoebaTorsionForce& owner;
Kernel kernel;
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_TORSION_FORCE_IMPL_H_*/
#ifndef OPENMM_AMOEBA_UREY_BRADLEY_FORCE_IMPL_H_
#define OPENMM_AMOEBA_UREY_BRADLEY_FORCE_IMPL_H_
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
* 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. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/ForceImpl.h"
#include "openmm/AmoebaUreyBradleyForce.h"
#include "openmm/Kernel.h"
#include <utility>
#include <set>
#include <string>
namespace OpenMM {
/**
* This is the internal implementation of AmoebaUreyBradleyForce.
*/
class AmoebaUreyBradleyForceImpl : public ForceImpl {
public:
AmoebaUreyBradleyForceImpl(AmoebaUreyBradleyForce& owner);
~AmoebaUreyBradleyForceImpl();
void initialize(ContextImpl& context);
AmoebaUreyBradleyForce& getOwner() {
return owner;
}
void updateContextState(ContextImpl& context) {
// This force field doesn't update the state directly.
}
double calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups);
std::map<std::string, double> getDefaultParameters() {
return std::map<std::string, double>(); // This force field doesn't define any parameters.
}
std::vector<std::string> getKernelNames();
private:
AmoebaUreyBradleyForce& owner;
Kernel kernel;
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_UREY_BRADLEY_FORCE_IMPL_H_*/
...@@ -39,25 +39,25 @@ using namespace OpenMM; ...@@ -39,25 +39,25 @@ using namespace OpenMM;
using std::string; using std::string;
using std::vector; using std::vector;
AmoebaMultipoleForce::AmoebaMultipoleForce() : nonbondedMethod(NoCutoff), polarizationType(Mutual), pmeBSplineOrder(5), cutoffDistance(1.0), ewaldErrorTol(1e-4), mutualInducedIterationMethod(SOR), mutualInducedMaxIterations(60), AmoebaMultipoleForce::AmoebaMultipoleForce() : nonbondedMethod(NoCutoff), polarizationType(Mutual), pmeBSplineOrder(5), cutoffDistance(1.0), ewaldErrorTol(1e-4), mutualInducedMaxIterations(60),
mutualInducedTargetEpsilon(1.0e-02), scalingDistanceCutoff(100.0), electricConstant(138.9354558456), aewald(0.0) { mutualInducedTargetEpsilon(1.0e-02), scalingDistanceCutoff(100.0), electricConstant(138.9354558456), aewald(0.0) {
pmeGridDimension.resize(3); pmeGridDimension.resize(3);
pmeGridDimension[0] = pmeGridDimension[1] = pmeGridDimension[2]; pmeGridDimension[0] = pmeGridDimension[1] = pmeGridDimension[2];
} }
AmoebaMultipoleForce::AmoebaNonbondedMethod AmoebaMultipoleForce::getNonbondedMethod( void ) const { AmoebaMultipoleForce::NonbondedMethod AmoebaMultipoleForce::getNonbondedMethod( void ) const {
return nonbondedMethod; return nonbondedMethod;
} }
void AmoebaMultipoleForce::setNonbondedMethod( AmoebaMultipoleForce::AmoebaNonbondedMethod method) { void AmoebaMultipoleForce::setNonbondedMethod( AmoebaMultipoleForce::NonbondedMethod method) {
nonbondedMethod = method; nonbondedMethod = method;
} }
AmoebaMultipoleForce::AmoebaPolarizationType AmoebaMultipoleForce::getPolarizationType( void ) const { AmoebaMultipoleForce::PolarizationType AmoebaMultipoleForce::getPolarizationType( void ) const {
return polarizationType; return polarizationType;
} }
void AmoebaMultipoleForce::setPolarizationType( AmoebaMultipoleForce::AmoebaPolarizationType type ) { void AmoebaMultipoleForce::setPolarizationType( AmoebaMultipoleForce::PolarizationType type ) {
polarizationType = type; polarizationType = type;
} }
...@@ -230,8 +230,8 @@ void AmoebaMultipoleForce::getElectrostaticPotential( const std::vector< Vec3 >& ...@@ -230,8 +230,8 @@ void AmoebaMultipoleForce::getElectrostaticPotential( const std::vector< Vec3 >&
dynamic_cast<AmoebaMultipoleForceImpl&>(getImplInContext(context)).getElectrostaticPotential(getContextImpl(context), inputGrid, outputElectrostaticPotential); dynamic_cast<AmoebaMultipoleForceImpl&>(getImplInContext(context)).getElectrostaticPotential(getContextImpl(context), inputGrid, outputElectrostaticPotential);
} }
void AmoebaMultipoleForce::getSystemMultipoleMoments( const Vec3& origin, Context& context, std::vector< double >& outputMultipoleMonents ){ void AmoebaMultipoleForce::getSystemMultipoleMoments(Context& context, std::vector< double >& outputMultipoleMonents ){
dynamic_cast<AmoebaMultipoleForceImpl&>(getImplInContext(context)).getSystemMultipoleMoments(getContextImpl(context), origin, outputMultipoleMonents); dynamic_cast<AmoebaMultipoleForceImpl&>(getImplInContext(context)).getSystemMultipoleMoments(getContextImpl(context), outputMultipoleMonents);
} }
ForceImpl* AmoebaMultipoleForce::createImpl() { ForceImpl* AmoebaMultipoleForce::createImpl() {
......
...@@ -188,7 +188,7 @@ void AmoebaMultipoleForceImpl::getElectrostaticPotential( ContextImpl& context, ...@@ -188,7 +188,7 @@ void AmoebaMultipoleForceImpl::getElectrostaticPotential( ContextImpl& context,
kernel.getAs<CalcAmoebaMultipoleForceKernel>().getElectrostaticPotential(context, inputGrid, outputElectrostaticPotential); kernel.getAs<CalcAmoebaMultipoleForceKernel>().getElectrostaticPotential(context, inputGrid, outputElectrostaticPotential);
} }
void AmoebaMultipoleForceImpl::getSystemMultipoleMoments( ContextImpl& context, const Vec3& origin, std::vector< double >& outputMultipoleMonents ){ void AmoebaMultipoleForceImpl::getSystemMultipoleMoments( ContextImpl& context, std::vector< double >& outputMultipoleMonents ){
kernel.getAs<CalcAmoebaMultipoleForceKernel>().getSystemMultipoleMoments(context, origin, outputMultipoleMonents); kernel.getAs<CalcAmoebaMultipoleForceKernel>().getSystemMultipoleMoments(context, outputMultipoleMonents);
} }
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