View Javadoc
1   // ******************************************************************************
2   //
3   // Title:       Force Field X.
4   // Description: Force Field X - Software for Molecular Biophysics.
5   // Copyright:   Copyright (c) Michael J. Schnieders 2001-2024.
6   //
7   // This file is part of Force Field X.
8   //
9   // Force Field X is free software; you can redistribute it and/or modify it
10  // under the terms of the GNU General Public License version 3 as published by
11  // the Free Software Foundation.
12  //
13  // Force Field X is distributed in the hope that it will be useful, but WITHOUT
14  // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16  // details.
17  //
18  // You should have received a copy of the GNU General Public License along with
19  // Force Field X; if not, write to the Free Software Foundation, Inc., 59 Temple
20  // Place, Suite 330, Boston, MA 02111-1307 USA
21  //
22  // Linking this library statically or dynamically with other modules is making a
23  // combined work based on this library. Thus, the terms and conditions of the
24  // GNU General Public License cover the whole combination.
25  //
26  // As a special exception, the copyright holders of this library give you
27  // permission to link this library with independent modules to produce an
28  // executable, regardless of the license terms of these independent modules, and
29  // to copy and distribute the resulting executable under terms of your choice,
30  // provided that you also meet, for each linked independent module, the terms
31  // and conditions of the license of that module. An independent module is a
32  // module which is not derived from or based on this library. If you modify this
33  // library, you may extend this exception to your version of the library, but
34  // you are not obligated to do so. If you do not wish to do so, delete this
35  // exception statement from your version.
36  //
37  // ******************************************************************************
38  package ffx.openmm.amoeba;
39  
40  import ffx.openmm.Context;
41  import ffx.openmm.Force;
42  
43  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_addParticle_1;
44  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_create;
45  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_destroy;
46  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_setDielectricOffset;
47  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_setIncludeCavityTerm;
48  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_setParticleParameters_1;
49  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_setProbeRadius;
50  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_setSoluteDielectric;
51  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_setSolventDielectric;
52  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_setSurfaceAreaFactor;
53  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_setTanhParameters;
54  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_setTanhRescaling;
55  import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaGeneralizedKirkwoodForce_updateParametersInContext;
56  
57  /**
58   * Amoeba Generalized Kirkwood Force.
59   */
60  public class GeneralizedKirkwoodForce extends Force {
61  
62    public GeneralizedKirkwoodForce() {
63      pointer = OpenMM_AmoebaGeneralizedKirkwoodForce_create();
64    }
65  
66    /**
67     * Set the solvent dielectric constant.
68     *
69     * @param dielectric The solvent dielectric constant.
70     */
71    public void setSolventDielectric(double dielectric) {
72      OpenMM_AmoebaGeneralizedKirkwoodForce_setSolventDielectric(pointer, dielectric);
73    }
74  
75    /**
76     * Set the solute dielectric constant.
77     *
78     * @param dielectric The solute dielectric constant.
79     */
80    public void setSoluteDielectric(double dielectric) {
81      OpenMM_AmoebaGeneralizedKirkwoodForce_setSoluteDielectric(pointer, dielectric);
82    }
83  
84    /**
85     * Set the dielectric offset.
86     *
87     * @param offset The dielectric offset.
88     */
89    public void setDielectricOffset(double offset) {
90      OpenMM_AmoebaGeneralizedKirkwoodForce_setDielectricOffset(pointer, offset);
91    }
92  
93    /**
94     * Set the tanh rescaling.
95     *
96     * @param tanhRescale The tanh rescaling.
97     */
98    public void setTanhRescaling(int tanhRescale) {
99      OpenMM_AmoebaGeneralizedKirkwoodForce_setTanhRescaling(pointer, tanhRescale);
100   }
101 
102   /**
103    * Set the tanh parameters.
104    *
105    * @param beta0 The tanh parameter beta0.
106    * @param beta1 The tanh parameter beta1.
107    * @param beta2 The tanh parameter beta2.
108    */
109   public void setTanhParameters(double beta0, double beta1, double beta2) {
110     OpenMM_AmoebaGeneralizedKirkwoodForce_setTanhParameters(pointer, beta0, beta1, beta2);
111   }
112 
113   /**
114    * Set the probe radius.
115    *
116    * @param radius The probe radius.
117    */
118   public void setProbeRadius(double radius) {
119     OpenMM_AmoebaGeneralizedKirkwoodForce_setProbeRadius(pointer, radius);
120   }
121 
122   /**
123    * Set the include cavity term.
124    *
125    * @param includeCavityTerm The include cavity term.
126    */
127   public void setIncludeCavityTerm(int includeCavityTerm) {
128     OpenMM_AmoebaGeneralizedKirkwoodForce_setIncludeCavityTerm(pointer, includeCavityTerm);
129   }
130 
131   /**
132    * Set the surface area factor.
133    *
134    * @param surfaceAreaFactor The surface area factor.
135    */
136   public void setSurfaceAreaFactor(double surfaceAreaFactor) {
137     OpenMM_AmoebaGeneralizedKirkwoodForce_setSurfaceAreaFactor(pointer, surfaceAreaFactor);
138   }
139 
140   /**
141    * Add a particle to the force.
142    *
143    * @param charge   The charge of the particle.
144    * @param radius   The radius of the particle.
145    * @param hctScale The hctScale of the particle.
146    * @param descreen The descreen of the particle.
147    * @param neck     The neck of the particle.
148    */
149   public void addParticle_1(double charge, double radius, double hctScale, double descreen, double neck) {
150     OpenMM_AmoebaGeneralizedKirkwoodForce_addParticle_1(pointer, charge, radius, hctScale, descreen, neck);
151   }
152 
153   /**
154    * Set the particle parameters.
155    *
156    * @param index    The index of the particle.
157    * @param charge   The charge of the particle.
158    * @param radius   The radius of the particle.
159    * @param hctScale The hctScale of the particle.
160    * @param descreen The descreen of the particle.
161    * @param neck     The neck of the particle.
162    */
163   public void setParticleParameters_1(int index, double charge, double radius, double hctScale, double descreen, double neck) {
164     OpenMM_AmoebaGeneralizedKirkwoodForce_setParticleParameters_1(pointer, index, charge, radius, hctScale, descreen, neck);
165   }
166 
167   /**
168    * Update the parameters in the context.
169    *
170    * @param context The OpenMM context.
171    */
172   public void updateParametersInContext(Context context) {
173     if (context.hasContextPointer()) {
174       OpenMM_AmoebaGeneralizedKirkwoodForce_updateParametersInContext(pointer, context.getPointer());
175     }
176   }
177 
178   /**
179    * Destroy the force.
180    */
181   public void destroy() {
182     if (pointer != null) {
183       OpenMM_AmoebaGeneralizedKirkwoodForce_destroy(pointer);
184       pointer = null;
185     }
186   }
187 
188 }