AmoebaWcaDispersionForce.cpp 4.98 KB
Newer Older
Mark Friedrichs's avatar
Mark Friedrichs committed
1
/* -------------------------------------------------------------------------- *
2
 *                                 OpenMMAmoeba                               *
Mark Friedrichs's avatar
Mark Friedrichs committed
3
4
5
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
32
33
 * -------------------------------------------------------------------------- *
 * This is part of the OpenMM molecular simulation toolkit originating from   *
 * Simbios, the NIH National Center for Physics-Based Simulation of           *
 * Biological Structures at Stanford, funded under the NIH Roadmap for        *
 * Medical Research, grant U54 GM072970. See https://simtk.org.               *
 *                                                                            *
 * Portions copyright (c) 2008-2009 Stanford University and the Authors.      *
 * Authors:                                                                   *
 * Contributors:                                                              *
 *                                                                            *
 * Permission is hereby granted, free of charge, to any person obtaining a    *
 * copy of this software and associated documentation files (the "Software"), *
 * to deal in the Software without restriction, including without limitation  *
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,   *
 * and/or sell copies of the Software, and to permit persons to whom the      *
 * Software is furnished to do so, subject to the following conditions:       *
 *                                                                            *
 * The above copyright notice and this permission notice shall be included in *
 * all copies or substantial portions of the Software.                        *
 *                                                                            *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    *
 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,    *
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR      *
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE  *
 * USE OR OTHER DEALINGS IN THE SOFTWARE.                                     *
 * -------------------------------------------------------------------------- */

#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
34
35
#include "openmm/AmoebaWcaDispersionForce.h"
#include "openmm/internal/AmoebaWcaDispersionForceImpl.h"
Mark Friedrichs's avatar
Mark Friedrichs committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <cmath>

using namespace OpenMM;

AmoebaWcaDispersionForce::AmoebaWcaDispersionForce() {
    epso      = 0.1100;
    epsh      = 0.0135;
    rmino     = 1.7025;
    rminh     = 1.3275;
    awater    = 0.033428;
    slevy     = 1.0;
    shctd     = 0.81;
    dispoff   = 0.26;
}

int AmoebaWcaDispersionForce::addParticle( double radius, double epsilon ) {
    parameters.push_back(WcaDispersionInfo( radius, epsilon));
    return parameters.size()-1;
}

void AmoebaWcaDispersionForce::getParticleParameters(int particleIndex, double& radius, double& epsilon ) const {
    radius          = parameters[particleIndex].radius;
    epsilon         = parameters[particleIndex].epsilon;
}

void AmoebaWcaDispersionForce::setParticleParameters(int particleIndex, double radius, double epsilon ) {
    parameters[particleIndex].radius          = radius;
    parameters[particleIndex].epsilon         = epsilon;
}

peastman's avatar
peastman committed
66
double AmoebaWcaDispersionForce::getEpso() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
67
68
69
    return epso;
}

peastman's avatar
peastman committed
70
double AmoebaWcaDispersionForce::getEpsh() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
71
72
73
    return epsh;
}

peastman's avatar
peastman committed
74
double AmoebaWcaDispersionForce::getRmino() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
75
76
77
    return rmino;
}

peastman's avatar
peastman committed
78
double AmoebaWcaDispersionForce::getRminh() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
79
80
81
    return rminh;
}

peastman's avatar
peastman committed
82
double AmoebaWcaDispersionForce::getAwater() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
83
84
85
    return awater;
}

peastman's avatar
peastman committed
86
double AmoebaWcaDispersionForce::getShctd() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
87
88
89
    return shctd;
}

peastman's avatar
peastman committed
90
double AmoebaWcaDispersionForce::getDispoff() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
91
92
93
    return dispoff;
}

peastman's avatar
peastman committed
94
double AmoebaWcaDispersionForce::getSlevy() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
    return slevy;
}

void AmoebaWcaDispersionForce::setEpso( double inputEpso ){
    epso = inputEpso;
}

void AmoebaWcaDispersionForce::setEpsh( double inputEpsh ){
    epsh = inputEpsh;
}

void AmoebaWcaDispersionForce::setRmino( double inputRmino ){
    rmino = inputRmino;
}

void AmoebaWcaDispersionForce::setRminh( double inputRminh ){
    rminh = inputRminh;
}

void AmoebaWcaDispersionForce::setAwater( double inputAwater ){
    awater = inputAwater;
}

void AmoebaWcaDispersionForce::setShctd( double inputShctd ){
    shctd = inputShctd;
}

void AmoebaWcaDispersionForce::setDispoff( double inputDispoff ){
    dispoff = inputDispoff;
}

void AmoebaWcaDispersionForce::setSlevy( double inputSlevy ){
    slevy = inputSlevy;
}

130
ForceImpl* AmoebaWcaDispersionForce::createImpl() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
131
132
    return new AmoebaWcaDispersionForceImpl(*this);
}
133
134
135
136

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