OpenMM
System Class Reference

This class represents a molecular system. More...

Inherits _object.

List of all members.

Public Member Functions

def getNumParticles
 getNumParticles(self) -> int
def addParticle
 addParticle(self, mass) -> int
def getParticleMass
 getParticleMass(self, index) -> double
def setParticleMass
 Set the mass (in atomic mass units) of a particle.
def setVirtualSite
 Set a particle to be a virtual site.
def isVirtualSite
 isVirtualSite(self, index) -> bool
def getVirtualSite
 getVirtualSite(self, index) -> VirtualSite
def getNumConstraints
 getNumConstraints(self) -> int
def addConstraint
 addConstraint(self, particle1, particle2, distance) -> int
def getConstraintParameters
 Get the parameters defining a distance constraint.
def setConstraintParameters
 Set the parameters defining a distance constraint.
def removeConstraint
 Remove a constraint from the System.
def addForce
 addForce(self, force) -> int
def getNumForces
 getNumForces(self) -> int
def getForce
 getForce(self, index) -> Force getForce(self, index) -> Force
def removeForce
 Remove a Force from the System.
def getDefaultPeriodicBoxVectors
 Get the default values of the vectors defining the axes of the periodic box (measured in nm).
def setDefaultPeriodicBoxVectors
 Set the default values of the vectors defining the axes of the periodic box (measured in nm).
def usesPeriodicBoundaryConditions
 usesPeriodicBoundaryConditions(self) -> bool
def __getstate__
def __setstate__
def __deepcopy__
def getForces
 Get the list of Forces in this System.
def __copy__
 __copy__(self) -> System
def __init__
 __init__(self) -> System __init__(self, other) -> System

Public Attributes

 this

Detailed Description

This class represents a molecular system.

The definition of a System involves four elements:

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 & Destructor Documentation

def __init__ (   self,
  args 
)

__init__(self) -> System __init__(self, other) -> System

Create a new System.


Member Function Documentation

def __copy__ (   self)

__copy__(self) -> System

def __deepcopy__ (   self,
  memo 
)
def __getstate__ (   self)
def __setstate__ (   self,
  serializationString 
)
def addConstraint (   self,
  particle1,
  particle2,
  distance 
)

addConstraint(self, particle1, particle2, distance) -> int

Add a constraint to the System. Particles whose mass is 0 cannot participate in constraints.

Parameters:
particle1(int) the index of the first particle involved in the constraint
particle2(int) the index of the second particle involved in the constraint
distance(double) the required distance between the two particles, measured in nm
Returns:
(int) the index of the constraint that was added
def addForce (   self,
  force 
)

addForce(self, force) -> int

Add a Force to the System. The Force should have been created on the heap with the "new" operator. The System takes over ownership of it, and deletes the Force when the System itself is deleted.

Parameters:
force(Force *) a pointer to the Force object to be added
Returns:
(int) the index within the System of the Force that was added
def addParticle (   self,
  mass 
)

addParticle(self, mass) -> int

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(double) the mass of the particle (in atomic mass units)
Returns:
(int) the index of the particle that was added
def getConstraintParameters (   self,
  index 
)

Get the parameters defining a distance constraint.

Parameters:
index(int) the index of the constraint for which to get parameters
Returns:
(int) the index of the first particle involved in the constraint
(int) the index of the second particle involved in the constraint
(double) the required distance between the two particles, measured in nm

Get the default values of the vectors defining the axes of the periodic box (measured in nm).

Any newly created Context will have its box vectors set to these. They will affect any Force added to the System that uses periodic boundary conditions.

Returns:
(Vec3) the vector defining the first edge of the periodic box
(Vec3) the vector defining the second edge of the periodic box
(Vec3) the vector defining the third edge of the periodic box
def getForce (   self,
  args 
)

getForce(self, index) -> Force getForce(self, index) -> Force

Get a writable reference to one of the Forces in this System.

Parameters:
index(int) the index of the Force to get
def getForces (   self)

Get the list of Forces in this System.

def getNumConstraints (   self)

getNumConstraints(self) -> int

Get the number of distance constraints in this System.

def getNumForces (   self)

getNumForces(self) -> int

Get the number of Force objects that have been added to the System.

def getNumParticles (   self)

getNumParticles(self) -> int

Get the number of particles in this System.

def getParticleMass (   self,
  index 
)

getParticleMass(self, index) -> double

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(int) the index of the particle for which to get the mass
def getVirtualSite (   self,
  index 
)

getVirtualSite(self, index) -> VirtualSite

Get VirtualSite object for a particle. If the particle is not a virtual site, this throws an exception.

Parameters:
index(int) the index of the particle to get
def isVirtualSite (   self,
  index 
)

isVirtualSite(self, index) -> bool

Get whether a particle is a VirtualSite.

Parameters:
index(int) the index of the particle to check
def removeConstraint (   self,
  index 
)

Remove a constraint from the System.

Parameters:
index(int) the index of the constraint to remove
def removeForce (   self,
  index 
)

Remove a Force from the System.

The memory associated with the removed Force object is deleted.

Parameters:
index(int) the index of the Force to remove
def setConstraintParameters (   self,
  index,
  particle1,
  particle2,
  distance 
)

Set the parameters defining a distance constraint.

Particles whose mass is 0 cannot participate in constraints.

Parameters:
index(int) the index of the constraint for which to set parameters
particle1(int) the index of the first particle involved in the constraint
particle2(int) the index of the second particle involved in the constraint
distance(double) the required distance between the two particles, measured in nm
def setDefaultPeriodicBoxVectors (   self,
  a,
  b,
  c 
)

Set the default values of the vectors defining the axes of the periodic box (measured in nm).

Any newly created Context will have its box vectors set to these. They will affect any Force added to the System that uses periodic boundary conditions.

Triclinic boxes are supported, but the vectors must satisfy certain requirements. In particular, a must point in the x direction, b must point "mostly" in the y direction, and c must point "mostly" in the z direction. See the documentation for details.

Parameters:
a(Vec3) the vector defining the first edge of the periodic box
b(Vec3) the vector defining the second edge of the periodic box
c(Vec3) the vector defining the third edge of the periodic box
def setParticleMass (   self,
  index,
  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(int) the index of the particle for which to set the mass
mass(double) the mass of the particle
def setVirtualSite (   self,
  index,
  virtualSite 
)

Set a particle to be a virtual site.

The VirtualSite object should have been created on the heap with the "new" operator. The System takes over ownership of it, and deletes it when the System itself is deleted.

Parameters:
index(int) the index of the particle that should be treated as a virtual site
virtualSite(VirtualSite *) a pointer to the VirtualSite object describing it

usesPeriodicBoundaryConditions(self) -> bool

Returns whether or not any forces in this System use periodic boundaries.

If a force in this System does not implement usesPeriodicBoundaryConditions a OpenMM::OpenMMException is thrown

Returns:
(bool) true if at least one force uses PBC and false otherwise

Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Functions Variables