"platforms/vscode:/vscode.git/clone" did not exist on "c300870aee44ab659d908fdd2bb8edcc40e034ae"
AmoebaGeneralizedKirkwoodForce.cpp 5.62 KB
Newer Older
Mark Friedrichs's avatar
Mark Friedrichs committed
1
2
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
/* -------------------------------------------------------------------------- *
 *                                   OpenMM                                   *
 * -------------------------------------------------------------------------- *
 * 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: 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"
34
35
#include "openmm/AmoebaGeneralizedKirkwoodForce.h"
#include "openmm/internal/AmoebaGeneralizedKirkwoodForceImpl.h"
Mark Friedrichs's avatar
Mark Friedrichs committed
36
37
38

using namespace OpenMM;

39
40
41
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
42
43
44
45
     surfaceAreaFactor = -6.0* 3.1415926535*0.0216*1000.0*0.4184;
}

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

50
51
52
53
54
55
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
56
57
58
    charge = particles[index].charge;
    radius = particles[index].radius;
    scalingFactor = particles[index].scalingFactor;
59
60
    descreenRadius = particles[index].descreenRadius;
    neckFactor = particles[index].neckFactor;
Mark Friedrichs's avatar
Mark Friedrichs committed
61
62
}

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

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

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

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

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

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

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

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

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

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

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

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

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