etomica.atom
Class AtomPositionCOM

java.lang.Object
  extended by etomica.atom.AtomPositionCOM
All Implemented Interfaces:
IAtomPositionDefinition, Serializable

public class AtomPositionCOM
extends Object
implements IAtomPositionDefinition, Serializable

Calculates the center of mass (COM) over a set of atoms. The mass and position of all atoms passed to the actionPerformed are accumulated and used to compute their center of mass. Calculated COM is obtained via the getData method, which returns an array with the elements of the calculated COM vector, or via the getCOM method, which returns a vector with the calculated COM. Calculation is zeroed via the reset method.

A typical use of this class would have it passed to the allAtoms method of an iterator, or wrapped in an AtomGroupAction to calculate the COM of the atoms in an atom group.

See Also:
Serialized Form

Constructor Summary
AtomPositionCOM(ISpace space)
           
 
Method Summary
 IVector position(IMolecule atom)
          Returns the defined position for the given atom, which may be an atom group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtomPositionCOM

public AtomPositionCOM(ISpace space)
Method Detail

position

public IVector position(IMolecule atom)
Description copied from interface: IAtomPositionDefinition
Returns the defined position for the given atom, which may be an atom group.

Specified by:
position in interface IAtomPositionDefinition