Commit d3f0d1f7 authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Removed SASAForce -- not currently used

Added checks for nonbonded methods
Removed unused functionality from GK force
Moved non-accessor methods from Force classes to ForceImpl classes
parent 839f9a81
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements an implicit solvation force using the GBSA-OBC model. * This class implements an implicit solvation force using the generalized Kirkwood/OBC 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 a 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 GBSA parameters must
...@@ -51,26 +51,6 @@ namespace OpenMM { ...@@ -51,26 +51,6 @@ namespace OpenMM {
class OPENMM_EXPORT AmoebaGeneralizedKirkwoodForce : public Force { class OPENMM_EXPORT AmoebaGeneralizedKirkwoodForce : 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,
/**
* Interactions beyond the cutoff distance are ignored.
*/
CutoffNonPeriodic = 1,
/**
* 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 = 2,
};
/* /*
* Create a AmoebaGeneralizedKirkwoodForce. * Create a AmoebaGeneralizedKirkwoodForce.
*/ */
...@@ -84,7 +64,7 @@ public: ...@@ -84,7 +64,7 @@ public:
} }
/** /**
* Add the GBSA parameters for a particle. This should be called once for each particle * Add the parameters for a particle. This should be called once for each particle
* 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
...@@ -141,27 +121,6 @@ public: ...@@ -141,27 +121,6 @@ public:
void setSoluteDielectric(double dielectric) { void setSoluteDielectric(double dielectric) {
soluteDielectric = dielectric; soluteDielectric = dielectric;
} }
/**
* Get the method used for handling long range nonbonded interactions.
*/
NonbondedMethod getNonbondedMethod() const;
/**
* Set the method used for handling long range nonbonded interactions.
*/
void setNonbondedMethod(NonbondedMethod method);
/**
* Get the cutoff distance (in nm) being used for nonbonded interactions. If the NonbondedMethod in use
* is NoCutoff, this value will have no effect.
*/
double getCutoffDistance() const;
/**
* Set the cutoff distance (in nm) being used for nonbonded interactions. If the NonbondedMethod in use
* is NoCutoff, this value will have no effect.
*/
void setCutoffDistance(double distance);
/** /**
* Get the dielectric offset (nm) used in OBC * Get the dielectric offset (nm) used in OBC
...@@ -207,9 +166,8 @@ protected: ...@@ -207,9 +166,8 @@ protected:
ForceImpl* createImpl(); ForceImpl* createImpl();
private: private:
class ParticleInfo; class ParticleInfo;
NonbondedMethod nonbondedMethod;
int includeCavityTerm; int includeCavityTerm;
double cutoffDistance, solventDielectric, soluteDielectric, dielectricOffset, double solventDielectric, soluteDielectric, dielectricOffset,
probeRadius, surfaceAreaFactor; probeRadius, surfaceAreaFactor;
std::vector<ParticleInfo> particles; std::vector<ParticleInfo> particles;
}; };
...@@ -227,4 +185,4 @@ public: ...@@ -227,4 +185,4 @@ public:
} // namespace OpenMM } // namespace OpenMM
#endif /*AMOEBA_OPENMM_GBSA_OBC_FORCE_FIELD_H_*/ #endif /*AMOEBA_OPENMM_GK_FORCE_FIELD_H_*/
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
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 triplets of particles that varies harmonically with the angle
* between them. To use it, create a HarmonicAngleForce object then call addAngle() once for each angle. After * between them. To use it, create a AmoebaHarmonicAngleForce object then call addAngle() once for each angle. After
* a angle has been added, you can modify its force field parameters by calling setAngleParameters(). * a angle has been added, you can modify its force field parameters by calling setAngleParameters().
*/ */
...@@ -120,8 +120,8 @@ public: ...@@ -120,8 +120,8 @@ public:
* @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 length of the angle, measured in nm * @param length the angle measured in radians
* @param quadratic k the quadratic harmonic force constant for the angle * @param quadratic k the quadratic harmonic 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, int addAngle(int particle1, int particle2, int particle3, double length,
...@@ -134,8 +134,8 @@ public: ...@@ -134,8 +134,8 @@ public:
* @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 length of the angle, measured in nm * @param length the equilibrium angle, measured in radians
* @param quadratic k the quadratic harmonic force constant for the angle * @param quadratic k the quadratic harmonic force constant for the angle, measured in kJ/mol/radian^2
*/ */
void getAngleParameters(int index, int& particle1, int& particle2, int& particle3, double& length, void getAngleParameters(int index, int& particle1, int& particle2, int& particle3, double& length,
double& quadraticK ) const; double& quadraticK ) const;
...@@ -147,8 +147,8 @@ public: ...@@ -147,8 +147,8 @@ public:
* @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 length of the angle, measured in nm * @param length the equilibrium angle, measured in radians
* @param quadratic k the quadratic harmonic force constant for the angle * @param quadratic k the quadratic harmonic 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 );
......
...@@ -43,7 +43,7 @@ namespace OpenMM { ...@@ -43,7 +43,7 @@ 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 harmonically with the distance
* between them. To use it, create a HarmonicBondForce object then call addBond() once for each bond. After * between them. To use it, create a 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().
*/ */
......
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
namespace OpenMM { namespace OpenMM {
/** /**
* This class implements an interaction between pairs of particles that varies harmonically with the distance * 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 them. To use it, create a AmoebaHarmonicInPlaneAngle object then call addAngle() once for each angle. After * between them. To use it, create a AmoebaHarmonicInPlaneAngle object then call addAngle() once for each angle. After
* a angle has been added, you can modify its force field parameters by calling setAngleParameters(). * a angle has been added, you can modify its force field parameters by calling setAngleParameters().
*/ */
...@@ -73,9 +74,9 @@ public: ...@@ -73,9 +74,9 @@ public:
double getAmoebaGlobalHarmonicInPlaneAngleCubic( void ) const; double getAmoebaGlobalHarmonicInPlaneAngleCubic( 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 harmonic force constant for the angle
*/ */
void setAmoebaGlobalHarmonicInPlaneAngleQuartic( double quarticK ); void setAmoebaGlobalHarmonicInPlaneAngleQuartic( double quarticK );
...@@ -121,8 +122,8 @@ public: ...@@ -121,8 +122,8 @@ public:
* @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 length of the angle, measured in nm * @param length the equilibrium angle, measured in radians
* @param quadratic k the quadratic harmonic force constant for the angle * @param quadratic k the quadratic harmonic 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,
...@@ -136,8 +137,8 @@ public: ...@@ -136,8 +137,8 @@ public:
* @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 length of the angle, measured in nm * @param length the equilibrium angle, measured in radians
* @param quadratic k the quadratic harmonic force constant for the angle * @param quadratic k the quadratic harmonic 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;
...@@ -150,8 +151,8 @@ public: ...@@ -150,8 +151,8 @@ public:
* @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 length of the angle, measured in nm * @param length the equilibrium angle, measured in radians
* @param quadratic k the quadratic harmonic force constant for the angle * @param quadratic k the quadratic harmonic 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 );
......
...@@ -52,21 +52,23 @@ public: ...@@ -52,21 +52,23 @@ public:
enum MultipoleAxisTypes { ZThenX, Bisector }; enum MultipoleAxisTypes { ZThenX, Bisector };
enum MutualInducedIterationMethod { SOR, ConjugateGradient }; // Algorithm used to converge mutual induced dipoles:
// SOR: successive-over-relaxation
//enum MutualInducedIterationMethod { SOR, ConjugateGradient };
enum MutualInducedIterationMethod { SOR };
enum CovalentType { enum CovalentType {
Covalent12, Covalent13, Covalent14, Covalent15, Covalent12, Covalent13, Covalent14, Covalent15,
PolarizationCovalent11, PolarizationCovalent12, PolarizationCovalent13, PolarizationCovalent14, CovalentEnd }; PolarizationCovalent11, PolarizationCovalent12, PolarizationCovalent13, PolarizationCovalent14, CovalentEnd };
static const int CovalentDegrees[8];
/** /**
* Create a Amoeba MultipoleForce. * Create a Amoeba MultipoleForce.
*/ */
AmoebaMultipoleForce(); AmoebaMultipoleForce();
/** /**
* Get the number of pi torsion terms in the potential function * Get the number of particles in the potential function
*/ */
int getNumMultipoles() const { int getNumMultipoles() const {
return multipoles.size(); return multipoles.size();
...@@ -148,22 +150,6 @@ public: ...@@ -148,22 +150,6 @@ public:
*/ */
void getCovalentMaps(int index, std::vector < std::vector<int> >& covalentLists ) const; void getCovalentMaps(int index, std::vector < std::vector<int> >& covalentLists ) const;
/**
* Get the CovalentMap for an atom
*
* @param index the index of the atom for which to set parameters
* @param minCovalentIndex minimum covalent index
* @param maxCovalentIndex maximum covalent index
*/
void getCovalentRange(int index, const std::vector<CovalentType>& lists, int* minCovalentIndex, int* maxCovalentIndex ) const;
/**
* Get the covalent degree for the CovalentEnd lists
*
* @param covalentDegree covalent degrees for the CovalentEnd lists
*/
void getCovalentDegree( std::vector<int>& covalentDegree ) const;
/** /**
* Get the iteration method to be used for calculating the mutual induced dipoles * Get the iteration method to be used for calculating the mutual induced dipoles
* *
...@@ -222,7 +208,7 @@ public: ...@@ -222,7 +208,7 @@ public:
/** /**
* Get the electric constant * Get the electric constant
*
* @return the electric constant * @return the electric constant
*/ */
double getElectricConstant( void ) const; double getElectricConstant( void ) const;
...@@ -284,15 +270,6 @@ public: ...@@ -284,15 +270,6 @@ public:
charge(charge), axisType(axisType), multipoleAtomId1(multipoleAtomId1), multipoleAtomId2(multipoleAtomId2), charge(charge), axisType(axisType), multipoleAtomId1(multipoleAtomId1), multipoleAtomId2(multipoleAtomId2),
thole(thole), dampingFactor(dampingFactor), polarity(polarity) { thole(thole), dampingFactor(dampingFactor), polarity(polarity) {
// only 'Z-then-X' or 'Bisector' currently handled
if( axisType != ZThenX && axisType != Bisector ){
std::stringstream buffer;
buffer << "AmoebaMultipoleForce: axis type=" << axisType;
buffer << " not currently handled - only axisTypes[ " << ZThenX << ", " << Bisector << "] (ZThenX, Bisector) currently handled .";
throw OpenMMException(buffer.str());
}
covalentInfo.resize( CovalentEnd ); covalentInfo.resize( CovalentEnd );
molecularDipole.resize( 3 ); molecularDipole.resize( 3 );
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "AmoebaTorsionTorsionForce.h" #include "AmoebaTorsionTorsionForce.h"
#include "AmoebaMultipoleForce.h" #include "AmoebaMultipoleForce.h"
#include "AmoebaGeneralizedKirkwoodForce.h" #include "AmoebaGeneralizedKirkwoodForce.h"
#include "AmoebaSASAForce.h"
#include "AmoebaVdwForce.h" #include "AmoebaVdwForce.h"
#include "AmoebaWcaDispersionForce.h" #include "AmoebaWcaDispersionForce.h"
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "openmm/Force.h" #include "openmm/Force.h"
//#include "openmm/Vec3.h"
#include <vector> #include <vector>
#include "openmm/internal/windowsExport.h" #include "openmm/internal/windowsExport.h"
......
#ifndef AMOEBA_OPENMM_SASA_FORCE_FIELD_H_
#define AMOEBA_OPENMM_SASA_FORCE_FIELD_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* 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: Peter Eastman *
* 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 <vector>
#include "openmm/internal/windowsExport.h"
namespace OpenMM {
/**
* This class implements an SASA force
* by performing an analytical computation of the weighted
* solvent accessible surface area of each atom and the first
* derivatives of the area with respect to Cartesian coordinates
*
* Literature references:
*
* T. J. Richmond, "Solvent Accessible Surface Area and
* Excluded Volume in Proteins", Journal of Molecular Biology,
* 178, 63-89 (1984)
*
* L. Wesson and D. Eisenberg, "Atomic Solvation Parameters
* Applied to Molecular Dynamics of Proteins in Solution",
* Protein Science, 1, 227-235 (1992)
*
* <p>
* To use this class, create a AmoebaSASAForce object, then call addParticle() once for each particle in the
* System to define its parameters. The number of particles for which you define SASA parameters must
* be exactly 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
* by calling setParticleParameters().
*/
class OPENMM_EXPORT AmoebaSASAForce : public Force {
public:
/*
* Create a AmoebaSASAForce.
*/
AmoebaSASAForce();
/**
* Get the number of particles in the system.
*/
int getNumParticles() const {
return particles.size();
}
/**
* Add the SASA parameters for a particle. This should be called once for each particle
* in the System. When it is called for the i'th time, it specifies the parameters for the i'th particle.
*
* @param radius the radius of the particle, measured in nm
* @param weight the sasa weight (Tinker asolv())
* @return the index of the particle that was added
*/
int addParticle(double radius, double weight);
/**
* Get the force field parameters for a particle.
*
* @param index the index of the particle for which to get parameters
* @param radius the radius of the particle, measured in nm
* @param weight the sasa weight(Tinker asolv())
*/
void getParticleParameters(int index, double& radius, double& weight) const;
/**
* Set the force field parameters for a particle.
*
* @param index the index of the particle for which to set parameters
* @param radius the radius of the particle, measured in nm
* @param weight the sasa weight(Tinker asolv())
*/
void setParticleParameters(int index, double radius, double weight);
/**
* Get the probe radius
*/
double getProbeRadius() const;
/**
* Set the probe radius
*/
void setProbeRadius(double distance);
protected:
ForceImpl* createImpl();
private:
class ParticleInfo;
double probeRadius;
std::vector<ParticleInfo> particles;
};
class AmoebaSASAForce::ParticleInfo {
public:
double radius, weight;
ParticleInfo() {
radius = weight = 0.0;
}
ParticleInfo(double radius, double weight) :
radius(radius), weight(weight) {
}
};
} // namespace OpenMM
#endif /*AMOEBA_OPENMM_GBSA_OBC_FORCE_FIELD_H_*/
...@@ -145,6 +145,7 @@ private: ...@@ -145,6 +145,7 @@ private:
} }
} }
} }
public: public:
int particle1, particle2, particle3, particle4; int particle1, particle2, particle3, particle4;
std::vector< std::vector<double> > torsionParameters; std::vector< std::vector<double> > torsionParameters;
......
...@@ -174,7 +174,7 @@ public: ...@@ -174,7 +174,7 @@ public:
VdwInfo() { VdwInfo() {
ivIndex = classIndex = -1; ivIndex = classIndex = -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 ivIndex, int classIndex, double sigma, double epsilon, double reductionFactor ) :
......
...@@ -85,42 +85,27 @@ public: ...@@ -85,42 +85,27 @@ public:
*/ */
int addParticle( double radius, double epsilon ); int addParticle( double radius, double epsilon );
/**
* Get the maximum dispersion energy for a particle
*
* @param particleIndex the particle index
* @param maxDispersionEnergy maximum dispersion energy
*/
void getMaximumDispersionEnergy(int particleIndex, double& maxDispersionEnergy ) const;
/**
* Get the total maximum dispersion energy
*
* @return total maximum dispersion energy for the system
*/
double getTotalMaximumDispersionEnergy( void ) const;
/* /*
* Constants * Constants
*/ */
double getEpso( void ) const; double getEpso( void ) const;
double getEpsh( void ) const; double getEpsh( void ) const;
double getRmino( void ) const; double getRmino( void ) const;
double getRminh( void ) const; double getRminh( void ) const;
double getAwater( void ) const; double getAwater( void ) const;
double getShctd( void ) const; double getShctd( void ) const;
double getDispoff( void ) const; double getDispoff( void ) const;
double getSlevy( void ) const; double getSlevy( void ) 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();
......
...@@ -324,34 +324,6 @@ public: ...@@ -324,34 +324,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 AmoebaSASAForce to calculate the solvent-accessible surface area forces acting on the system and the energy of the system.
*/
class CalcAmoebaSASAForceKernel : public KernelImpl {
public:
static std::string Name() {
return "CalcAmoebaSASAForce";
}
CalcAmoebaSASAForceKernel(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 GBSAOBCForce this kernel will be used for
*/
virtual void initialize(const System& system, const AmoebaSASAForce& 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 AmoebaVdwForce to calculate the vdw forces acting on the system and the vdw energy of the system. * This kernel is invoked by AmoebaVdwForce to calculate the vdw forces acting on the system and the vdw energy of the system.
......
...@@ -60,9 +60,34 @@ public: ...@@ -60,9 +60,34 @@ public:
return std::map<std::string, double>(); // This force field doesn't define any parameters. return std::map<std::string, double>(); // This force field doesn't define any parameters.
} }
std::vector<std::string> getKernelNames(); std::vector<std::string> getKernelNames();
/**
* Get the CovalentMap for an atom
*
* @param force AmoebaMultipoleForce force reference
* @param index the index of the atom for which to set parameters
* @param minCovalentIndex minimum covalent index
* @param maxCovalentIndex maximum covalent index
*/
static void getCovalentRange( const AmoebaMultipoleForce& force, int index,
const std::vector< AmoebaMultipoleForce::CovalentType>& lists,
int* minCovalentIndex, int* maxCovalentIndex );
/**
* Get the covalent degree for the CovalentEnd lists
*
* @param force AmoebaMultipoleForce force reference
* @param covalentDegree covalent degrees for the CovalentEnd lists
*/
static void getCovalentDegree( const AmoebaMultipoleForce& force, std::vector<int>& covalentDegree );
private: private:
AmoebaMultipoleForce& owner; AmoebaMultipoleForce& owner;
Kernel kernel; Kernel kernel;
static int CovalentDegrees[AmoebaMultipoleForce::CovalentEnd];
static bool initializedCovalentDegrees;
static const int* getCovalentDegrees( void );
}; };
} // namespace OpenMM } // namespace OpenMM
......
#ifndef OPENMM_AMOEBA_SASA_FORCE_FIELD_IMPL_H_
#define OPENMM_AMOEBA_SASA_FORCE_FIELD_IMPL_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* 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: Peter Eastman *
* 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 "AmoebaSASAForce.h"
#include "openmm/Kernel.h"
#include <string>
namespace OpenMM {
/**
* This is the internal implementation of AmoebaSASAForce.
*/
class AmoebaSASAForceImpl : public ForceImpl {
public:
AmoebaSASAForceImpl(AmoebaSASAForce& owner);
void initialize(ContextImpl& context);
AmoebaSASAForce& getOwner() {
return owner;
}
void updateContextState(ContextImpl& context) {
// This force field doesn't update the state directly.
}
double calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy);
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:
AmoebaSASAForce& owner;
Kernel kernel;
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_SASA_FORCE_FIELD_IMPL_H_*/
...@@ -61,6 +61,25 @@ public: ...@@ -61,6 +61,25 @@ public:
return std::map<std::string, double>(); // This force field doesn't define any parameters. return std::map<std::string, double>(); // This force field doesn't define any parameters.
} }
std::vector<std::string> getKernelNames(); std::vector<std::string> getKernelNames();
/**
* Get the maximum dispersion energy for a particle
*
* @param force AmoebaWcaDispersionForce reference
* @param particleIndex the particle index
* @param maxDispersionEnergy maximum dispersion energy
*/
static void getMaximumDispersionEnergy( const AmoebaWcaDispersionForce& force, int particleIndex, double& maxDispersionEnergy );
/**
* Get the total maximum dispersion energy
*
* @param force AmoebaWcaDispersionForce reference
*
* @return total maximum dispersion energy for the system
*/
static double getTotalMaximumDispersionEnergy( const AmoebaWcaDispersionForce& force);
private: private:
AmoebaWcaDispersionForce& owner; AmoebaWcaDispersionForce& owner;
Kernel kernel; Kernel kernel;
......
...@@ -36,8 +36,7 @@ ...@@ -36,8 +36,7 @@
using namespace OpenMM; using namespace OpenMM;
AmoebaGeneralizedKirkwoodForce::AmoebaGeneralizedKirkwoodForce() : nonbondedMethod(NoCutoff), cutoffDistance(1.0), solventDielectric(78.3), soluteDielectric(1.0), AmoebaGeneralizedKirkwoodForce::AmoebaGeneralizedKirkwoodForce() : solventDielectric(78.3), soluteDielectric(1.0), dielectricOffset(0.009), includeCavityTerm(1), probeRadius(0.14) {
dielectricOffset(0.009), includeCavityTerm(1), probeRadius(0.14) {
surfaceAreaFactor = -6.0* 3.1415926535*0.0216*1000.0*0.4184; surfaceAreaFactor = -6.0* 3.1415926535*0.0216*1000.0*0.4184;
} }
...@@ -59,22 +58,6 @@ void AmoebaGeneralizedKirkwoodForce::setParticleParameters(int index, double cha ...@@ -59,22 +58,6 @@ void AmoebaGeneralizedKirkwoodForce::setParticleParameters(int index, double cha
particles[index].scalingFactor = scalingFactor; particles[index].scalingFactor = scalingFactor;
} }
AmoebaGeneralizedKirkwoodForce::NonbondedMethod AmoebaGeneralizedKirkwoodForce::getNonbondedMethod() const {
return nonbondedMethod;
}
void AmoebaGeneralizedKirkwoodForce::setNonbondedMethod(NonbondedMethod method) {
nonbondedMethod = method;
}
double AmoebaGeneralizedKirkwoodForce::getCutoffDistance() const {
return cutoffDistance;
}
void AmoebaGeneralizedKirkwoodForce::setCutoffDistance(double distance) {
cutoffDistance = distance;
}
double AmoebaGeneralizedKirkwoodForce::getDielectricOffset() const { double AmoebaGeneralizedKirkwoodForce::getDielectricOffset() const {
return dielectricOffset; return dielectricOffset;
} }
......
...@@ -40,6 +40,12 @@ AmoebaGeneralizedKirkwoodForceImpl::AmoebaGeneralizedKirkwoodForceImpl(AmoebaGen ...@@ -40,6 +40,12 @@ AmoebaGeneralizedKirkwoodForceImpl::AmoebaGeneralizedKirkwoodForceImpl(AmoebaGen
} }
void AmoebaGeneralizedKirkwoodForceImpl::initialize(ContextImpl& context) { void AmoebaGeneralizedKirkwoodForceImpl::initialize(ContextImpl& context) {
System& system = context.getSystem();
if (owner.getNumParticles() != system.getNumParticles())
throw OpenMMException("AmoebaGeneralizedKirkwoodForce must have exactly as many particles as the System it belongs to.");
kernel = context.getPlatform().createKernel(CalcAmoebaGeneralizedKirkwoodForceKernel::Name(), context); kernel = context.getPlatform().createKernel(CalcAmoebaGeneralizedKirkwoodForceKernel::Name(), context);
if (owner.getNumParticles() != context.getSystem().getNumParticles()) if (owner.getNumParticles() != context.getSystem().getNumParticles())
throw OpenMMException("AmoebaGeneralizedKirkwoodForce must have exactly as many particles as the System it belongs to."); throw OpenMMException("AmoebaGeneralizedKirkwoodForce must have exactly as many particles as the System it belongs to.");
......
...@@ -36,9 +36,6 @@ ...@@ -36,9 +36,6 @@
using namespace OpenMM; using namespace OpenMM;
const int AmoebaMultipoleForce::CovalentDegrees[8] = { 1, 2, 3, 4, 0, 1, 2, 3 };
AmoebaMultipoleForce::AmoebaMultipoleForce() { AmoebaMultipoleForce::AmoebaMultipoleForce() {
mutualInducedIterationMethod = SOR; mutualInducedIterationMethod = SOR;
...@@ -187,31 +184,6 @@ void AmoebaMultipoleForce::getCovalentMaps(int index, std::vector< std::vector<i ...@@ -187,31 +184,6 @@ void AmoebaMultipoleForce::getCovalentMaps(int index, std::vector< std::vector<i
} }
} }
void AmoebaMultipoleForce::getCovalentRange( int index, const std::vector<CovalentType>& lists, int* minCovalentIndex, int* maxCovalentIndex ) const {
*minCovalentIndex = 999999999;
*maxCovalentIndex = -999999999;
for( unsigned int kk = 0; kk < lists.size(); kk++ ){
CovalentType jj = lists[kk];
std::vector<int> covalentList = multipoles[index].covalentInfo[jj];
for( unsigned int ii = 0; ii < covalentList.size(); ii++ ){
if( *minCovalentIndex > covalentList[ii] ){
*minCovalentIndex = covalentList[ii];
}
if( *maxCovalentIndex < covalentList[ii] ){
*maxCovalentIndex = covalentList[ii];
}
}
}
}
void AmoebaMultipoleForce::getCovalentDegree( std::vector<int>& covalentDegree ) const {
covalentDegree.resize( CovalentEnd );
for( unsigned int kk = 0; kk < CovalentEnd; kk++ ){
covalentDegree[kk] = CovalentDegrees[kk];
}
}
ForceImpl* AmoebaMultipoleForce::createImpl() { ForceImpl* AmoebaMultipoleForce::createImpl() {
return new AmoebaMultipoleForceImpl(*this); return new AmoebaMultipoleForceImpl(*this);
} }
...@@ -37,6 +37,9 @@ using namespace OpenMM; ...@@ -37,6 +37,9 @@ using namespace OpenMM;
using std::vector; using std::vector;
bool AmoebaMultipoleForceImpl::initializedCovalentDegrees = false;
int AmoebaMultipoleForceImpl::CovalentDegrees[] = { 1,2,3,4,0,1,2,3};
AmoebaMultipoleForceImpl::AmoebaMultipoleForceImpl(AmoebaMultipoleForce& owner) : owner(owner) { AmoebaMultipoleForceImpl::AmoebaMultipoleForceImpl(AmoebaMultipoleForce& owner) : owner(owner) {
} }
...@@ -44,6 +47,30 @@ AmoebaMultipoleForceImpl::~AmoebaMultipoleForceImpl() { ...@@ -44,6 +47,30 @@ AmoebaMultipoleForceImpl::~AmoebaMultipoleForceImpl() {
} }
void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) { void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) {
System& system = context.getSystem();
if (owner.getNumMultipoles() != system.getNumParticles())
throw OpenMMException("AmoebaMultipoleForce must have exactly as many particles as the System it belongs to.");
for( int ii = 0; ii < system.getNumParticles(); ii++ ){
int index, axisType, multipoleAtomId1, multipoleAtomId2;
double charge, thole, dampingFactor, polarity ;
std::vector<double> molecularDipole;
std::vector<double> molecularQuadrupole;
owner.getMultipoleParameters( ii, charge, molecularDipole, molecularQuadrupole, axisType, multipoleAtomId1, multipoleAtomId2,
thole, dampingFactor, polarity );
// only 'Z-then-X' or 'Bisector' currently handled
if( axisType != AmoebaMultipoleForce::ZThenX && axisType != AmoebaMultipoleForce::Bisector ){
std::stringstream buffer;
buffer << "AmoebaMultipoleForce: axis type=" << axisType;
buffer << " not currently handled - only axisTypes[ " << AmoebaMultipoleForce::ZThenX << ", " << AmoebaMultipoleForce::Bisector << "] (ZThenX, Bisector) currently handled .";
throw OpenMMException(buffer.str());
}
}
kernel = context.getPlatform().createKernel(CalcAmoebaMultipoleForceKernel::Name(), context); kernel = context.getPlatform().createKernel(CalcAmoebaMultipoleForceKernel::Name(), context);
dynamic_cast<CalcAmoebaMultipoleForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaMultipoleForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
...@@ -58,3 +85,47 @@ std::vector<std::string> AmoebaMultipoleForceImpl::getKernelNames() { ...@@ -58,3 +85,47 @@ std::vector<std::string> AmoebaMultipoleForceImpl::getKernelNames() {
return names; return names;
} }
const int* AmoebaMultipoleForceImpl::getCovalentDegrees( void ) {
if( !initializedCovalentDegrees ){
initializedCovalentDegrees = true;
CovalentDegrees[AmoebaMultipoleForce::Covalent12] = 1;
CovalentDegrees[AmoebaMultipoleForce::Covalent13] = 2;
CovalentDegrees[AmoebaMultipoleForce::Covalent14] = 3;
CovalentDegrees[AmoebaMultipoleForce::Covalent15] = 4;
CovalentDegrees[AmoebaMultipoleForce::PolarizationCovalent11] = 0;
CovalentDegrees[AmoebaMultipoleForce::PolarizationCovalent12] = 1;
CovalentDegrees[AmoebaMultipoleForce::PolarizationCovalent13] = 2;
CovalentDegrees[AmoebaMultipoleForce::PolarizationCovalent14] = 3;
}
return CovalentDegrees;
}
void AmoebaMultipoleForceImpl::getCovalentRange( const AmoebaMultipoleForce& force, int atomIndex, const std::vector<AmoebaMultipoleForce::CovalentType>& lists,
int* minCovalentIndex, int* maxCovalentIndex ){
*minCovalentIndex = 999999999;
*maxCovalentIndex = -999999999;
for( unsigned int kk = 0; kk < lists.size(); kk++ ){
AmoebaMultipoleForce::CovalentType jj = lists[kk];
std::vector<int> covalentList;
force.getCovalentMap( atomIndex, jj, covalentList );
for( unsigned int ii = 0; ii < covalentList.size(); ii++ ){
if( *minCovalentIndex > covalentList[ii] ){
*minCovalentIndex = covalentList[ii];
}
if( *maxCovalentIndex < covalentList[ii] ){
*maxCovalentIndex = covalentList[ii];
}
}
}
return;
}
void AmoebaMultipoleForceImpl::getCovalentDegree( const AmoebaMultipoleForce& force, std::vector<int>& covalentDegree ){
covalentDegree.resize( AmoebaMultipoleForce::CovalentEnd );
const int* CovalentDegrees = AmoebaMultipoleForceImpl::getCovalentDegrees();
for( unsigned int kk = 0; kk < AmoebaMultipoleForce::CovalentEnd; kk++ ){
covalentDegree[kk] = CovalentDegrees[kk];
}
return;
}
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* 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: Peter Eastman *
* 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 "AmoebaSASAForce.h"
#include "internal/AmoebaSASAForceImpl.h"
using namespace OpenMM;
AmoebaSASAForce::AmoebaSASAForce() : probeRadius(0.14) {
}
int AmoebaSASAForce::addParticle( double radius, double weight) {
particles.push_back(ParticleInfo(radius, weight));
return particles.size()-1;
}
void AmoebaSASAForce::getParticleParameters(int index, double& radius, double& weight) const {
radius = particles[index].radius;
weight = particles[index].weight;
}
void AmoebaSASAForce::setParticleParameters(int index, double radius, double weight) {
particles[index].radius = radius;
particles[index].weight = weight;
}
double AmoebaSASAForce::getProbeRadius() const {
return probeRadius;
}
void AmoebaSASAForce::setProbeRadius(double distance) {
probeRadius = distance;
}
ForceImpl* AmoebaSASAForce::createImpl() {
return new AmoebaSASAForceImpl(*this);
}
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