Package ffx.openmm
Class System
java.lang.Object
ffx.openmm.System
- Direct Known Subclasses:
OpenMMSystem
This class represents a molecular system. The definition of a System involves
four elements:
- The set of particles in the system
- The forces acting on them
- Pairs of particles whose separation should be constrained to a fixed value
- For periodic systems, the dimensions of the periodic box
The particles and constraints are defined directly by the System object, while forces are defined by objects that extend the Force class. After creating a System, call addParticle() once for each particle, addConstraint() for each constraint, and addForce() for each Force.
In addition, particles may be designated as "virtual sites". These are particles whose positions are computed automatically based on the positions of other particles. To define a virtual site, call setVirtualSite(), passing in a VirtualSite object that defines the rules for computing its position.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
addConstraint
(int particle1, int particle2, double distance) Add a constraint to the system.int
Add a force to the system.int
addParticle
(double mass) Add a particle to the System.void
destroy()
Destroy the system.void
getConstraintParameters
(int index, com.sun.jna.ptr.IntByReference particle1, com.sun.jna.ptr.IntByReference particle2, com.sun.jna.ptr.DoubleByReference distance) Get the parameters defining a constraint.void
getConstraintParameters
(int index, IntBuffer particle1, IntBuffer particle2, DoubleBuffer distance) Get the parameters defining a constraint.void
getDefaultPeriodicBoxVectors
(edu.uiowa.jopenmm.OpenMM_Vec3 a, edu.uiowa.jopenmm.OpenMM_Vec3 b, edu.uiowa.jopenmm.OpenMM_Vec3 c) Get the default periodic box vectors.getForce
(int index) Get a force in the system.int
Get the number of constraints in the system.int
Get the number of forces in the system.int
Get the number of particles in the system.double
getParticleMass
(int index) Get the mass (in atomic mass units) of a particle.com.sun.jna.ptr.PointerByReference
Get the pointer to the system.getVirtualSite
(int index) Get the virtual site for a particle.boolean
isVirtualSite
(int index) Check if a particle is a virtual site.void
removeConstraint
(int index) Remove a constraint from the system.void
removeForce
(int index) Remove a force from the system.void
setConstraintParameters
(int index, int particle1, int particle2, double distance) Set the parameters defining a constraint.void
setDefaultPeriodicBoxVectors
(edu.uiowa.jopenmm.OpenMM_Vec3 a, edu.uiowa.jopenmm.OpenMM_Vec3 b, edu.uiowa.jopenmm.OpenMM_Vec3 c) Set the default periodic box vectors.void
setParticleMass
(int index, double mass) Set the mass (in atomic mass units) of a particle.void
setPointer
(com.sun.jna.ptr.PointerByReference pointer) Set the pointer to the system.void
setVirtualSite
(int index, VirtualSite virtualSite) Set a particle to be a virtual site.boolean
Check if the system uses periodic boundary conditions.
-
Constructor Details
-
System
public System()Constructor. -
System
public System(com.sun.jna.ptr.PointerByReference pointer) Constructor.- Parameters:
pointer
- The OpenMM System pointer.
-
-
Method Details
-
addConstraint
public int addConstraint(int particle1, int particle2, double distance) Add a constraint to the system.- Parameters:
particle1
- The first particle.particle2
- The second particle.distance
- The distance between the particles.- Returns:
- The index of the constraint that was added.
-
addForce
Add a force to the system.- Parameters:
force
- The force to add.- Returns:
- The index of the force that was added.
-
addParticle
public int addParticle(double mass) Add a particle to the System. If the mass is 0, Integrators will ignore the particle and not modify its position or velocity. This is most often used for virtual sites, but can also be used as a way to prevent a particle from moving.- Parameters:
mass
- the mass of the particle (in atomic mass units)- Returns:
- the index of the particle that was added
-
destroy
public void destroy()Destroy the system. -
getConstraintParameters
public void getConstraintParameters(int index, com.sun.jna.ptr.IntByReference particle1, com.sun.jna.ptr.IntByReference particle2, com.sun.jna.ptr.DoubleByReference distance) Get the parameters defining a constraint.- Parameters:
index
- The index of the constraint.particle1
- The index of the first particle involved in the constraint (output).particle2
- The index of the second particle involved in the constraint (output).distance
- The required distance between the two particles (output).
-
getConstraintParameters
public void getConstraintParameters(int index, IntBuffer particle1, IntBuffer particle2, DoubleBuffer distance) Get the parameters defining a constraint.- Parameters:
index
- The index of the constraint.particle1
- The index of the first particle involved in the constraint (output).particle2
- The index of the second particle involved in the constraint (output).distance
- The required distance between the two particles (output).
-
getDefaultPeriodicBoxVectors
public void getDefaultPeriodicBoxVectors(edu.uiowa.jopenmm.OpenMM_Vec3 a, edu.uiowa.jopenmm.OpenMM_Vec3 b, edu.uiowa.jopenmm.OpenMM_Vec3 c) Get the default periodic box vectors.- Parameters:
a
- The first vector (output).b
- The second vector (output).c
- The third vector (output).
-
getForce
Get a force in the system.- Parameters:
index
- The index of the force to get.- Returns:
- The force object.
-
getNumConstraints
public int getNumConstraints()Get the number of constraints in the system.- Returns:
- The number of constraints in the system.
-
getNumForces
public int getNumForces()Get the number of forces in the system.- Returns:
- The number of forces in the system.
-
getNumParticles
public int getNumParticles()Get the number of particles in the system.- Returns:
- The number of particles in the system.
-
getParticleMass
public double getParticleMass(int index) Get the mass (in atomic mass units) of a particle. If the mass is 0, Integrators will ignore the particle and not modify its position or velocity. This is most often used for virtual sites, but can also be used as a way to prevent a particle from moving.- Parameters:
index
- the index of the particle for which to get the mass- Returns:
- the mass of the particle (in atomic mass units)
-
getPointer
public com.sun.jna.ptr.PointerByReference getPointer()Get the pointer to the system.- Returns:
- The pointer to the system.
-
getVirtualSite
Get the virtual site for a particle.- Parameters:
index
- The index of the particle.- Returns:
- The virtual site object.
-
isVirtualSite
public boolean isVirtualSite(int index) Check if a particle is a virtual site.- Parameters:
index
- The index of the particle.- Returns:
- True if the particle is a virtual site.
-
removeConstraint
public void removeConstraint(int index) Remove a constraint from the system.- Parameters:
index
- The index of the constraint to remove.
-
removeForce
public void removeForce(int index) Remove a force from the system.- Parameters:
index
- The index of the force to remove.
-
setConstraintParameters
public void setConstraintParameters(int index, int particle1, int particle2, double distance) Set the parameters defining a constraint.- Parameters:
index
- The index of the constraint.particle1
- The index of the first particle involved in the constraint.particle2
- The index of the second particle involved in the constraint.distance
- The required distance between the two particles.
-
setDefaultPeriodicBoxVectors
public void setDefaultPeriodicBoxVectors(edu.uiowa.jopenmm.OpenMM_Vec3 a, edu.uiowa.jopenmm.OpenMM_Vec3 b, edu.uiowa.jopenmm.OpenMM_Vec3 c) Set the default periodic box vectors.- Parameters:
a
- The first vector.b
- The second vector.c
- The third vector.
-
setParticleMass
public void setParticleMass(int index, double mass) Set the mass (in atomic mass units) of a particle. If the mass is 0, Integrators will ignore the particle and not modify its position or velocity. This is most often used for virtual sites, but can also be used as a way to prevent a particle from moving.- Parameters:
index
- the index of the particle for which to set the massmass
- the mass of the particle
-
setPointer
public void setPointer(com.sun.jna.ptr.PointerByReference pointer) Set the pointer to the system.- Parameters:
pointer
- The pointer to the system.
-
setVirtualSite
Set a particle to be a virtual site.- Parameters:
index
- The index of the particle.virtualSite
- The virtual site object.
-
usesPeriodicBoundaryConditions
public boolean usesPeriodicBoundaryConditions()Check if the system uses periodic boundary conditions.- Returns:
- True if the system uses periodic boundary conditions.
-