AmoebaGeneralizedKirkwoodForce.cpp 5.46 KB
Newer Older
Mark Friedrichs's avatar
Mark Friedrichs committed
1
2
3
/* -------------------------------------------------------------------------- *
 *                                   OpenMM                                   *
 * -------------------------------------------------------------------------- *
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: Peter Eastman                                                     *
 * Contributors:                                                              *
 *                                                                            *
 * Permission is hereby granted, free of charge, to any person obtaining a    *
 * copy of this software and associated documentation files (the "Software"), *
 * to deal in the Software without restriction, including without limitation  *
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,   *
 * and/or sell copies of the Software, and to permit persons to whom the      *
 * Software is furnished to do so, subject to the following conditions:       *
 *                                                                            *
 * The above copyright notice and this permission notice shall be included in *
 * all copies or substantial portions of the Software.                        *
 *                                                                            *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    *
 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,    *
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR      *
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE  *
 * USE OR OTHER DEALINGS IN THE SOFTWARE.                                     *
 * -------------------------------------------------------------------------- */

#include "openmm/Force.h"
#include "openmm/OpenMMException.h"
32
33
#include "openmm/AmoebaGeneralizedKirkwoodForce.h"
#include "openmm/internal/AmoebaGeneralizedKirkwoodForceImpl.h"
Mark Friedrichs's avatar
Mark Friedrichs committed
34
35
36

using namespace OpenMM;

37
38
39
AmoebaGeneralizedKirkwoodForce::AmoebaGeneralizedKirkwoodForce() :
    solventDielectric(78.3), soluteDielectric(1.0), dielectricOffset(0.009), includeCavityTerm(1), probeRadius(0.14),
    tanhRescaling(false), beta0(0.9563), beta1(0.2578), beta2(0.0810), descreenOffset(0.0) {
Mark Friedrichs's avatar
Mark Friedrichs committed
40
41
42
43
     surfaceAreaFactor = -6.0* 3.1415926535*0.0216*1000.0*0.4184;
}

int AmoebaGeneralizedKirkwoodForce::addParticle(double charge, double radius, double scalingFactor) {
44
    particles.push_back(ParticleInfo(charge, radius, scalingFactor, radius, 0.0));
Mark Friedrichs's avatar
Mark Friedrichs committed
45
46
47
    return particles.size()-1;
}

48
49
50
51
52
53
int AmoebaGeneralizedKirkwoodForce::addParticle(double charge, double radius, double scalingFactor, double descreenRadius, double neckFactor) {
    particles.push_back(ParticleInfo(charge, radius, scalingFactor, descreenRadius, neckFactor));
    return particles.size()-1;
}

void AmoebaGeneralizedKirkwoodForce::getParticleParameters(int index, double& charge, double& radius, double& scalingFactor, double& descreenRadius, double& neckFactor) const {
Mark Friedrichs's avatar
Mark Friedrichs committed
54
55
56
    charge = particles[index].charge;
    radius = particles[index].radius;
    scalingFactor = particles[index].scalingFactor;
57
58
    descreenRadius = particles[index].descreenRadius;
    neckFactor = particles[index].neckFactor;
Mark Friedrichs's avatar
Mark Friedrichs committed
59
60
}

61
void AmoebaGeneralizedKirkwoodForce::setParticleParameters(int index, double charge, double radius, double scalingFactor, double descreenRadius, double neckFactor) {
Mark Friedrichs's avatar
Mark Friedrichs committed
62
63
64
    particles[index].charge = charge;
    particles[index].radius = radius;
    particles[index].scalingFactor = scalingFactor;
65
66
    particles[index].descreenRadius = descreenRadius;
    particles[index].neckFactor = neckFactor;
Mark Friedrichs's avatar
Mark Friedrichs committed
67
}
68

Mark Friedrichs's avatar
Mark Friedrichs committed
69
70
71
72
double AmoebaGeneralizedKirkwoodForce::getDielectricOffset() const {
    return dielectricOffset;
}

73
void AmoebaGeneralizedKirkwoodForce::setDielectricOffset(double inputDielectricOffset) {
Mark Friedrichs's avatar
Mark Friedrichs committed
74
    dielectricOffset = inputDielectricOffset;
75
}
Mark Friedrichs's avatar
Mark Friedrichs committed
76
77
78
79
80

int AmoebaGeneralizedKirkwoodForce::getIncludeCavityTerm() const {
    return includeCavityTerm;
}

81
void AmoebaGeneralizedKirkwoodForce::setIncludeCavityTerm(int inputIncludeCavityTerm) {
Mark Friedrichs's avatar
Mark Friedrichs committed
82
83
84
85
86
87
88
    includeCavityTerm = inputIncludeCavityTerm;
}

double AmoebaGeneralizedKirkwoodForce::getProbeRadius() const {
    return probeRadius;
}

89
void AmoebaGeneralizedKirkwoodForce::setProbeRadius(double inputProbeRadius) {
Mark Friedrichs's avatar
Mark Friedrichs committed
90
91
92
93
94
95
96
    probeRadius = inputProbeRadius;
}

double AmoebaGeneralizedKirkwoodForce::getSurfaceAreaFactor() const {
    return surfaceAreaFactor;
}

97
void AmoebaGeneralizedKirkwoodForce::setSurfaceAreaFactor(double inputSurfaceAreaFactor) {
Mark Friedrichs's avatar
Mark Friedrichs committed
98
99
100
    surfaceAreaFactor = inputSurfaceAreaFactor;
}

101
102
103
104
105
106
107
108
double AmoebaGeneralizedKirkwoodForce::getDescreenOffset() const {
    return descreenOffset;
}

void AmoebaGeneralizedKirkwoodForce::setDescreenOffset(double inputDescreenOffet) {
    descreenOffset = inputDescreenOffet;
}

109
ForceImpl* AmoebaGeneralizedKirkwoodForce::createImpl() const {
Mark Friedrichs's avatar
Mark Friedrichs committed
110
111
    return new AmoebaGeneralizedKirkwoodForceImpl(*this);
}
112
113
114
115

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