"...src/kernels/kCalculateAmoebaCudaFixedEAndGkFields.cu" did not exist on "cd93e5e03994ef183ea22ec0eb132f5bfc50fe7e"
AmoebaInPlaneAngleForce.h 9.2 KB
Newer Older
1
2
#ifndef OPENMM_AMOEBA_IN_PLANE_ANGLE_FORCE_H_
#define OPENMM_AMOEBA_IN_PLANE_ANGLE_FORCE_H_
Mark Friedrichs's avatar
Mark Friedrichs committed
3
4

/* -------------------------------------------------------------------------- *
5
 *                              OpenMMAmoeba                                  *
Mark Friedrichs's avatar
Mark Friedrichs committed
6
7
8
9
10
11
 * -------------------------------------------------------------------------- *
 * 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.               *
 *                                                                            *
12
 * Portions copyright (c) 2008-2016 Stanford University and the Authors.      *
13
 * Authors: Mark Friedrichs, Peter Eastman                                    *
Mark Friedrichs's avatar
Mark Friedrichs committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * 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"
36
#include "internal/windowsExportAmoeba.h"
Mark Friedrichs's avatar
Cleanup  
Mark Friedrichs committed
37
#include <vector>
Mark Friedrichs's avatar
Mark Friedrichs committed
38
39
40
41

namespace OpenMM {

/**
42
 * This class implements an interaction at trigonal centers corresponding to the projected in-plane angle bend energy
43
44
45
46
 * 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.
 * 
47
 * To use it, create an AmoebaInPlaneAngleForce object then call addAngle() once for each angle.  After
48
 * an angle has been added, you can modify its force field parameters by calling setAngleParameters().
49
 * This will have no effect on Contexts that already exist unless you call updateParametersInContext().
Mark Friedrichs's avatar
Mark Friedrichs committed
50
51
 */

52
class OPENMM_EXPORT_AMOEBA AmoebaInPlaneAngleForce : public Force {
Mark Friedrichs's avatar
Cleanup  
Mark Friedrichs committed
53

Mark Friedrichs's avatar
Mark Friedrichs committed
54
public:
Mark Friedrichs's avatar
Cleanup  
Mark Friedrichs committed
55

Mark Friedrichs's avatar
Mark Friedrichs committed
56
    /**
57
     * Create an AmoebaAngleForce.
Mark Friedrichs's avatar
Mark Friedrichs committed
58
     */
59
    AmoebaInPlaneAngleForce();
Mark Friedrichs's avatar
Mark Friedrichs committed
60
61

    /**
62
     * Get the number of in-plane angle terms in the potential function
Mark Friedrichs's avatar
Mark Friedrichs committed
63
64
65
66
67
68
69
70
     */
    int getNumAngles() const {
        return angles.size();
    }

    /**
     * Set the global cubic term
     * 
71
     * @param cubicK        the cubic force constant for the angle
Mark Friedrichs's avatar
Mark Friedrichs committed
72
     */
73
    void setAmoebaGlobalInPlaneAngleCubic(double cubicK);
Mark Friedrichs's avatar
Mark Friedrichs committed
74
75
76
77
78
79

    /**
     * Get the global cubic term
     * 
     * @return global cubicK term
     */
peastman's avatar
peastman committed
80
    double getAmoebaGlobalInPlaneAngleCubic() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
81
82

    /**
83
     * Set the global quartic term
Mark Friedrichs's avatar
Mark Friedrichs committed
84
     * 
85
     * @param quarticK the quartic force constant for the angle
Mark Friedrichs's avatar
Mark Friedrichs committed
86
     */
87
    void setAmoebaGlobalInPlaneAngleQuartic(double quarticK);
Mark Friedrichs's avatar
Mark Friedrichs committed
88
89
90
91
92
93

    /**
     * Get the global quartic term
     * 
     * @return global  quartic term
     */
peastman's avatar
peastman committed
94
    double getAmoebaGlobalInPlaneAngleQuartic() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
95
96
97
98

    /**
     * Set the global pentic term
     * 
99
     * @param penticK the pentic force constant for the angle
Mark Friedrichs's avatar
Mark Friedrichs committed
100
     */
101
    void setAmoebaGlobalInPlaneAnglePentic(double penticK);
Mark Friedrichs's avatar
Mark Friedrichs committed
102
103
104
105
106
107

