"plugins/amoeba/vscode:/vscode.git/clone" did not exist on "a47300e6cc73ddf2592bf3ee56c93eb6c8a84861"
AmoebaWcaDispersionForce.cpp 5.16 KB
Newer Older
Mark Friedrichs's avatar
Mark Friedrichs committed
1
/* -------------------------------------------------------------------------- *
2
 *                                 OpenMMAmoeba                               *
Mark Friedrichs's avatar
Mark Friedrichs committed
3
 * -------------------------------------------------------------------------- *
Evan Pretti's avatar
Evan Pretti committed
4
5
 * This is part of the OpenMM molecular simulation toolkit.                   *
 * See https://openmm.org/development.                                        *
Mark Friedrichs's avatar
Mark Friedrichs committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 *                                                                            *
 * Portions copyright (c) 2008-2009 Stanford University and the Authors.      *
 * Authors:                                                                   *
 * Contributors:                                                              *
 *                                                                            *
 * Permission is hereby granted, free of charge, to any person obtaining a    *
 * copy of this software and associated documentation files (the "Software"), *
 * to deal in the Software without restriction, including without limitation  *
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,   *
 * and/or sell copies of the Software, and to permit persons to whom the      *
 * Software is furnished to do so, subject to the following conditions:       *
 *                                                                            *
 * The above copyright notice and this permission notice shall be included in *
 * all copies or substantial portions of the Software.                        *
 *                                                                            *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    *
 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,    *
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR      *
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE  *
 * USE OR OTHER DEALINGS IN THE SOFTWARE.                                     *
 * -------------------------------------------------------------------------- */

#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
32
33
#include "openmm/AmoebaWcaDispersionForce.h"
#include "openmm/internal/AmoebaWcaDispersionForceImpl.h"
Mark Friedrichs's avatar
Mark Friedrichs committed
34
35
36
37
38
#include <cmath>

using namespace OpenMM;

AmoebaWcaDispersionForce::AmoebaWcaDispersionForce() {
39
40
41
42
43
    // Amoeba Water '03 vdW parameters (Diameters in Angstroms; Well depth in kcal/mole)
    // vdw           1               3.4050     0.1100
    // vdw           2               2.6550     0.0135      0.910

    // Convert kcal/mol to kJ/mol
Peter Eastman's avatar
Peter Eastman committed
44
45
    epso = 0.1100 * 4.184;
    epsh = 0.0135 * 4.184;
46
    // Convert A to nm.
Peter Eastman's avatar
Peter Eastman committed
47
48
49
    rmino = 1.7025e-1;
    rminh = 1.3275e-1;
    dispoff = 1.056e-1;
50
    // Convert water number density from water / A^3 to water / nm^3.
Peter Eastman's avatar
Peter Eastman committed
51
    awater = 0.033428e3;
52
53
54
    // No units.
    slevy = 1.0;
    shctd = 0.82;
Mark Friedrichs's avatar
Mark Friedrichs committed
55
56
}

57
58
int AmoebaWcaDispersionForce::addParticle(double radius, double epsilon) {
    parameters.push_back(WcaDispersionInfo(radius, epsilon));
Mark Friedrichs's avatar
Mark Friedrichs committed
59
60
61
    return parameters.size()-1;
}

62
void AmoebaWcaDispersionForce::getParticleParameters(int particleIndex, double& radius, double& epsilon) const {
Mark Friedrichs's avatar
Mark Friedrichs committed
63
64
65
66
    radius          = parameters[particleIndex].radius;
    epsilon         = parameters[particleIndex].epsilon;
}

67
void AmoebaWcaDispersionForce::setParticleParameters(int particleIndex, double radius, double epsilon) {
Mark Friedrichs's avatar
Mark Friedrichs committed
68
69
70
71
    parameters[particleIndex].radius          = radius;
    parameters[particleIndex].epsilon         = epsilon;
}

peastman's avatar
peastman committed
72
double AmoebaWcaDispersionForce::getEpso() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
73
74
75
    return epso;
}

peastman's avatar
peastman committed
76
double AmoebaWcaDispersionForce::getEpsh() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
77
78
79
    return epsh;
}

peastman's avatar
peastman committed
80
double AmoebaWcaDispersionForce::getRmino() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
81
82
83
    return rmino;
}

peastman's avatar
peastman committed
84
double AmoebaWcaDispersionForce::getRminh() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
85
86
87
    return rminh;
}

peastman's avatar
peastman committed
88
double AmoebaWcaDispersionForce::getAwater() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
89
90
91
    return awater;
}

peastman's avatar
peastman committed
92
double AmoebaWcaDispersionForce::getShctd() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
93
94
95
    return shctd;
}

peastman's avatar
peastman committed
96
double AmoebaWcaDispersionForce::getDispoff() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
97
98
99
    return dispoff;
}

peastman's avatar
peastman committed
100
double AmoebaWcaDispersionForce::getSlevy() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
101
102
103
    return slevy;
}

104
void AmoebaWcaDispersionForce::setEpso(double inputEpso) {
Mark Friedrichs's avatar
Mark Friedrichs committed
105
106
107
    epso = inputEpso;
}

108
void AmoebaWcaDispersionForce::setEpsh(double inputEpsh) {
Mark Friedrichs's avatar
Mark Friedrichs committed
109
110
111
    epsh = inputEpsh;
}

112
void AmoebaWcaDispersionForce::setRmino(double inputRmino) {
Mark Friedrichs's avatar
Mark Friedrichs committed
113
114
115
    rmino = inputRmino;
}

116
void AmoebaWcaDispersionForce::setRminh(double inputRminh) {
Mark Friedrichs's avatar
Mark Friedrichs committed
117
118
119
    rminh = inputRminh;
}

120
void AmoebaWcaDispersionForce::setAwater(double inputAwater) {
Mark Friedrichs's avatar
Mark Friedrichs committed
121
122
123
    awater = inputAwater;
}

124
void AmoebaWcaDispersionForce::setShctd(double inputShctd) {
Mark Friedrichs's avatar
Mark Friedrichs committed
125
126
127
    shctd = inputShctd;
}

128
void AmoebaWcaDispersionForce::setDispoff(double inputDispoff) {
Mark Friedrichs's avatar
Mark Friedrichs committed
129
130
131
    dispoff = inputDispoff;
}

132
void AmoebaWcaDispersionForce::setSlevy(double inputSlevy) {
Mark Friedrichs's avatar
Mark Friedrichs committed
133
134
135
    slevy = inputSlevy;
}

136
ForceImpl* AmoebaWcaDispersionForce::createImpl() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
137
138
    return new AmoebaWcaDispersionForceImpl(*this);
}
139
140
141
142

void AmoebaWcaDispersionForce::updateParametersInContext(Context& context) {
    dynamic_cast<AmoebaWcaDispersionForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
}