1 // ******************************************************************************
2 //
3 // Title: Force Field X.
4 // Description: Force Field X - Software for Molecular Biophysics.
5 // Copyright: Copyright (c) Michael J. Schnieders 2001-2025.
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;
39
40 import com.sun.jna.Pointer;
41 import com.sun.jna.ptr.PointerByReference;
42
43 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_Boolean.OpenMM_True;
44 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_addBond;
45 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_addEnergyParameterDerivative;
46 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_addGlobalParameter;
47 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_addGroup;
48 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_addPerBondParameter;
49 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_addTabulatedFunction;
50 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_create;
51 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_destroy;
52 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getBondParameters;
53 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getEnergyFunction;
54 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getEnergyParameterDerivativeName;
55 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getGlobalParameterDefaultValue;
56 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getGlobalParameterName;
57 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getGroupParameters;
58 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getNumBonds;
59 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getNumEnergyParameterDerivatives;
60 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getNumFunctions;
61 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getNumGlobalParameters;
62 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getNumGroups;
63 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getNumGroupsPerBond;
64 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getNumPerBondParameters;
65 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getNumTabulatedFunctions;
66 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getPerBondParameterName;
67 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getTabulatedFunction;
68 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_getTabulatedFunctionName;
69 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_setBondParameters;
70 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_setEnergyFunction;
71 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_setGlobalParameterDefaultValue;
72 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_setGlobalParameterName;
73 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_setGroupParameters;
74 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_setPerBondParameterName;
75 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_setUsesPeriodicBoundaryConditions;
76 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_updateParametersInContext;
77 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_CustomCentroidBondForce_usesPeriodicBoundaryConditions;
78
79 /**
80 * This class is similar to CustomCompoundBondForce, but instead of applying forces between individual particles,
81 * it applies them between the centers of groups of particles. This is useful for a variety of purposes, such as
82 * restraints to keep two molecules from moving too far apart.
83 * <p>
84 * When using this class, you define groups of particles, and the center of each group is calculated as a weighted
85 * average of the particle positions. By default, the particle masses are used as weights, so the center position
86 * is the center of mass. You can optionally specify different weights to use. You then add bonds just as with
87 * CustomCompoundBondForce, but instead of specifying the particles that make up a bond, you specify the groups.
88 * <p>
89 * When creating a CustomCentroidBondForce, you specify the number of groups involved in a bond, and an expression
90 * for the energy of each bond. It may depend on the center positions of individual groups, the distances between
91 * the centers of pairs of groups, the angles formed by sets of three groups, and the dihedral angles formed by
92 * sets of four groups.
93 * <p>
94 * We refer to the groups in a bond as g1, g2, g3, etc. For each bond, CustomCentroidBondForce evaluates a
95 * user supplied algebraic expression to determine the interaction energy. The expression may depend on the
96 * following variables and functions:
97 *
98 * <ul>
99 * <li>x1, y1, z1, x2, y2, z2, etc.: The x, y, and z coordinates of the centers of the groups. For example, x1
100 * is the x coordinate of the center of group g1, and y3 is the y coordinate of the center of group g3.</li>
101 * <li>distance(g1, g2): the distance between the centers of groups g1 and g2 (where "g1" and "g2" may be replaced
102 * by the names of whichever groups you want to calculate the distance between).</li>
103 * <li>angle(g1, g2, g3): the angle formed by the centers of the three specified groups.</li>
104 * <li>dihedral(g1, g2, g3, g4): the dihedral angle formed by the centers of the four specified groups.</li>
105 * </ul>
106 * <p>
107 * The expression also may involve tabulated functions, and may depend on arbitrary global and per-bond parameters.
108 * <p>
109 * To use this class, create a CustomCentroidBondForce object, passing an algebraic expression to the constructor
110 * that defines the interaction energy of each bond. Then call addPerBondParameter() to define per-bond
111 * parameters and addGlobalParameter() to define global parameters. The values of per-bond parameters are specified
112 * as part of the system definition, while values of global parameters may be modified during a simulation by calling
113 * Context::setParameter().
114 * <p>
115 * Next call addGroup() to define the particle groups. Each group is specified by the particles it contains, and
116 * the weights to use when computing the center position.
117 * <p>
118 * Then call addBond() to define bonds and specify their parameter values. After a bond has been added, you can
119 * modify its parameters by calling setBondParameters(). This will have no effect on Contexts that already exist unless
120 * you call updateParametersInContext().
121 * <p>
122 * As an example, the following code creates a CustomCentroidBondForce that implements a harmonic force between the
123 * centers of mass of two groups of particles.
124 *
125 * <pre>
126 * {@code
127 * CustomCentroidBondForce* force = new CustomCentroidBondForce(2, "0.5*k*distance(g1,g2)^2");
128 * force->addPerBondParameter("k");
129 * force->addGroup(particles1);
130 * force->addGroup(particles2);
131 * vector<int> bondGroups;
132 * bondGroups.push_back(0);
133 * bondGroups.push_back(1);
134 * vector<double> bondParameters;
135 * bondParameters.push_back(k);
136 * force->addBond(bondGroups, bondParameters);
137 * }
138 * </pre>
139 * <p>
140 * This class also has the ability to compute derivatives of the potential energy with respect to global parameters.
141 * Call addEnergyParameterDerivative() to request that the derivative with respect to a particular parameter be
142 * computed. You can then query its value in a Context by calling getState() on it.
143 * <p>
144 * Expressions may involve the operators + (add), - (subtract), * (multiply), / (divide), and ˆ (power), and the following
145 * functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, atan2, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta, select. All trigonometric functions
146 * are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise.
147 * select(x,y,z) = z if x = 0, y otherwise.
148 * <p>
149 * This class also supports the functions pointdistance(x1, y1, z1, x2, y2, z2),
150 * pointangle(x1, y1, z1, x2, y2, z2, x3, y3, z3), and pointdihedral(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4).
151 * These functions are similar to distance(), angle(), and dihedral(), but the arguments are the
152 * coordinates of points to perform the calculation based on rather than the names of groups.
153 * This enables more flexible geometric calculations. For example, the following computes the distance
154 * from group g1 to the midpoint between groups g2 and g3.
155 *
156 * <pre>
157 * {@code
158 * CustomCentroidBondForce* force = new CustomCentroidBondForce(3, "pointdistance(x1, y1, z1, (x2+x3)/2, (y2+y3)/2, (z2+z3)/2)");
159 * }
160 * </pre>
161 * <p>
162 * In addition, you can call addTabulatedFunction() to define a new function based on tabulated values. You specify the function by
163 * creating a TabulatedFunction object. That function can then appear in the expression.
164 */
165 public class CustomCentroidBondForce extends Force {
166
167 /**
168 * Create a CustomCentroidBondForce.
169 *
170 * @param numGroups the number of groups used to define each bond
171 * @param energy an algebraic expression giving the interaction energy of each bond as a function
172 * of particle positions, inter-particle distances, angles, and dihedrals, and any global
173 * and per-bond parameters
174 */
175 public CustomCentroidBondForce(int numGroups, String energy) {
176 super(OpenMM_CustomCentroidBondForce_create(numGroups, energy));
177 }
178
179 /**
180 * Add a bond to the force
181 *
182 * @param groups the indices of the groups the bond depends on
183 * @param parameters the list of per-bond parameter values for the new bond
184 * @return the index of the bond that was added
185 */
186 public int addBond(IntArray groups, DoubleArray parameters) {
187 return OpenMM_CustomCentroidBondForce_addBond(pointer, groups.getPointer(), parameters.getPointer());
188 }
189
190 /**
191 * Request that this Force compute the derivative of its energy with respect to a global parameter.
192 * The parameter must have already been added with addGlobalParameter().
193 *
194 * @param name the name of the parameter
195 */
196 public void addEnergyParameterDerivative(String name) {
197 OpenMM_CustomCentroidBondForce_addEnergyParameterDerivative(pointer, name);
198 }
199
200 /**
201 * Add a new global parameter that the interaction may depend on. The default value provided to
202 * this method is the initial value of the parameter in newly created Contexts. You can change
203 * the value at any time by calling setParameter() on the Context.
204 *
205 * @param name the name of the parameter
206 * @param defaultValue the default value of the parameter
207 * @return the index of the parameter that was added
208 */
209 public int addGlobalParameter(String name, double defaultValue) {
210 return OpenMM_CustomCentroidBondForce_addGlobalParameter(pointer, name, defaultValue);
211 }
212
213 /**
214 * Add a particle group.
215 *
216 * @param particles the indices of the particles to include in the group
217 * @param weights the weight to use for each particle when computing the center position.
218 * If this is omitted, then particle masses will be used as weights.
219 * @return the index of the group that was added
220 */
221 public int addGroup(IntArray particles, DoubleArray weights) {
222 return OpenMM_CustomCentroidBondForce_addGroup(pointer, particles.getPointer(), weights.getPointer());
223 }
224
225 /**
226 * Add a new per-bond parameter that the interaction may depend on.
227 *
228 * @param name the name of the parameter
229 * @return the index of the parameter that was added
230 */
231 public int addPerBondParameter(String name) {
232 return OpenMM_CustomCentroidBondForce_addPerBondParameter(pointer, name);
233 }
234
235 /**
236 * Add a tabulated function that may appear in the energy expression.
237 *
238 * @param name the name of the function as it appears in expressions
239 * @param function a TabulatedFunction object defining the function
240 * @return the index of the function that was added
241 */
242 public int addTabulatedFunction(String name, PointerByReference function) {
243 return OpenMM_CustomCentroidBondForce_addTabulatedFunction(pointer, name, function);
244 }
245
246 /**
247 * Destroy the OpenMM CustomCentroidBondForce.
248 */
249 @Override
250 public void destroy() {
251 if (pointer != null) {
252 OpenMM_CustomCentroidBondForce_destroy(pointer);
253 pointer = null;
254 }
255 }
256
257 /**
258 * Get the properties of a bond.
259 *
260 * @param index the index of the bond to get
261 * @param groups the indices of the groups in the bond
262 * @param parameters the list of per-bond parameter values for the bond
263 */
264 public void getBondParameters(int index, IntArray groups, DoubleArray parameters) {
265 OpenMM_CustomCentroidBondForce_getBondParameters(pointer, index, groups.getPointer(), parameters.getPointer());
266 }
267
268 /**
269 * Get the algebraic expression that gives the interaction energy of each bond
270 *
271 * @return The energy function expression.
272 */
273 public String getEnergyFunction() {
274 Pointer p = OpenMM_CustomCentroidBondForce_getEnergyFunction(pointer);
275 if (p == null) {
276 return null;
277 }
278 return p.getString(0);
279 }
280
281 /**
282 * Get the name of a global parameter with respect to which this Force should compute the
283 * derivative of the energy.
284 *
285 * @param index the index of the parameter derivative, between 0 and getNumEnergyParameterDerivatives()
286 * @return the parameter name
287 */
288 public String getEnergyParameterDerivativeName(int index) {
289 Pointer p = OpenMM_CustomCentroidBondForce_getEnergyParameterDerivativeName(pointer, index);
290 if (p == null) {
291 return null;
292 }
293 return p.getString(0);
294 }
295
296 /**
297 * Get the default value of a global parameter.
298 *
299 * @param index the index of the parameter for which to get the default value
300 * @return the parameter default value
301 */
302 public double getGlobalParameterDefaultValue(int index) {
303 return OpenMM_CustomCentroidBondForce_getGlobalParameterDefaultValue(pointer, index);
304 }
305
306 /**
307 * Get the name of a global parameter.
308 *
309 * @param index the index of the parameter for which to get the name
310 * @return the parameter name
311 */
312 public String getGlobalParameterName(int index) {
313 Pointer p = OpenMM_CustomCentroidBondForce_getGlobalParameterName(pointer, index);
314 if (p == null) {
315 return null;
316 }
317 return p.getString(0);
318 }
319
320 /**
321 * Get the properties of a group.
322 *
323 * @param index the index of the group to get
324 * @param particles the indices of the particles in the group
325 * @param weights the weight used for each particle when computing the center position.
326 * If no weights were specified, this vector will be empty indicating that particle
327 * masses should be used as weights.
328 */
329 public void getGroupParameters(int index, IntArray particles, DoubleArray weights) {
330 OpenMM_CustomCentroidBondForce_getGroupParameters(pointer, index, particles.getPointer(), weights.getPointer());
331 }
332
333 /**
334 * Get the number of bonds for which force field parameters have been defined.
335 *
336 * @return The number of bonds.
337 */
338 public int getNumBonds() {
339 return OpenMM_CustomCentroidBondForce_getNumBonds(pointer);
340 }
341
342 /**
343 * Get the number of global parameters with respect to which the derivative of the energy
344 * should be computed.
345 *
346 * @return The number of parameters.
347 */
348 public int getNumEnergyParameterDerivatives() {
349 return OpenMM_CustomCentroidBondForce_getNumEnergyParameterDerivatives(pointer);
350 }
351
352 /**
353 * Get the number of tabulated functions that have been defined.
354 *
355 * @return The number of tabulated functions.
356 * @deprecated This method exists only for backward compatibility. Use getNumTabulatedFunctions() instead.
357 */
358 @Deprecated
359 public int getNumFunctions() {
360 return OpenMM_CustomCentroidBondForce_getNumFunctions(pointer);
361 }
362
363 /**
364 * Get the number of global parameters that the interaction depends on.
365 *
366 * @return The number of global parameters.
367 */
368 public int getNumGlobalParameters() {
369 return OpenMM_CustomCentroidBondForce_getNumGlobalParameters(pointer);
370 }
371
372 /**
373 * Get the number of particle groups that have been defined.
374 *
375 * @return The number of groups.
376 */
377 public int getNumGroups() {
378 return OpenMM_CustomCentroidBondForce_getNumGroups(pointer);
379 }
380
381 /**
382 * Get the number of groups used to define each bond.
383 *
384 * @return The number of groups per bond.
385 */
386 public int getNumGroupsPerBond() {
387 return OpenMM_CustomCentroidBondForce_getNumGroupsPerBond(pointer);
388 }
389
390 /**
391 * Get the number of per-bond parameters that the interaction depends on.
392 *
393 * @return The number of per-bond parameters.
394 */
395 public int getNumPerBondParameters() {
396 return OpenMM_CustomCentroidBondForce_getNumPerBondParameters(pointer);
397 }
398
399 /**
400 * Get the number of tabulated functions that have been defined.
401 *
402 * @return The number of tabulated functions.
403 */
404 public int getNumTabulatedFunctions() {
405 return OpenMM_CustomCentroidBondForce_getNumTabulatedFunctions(pointer);
406 }
407
408 /**
409 * Get the name of a per-bond parameter.
410 *
411 * @param index the index of the parameter for which to get the name
412 * @return the parameter name
413 */
414 public String getPerBondParameterName(int index) {
415 Pointer p = OpenMM_CustomCentroidBondForce_getPerBondParameterName(pointer, index);
416 if (p == null) {
417 return null;
418 }
419 return p.getString(0);
420 }
421
422 /**
423 * Get a reference to a tabulated function that may appear in the energy expression.
424 *
425 * @param index the index of the function to get
426 * @return the TabulatedFunction object defining the function
427 */
428 public PointerByReference getTabulatedFunction(int index) {
429 return OpenMM_CustomCentroidBondForce_getTabulatedFunction(pointer, index);
430 }
431
432 /**
433 * Get the name of a tabulated function that may appear in the energy expression.
434 *
435 * @param index the index of the function to get
436 * @return the name of the function as it appears in expressions
437 */
438 public String getTabulatedFunctionName(int index) {
439 Pointer p = OpenMM_CustomCentroidBondForce_getTabulatedFunctionName(pointer, index);
440 if (p == null) {
441 return null;
442 }
443 return p.getString(0);
444 }
445
446 /**
447 * Set the properties of a bond.
448 *
449 * @param index the index of the bond to set
450 * @param groups the indices of the groups in the bond
451 * @param parameters the list of per-bond parameter values for the bond
452 */
453 public void setBondParameters(int index, IntArray groups, DoubleArray parameters) {
454 OpenMM_CustomCentroidBondForce_setBondParameters(pointer, index, groups.getPointer(), parameters.getPointer());
455 }
456
457 /**
458 * Set the algebraic expression that gives the interaction energy of each bond
459 *
460 * @param energy The energy function expression.
461 */
462 public void setEnergyFunction(String energy) {
463 OpenMM_CustomCentroidBondForce_setEnergyFunction(pointer, energy);
464 }
465
466 /**
467 * Set the default value of a global parameter.
468 *
469 * @param index the index of the parameter for which to set the default value
470 * @param defaultValue the default value of the parameter
471 */
472 public void setGlobalParameterDefaultValue(int index, double defaultValue) {
473 OpenMM_CustomCentroidBondForce_setGlobalParameterDefaultValue(pointer, index, defaultValue);
474 }
475
476 /**
477 * Set the name of a global parameter.
478 *
479 * @param index the index of the parameter for which to set the name
480 * @param name the name of the parameter
481 */
482 public void setGlobalParameterName(int index, String name) {
483 OpenMM_CustomCentroidBondForce_setGlobalParameterName(pointer, index, name);
484 }
485
486 /**
487 * Set the properties of a group.
488 *
489 * @param index the index of the group to set
490 * @param particles the indices of the particles in the group
491 * @param weights the weight to use for each particle when computing the center position.
492 * If this is omitted, then particle masses will be used as weights.
493 */
494 public void setGroupParameters(int index, IntArray particles, DoubleArray weights) {
495 OpenMM_CustomCentroidBondForce_setGroupParameters(pointer, index, particles.getPointer(), weights.getPointer());
496 }
497
498 /**
499 * Set the name of a per-bond parameter.
500 *
501 * @param index the index of the parameter for which to set the name
502 * @param name the name of the parameter
503 */
504 public void setPerBondParameterName(int index, String name) {
505 OpenMM_CustomCentroidBondForce_setPerBondParameterName(pointer, index, name);
506 }
507
508 /**
509 * Set whether this force should apply periodic boundary conditions when calculating displacements.
510 * Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
511 *
512 * @param periodic 1 if periodic boundary conditions should be used, 0 if not.
513 */
514 public void setUsesPeriodicBoundaryConditions(int periodic) {
515 OpenMM_CustomCentroidBondForce_setUsesPeriodicBoundaryConditions(pointer, periodic);
516 }
517
518 /**
519 * Update the per-bond parameters and tabulated functions in a Context to match those stored in this Force object. This method provides
520 * an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
521 * Simply call setBondParameters() to modify this object's parameters, then call updateParametersInContext()
522 * to copy them over to the Context.
523 * <p>
524 * This method has several limitations. The only information it updates is the values of per-bond parameters and tabulated
525 * functions. All other aspects of the Force (such as the energy function) are unaffected and can only be changed by reinitializing
526 * the Context. Neither the definitions of groups nor the set of groups involved in a bond can be changed, nor can new
527 * bonds be added. Also, while the tabulated values of a function can change, everything else about it (its dimensions,
528 * the data range) must not be changed.
529 *
530 * @param context the OpenMM context.
531 */
532 public void updateParametersInContext(Context context) {
533 if (context.hasContextPointer()) {
534 OpenMM_CustomCentroidBondForce_updateParametersInContext(pointer, context.getPointer());
535 }
536 }
537
538 /**
539 * Returns whether this force makes use of periodic boundary
540 * conditions.
541 *
542 * @return true if force uses PBC and false otherwise
543 */
544 @Override
545 public boolean usesPeriodicBoundaryConditions() {
546 int pbc = OpenMM_CustomCentroidBondForce_usesPeriodicBoundaryConditions(pointer);
547 return pbc == OpenMM_True;
548 }
549 }