MMTK is the base module of the Molecular Modelling Toolkit. It contains the most common objects and all submodules. As a convenience to the user, it also imports some commonly used objects from other libraries:
Vector from Scientific.Geometry
Translation and Rotation from Scientific.Geometry.Transformation
copy and deepcopy from copy
stdin, stdout, and stderr from sys
Writes object to a newly created file with the name filename, for later retrieval by load().
Loads the file indicated by filename, which must have been produced by save(), and returns the object stored in that file.
A subclass of MMTK.ParticleProperties.ParticleProperty.
ParticleScalar objects can be added to each other and multiplied with scalars.
Methods:Returns the highest value for any particle.
Returns the smallest value for any particle.
Applies function to each value and returns the result as a new ParticleScalar object.
A subclass of MMTK.ParticleProperties.ParticleProperty.
ParticleVector objects can be added to each other and multiplied with scalars or MMTK.ParticleScalar objects; all of these operations result in another ParticleVector object. Multiplication with a vector or another ParticleVector object yields a MMTK.ParticleScalar object containing the dot products for each particle. Multiplications that treat ParticleVectors as vectors in a 3N-dimensional space are implemented as methods.
Methods:Returns a ParticleScalar containing the length of the vector for each particle.
Returns the norm of the ParticleVector seen as a 3N-dimensional vector.
Returns the dot product with other (a ParticleVector) treating both operands as 3N-dimensional vectors.
Returns the mass-weighted dot product with other (a ParticleVector object) treating both operands as 3N-dimensional vectors.
Returns a MMTK.ParticleTensor object representing the dyadic product with other (a ParticleVector).
A subclass of MMTK.ParticleVector.
Its instances represent a configuration of a universe, consisting of positions for all atoms (like in a ParticleVector) plus the geometry of the universe itself, e.g. the cell shape for periodic universes.
A subclass of MMTK.ParticleProperties.ParticleProperty.
ParticleTensor objects can be added to each other and multiplied with scalars or MMTK.ParticleScalar objects; all of these operations result in another ParticleTensor object.
A subclass of MMTK.ChemicalObjects.ChemicalObject.
Constructor: Atom(element, **|properties|)
a string (not case sensitive) specifying the chemical element
optional keyword properties:
position: the atom position (a vector)
name: the atom name (a string)
Changes the position to position.
Returns the position in configuration conf. If conf is None, use the current configuration. If the atom has not been assigned a position, the return value is None.
Set the atom mass to mass.
Returns a list of all atoms to which a chemical bond exists.
A subclass of MMTK.Collection.GroupOfAtoms and MMTK.Visualization.Viewable.
Collections permit the grouping of arbitrary chemical objects (atoms, molecules, etc.) into one object for the purpose of analysis or manipulation.
Constructor: Collection(objects=None)
a chemical object or a sequence of chemical objects that define the initial content of the collection.
Collections permit length inquiry, item extraction by indexing, and iteration, like any Python sequence object. Two collections can be added to yield a collection that contains the combined elements.
Methods:Adds object to the collection. If object is another collection or a list, all of its elements are added.
Removes object from the collection. If object is a collection or a list, each of its elements is removed. The object to be removed must be an element of the collection.
Return a collection of all elements whose distance from point is between r1 and r2.
Return a collection of all elements that lie within a box whose corners are given by p1 and p2.
Returns a list of all objects in the collection. If klass is not None, only objects whose class is equal to klass are returned.
Returns a list containing all atoms of all objects in the collection.
Returns the total number of atoms in the objects of the collection.
Returns the universe of which the objects in the collection are part. If no such universe exists, the return value is None.
Applies function to all objects in the collection and returns the list of the results. If the results are chemical objects, a Collection object is returned instead of a list.
Returns the list of distance constraints.
Returns the number of distance constraints.
Sets distance constraints for all bonds.
Removes all distance constraints.
A subclass of MMTK.ChemicalObjects.ChemicalObject.
Molecules consist of atoms and groups linked by bonds.
Constructor: Molecule(species, **|properties|)
a string (not case sensitive) that specifies the molecule name in the chemical database
optional keyword properties:
position: the center-of-mass position (a vector)
configuration: the name of a configuration listed in the database definition of the molecule, which is used to initialize the atom positions. If no configuration is specified, the configuration named "default" will be used, if it exists. Otherwise the atom positions are undefined.
name: the atom name (a string)
Find reasonable positions for hydrogen atoms that have no position assigned.
This method uses a heuristic approach based on standard geometry data. It was developed for proteins and DNA and may not give good results for other molecules. It raises an exception if presented with a topology it cannot handle.
A subclass of MMTK.Collection.
A PartitionedCollection differs from a plain Collection by sorting its elements into small cubic cells. This makes adding objects slower, but geometrical operations like selectShell become much faster for a large number of objects.
Constructor: PartitionedCollection(partition_size, objects=None)
the edge length of the cubic cells
a chemical object or a sequence of chemical objects that define the initial content of the collection.
Returns a list of cubic partitions. Each partition is specified by a tuple containing two vectors (describing the diagonally opposite corners) and the list of objects in the partition.
Returns a list containing all pairs of objects in the collection whose center-of-mass distance is less than cutoff.
A subclass of MMTK.PartitionedCollection.
PartitionedAtomCollection objects behave like PartitionedCollection atoms, except that they store only atoms. When a composite chemical object is added, its atoms are stored instead.
Constructor: PartitionedAtomCollection(partition_size, objects=None)
the edge length of the cubic cells
a chemical object or a sequence of chemical objects that define the initial content of the collection.
A subclass of MMTK.Universe.Universe.
Constructor: InfiniteUniverse(forcefield=None)
a force field object, or None for no force field
A subclass of MMTK.ChemicalObjects.ChemicalObject.
A complex is an assembly of molecules that are not connected by chemical bonds.
Constructor: Complex(species, **|properties|)
a string (not case sensitive) that specifies the complex name in the chemical database
optional keyword properties:
position: the center-of-mass position (a vector)
configuration: the name of a configuration listed in the database definition of the complex
name: the atom name (a string)
A subclass of MMTK.ChemicalObjects.ChemicalObject.
An atom cluster acts like a molecule without any bonds or atom properties. It can be used to represent a group of atoms that are known to form a chemical unit but whose chemical properties are not sufficiently known to define a molecule.
Constructor: AtomCluster(atoms, **|properties|)
a list of atom objects
optional keyword properties:
position: the center-of-mass position (a vector)
name: the atom name (a string)
A subclass of MMTK.Universe.Universe.
Constructor: OrthorhombicPeriodicUniverse(shape, forcefield=None)
a sequence of length three specifying the edge lengths along the x, y, and z directions
a force field object, or None for no force field
Multiplies all edge lengths by factor.
Multiplies all edge lengths by the same factor such that the cell volume becomes volume.
A subclass of MMTK.Universe.Universe.
a number specifying the edge length along the x, y, and z directions
a force field object, or None for no force field Constructor: CubicPeriodicUniverse(shape, forcefield=None)