# Module MMTK.Collection

## Functions

- isCollection()

  Return 1 if object is a Collection.

## Class GroupOfAtoms: Anything that consists of atoms

This class is a mix-in class that defines a large set of operations which are common to all objects that consist of atoms, i.e. any subset of a chemical system. Examples are atoms, molecules, collections, or universes.

Methods:

- numberOfAtoms()

  Returns the number of atoms.

- numberOfPoints()

  Returns the number of geometrical points that define the object. It is currently always equal to the number of atoms, but could be different e.g. for quantum systems, in which each atom is described by a wave function or a path integral.

- numberOfFixedAtoms()

  Returns the number of atoms that are fixed, i.e. cannot move.

- degreesOfFreedom()

  Returns the number of mechanical degrees of freedom.

- atomCollection()

  Returns a collection containing all atoms in the object.

- atomsWithDefinedPositions(conf=`None`)

  Returns a collection of all atoms that have a definite position.

- mass()

  Returns the total mass.

- centerOfMass(conf=`None`)

  Returns the center of mass.

- centerAndMomentOfInertia(conf=`None`)

  Returns the center of mass and the moment of inertia tensor.

- rotationalConstants(conf=`None`)

  Returns a sorted array of rotational constants A, B, C in internal units.

- boundingBox(conf=`None`)

  Returns two opposite corners of a bounding box around the object. The bounding box is the smallest rectangular bounding box with edges parallel to the coordinate axes.

- boundingSphere(conf=`None`)

  Returns a sphere that contains all atoms in the object. This is not the minimal bounding sphere, just some bounding sphere.

- rmsDifference(conf1, conf2=`None`)

  Returns the RMS (root-mean-square) difference between the conformations of the object in two universe configurations, conf1 and conf2 (the latter defaults to the current configuration).

- findTransformation(conf1, conf2=`None`)

  Returns the linear transformation that, when applied to the object in configuration conf1, minimizes the RMS distance to the conformation in conf2, and the minimal RMS distance. If conf2 is `None`, returns the transformation from the current configuration to conf1 and the associated RMS distance. The algorithm is described in [Kneller1990].

- translateBy(vector)

  Translates the object by the displacement vector.

- translateTo(position)

  Translates the object such that its center of mass is at position.

- normalizeConfiguration(repr=`None`)

  Applies a linear transformation such that the coordinate origin becomes the center of mass of the object and its principal axes of inertia are parallel to the three coordinate axes.

  A specific representation can be chosen by setting repr to Ir : x y z <--> b c a IIr : x y z <--> c a b IIIr : x y z <--> a b c Il : x y z <--> c b a IIl : x y z <--> a c b IIIl : x y z <--> b a c

- applyTransformation(t)

  Applies the transformation t to the object.

- displacementUnderTransformation(t)

  Returns the displacement vectors (in a ParticleVector) for the atoms in the object that correspond to the transformation t.

- rotateAroundCenter(axis_direction, angle)

  Rotates the object by the given angle around an axis that passes through its center of mass and has the given direction.

- rotateAroundOrigin(axis, angle)

  Rotates the object by the given angle around an axis that passes through the coordinate origin and has the given direction.

- rotateAroundAxis(point1, point2, angle)

  Rotates the object by the given angle around the axis that passes through point1 and point2

- writeToFile(filename, configuration=`None`, format=`None`)

  Writes a representation of the object in the given configuration to the file identified by filename. The format can be either "pdb" or "vrml"; if no format is specified, it is deduced from the filename. An optional subformat specification can be added to the format name, separated by a dot. The subformats of "pdb" are defined by the module `Scientific.IO.PDB`, the subformats of "vrml" are "wireframe" (the default, yielding a wireframe representation), "ball_and_stick" (yielding a ball-and-stick representation), "highlight" (like wireframe, but with a small sphere for all atoms that have an attribute "highlight" with a non-zero value), and "charge" (wireframe plus small spheres for the atoms with colors from a red-to-green color scale to indicate the charge).

- view(configuration=`None`, format=`'pdb'`)

  Starts an external viewer for the object in the given configuration. The optional parameter format indicates which format (and hence which viewer) should be used; the formats are "pdb" and "vrml". An optional subformat specification can be added to the format name, separated by a dot. The subformats of "pdb" are defined by the module `Scientific.IO.PDB`, the subformats of "vrml" are "wireframe" (the default, yielding a wireframe representation), "ball_and_stick" (yielding a ball-and-stick representation), "highlight" (like wireframe, but with a small sphere for all atoms that have an attribute "highlight" with a non-zero value), and "charge" (wireframe plus small spheres for the atoms with colors from a red-to-green color scale to indicate the charge).

- kineticEnergy(velocities=`None`)

  Returns the kinetic energy.

- temperature(velocities=`None`)

  Returns the temperature.

- momentum(velocities=`None`)

  Returns the momentum.

- angularMomentum(velocities=`None`, conf=`None`)

  Returns the angular momentum.

- angularVelocity(velocities=`None`, conf=`None`)

  Returns the angular velocity.

- universe()

  Returns the universe of which the object is part. For an object that is not part of a universe, the result is `None`.

- charge()

  Returns the total charge of the object. This is defined only for objects that are part of a universe with a force field that defines charges.

- dipole(reference=`None`)

  Returns the total dipole moment of the object. This is defined only for objects that are part of a universe with a force field that defines charges.

- booleanMask()

  Returns a ParticleScalar object that contains a value of 1 for each atom that is in the object and a value of 0 for all other atoms in the universe.