Unverified Commit 1e42b8be authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Replaced several AMOEBA bonded forces with custom forces (#3046)

* Replaced several AMOEBA bonded forces with custom forces

* Deleted obsolete AMOEBA forces

* Replaced AmoebaPiTorsionForce with custom force
parent 014797f4
...@@ -32,12 +32,6 @@ ...@@ -32,12 +32,6 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. * * USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "openmm/AmoebaBondForce.h"
#include "openmm/AmoebaAngleForce.h"
#include "openmm/AmoebaInPlaneAngleForce.h"
#include "openmm/AmoebaPiTorsionForce.h"
#include "openmm/AmoebaStretchBendForce.h"
#include "openmm/AmoebaOutOfPlaneBendForce.h"
#include "openmm/AmoebaTorsionTorsionForce.h" #include "openmm/AmoebaTorsionTorsionForce.h"
#include "openmm/AmoebaMultipoleForce.h" #include "openmm/AmoebaMultipoleForce.h"
#include "openmm/AmoebaGeneralizedKirkwoodForce.h" #include "openmm/AmoebaGeneralizedKirkwoodForce.h"
......
#ifndef OPENMM_AMOEBA_ANGLE_FORCE_H_
#define OPENMM_AMOEBA_ANGLE_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-2016 Stanford University and the Authors. *
* Authors: Mark Friedrichs, 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 "internal/windowsExportAmoeba.h"
#include <vector>
namespace OpenMM {
/**
* This class implements an interaction between triplets of particles that varies with the angle
* between them. The interaction is defined by a 6th order polynomial. Only the quadratic term
* 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 AmoebaAngleForce object then call addAngle() once for each angle. After
* an angle has been added, you can modify its force field parameters by calling setAngleParameters().
* This will have no effect on Contexts that already exist unless you call updateParametersInContext().
*/
class OPENMM_EXPORT_AMOEBA AmoebaAngleForce : public Force {
public:
/**
* Create an AmoebaAngleForce.
*/
AmoebaAngleForce();
/**
* Get the number of angle stretch terms in the potential function
*/
int getNumAngles() const {
return angles.size();
}
/**
* Set the global cubic term
*
* @param cubicK the cubic force constant for the angle
*/
void setAmoebaGlobalAngleCubic(double cubicK);
/**
* Get the global cubic term
*
* @return global cubicK term
*/
double getAmoebaGlobalAngleCubic() const;
/**
* Set the global quartic term
*
* @param quarticK the quartic force constant for the angle
*/
void setAmoebaGlobalAngleQuartic(double quarticK);
/**
* Get the global quartic term
*
* @return global quartic term
*/
double getAmoebaGlobalAngleQuartic() const;
/**
* Set the global pentic term
*
* @param penticK the pentic force constant for the angle
*/
void setAmoebaGlobalAnglePentic(double penticK);
/**
* Get the global pentic term
*
* @return global penticK term
*/
double getAmoebaGlobalAnglePentic() const;
/**
* Set the global sextic term
*
* @param sexticK the sextic force constant for the angle
*/
void setAmoebaGlobalAngleSextic(double sexticK);
/**
* Get the global sextic term
*
* @return global sextic term
*/
double getAmoebaGlobalAngleSextic() const;
/**
* Add an angle term to the force field.
*
* @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 particle3 the index of the third particle connected by the angle
* @param length the equilibrium angle, measured in degrees
* @param quadraticK the quadratic force constant for the angle, measured in kJ/mol/radian^2
* @return the index of the angle that was added
*/
int addAngle(int particle1, int particle2, int particle3, double length, double quadraticK);
/**
* Get the force field parameters for an angle term.
*
* @param index the index of the angle for which to get parameters
* @param[out] particle1 the index of the first particle connected by the angle
* @param[out] particle2 the index of the second particle connected by the angle
* @param[out] particle3 the index of the third particle connected by the angle
* @param[out] length the equilibrium angle, measured in degrees
* @param[out] quadraticK 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;
/**
* Set the force field parameters for an angle term.
*
* @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 particle2 the index of the second 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 quadraticK 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);
/**
* Update the per-angle parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setAngleParameters() to modify this object's parameters, then call updateParametersInContext()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-angle parameters. The set of particles involved
* in an angle cannot be changed, nor can new angles be added.
*/
void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const;
protected:
ForceImpl* createImpl() const;
double _globalCubicK, _globalQuarticK, _globalPenticK, _globalSexticK;
private:
class AngleInfo;
std::vector<AngleInfo> angles;
bool usePeriodic;
};
/**
* This is an internal class used to record information about an angle.
* @private
*/
class AmoebaAngleForce::AngleInfo {
public:
int particle1, particle2, particle3;
double length, quadraticK;
AngleInfo() {
particle1 = particle2 = particle3 = -1;
length = quadraticK = 0.0;
}
AngleInfo(int particle1, int particle2, int particle3, double length, double quadraticK) :
particle1(particle1), particle2(particle2), particle3(particle3), length(length), quadraticK(quadraticK) {
}
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_ANGLE_FORCE_H_*/
#ifndef OPENMM_AMOEBA_BOND_FORCE_H_
#define OPENMM_AMOEBA_BOND_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-2016 Stanford University and the Authors. *
* Authors: Mark Friedrichs, 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/Vec3.h"
#include "internal/windowsExportAmoeba.h"
#include <map>
#include <vector>
namespace OpenMM {
/**
* This class implements an interaction between pairs of particles that varies with the distance
* 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 AmoebaBondForce object then call addBond() once for each bond. After
* a bond has been added, you can modify its force field parameters by calling setBondParameters().
* This will have no effect on Contexts that already exist unless you call updateParametersInContext().
*/
class OPENMM_EXPORT_AMOEBA AmoebaBondForce : public Force {
public:
/**
* Create an AmoebaBondForce.
*/
AmoebaBondForce();
/**
* Get the number of bond stretch terms in the potential function
*/
int getNumBonds() const {
return bonds.size();
}
/**
* Set the global cubic term
*
* @param cubicK the cubic force constant for the bond
*/
void setAmoebaGlobalBondCubic(double cubicK);
/**
* Get the global cubic term
*
* @return global cubicK term
*/
double getAmoebaGlobalBondCubic() const;
/**
* Set the global quartic term
*
* @param quarticK the quartic force constant for the bond
*/
void setAmoebaGlobalBondQuartic(double quarticK);
/**
* Get the global quartic term
*
* @return global quartic term
*/
double getAmoebaGlobalBondQuartic() const;
/**
* Add a bond term to the force field.
*
* @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 length the equilibrium length of the bond, measured in nm
* @param quadraticK the quadratic force constant for the bond
* @return the index of the bond that was added
*/
int addBond(int particle1, int particle2, double length, double quadraticK);
/**
* Get the force field parameters for a bond term.
*
* @param index the index of the bond for which to get parameters
* @param[out] particle1 the index of the first particle connected by the bond
* @param[out] particle2 the index of the second particle connected by the bond
* @param[out] length the equilibrium length of the bond, measured in nm
* @param[out] quadraticK the quadratic force constant for the bond
*/
void getBondParameters(int index, int& particle1, int& particle2, double& length, double& quadraticK) const;
/**
* Set the force field parameters for a bond term.
*
* @param index the index of the bond for which to set parameters
* @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 length the equilibrium length of the bond, measured in nm
* @param quadraticK the quadratic force constant for the bond
*/
void setBondParameters(int index, int particle1, int particle2, double length, double quadraticK);
/**
* Update the per-bond parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setBondParameters() to modify this object's parameters, then call updateParametersInContext()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-bond parameters. The set of particles involved
* in a bond cannot be changed, nor can new bonds be added.
*/
void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const;
protected:
double _globalQuarticK, _globalCubicK;
ForceImpl* createImpl() const;
private:
class BondInfo;
std::vector<BondInfo> bonds;
bool usePeriodic;
};
/**
* This is an internal class used to record information about a bond.
* @private
*/
class AmoebaBondForce::BondInfo {
public:
int particle1, particle2;
double length, quadraticK;
BondInfo() {
particle1 = particle2 = -1;
length = quadraticK = 0.0;
}
BondInfo(int particle1, int particle2, double length, double quadraticK) :
particle1(particle1), particle2(particle2), length(length), quadraticK(quadraticK) {
}
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_BOND_FORCE_H_*/
#ifndef OPENMM_AMOEBA_IN_PLANE_ANGLE_FORCE_H_
#define OPENMM_AMOEBA_IN_PLANE_ANGLE_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-2016 Stanford University and the Authors. *
* Authors: Mark Friedrichs, 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 "internal/windowsExportAmoeba.h"
#include <vector>
namespace OpenMM {
/**
* This class implements an interaction at trigonal centers corresponding to the projected in-plane angle bend energy
* between four particles. The interaction is defined by a 6th order polynomial in the angle between them. Only the
* quadratic term 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 AmoebaInPlaneAngleForce object then call addAngle() once for each angle. After
* an angle has been added, you can modify its force field parameters by calling setAngleParameters().
* This will have no effect on Contexts that already exist unless you call updateParametersInContext().
*/
class OPENMM_EXPORT_AMOEBA AmoebaInPlaneAngleForce : public Force {
public:
/**
* Create an AmoebaAngleForce.
*/
AmoebaInPlaneAngleForce();
/**
* Get the number of in-plane angle terms in the potential function
*/
int getNumAngles() const {
return angles.size();
}
/**
* Set the global cubic term
*
* @param cubicK the cubic force constant for the angle
*/
void setAmoebaGlobalInPlaneAngleCubic(double cubicK);
/**
* Get the global cubic term
*
* @return global cubicK term
*/
double getAmoebaGlobalInPlaneAngleCubic() const;
/**
* Set the global quartic term
*
* @param quarticK the quartic force constant for the angle
*/
void setAmoebaGlobalInPlaneAngleQuartic(double quarticK);
/**
* Get the global quartic term
*
* @return global quartic term
*/
double getAmoebaGlobalInPlaneAngleQuartic() const;
/**
* Set the global pentic term
*
* @param penticK the pentic force constant for the angle
*/
void setAmoebaGlobalInPlaneAnglePentic(double penticK);
/**
* Get the global pentic term
*
* @return global penticK term
*/
double getAmoebaGlobalInPlaneAnglePentic() const;
/**
* Set the global sextic term
*
* @param sexticK the sextic force constant for the angle
*/
void setAmoebaGlobalInPlaneAngleSextic(double sexticK);
/**
* Get the global sextic term
*
* @return global sextic term
*/
double getAmoebaGlobalInPlaneAngleSextic() const;
/**
* Add an angle term to the force field.
*
* @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 particle3 the index of the third 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 quadraticK the quadratic force constant for the angle measured in kJ/mol/radian^2
* @return the index of the angle that was added
*/
int addAngle(int particle1, int particle2, int particle3, int particle4, double length,
double quadraticK);
/**
* Get the force field parameters for an angle term.
*
* @param index the index of the angle for which to get parameters
* @param[out] particle1 the index of the first particle connected by the angle
* @param[out] particle2 the index of the second particle connected by the angle
* @param[out] particle3 the index of the third particle connected by the angle
* @param[out] particle4 the index of the fourth particle connected by the angle
* @param[out] length the equilibrium angle, measured in radians
* @param[out] quadraticK 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,
double& quadraticK) const;
/**
* Set the force field parameters for an angle term.
*
* @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 particle2 the index of the second 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 length the equilibrium angle, measured in radians
* @param quadraticK 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);
/**
* Update the per-angle parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setAngleParameters() to modify this object's parameters, then call updateParametersInContext()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-angle parameters. The set of particles involved
* in an angle cannot be changed, nor can new angles be added.
*/
void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const;
protected:
ForceImpl* createImpl() const;
double _globalCubicK, _globalQuarticK, _globalPenticK, _globalSexticK;
private:
class AngleInfo;
std::vector<AngleInfo> angles;
bool usePeriodic;
};
/**
* This is an internal class used to record information about an angle.
* @private
*/
class AmoebaInPlaneAngleForce::AngleInfo {
public:
int particle1, particle2, particle3, particle4;
double length, quadraticK;
AngleInfo() {
particle1 = particle2 = particle3 = particle4 = -1;
length = quadraticK = 0.0;
}
AngleInfo(int particle1, int particle2, int particle3, int particle4, double length, double quadraticK) :
particle1(particle1), particle2(particle2), particle3(particle3), particle4(particle4),
length(length), quadraticK(quadraticK) {
}
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_IN_PLANE_ANGLE_FORCE_H_*/
#ifndef OPENMM_AMOEBA_OUT_OF_PLANE_BEND_FORCE_H_
#define OPENMM_AMOEBA_OUT_OF_PLANE_BEND_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-2016 Stanford University and the Authors. *
* Authors: Mark Friedrichs, 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 "internal/windowsExportAmoeba.h"
#include <vector>
namespace OpenMM {
/**
* This class implements the Amoeba out-of-plane bend interaction.
*
* 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().
* This will have no effect on Contexts that already exist unless you call updateParametersInContext().
*/
class OPENMM_EXPORT_AMOEBA AmoebaOutOfPlaneBendForce : public Force {
public:
/**
* Create an AmoebaOutOfPlaneBendForce.
*/
AmoebaOutOfPlaneBendForce();
/**
* Get the number of out-of-plane bend terms in the potential function
*/
int getNumOutOfPlaneBends() const {
return outOfPlaneBends.size();
}
/**
* Set the global cubic term
*
* @param cubicK the cubic force constant for the angle
*/
void setAmoebaGlobalOutOfPlaneBendCubic(double cubicK);
/**
* Get the global cubic term
*
* @return global cubicK term
*/
double getAmoebaGlobalOutOfPlaneBendCubic() const;
/**
* Set the global cubic term
*
* @param quarticK the quartic force constant for the angle
*/
void setAmoebaGlobalOutOfPlaneBendQuartic(double quarticK);
/**
* Get the global quartic term
*
* @return global quartic term
*/
double getAmoebaGlobalOutOfPlaneBendQuartic() const;
/**
* Set the global pentic term
*
* @param penticK the pentic force constant for the angle
*/
void setAmoebaGlobalOutOfPlaneBendPentic(double penticK);
/**
* Get the global pentic term
*
* @return global penticK term
*/
double getAmoebaGlobalOutOfPlaneBendPentic() const;
/**
* Set the global sextic term
*
* @param sexticK the sextic force constant for the angle
*/
void setAmoebaGlobalOutOfPlaneBendSextic(double sexticK);
/**
* Get the global sextic term
*
* @return global sexticK term
*/
double getAmoebaGlobalOutOfPlaneBendSextic() const;
/**
* Add an out-of-plane bend term to the force field.
*
* @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 particle3 the index of the third particle connected by the outOfPlaneBend
* @param particle4 the index of the fourth particle connected by the outOfPlaneBend
* @param k the force constant for the out-of-plane bend
* @return the index of the out-of-plane bend that was added
*/
int addOutOfPlaneBend(int particle1, int particle2, int particle3, int particle4, double k);
/**
* 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[out] particle1 the index of the first particle connected by the outOfPlaneBend
* @param[out] particle2 the index of the second particle connected by the outOfPlaneBend
* @param[out] particle3 the index of the third particle connected by the outOfPlaneBend
* @param[out] particle4 the index of the fourth particle connected by the outOfPlaneBend
* @param[out] 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;
/**
* 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 particle1 the index of the first 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 particle4 the index of the fourth particle connected by 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);
/**
* Update the per-bend term parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setOutOfPlaneBendParameters() to modify this object's parameters, then call updateParametersInContext()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-bend term parameters. The set of particles involved
* in a term cannot be changed, nor can new terms be added.
*/
void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const;
protected:
ForceImpl* createImpl() const;
double _globalCubicK, _globalQuarticK, _globalPenticK, _globalSexticK;
private:
class OutOfPlaneBendInfo;
std::vector<OutOfPlaneBendInfo> outOfPlaneBends;
bool usePeriodic;
};
/**
* This is an internal class used to record information about a bend.
* @private
*/
class AmoebaOutOfPlaneBendForce::OutOfPlaneBendInfo {
public:
int particle1, particle2, particle3, particle4;
double k;
OutOfPlaneBendInfo() {
particle1 = particle2 = particle3 = particle4 = -1;
k = 0.0;
}
OutOfPlaneBendInfo(int particle1, int particle2, int particle3, int particle4,
double k) :
particle1(particle1), particle2(particle2), particle3(particle3), particle4(particle4), k(k) {
}
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_OUT_OF_PLANE_BEND_FORCE_H_*/
#ifndef OPENMM_AMOEBA_PI_TORSION_FORCE_H_
#define OPENMM_AMOEBA_PI_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-2016 Stanford University and the Authors. *
* Authors: Mark Friedrichs, 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 "internal/windowsExportAmoeba.h"
#include <vector>
namespace OpenMM {
/**
* This class implements the Amoeba pi-torsion interaction.
*
* 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().
* This will have no effect on Contexts that already exist unless you call updateParametersInContext().
*/
class OPENMM_EXPORT_AMOEBA AmoebaPiTorsionForce : public Force {
public:
/**
* Create an AmoebaPiTorsionForce.
*/
AmoebaPiTorsionForce();
/**
* Get the number of pi torsion terms in the potential function
*/
int getNumPiTorsions() const {
return piTorsions.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 particle5 the index of the fifth 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
* @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);
/**
* Get the force field parameters for a torsion term.
*
* @param index the index of the torsion for which to get parameters
* @param[out] particle1 the index of the first particle connected by the torsion
* @param[out] particle2 the index of the second particle connected by the torsion
* @param[out] particle3 the index of the third particle connected by the torsion
* @param[out] particle4 the index of the fourth particle connected by the torsion
* @param[out] particle5 the index of the fifth particle connected by the torsion
* @param[out] particle6 the index of the sixth particle connected by the torsion
* @param[out] 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;
/**
* Set the force field parameters for a pi 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 particle5 the index of the fifth 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
*/
void setPiTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, int particle5, int particle6, double k);
/**
* Update the per-torsion parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setPiTorsionParameters() to modify this object's parameters, then call updateParametersInContext()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-torsion parameters. The set of particles involved
* in a torsion cannot be changed, nor can new torsions be added.
*/
void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const;
protected:
ForceImpl* createImpl() const;
private:
class PiTorsionInfo;
std::vector<PiTorsionInfo> piTorsions;
bool usePeriodic;
};
/**
* This is an internal class used to record information about a torsion.
* @private
*/
class AmoebaPiTorsionForce::PiTorsionInfo {
public:
int particle1, particle2, particle3, particle4, particle5, particle6;
double k;
PiTorsionInfo() {
particle1 = particle2 = particle3 = particle4 = particle5 = particle6 = -1;
k = 0.0;
}
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) {
}
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_PI_TORSION_FORCE_H_*/
#ifndef OPENMM_AMOEBA_STRETCH_BEND_FORCE_H_
#define OPENMM_AMOEBA_STRETCH_BEND_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-2016 Stanford University and the Authors. *
* Authors: Mark Friedrichs, 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 "internal/windowsExportAmoeba.h"
#include <vector>
namespace OpenMM {
/**
* This class implements the Amoeba stretch-bend interaction.
*
* 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().
* This will have no effect on Contexts that already exist unless you call updateParametersInContext().
*/
class OPENMM_EXPORT_AMOEBA AmoebaStretchBendForce : public Force {
public:
/**
* Create an AmoebaStretchBendForce.
*/
AmoebaStretchBendForce();
/**
* Get the number of stretch-bend terms in the potential function
*/
int getNumStretchBends() const {
return stretchBends.size();
}
/**
* Add a stretch-bend term to the force field.
*
* @param particle1 the index of the first particle connected by the stretch-bend
* @param particle2 the index of the second particle connected by the stretch-bend
* @param particle3 the index of the third particle connected by the stretch-bend
* @param lengthAB the equilibrium length of the stretch-bend in bond ab [particle1, 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 k1 the force constant of the product of bond ab and angle a-b-c
* @param k2 the force constant of the product of bond bc and angle a-b-c (optional, default is the same as k1)
* @return the index of the stretch-bend that was added
*/
int addStretchBend(int particle1, int particle2, int particle3, double lengthAB, double lengthCB, double angle,
double k1, double k2);
/**
* Get the force field parameters for a stretch-bend term.
*
* @param index the index of the stretch-bend for which to get parameters
* @param[out] particle1 the index of the first particle connected by the stretch-bend
* @param[out] particle2 the index of the second particle connected by the stretch-bend
* @param[out] particle3 the index of the third particle connected by the stretch-bend
* @param[out] lengthAB the equilibrium length of the stretch-bend in bond ab [particle1, particle2], measured in nm
* @param[out] lengthCB the equilibrium length of the stretch-bend in bond cb [particle3, particle2], measured in nm
* @param[out] angle the equilibrium angle in radians
* @param[out] k1 the force constant of the product of bond ab and angle a-b-c
* @param[out] k2 the force constant of the product of bond bc and angle a-b-c
*/
void getStretchBendParameters(int index, int& particle1, int& particle2, int& particle3, double& lengthAB,
double& lengthCB, double& angle, double& k1, double& k2) const;
/**
* Set the force field parameters for a stretch-bend term.
*
* @param index the index of the stretch-bend for which to set parameters
* @param particle1 the index of the first particle connected by the stretch-bend
* @param particle2 the index of the second particle connected by the stretch-bend
* @param particle3 the index of the third particle connected by the stretch-bend
* @param lengthAB the equilibrium length of the stretch-bend in bond ab [particle1, 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 k1 the force constant of the product of bond ab and angle a-b-c
* @param k2 the force constant of the product of bond bc and angle a-b-c (optional, default is the same as k1)
*/
void setStretchBendParameters(int index, int particle1, int particle2, int particle3,
double lengthAB, double lengthCB, double angle, double k1, double k2);
/**
* Update the per-stretch-bend term parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setStretchBendParameters() to modify this object's parameters, then call updateParametersInContext()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-stretch-bend term parameters. The set of particles involved
* in a term cannot be changed, nor can new terms be added.
*/
void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const;
protected:
ForceImpl* createImpl() const;
private:
class StretchBendInfo;
std::vector<StretchBendInfo> stretchBends;
bool usePeriodic;
};
/**
* This is an internal class used to record information about a stretch-bend.
* @private
*/
class AmoebaStretchBendForce::StretchBendInfo {
public:
int particle1, particle2, particle3;
double lengthAB, lengthCB, angle, k1, k2;
StretchBendInfo() {
particle1 = particle2 = particle3 = -1;
lengthAB = lengthCB = angle = k1 = k2 = 0.0;
}
StretchBendInfo(int particle1, int particle2, int particle3,
double lengthAB, double lengthCB, double angle, double k1, double k2) :
particle1(particle1), particle2(particle2), particle3(particle3),
lengthAB(lengthAB), lengthCB(lengthCB), angle(angle), k1(k1), k2(k2) {
}
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_STRETCH_BEND_FORCE_H_*/
...@@ -43,246 +43,6 @@ ...@@ -43,246 +43,6 @@
namespace OpenMM { namespace OpenMM {
/**
* This kernel is invoked by AmoebaBondForce to calculate the forces acting on the system and the energy of the system.
*/
class CalcAmoebaBondForceKernel : public KernelImpl {
public:
static std::string Name() {
return "CalcAmoebaBondForce";
}
CalcAmoebaBondForceKernel(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 AmoebaBondForce this kernel will be used for
*/
virtual void initialize(const System& system, const AmoebaBondForce& 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;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaBondForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaBondForce& force) = 0;
};
/**
* This kernel is invoked by AmoebaAngleForce to calculate the forces acting on the system and the energy of the system.
*/
class CalcAmoebaAngleForceKernel : public KernelImpl {
public:
static std::string Name() {
return "CalcAmoebaAngleForce";
}
CalcAmoebaAngleForceKernel(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 AmoebaAngleForce this kernel will be used for
*/
virtual void initialize(const System& system, const AmoebaAngleForce& 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;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaAngleForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaAngleForce& force) = 0;
};
/**
* This kernel is invoked by AmoebaInPlaneAngleForce to calculate the forces acting on the system and the energy of the system.
*/
class CalcAmoebaInPlaneAngleForceKernel : public KernelImpl {
public:
static std::string Name() {
return "CalcAmoebaInPlaneAngleForce";
}
CalcAmoebaInPlaneAngleForceKernel(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 AmoebaInPlaneAngleForce this kernel will be used for
*/
virtual void initialize(const System& system, const AmoebaInPlaneAngleForce& 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;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaInPlaneAngleForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaInPlaneAngleForce& force) = 0;
};
/**
* This kernel is invoked by AmoebaTorsionForce to calculate the forces acting on the system and the energy of the system.
*/
class CalcAmoebaPiTorsionForceKernel : public KernelImpl {
public:
static std::string Name() {
return "CalcAmoebaPiTorsionForce";
}
CalcAmoebaPiTorsionForceKernel(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 PiTorsionForce this kernel will be used for
*/
virtual void initialize(const System& system, const AmoebaPiTorsionForce& 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;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaPiTorsionForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaPiTorsionForce& force) = 0;
};
/**
* This kernel is invoked by AmoebaTorsionForce to calculate the forces acting on the system and the energy of the system.
*/
class CalcAmoebaStretchBendForceKernel : public KernelImpl {
public:
static std::string Name() {
return "CalcAmoebaStretchBendForce";
}
CalcAmoebaStretchBendForceKernel(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 StretchBendForce this kernel will be used for
*/
virtual void initialize(const System& system, const AmoebaStretchBendForce& 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;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaStretchBendForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaStretchBendForce& force) = 0;
};
/**
* This kernel is invoked by AmoebaTorsionForce to calculate the forces acting on the system and the energy of the system.
*/
class CalcAmoebaOutOfPlaneBendForceKernel : public KernelImpl {
public:
static std::string Name() {
return "CalcAmoebaOutOfPlaneBendForce";
}
CalcAmoebaOutOfPlaneBendForceKernel(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 OutOfPlaneBendForce this kernel will be used for
*/
virtual void initialize(const System& system, const AmoebaOutOfPlaneBendForce& 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;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaOutOfPlaneBendForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaOutOfPlaneBendForce& force) = 0;
};
/** /**
* This kernel is invoked by AmoebaTorsionTorsionForce to calculate the forces acting on the system and the energy of the system. * This kernel is invoked by AmoebaTorsionTorsionForce to calculate the forces acting on the system and the energy of the system.
*/ */
......
#ifndef OPENMM_AMOEBA_ANGLE_FORCE_IMPL_H_
#define OPENMM_AMOEBA_ANGLE_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/AmoebaAngleForce.h"
#include "openmm/Kernel.h"
#include <utility>
#include <set>
#include <string>
namespace OpenMM {
/**
* This is the internal implementation of AmoebaAngleForce.
*/
class AmoebaAngleForceImpl : public ForceImpl {
public:
AmoebaAngleForceImpl(const AmoebaAngleForce& owner);
~AmoebaAngleForceImpl();
void initialize(ContextImpl& context);
const AmoebaAngleForce& getOwner() const {
return owner;
}
void updateContextState(ContextImpl& context, bool& forcesInvalid) {
// 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();
void updateParametersInContext(ContextImpl& context);
private:
const AmoebaAngleForce& owner;
Kernel kernel;
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_ANGLE_FORCE_IMPL_H_*/
#ifndef OPENMM_AMOEBA_BOND_FORCE_IMPL_H_
#define OPENMM_AMOEBA_BOND_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/AmoebaBondForce.h"
#include "openmm/Kernel.h"
#include <utility>
#include <set>
#include <vector>
#include <string>
namespace OpenMM {
/**
* This is the internal implementation of AmoebaBondForce.
*/
class AmoebaBondForceImpl : public ForceImpl {
public:
AmoebaBondForceImpl(const AmoebaBondForce& owner);
~AmoebaBondForceImpl();
void initialize(ContextImpl& context);
const AmoebaBondForce& getOwner() const {
return owner;
}
void updateContextState(ContextImpl& context, bool& forcesInvalid) {
// 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();
std::vector< std::pair<int, int> > getBondedParticles() const;
void updateParametersInContext(ContextImpl& context);
private:
const AmoebaBondForce& owner;
Kernel kernel;
};
} // namespace OpenMM
#endif /*OPENMM_BOND_FORCE_IMPL_H_*/
#ifndef OPENMM_AMOEBA_IN_PLANE_ANGLE_FORCE_IMPL_H_
#define OPENMM_AMOEBA_IN_PLANE_ANGLE_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/AmoebaInPlaneAngleForce.h"
#include "openmm/Kernel.h"
#include <utility>
#include <set>
#include <string>
namespace OpenMM {
/**
* This is the internal implementation of AmoebaInPlaneAngleForce.
*/
class AmoebaInPlaneAngleForceImpl : public ForceImpl {
public:
AmoebaInPlaneAngleForceImpl(const AmoebaInPlaneAngleForce& owner);
~AmoebaInPlaneAngleForceImpl();
void initialize(ContextImpl& context);
const AmoebaInPlaneAngleForce& getOwner() const {
return owner;
}
void updateContextState(ContextImpl& context, bool& forcesInvalid) {
// 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();
void updateParametersInContext(ContextImpl& context);
private:
const AmoebaInPlaneAngleForce& owner;
Kernel kernel;
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_ANGLE_FORCE_IMPL_H_*/
#ifndef OPENMM_AMOEBA_OUT_OF_PLANE_BEND_FORCE_IMPL_H_
#define OPENMM_AMOEBA_OUT_OF_PLANE_BEND_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/AmoebaOutOfPlaneBendForce.h"
#include "openmm/Kernel.h"
#include <utility>
#include <set>
#include <string>
namespace OpenMM {
/**
* This is the internal implementation of AmoebaOutOfPlaneBendForce.
*/
class AmoebaOutOfPlaneBendForceImpl : public ForceImpl {
public:
AmoebaOutOfPlaneBendForceImpl(const AmoebaOutOfPlaneBendForce& owner);
~AmoebaOutOfPlaneBendForceImpl();
void initialize(ContextImpl& context);
const AmoebaOutOfPlaneBendForce& getOwner() const {
return owner;
}
void updateContextState(ContextImpl& context, bool& forcesInvalid) {
// 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();
void updateParametersInContext(ContextImpl& context);
private:
const AmoebaOutOfPlaneBendForce& owner;
Kernel kernel;
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_OUT_OF_PLANE_BEND_FORCE_IMPL_H_*/
#ifndef OPENMM_AMOEBA_PI_TORSION_FORCE_IMPL_H_
#define OPENMM_AMOEBA_PI_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/AmoebaPiTorsionForce.h"
#include "openmm/Kernel.h"
#include <utility>
#include <set>
#include <string>
namespace OpenMM {
/**
* This is the internal implementation of AmoebaPiTorsionForce.
*/
class AmoebaPiTorsionForceImpl : public ForceImpl {
public:
AmoebaPiTorsionForceImpl(const AmoebaPiTorsionForce& owner);
~AmoebaPiTorsionForceImpl();
void initialize(ContextImpl& context);
const AmoebaPiTorsionForce& getOwner() const {
return owner;
}
void updateContextState(ContextImpl& context, bool& forcesInvalid) {
// 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();
void updateParametersInContext(ContextImpl& context);
private:
const AmoebaPiTorsionForce& owner;
Kernel kernel;
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_PI_TORSION_FORCE_IMPL_H_*/
#ifndef OPENMM_AMOEBA_STRETCH_BEND_FORCE_IMPL_H_
#define OPENMM_AMOEBA_STRETCH_BEND_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/AmoebaStretchBendForce.h"
#include "openmm/Kernel.h"
#include <utility>
#include <set>
#include <string>
namespace OpenMM {
/**
* This is the internal implementation of AmoebaStretchBendForce.
*/
class AmoebaStretchBendForceImpl : public ForceImpl {
public:
AmoebaStretchBendForceImpl(const AmoebaStretchBendForce& owner);
~AmoebaStretchBendForceImpl();
void initialize(ContextImpl& context);
const AmoebaStretchBendForce& getOwner() const {
return owner;
}
void updateContextState(ContextImpl& context, bool& forcesInvalid) {
// 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();
void updateParametersInContext(ContextImpl& context);
private:
const AmoebaStretchBendForce& owner;
Kernel kernel;
};
} // namespace OpenMM
#endif /*OPENMM_AMOEBA_STRETCH_BEND_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-2016 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/AmoebaAngleForce.h"
#include "openmm/internal/AmoebaAngleForceImpl.h"
using namespace OpenMM;
AmoebaAngleForce::AmoebaAngleForce() : usePeriodic(false) {
_globalCubicK = _globalQuarticK = _globalPenticK = _globalSexticK = 0.0;
}
int AmoebaAngleForce::addAngle(int particle1, int particle2, int particle3, double length, double quadraticK) {
angles.push_back(AngleInfo(particle1, particle2, particle3, length, quadraticK));
return angles.size()-1;
}
void AmoebaAngleForce::getAngleParameters(int index, int& particle1, int& particle2, int& particle3,
double& length, double& quadraticK) const {
particle1 = angles[index].particle1;
particle2 = angles[index].particle2;
particle3 = angles[index].particle3;
length = angles[index].length;
quadraticK = angles[index].quadraticK;
}
void AmoebaAngleForce::setAngleParameters(int index, int particle1, int particle2, int particle3,
double length, double quadraticK) {
angles[index].particle1 = particle1;
angles[index].particle2 = particle2;
angles[index].particle3 = particle3;
angles[index].length = length;
angles[index].quadraticK = quadraticK;
}
double AmoebaAngleForce::getAmoebaGlobalAngleCubic() const {
return _globalCubicK;
}
void AmoebaAngleForce::setAmoebaGlobalAngleCubic(double cubicK) {
_globalCubicK = cubicK;
}
double AmoebaAngleForce::getAmoebaGlobalAngleQuartic() const {
return _globalQuarticK;
}
void AmoebaAngleForce::setAmoebaGlobalAngleQuartic(double quarticK) {
_globalQuarticK = quarticK;
}
double AmoebaAngleForce::getAmoebaGlobalAnglePentic() const {
return _globalPenticK;
}
void AmoebaAngleForce::setAmoebaGlobalAnglePentic(double penticK) {
_globalPenticK = penticK;
}
double AmoebaAngleForce::getAmoebaGlobalAngleSextic() const {
return _globalSexticK;
}
void AmoebaAngleForce::setAmoebaGlobalAngleSextic(double sexticK) {
_globalSexticK = sexticK;
}
ForceImpl* AmoebaAngleForce::createImpl() const {
return new AmoebaAngleForceImpl(*this);
}
void AmoebaAngleForce::updateParametersInContext(Context& context) {
dynamic_cast<AmoebaAngleForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
}
void AmoebaAngleForce::setUsesPeriodicBoundaryConditions(bool periodic) {
usePeriodic = periodic;
}
bool AmoebaAngleForce::usesPeriodicBoundaryConditions() const {
return usePeriodic;
}
/* -------------------------------------------------------------------------- *
* 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/ContextImpl.h"
#include "openmm/internal/AmoebaAngleForceImpl.h"
#include "openmm/amoebaKernels.h"
using namespace OpenMM;
using std::pair;
using std::vector;
using std::set;
AmoebaAngleForceImpl::AmoebaAngleForceImpl(const AmoebaAngleForce& owner) : owner(owner) {
}
AmoebaAngleForceImpl::~AmoebaAngleForceImpl() {
}
void AmoebaAngleForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaAngleForceKernel::Name(), context);
kernel.getAs<CalcAmoebaAngleForceKernel>().initialize(context.getSystem(), owner);
}
double AmoebaAngleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0)
return kernel.getAs<CalcAmoebaAngleForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0;
}
std::vector<std::string> AmoebaAngleForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaAngleForceKernel::Name());
return names;
}
void AmoebaAngleForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcAmoebaAngleForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
}
/* -------------------------------------------------------------------------- *
* 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-2016 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/AmoebaBondForce.h"
#include "openmm/internal/AmoebaBondForceImpl.h"
using namespace OpenMM;
AmoebaBondForce::AmoebaBondForce() : usePeriodic(false) {
_globalCubicK = _globalQuarticK = 0.0;
}
int AmoebaBondForce::addBond(int particle1, int particle2, double length, double quadraticK) {
bonds.push_back(BondInfo(particle1, particle2, length, quadraticK));
return bonds.size()-1;
}
void AmoebaBondForce::getBondParameters(int index, int& particle1, int& particle2, double& length, double& quadraticK) const {
particle1 = bonds[index].particle1;
particle2 = bonds[index].particle2;
length = bonds[index].length;
quadraticK = bonds[index].quadraticK;
}
void AmoebaBondForce::setBondParameters(int index, int particle1, int particle2, double length, double quadraticK) {
bonds[index].particle1 = particle1;
bonds[index].particle2 = particle2;
bonds[index].length = length;
bonds[index].quadraticK = quadraticK;
}
void AmoebaBondForce::setAmoebaGlobalBondCubic(double cubicK) {
_globalCubicK = cubicK;
}
void AmoebaBondForce::setAmoebaGlobalBondQuartic(double quarticK) {
_globalQuarticK = quarticK;
}
double AmoebaBondForce::getAmoebaGlobalBondCubic() const {
return _globalCubicK;
}
double AmoebaBondForce::getAmoebaGlobalBondQuartic() const {
return _globalQuarticK;
}
ForceImpl* AmoebaBondForce::createImpl() const {
return new AmoebaBondForceImpl(*this);
}
void AmoebaBondForce::updateParametersInContext(Context& context) {
dynamic_cast<AmoebaBondForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
}
void AmoebaBondForce::setUsesPeriodicBoundaryConditions(bool periodic) {
usePeriodic = periodic;
}
bool AmoebaBondForce::usesPeriodicBoundaryConditions() const {
return usePeriodic;
}
/* -------------------------------------------------------------------------- *
* 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/ContextImpl.h"
#include "openmm/internal/AmoebaBondForceImpl.h"
#include "openmm/amoebaKernels.h"
#include "openmm/Platform.h"
using namespace OpenMM;
using std::pair;
using std::vector;
using std::set;
AmoebaBondForceImpl::AmoebaBondForceImpl(const AmoebaBondForce& owner) : owner(owner) {
}
AmoebaBondForceImpl::~AmoebaBondForceImpl() {
}
void AmoebaBondForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaBondForceKernel::Name(), context);
kernel.getAs<CalcAmoebaBondForceKernel>().initialize(context.getSystem(), owner);
}
double AmoebaBondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0)
return kernel.getAs<CalcAmoebaBondForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0;
}
std::vector<std::string> AmoebaBondForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaBondForceKernel::Name());
return names;
}
vector<pair<int, int> > AmoebaBondForceImpl::getBondedParticles() const {
int numBonds = owner.getNumBonds();
vector<pair<int, int> > bonds(numBonds);
for (int i = 0; i < numBonds; i++) {
double length, k;
owner.getBondParameters(i, bonds[i].first, bonds[i].second, length, k);
}
return bonds;
}
void AmoebaBondForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcAmoebaBondForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
}
/* -------------------------------------------------------------------------- *
* 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-2016 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/AmoebaInPlaneAngleForce.h"
#include "openmm/internal/AmoebaInPlaneAngleForceImpl.h"
using namespace OpenMM;
AmoebaInPlaneAngleForce::AmoebaInPlaneAngleForce() : usePeriodic(false) {
_globalCubicK = _globalQuarticK = _globalPenticK = _globalSexticK = 0.0;
}
int AmoebaInPlaneAngleForce::addAngle(int particle1, int particle2, int particle3, int particle4, double length, double quadraticK) {
angles.push_back(AngleInfo(particle1, particle2, particle3, particle4, length, quadraticK));
return angles.size()-1;
}
void AmoebaInPlaneAngleForce::getAngleParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4,
double& length, double& quadraticK) const {
particle1 = angles[index].particle1;
particle2 = angles[index].particle2;
particle3 = angles[index].particle3;
particle4 = angles[index].particle4;
length = angles[index].length;
quadraticK = angles[index].quadraticK;
}
void AmoebaInPlaneAngleForce::setAngleParameters(int index, int particle1, int particle2, int particle3, int particle4,
double length, double quadraticK) {
angles[index].particle1 = particle1;
angles[index].particle2 = particle2;
angles[index].particle3 = particle3;
angles[index].particle4 = particle4;
angles[index].length = length;
angles[index].quadraticK = quadraticK;
}
void AmoebaInPlaneAngleForce::setAmoebaGlobalInPlaneAngleCubic(double cubicK) {
_globalCubicK = cubicK;
}
void AmoebaInPlaneAngleForce::setAmoebaGlobalInPlaneAngleQuartic(double quarticK) {
_globalQuarticK = quarticK;
}
double AmoebaInPlaneAngleForce::getAmoebaGlobalInPlaneAngleCubic() const {
return _globalCubicK;
}
double AmoebaInPlaneAngleForce::getAmoebaGlobalInPlaneAngleQuartic() const {
return _globalQuarticK;
}
void AmoebaInPlaneAngleForce::setAmoebaGlobalInPlaneAnglePentic(double cubicK) {
_globalPenticK = cubicK;
}
void AmoebaInPlaneAngleForce::setAmoebaGlobalInPlaneAngleSextic(double quarticK) {
_globalSexticK = quarticK;
}
double AmoebaInPlaneAngleForce::getAmoebaGlobalInPlaneAnglePentic() const {
return _globalPenticK;
}
double AmoebaInPlaneAngleForce::getAmoebaGlobalInPlaneAngleSextic() const {
return _globalSexticK;
}
ForceImpl* AmoebaInPlaneAngleForce::createImpl() const {
return new AmoebaInPlaneAngleForceImpl(*this);
}
void AmoebaInPlaneAngleForce::updateParametersInContext(Context& context) {
dynamic_cast<AmoebaInPlaneAngleForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
}
void AmoebaInPlaneAngleForce::setUsesPeriodicBoundaryConditions(bool periodic) {
usePeriodic = periodic;
}
bool AmoebaInPlaneAngleForce::usesPeriodicBoundaryConditions() const {
return usePeriodic;
}
/* -------------------------------------------------------------------------- *
* 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/ContextImpl.h"
#include "openmm/internal/AmoebaInPlaneAngleForceImpl.h"
#include "openmm/amoebaKernels.h"
using namespace OpenMM;
using std::pair;
using std::vector;
using std::set;
AmoebaInPlaneAngleForceImpl::AmoebaInPlaneAngleForceImpl(const AmoebaInPlaneAngleForce& owner) : owner(owner) {
}
AmoebaInPlaneAngleForceImpl::~AmoebaInPlaneAngleForceImpl() {
}
void AmoebaInPlaneAngleForceImpl::initialize(ContextImpl& context) {
kernel = context.getPlatform().createKernel(CalcAmoebaInPlaneAngleForceKernel::Name(), context);
kernel.getAs<CalcAmoebaInPlaneAngleForceKernel>().initialize(context.getSystem(), owner);
}
double AmoebaInPlaneAngleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0)
return kernel.getAs<CalcAmoebaInPlaneAngleForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0;
}
std::vector<std::string> AmoebaInPlaneAngleForceImpl::getKernelNames() {
std::vector<std::string> names;
names.push_back(CalcAmoebaInPlaneAngleForceKernel::Name());
return names;
}
void AmoebaInPlaneAngleForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcAmoebaInPlaneAngleForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
}
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