    /**
     * Get the global pentic term
     * 
     * @return global penticK term
     */
peastman's avatar
peastman committed
108
    double getAmoebaGlobalInPlaneAnglePentic() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
109
110
111
112

    /**
     * Set the global sextic term
     * 
113
     * @param sexticK       the sextic force constant for the angle
Mark Friedrichs's avatar
Mark Friedrichs committed
114
     */
115
    void setAmoebaGlobalInPlaneAngleSextic(double sexticK);
Mark Friedrichs's avatar
Mark Friedrichs committed
116
117
118
119
120
121

    /**
     * Get the global sextic term
     * 
     * @return global  sextic term
     */
peastman's avatar
peastman committed
122
    double getAmoebaGlobalInPlaneAngleSextic() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
123
124

    /**
125
     * Add an angle term to the force field.
Mark Friedrichs's avatar
Mark Friedrichs committed
126
127
128
129
130
     *
     * @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
131
     * @param length        the equilibrium angle, measured in radians
Robert McGibbon's avatar
Robert McGibbon committed
132
     * @param quadraticK    the quadratic force constant for the angle measured in kJ/mol/radian^2
Mark Friedrichs's avatar
Mark Friedrichs committed
133
134
135
     * @return the index of the angle that was added
     */
    int addAngle(int particle1, int particle2, int particle3, int particle4, double length, 
136
                 double quadraticK);
Mark Friedrichs's avatar
Mark Friedrichs committed
137
138

    /**
139
     * Get the force field parameters for an angle term.
Mark Friedrichs's avatar
Mark Friedrichs committed
140
     * 
Robert McGibbon's avatar
Robert McGibbon committed
141
142
143
144
145
146
147
     * @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
Mark Friedrichs's avatar
Mark Friedrichs committed
148
149
     */
    void getAngleParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, double& length,
150
                            double& quadraticK) const;
Mark Friedrichs's avatar
Mark Friedrichs committed
151
152

    /**
153
     * Set the force field parameters for an angle term.
Mark Friedrichs's avatar
Mark Friedrichs committed
154
155
156
157
158
159
     * 
     * @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
160
     * @param length        the equilibrium angle, measured in radians
Robert McGibbon's avatar
Robert McGibbon committed
161
     * @param quadraticK    the quadratic force constant for the angle, measured in kJ/mol/radian^2
Mark Friedrichs's avatar
Mark Friedrichs committed
162
     */
163
    void setAngleParameters(int index, int particle1, int particle2, int particle3, int particle4, double length, double quadraticK);
164
165
166
    /**
     * 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.
peastman's avatar
peastman committed
167
     * Simply call setAngleParameters() to modify this object's parameters, then call updateParametersInContext()
168
169
170
171
172
173
     * 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);
174
175
176
177
178
    /**
     * 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);
179
180
181
182
    /**
     * Returns whether or not this force makes use of periodic boundary
     * conditions.
     *
183
     * @returns true if force uses PBC and false otherwise
184
     */
185
    bool usesPeriodicBoundaryConditions() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
186
protected:
187
    ForceImpl* createImpl() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
188
189
190
191
    double _globalCubicK, _globalQuarticK, _globalPenticK, _globalSexticK;
private:
    class AngleInfo;
    std::vector<AngleInfo> angles;
192
    bool usePeriodic;
Mark Friedrichs's avatar
Mark Friedrichs committed
193
194
};

195
196
197
198
/**
 * This is an internal class used to record information about an angle.
 * @private
 */
199
class AmoebaInPlaneAngleForce::AngleInfo {
Mark Friedrichs's avatar
Mark Friedrichs committed
200
201
202
203
204
205
206
public:
    int particle1, particle2, particle3, particle4;
    double length, quadraticK;
    AngleInfo() {
        particle1 = particle2  = particle3 = particle4 = -1;
        length    = quadraticK = 0.0;
    }
207
    AngleInfo(int particle1, int particle2, int particle3, int particle4, double length, double  quadraticK) :
Mark Friedrichs's avatar
Mark Friedrichs committed
208
209
210
211
212
213
214
        particle1(particle1), particle2(particle2), particle3(particle3), particle4(particle4),
        length(length), quadraticK(quadraticK) {
    }
};

} // namespace OpenMM

215
#endif /*OPENMM_AMOEBA_IN_PLANE_ANGLE_FORCE_H_*/