# System Class Reference

This class represents a molecular system. More...

Inherits simtk::openmm::openmm::_object.

List of all members.

## Public Member Functions

def | __del__
| __del__(self)
def | getNumParticles
| getNumParticles(self) -> int
def | addParticle
| addParticle(self, double mass) -> int
def | getParticleMass
| getParticleMass(self, int index) -> double
def | setParticleMass
| setParticleMass(self, int index, double mass)
def | setVirtualSite
| setVirtualSite(self, int index, VirtualSite virtualSite)
def | isVirtualSite
| isVirtualSite(self, int index) -> bool
def | getVirtualSite
| getVirtualSite(self, int index) -> VirtualSite
def | getNumConstraints
| getNumConstraints(self) -> int
def | addConstraint
| addConstraint(self, int particle1, int particle2, double distance) -> int
def | getConstraintParameters
| getConstraintParameters(self, int index)
def | setConstraintParameters
| setConstraintParameters(self, int index, int particle1, int particle2, double distance)
def | addForce
| addForce(self, Force force) -> int
def | getNumForces
| getNumForces(self) -> int
def | getForce
| getForce(self, int index) -> Force getForce(self, int index) -> Force
def | getDefaultPeriodicBoxVectors
| getDefaultPeriodicBoxVectors(self)
def | setDefaultPeriodicBoxVectors
| setDefaultPeriodicBoxVectors(self, Vec3 a, Vec3 b, Vec3 c)
def | __getstate__
def | __setstate__
def | getForces
| Get the list of Forces in this System.
def | __init__
| __init__(self) -> System __init__(self, System 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.

## Member Function Documentation

def __del__ | ( |  | self | ) |

__del__(self)

def __getstate__ | ( |  | self | ) |

def __init__ | ( |  | self,
|  |  | args |
| ) |  |  |

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

Create a new System.

def __setstate__ | ( |  | self,
|  |  | serializationString |
| ) |  |  |

def addConstraint | ( |  | self,
|  |  | args |
| ) |  |  |

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

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

Parameters:

  | 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, measured in nm

def addForce | ( |  | self,
|  |  | args |
| ) |  |  |

addForce(self, Force 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 | a pointer to the Force object to be added

def addParticle | ( |  | self,
|  |  | args |
| ) |  |  |

addParticle(self, double 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 | the mass of the particle (in atomic mass units)

def getConstraintParameters | ( |  | self,
|  |  | args |
| ) |  |  |

getConstraintParameters(self, int index)

Get the parameters defining a distance constraint.

Parameters:

  | index | the index of the constraint for which to get parameters
  | 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, measured in nm

def getDefaultPeriodicBoxVectors | ( |  | self | ) |

getDefaultPeriodicBoxVectors(self)

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.

Currently, only rectangular boxes are supported. This means that a, b, and c must be aligned with the x, y, and z axes respectively. Future releases may support arbitrary triclinic boxes.

Parameters:

  | a | on exit, this contains the vector defining the first edge of the periodic box
  | b | on exit, this contains the vector defining the second edge of the periodic box
  | c | on exit, this contains the vector defining the third edge of the periodic box

def getForce | ( |  | self,
|  |  | args |
| ) |  |  |

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

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

Parameters:

  | index | 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,
|  |  | args |
| ) |  |  |

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

def getVirtualSite | ( |  | self,
|  |  | args |
| ) |  |  |

getVirtualSite(self, int index) -> VirtualSite

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

Parameters:

  | index | the index of the particle to get

def isVirtualSite | ( |  | self,
|  |  | args |
| ) |  |  |

isVirtualSite(self, int index) -> bool

Get whether a particle is a VirtualSite.

Parameters:

  | index | the index of the particle to check

def setConstraintParameters | ( |  | self,
|  |  | args |
| ) |  |  |

setConstraintParameters(self, int index, int particle1, int particle2, double distance)

Set the parameters defining a distance constraint. Particles whose mass is 0 cannot participate in constraints.

Parameters:

  | index | the index of the constraint for which to set parameters
  | 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, measured in nm

def setDefaultPeriodicBoxVectors | ( |  | self,
|  |  | args |
| ) |  |  |

setDefaultPeriodicBoxVectors(self, Vec3 a, Vec3 b, Vec3 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.

Currently, only rectangular boxes are supported. This means that a, b, and c must be aligned with the x, y, and z axes respectively. Future releases may support arbitrary triclinic boxes.

Parameters:

  | a | the vector defining the first edge of the periodic box
  | b | the vector defining the second edge of the periodic box
  | c | the vector defining the third edge of the periodic box

def setParticleMass | ( |  | self,
|  |  | args |
| ) |  |  |

setParticleMass(self, 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 mass
  | mass | the mass of the particle

def setVirtualSite | ( |  | self,
|  |  | args |
| ) |  |  |

setVirtualSite(self, int index, VirtualSite 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 | the index of the particle that should be treated as a virtual site
  | virtualSite | a pointer to the VirtualSite object describing it

## Member Data Documentation

this

The documentation for this class was generated from the following file:

- openmm.py