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:
Base classes for proteins and nucleic acids
Bases: MMTK.ChemicalObjects.Group
Base class for aminoacid and nucleic acid residues
Parameters: |
|
---|
Bases: MMTK.ChemicalObjects.Molecule
Chain of residues
Base class for peptide chains and nucleotide chains
Parameters: |
|
---|
Returns: | a collection containing all residues |
---|---|
Return type: | Collection |
Parameters: | types (str) – residue type codes |
---|---|
Returns: | a collection that contains all residues whose type (residue code) is contained in types |
Return type: | Collection |
Add a non-standard amino acid residue to the internal residue table. Once added to the residue table, the new residue can be used like any of the standard residues in the creation of peptide chains.
Parameters: |
|
---|
Add a non-standard nucleic acid residue to the internal residue table. Once added to the residue table, the new residue can be used like any of the standard residues in the creation of nucleotide chains.
Parameters: |
|
---|
Bonds, bond lists, bond angle lists, and dihedral angle lists
The classes in this module are normally not used directly from client code. They are used by the classes in ChemicalObjects and ForceField.
Bases: object
Chemical bond
A bond links two atoms (attributes a1 and a2)
Bases: object
Bond angle
A bond angle is the angle between two bonds that share a common atom. It is defined by two bond objects (attributes b1 and b2) and an atom object (the common atom, attribute ca).
Bases: object
Bond angle list
Returns: | a list of all dihedral angles that can be formed from the bond angles in the list |
---|---|
Return type: | DihedralAngleList |
Bases: object
Dihedral angle
A dihedral angle is the angle between two planes that are defined by BondAngle objects (attributes ba1 and ba2) and their common bond (attribute cb).
There are proper dihedrals (four atoms linked by three bonds in sequence) and improper dihedrals (a central atom linked to three surrounding atoms by three bonds). The boolean attribute improper indicates whether a dihedral is an improper one.
Fit of point chages to an electrostatic potential surface
This module implements a numerically stable method (based on Singular Value Decomposition) to fit point charges to values of an electrostatic potential surface. Two types of constraints are avaiable: a constraint on the total charge of the system or a subset of the system, and constraints that force the charges of several atoms to be equal. There is also a utility function that selects suitable evaluation points for the electrostatic potential surface. For the potential evaluation itself, some quantum chemistry program is needed.
The charge fitting method is described in:
K. Hinsen and B. Roux,An accurate potential for simulating proton transfer in acetylacetone,J. Comp. Chem. 18, 1997: 368
See also Examples/Miscellaneous/charge_fit.py.
Bases: object
Fit of point charges to an electrostatic potential surface
A ChargeFit object acts like a dictionary that stores the fitted charge value for each atom in the system.
Parameters: |
|
---|
Bases: object
Constraint forcing two charges to be equal
To be used with ChargeFit
Any atom may occur in more than one EqualityConstraint object, in order to keep the charges of more than two atoms equal.
Parameters: |
---|
Bases: object
Constraint on the total system charge
To be used with ChargeFit
Parameters: |
|
---|
Generate points in space around a molecule that are suitable for potential evaluation in view of a subsequent charge fit. The points are chosen at random and uniformly in a shell around the system.
Parameters: |
|
---|---|
Returns: | a list of evaluation points |
Return type: | list of Scientific.Geometry.Vector |
Atoms, groups, molecules and similar objects
Bases: MMTK.ChemicalObjects.ChemicalObject
Atom
Parameters: |
|
---|
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. |
---|---|
Return type: | Scientific.Geometry.Vector |
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. |
---|---|
Return type: | Scientific.Geometry.Vector |
Changes the position of the atom.
Parameters: | position (Scientific.Geometry.Vector) – the new position |
---|
Changes the position of the atom.
Parameters: | position (Scientific.Geometry.Vector) – the new position |
---|
Bases: MMTK.ChemicalObjects.CompositeChemicalObject, MMTK.ChemicalObjects.ChemicalObject
An agglomeration of atoms
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.
Parameters: |
|
---|
Bases: MMTK.ChemicalObjects.Molecule
ChainMolecule
ChainMolecules are generated by a MoleculeFactory from templates that have a sequence attribute.
Parameters: |
|
---|
Bases: MMTK.Collections.GroupOfAtoms, MMTK.Visualization.Viewable
General chemical object
This is an abstract base class that implements methods which are applicable to any chemical object (atom, molecule, etc.).
Returns: | the largest subobjects which can contain bonds. There are no bonds between any of the subobjects in the list. |
---|---|
Return type: | list |
Returns: | the full name of the object. The full name consists of the proper name of the object preceded by the full name of its parent separated by a dot. |
---|---|
Return type: | str |
Retrieve atom properties from the chemical database.
Note: the property is first looked up in the database entry for the object on which the method is called. If the lookup fails, the complete hierarchy from the atom to the top-level object is constructed and traversed starting from the top-level object until the property is found. This permits database entries for higher-level objects to override property definitions in its constituents.
At the atom level, the property is retrieved from an attribute with the same name. This means that properties at the atom level can be defined both in the chemical database and for each atom individually by assignment to the attribute.
Returns: | the value of the specified property for the given atom from the chemical database. |
---|
Returns: | the number of distance constraints of the object |
---|---|
Return type: | int |
Sets distance constraints that make the object fully rigid.
Bases: MMTK.ChemicalObjects.CompositeChemicalObject, MMTK.ChemicalObjects.ChemicalObject
Complex
A complex is an assembly of molecules that are not connected by chemical bonds.
Parameters: |
|
---|
Bases: object
Chemical object containing subobjects
This is an abstract base class that implements methods which can be used with any composite chemical object, i.e. any chemical object that is not an atom.
Bases: MMTK.ChemicalObjects.CompositeChemicalObject, MMTK.ChemicalObjects.ChemicalObject
Group of bonded atoms
Groups can contain atoms and other groups, and link them by chemical bonds. They are used to represent functional groups or any other part of a molecule that has a well-defined identity.
Groups cannot be created in application programs, but only in database definitions for molecules or through a MoleculeFactory.
Parameters: |
|
---|
Bases: MMTK.ChemicalObjects.CompositeChemicalObject, MMTK.ChemicalObjects.ChemicalObject
Molecule
Molecules consist of atoms and groups linked by bonds.
Parameters: |
|
---|
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.
Collections of chemical objects
Bases: MMTK.Collections.GroupOfAtoms, MMTK.Visualization.Viewable
Collection of chemical objects
Collections permit the grouping of arbitrary chemical objects (atoms, molecules, etc.) into one object for the purpose of analysis or manipulation.
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.
Parameters: | objects – a chemical object or a sequence of or a generator |
---|
yielding chemical objects that define the initial content of the collection.
Add objects to the collection.
Parameters: | object – the object(s) to be added. If it is another collection or a list, all of its elements are added |
---|
Returns: | a list containing all atoms of all objects in the collection |
---|---|
Return type: | list |
Apply a function to all objects in the collection and return the list of the results. If the results are chemical objects, a Collection object is returned instead of a list.
Parameters: | function (callable) – the function to be applied |
---|---|
Returns: | the list or collection of the results |
Returns: | the total number of atoms in the objects of the collection |
---|---|
Return type: | int |
Make a list of all objects in the collection that are instances of a specific type or of one of its subtypes.
Parameters: | type – the type that serves as a filter. If None, all objects are returned |
---|---|
Returns: | the objects that match the given type |
Return type: | list |
Remove an object or a list or collection of objects from the collection. The object(s) to be removed must be elements of the collection.
Parameters: | object – the object to be removed, or a list or collection of objects whose elements are to be removed |
---|---|
Raises ValueError: | |
if the object is not an element of the collection |
Select objects in a rectangular volume
Parameters: |
|
---|---|
Returns: | a collection of all elements that lie within the rectangular volume |
Return type: |
Select objects in a spherical shell around a central point.
Parameters: |
|
---|---|
Returns: | a collection of all elements whose distance from point is between r1 and r2 |
Return type: |
Bases: object
Anything that consists of atoms
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.
Parameters: |
|
---|---|
Returns: | the angluar momentum |
Return type: | Scientific.Geometry.Vector |
Parameters: |
|
---|---|
Returns: | the angluar velocity |
Return type: | Scientific.Geometry.Vector |
Apply a transformation to the object
Parameters: | t (Scientific.Geometry.Transformation) – the transformation to be applied |
---|
Parameters: | conf (Configuration or NoneType) – a configuration object, or None for the current configuration |
---|---|
Returns: | a collection of all atoms that have a position in the given configuration |
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 |
---|---|
Return type: | ParticleScalar |
Parameters: | conf (Configuration or NoneType) – a configuration object, or None for the current configuration |
---|---|
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. |
Return type: | tuple of two Scientific.Geometry.Vector |
Parameters: | conf (Configuration or NoneType) – a configuration object, or None for the current configuration |
---|---|
Returns: | a sphere that contains all atoms in the object. This is B{not} the minimal bounding sphere, just B{some} bounding sphere. |
Return type: | Scientific.Geometry.Objects3D.Sphere |
Parameters: | conf (Configuration or NoneType) – a configuration object, or None for the current configuration |
---|---|
Returns: | the center of mass and the moment of inertia tensor in the given configuration |
Parameters: | conf (Configuration or NoneType) – a configuration object, or None for the current configuration |
---|---|
Returns: | the center of mass in the given configuration |
Return type: | Scientific.Geometry.Vector |
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. |
---|---|
Return type: | float |
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. |
---|---|
Return type: | Scientific.Geometry.Vector |
Parameters: | t (Scientific.Geometry.Transformation) – the transformation to be applied |
---|---|
Returns: | the displacement vectors for the atoms in the object that correspond to the transformation t. |
Return type: | ParticleVector |
Parameters: |
|
---|---|
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. |
Parameters: | velocities (ParticleVector) – a set of velocities for all atoms, or None for the current velocities |
---|---|
Returns: | the kinetic energy |
Return type: | float |
Parameters: | velocities (ParticleVector) – a set of velocities for all atoms, or None for the current velocities |
---|---|
Returns: | the momentum |
Return type: | Scientific.Geometry.Vector |
Apply a linear transformation such that the center of mass of the object is translated to the coordinate origin and its principal axes of inertia become parallel to the three coordinate axes.
Parameters: | repr – the specific representation for axis alignment: - 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 |
---|
Calculate a linear transformation that shifts the center of mass of the object to the coordinate origin and makes its principal axes of inertia parallel to the three coordinate axes.
Parameters: | repr – the specific representation for axis alignment: 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 |
---|---|
Returns: | the normalizing transformation |
Return type: | Scientific.Geometry.Transformation.RigidBodyTransformation |
Returns: | the number of geometrical points that define the object. It is currently 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. |
---|---|
Return type: | int |
Returns: | the number of atoms that are fixed, i.e. that cannot move |
---|---|
Return type: | int |
Returns: | the number of geometrical points that define the object. It is currently 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. |
---|---|
Return type: | int |
Parameters: | conf (Configuration or NoneType) – a configuration object, or None for the current configuration |
---|---|
Returns: | the center of mass in the given configuration |
Return type: | Scientific.Geometry.Vector |
Parameters: |
|
---|---|
Returns: | the RMS (root-mean-square) difference between the conformations of the object in two universe configurations, conf1 and conf2 |
Return type: | float |
Rotate the object arond an axis specified by two points
Parameters: |
|
---|
Rotate the object around an axis that passes through its center of mass.
Parameters: |
|
---|
Rotate the object around an axis that passes through the coordinate origin.
Parameters: |
|
---|
Parameters: | conf (Configuration or NoneType) – a configuration object, or None for the current configuration |
---|---|
Returns: | a sorted array of rotational constants A, B, C in internal units |
Parameters: | velocities (ParticleVector) – a set of velocities for all atoms, or None for the current velocities |
---|---|
Returns: | the temperature |
Return type: | float |
Translate the object by a displacement vector
Parameters: | vector (Scientific.Geometry.Vector) – the displacement vector |
---|
Translate the object such that its center of mass is at position :param position: the final position :type position: Scientific.Geometry.Vector
Returns: | the universe of which the object is part. For an object that is not part of a universe, the result is None |
---|---|
Return type: | Universe |
Start an external viewer for the object in the given configuration.
Parameters: |
|
---|
Write a representation of the object in a given configuration to a file.
Parameters: |
|
---|
Bases: MMTK.Collections.PartitionedCollection
Partitioned collection of atoms
PartitionedAtomCollection objects behave like PartitionedCollection atoms, except that they store only atoms. When a composite chemical object is added, its atoms are stored instead.
Bases: MMTK.Collections.Collection
Collection with cubic partitions
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.
Parameters: |
|
---|
Parameters: | object – any Python object |
---|---|
Returns: | True if the object is a Collection |
I/O of molecular configurations
Input: Z-Matrix and Cartesian Output: VRML PDB files are handled in PDB.
Bases: object
Cartesian specification of a molecule conformation
Cartesian objects can be used in chemical database entries to specify molecule conformations by Cartesian coordinates.
Parameters: | data – a dictionary mapping atoms to tuples of length three |
---|
that define its Cartesian coordinates
Bases: object
Z-Matrix specification of a molecule conformation
ZMatrix objects can be used in chemical database entries to specify molecule conformations by internal coordinates. With the exception of the three first atoms, each atom is defined relative to three previously atoms by a distance, an angle, and a dihedral angle.
Parameters: | data – a list of atom definitions. Each atom definition (except |
---|
for the first three ones) is a list containing seven elements:
- the atom to be defined
- a previously defined atom and the distance to it
- another previously defined atom and the angle to it
- a third previously defined atom and the dihedral angle to it
The definition of the first atom contains only the first element, the second atom needs the first three elements, and the third atom is defined by the first five elements.
Reading and writing of DCD trajectory files
The DCD format for trajectories is used by CHARMM, X-Plor, and NAMD. It can be read by various visualization programs.
The DCD format is defined as a binary (unformatted) Fortran format and is therefore platform-dependent.
Bases: MMTK.Trajectory.TrajectoryGenerator
Reader for DCD trajectories (CHARMM/X-Plor/NAMD)
A DCDReader reads a DCD trajectory and “plays back” the data as if it were generated directly by an integrator. The universe for which the DCD file is read must be perfectly compatible with the data in the file, including an identical internal atom numbering. This can be guaranteed only if the universe was created from a PDB file that is compatible with the DCD file without leaving out any part of the system.
Reading is started by calling the reader object. The following data categories and variables are available for output:
Parameters: |
|
---|
Write a sequence of configurations to a DCD file and generate a compatible PDB file.
Parameters: |
|
---|
Write a sequence of velocity particle vectors to a DCD file and generate a compatible PDB file.
Parameters: |
|
---|
Deformation energies in proteins
This module implements deformational energies for use in the analysis of motions and conformational changes in macromolecules. A description of the techniques can be found in the following articles:
K. HinsenAnalysis of domain motions by approximate normal mode calculationsProteins 33 (1998): 417-429K. Hinsen, A. Thomas, M.J. FieldAnalysis of domain motions in large proteinsProteins 34 (1999): 369-382
Bases: MMTK.Deformation.DeformationEvaluationFunction
Infinite-displacement deformation energy function
The deformation energy is the sum of the deformation values over all atoms of a system.
The default values are appropriate for a Cα model of a protein with the global scaling described in the reference cited above.
A DeformationEnergyFunction is called with one or two parameters. The first parameter is a ParticleVector object containing the infinitesimal displacements of the atoms for which the deformation energy is to be evaluated. The optional second argument can be set to a non-zero value to request the gradients of the energy in addition to the energy itself. In that case there are two return values (energy and the gradients in a ParticleVector object), otherwise only the energy is returned.
Parameters: |
|
---|
Bases: MMTK.Deformation.DeformationEvaluationFunction
Infinite-displacement deformation function
The default values are appropriate for a Cα model of a protein with the global scaling described in the reference cited above.
A DeformationFunction object must be called with a single parameter, which is a ParticleVector object containing the infinitesimal displacements of the atoms for which the deformation is to be evaluated. The return value is a ParticleScalar object containing the deformation value for each atom.
Parameters: |
|
---|
Bases: MMTK.Deformation.DeformationEvaluationFunction
Iterative reduction of the deformation energy
The default values are appropriate for a Cα model of a protein with the global scaling described in the reference cited above.
A DeformationReducer is called with two arguments. The first is a ParticleVector containing the initial infinitesimal displacements for all atoms. The second is an integer indicating the number of iterations. The result is a modification of the displacements by steepest-descent minimization of the deformation energy.
Parameters: |
|
---|
Bases: MMTK.Deformation.DeformationEvaluationFunction
Finite-displacement deformation energy function
The deformation energy is the sum of the deformation values over all atoms of a system.
The default values are appropriate for a Cα model of a protein with the global scaling described in the reference cited above.
A FiniteDeformationEnergyFunction is called with one or two parameters. The first parameter is a ParticleVector object containing the alternate configuration of the universe for which the deformation energy is to be evaluated. The optional second argument can be set to a non-zero value to request the gradients of the energy in addition to the energy itself. In that case there are two return values (energy and the gradients in a ParticleVector object), otherwise only the energy is returned.
Parameters: |
|
---|
Bases: MMTK.Deformation.DeformationEvaluationFunction
Finite-displacement deformation function
The default values are appropriate for a Cα model of a protein with the global scaling described in the reference cited above.
A FiniteDeformationFunction object must be called with a single parameter, which is a Configuration or a ParticleVector object containing the alternate configuration of the universe for which the deformation is to be evaluated. The return value is a ParticleScalar object containing the deformation value for each atom.
Parameters: |
|
---|
Bases: MMTK.Deformation.DeformationEvaluationFunction
Iterative reduction of the finite-displacement deformation energy
The default values are appropriate for a Cα model of a protein with the global scaling described in the reference cited above.
A FiniteDeformationReducer is called with two arguments. The first is a ParticleVector or Configuration containing the alternate configuration for which the deformation energy is evaluated. The second is the RMS distance that defines the termination condition. The return value a configuration that differs from the input configuration by approximately the specified RMS distance, and which is obtained by iterative steepest-descent minimization of the finite-displacement deformation energy.
Parameters: |
|
---|
Bases: MMTK.Deformation.DeformationEnergyFunction
Normalized infinite-displacement deformation energy function
The normalized deformation energy is the sum of the normalized deformation values over all atoms of a system.
The default values are appropriate for a Cα model of a protein with the global scaling described in the reference cited above. The normalization is defined by equation 10 of reference 1.
A NormalizedDeformationEnergyFunction is called with one or two parameters. The first parameter is a ParticleVector object containing the infinitesimal displacements of the atoms for which the deformation energy is to be evaluated. The optional second argument can be set to a non-zero value to request the gradients of the energy in addition to the energy itself. In that case there are two return values (energy and the gradients in a ParticleVector object), otherwise only the energy is returned.
Parameters: |
|
---|
Bases: MMTK.Deformation.DeformationFunction
Normalized infinite-displacement deformation function
The default values are appropriate for a Cα model of a protein with the global scaling described in the reference cited above. The normalization is defined by equation 10 of reference 1 (see above).
A NormalizedDeformationFunction object must be called with a single parameter, which is a ParticleVector object containing the infinitesimal displacements of the atoms for which the deformation is to be evaluated. The return value is a ParticleScalar object containing the deformation value for each atom.
Molecular Dynamics integrators
Bases: MMTK.Trajectory.TrajectoryAction
Barostat reset action
A BarostatReset object is used in the action list of a VelocityVerletIntegrator. It resets the barostat coordinate to zero.
Parameters: |
|
---|
Bases: MMTK.Trajectory.TrajectoryAction
Periodic heating action
A Heater object us used in the action list of a VelocityVerletIntegrator. It scales the velocities to a temperature that increases over time.
Parameters: |
|
---|
Bases: MMTK.Trajectory.TrajectoryAction
Action that eliminates global rotation
A RotationRemover object is used in the action list of a VelocityVerletIntegrator. It adjusts the atomic velocities such that the total angular momentum is zero.
Parameters: |
|
---|
Bases: MMTK.Trajectory.TrajectoryAction
Action that eliminates global translation
A TranslationRemover object is used in the action list of a VelocityVerletIntegrator. It subtracts the total velocity of the system from each atomic velocity.
Parameters: |
|
---|
Bases: MMTK.Trajectory.TrajectoryAction
Periodic velocity scaling action
A VelocityScaler object is used in the action list of a VelocityVerletIntegrator. It rescales all atomic velocities by a common factor to make the temperature of the system equal to a predefined value.
Parameters: |
|
---|
Bases: MMTK.Dynamics.Integrator
Velocity-Verlet molecular dynamics integrator
The integrator can handle fixed atoms, distance constraints, a thermostat, and a barostat, as well as any combination. It is fully thread-safe.
The integration is started by calling the integrator object. All the keyword options (see documnentation of __init__) can be specified either when creating the integrator or when calling it.
The following data categories and variables are available for output:
- category “time”: time
- category “configuration”: configuration and box size (for periodic universes)
- category “velocities”: atomic velocities
- category “gradients”: energy gradients for each atom
- category “energy”: potential and kinetic energy, plus extended-system energy terms if a thermostat and/or barostat are used
- category “thermodynamic”: temperature, volume (if a barostat is used) and pressure
- category “auxiliary”: extended-system coordinates if a thermostat and/or barostat are used
Parameters: |
|
---|
Environment objects
Environment objects are objects that define a simulation system without being composed of atoms. Examples are thermostats, barostats, external fields, etc.
Bases: MMTK.Environment.EnvironmentObject
Andersen barostat for Molecular Dynamics
A barostat object can be added to a universe and will then together with a thermostat object modify the integration algorithm to a simulation of an NPT ensemble.
Parameters: |
|
---|
Bases: MMTK.Environment.EnvironmentObject
Nose thermostat for Molecular Dynamics
A thermostat object can be added to a universe and will then modify the integration algorithm to a simulation of an NVT ensemble.
Parameters: |
|
---|
Scalar and vector fields in molecular systems
This module defines field objects that are useful in the analysis and visualization of collective motions in molecular systems. Atomic quantities characterizing collective motions vary slowly in space, and can be considered functions of position instead of values per atom. Functions of position are called fields, and mathematical techniques for the analysis of fields have proven useful in many branches of physics. Fields can be described numerically by values on a regular grid. In addition to permitting the application of vector analysis methods to atomic quantities, the introduction of fields is a valuable visualization aid, because information defined on a coarse regular grid can be added to a picture of a molecular system without overloading it.
Bases: object
A field whose values are determined by atomic quantities
This is an abstract base class. To create field objects, use one of its subclasses.
Returns: | the values of the field at the positions of the atoms |
---|---|
Return type: | ParticleProperty |
Shows a graphical representation of the field using a VRML viewer.
Parameters: |
|
---|
Writes a graphical representation of the field to a VRML file.
Parameters: |
|
---|
Bases: MMTK.Field.AtomicField, MMTK.Visualization.Viewable
Scalar field defined by atomic quantities
For visualization, scalar fields are represented by a small cube on each grid point whose color indicates the field’s value on a symmetric red-to-green color scale defined by the range of the field values.
Parameters: |
|
---|
Returns: | the gradient of the field |
---|---|
Return type: | AtomicVectorField |
Returns: | the laplacian of the field |
---|---|
Return type: | AtomicScalarField |
Bases: MMTK.Field.AtomicField, MMTK.Visualization.Viewable
Vector field defined by atomic quantities
For visualization, scalar fields are represented by a small arrow on each grid point. The arrow starts at the grid point and represents the vector value at that point.
Parameters: |
|
---|
Returns: | the curl of the field |
---|---|
Return type: | AtomicVectorField |
Returns: | the divergence of the field |
---|---|
Return type: | AtomicScalarField |
Returns: | the laplacian of the field |
---|---|
Return type: | AtomicVectorField |
Returns: | a field of the length of the field vectors |
---|---|
Return type: | AtomicScalarField |
Amber force field implementation
General comments about parameters for Lennard-Jones and electrostatic interactions:
Pair interactions in periodic systems are calculated using the minimum-image convention; the cutoff should therefore never be larger than half the smallest edge length of the elementary cell.
For Lennard-Jones interactions, all terms for pairs whose distance exceeds the cutoff are set to zero, without any form of correction. For electrostatic interactions, a charge-neutralizing surface charge density is added around the cutoff sphere in order to reduce cutoff effects (see Wolf et al., J. Chem. Phys. 17, 8254 (1999)).
For Ewald summation, there are some additional parameters that can be specified by dictionary entries:
“beta” specifies the Ewald screening parameter
It should be significantly larger than 1/beta to ensure that the neglected terms are small.
Note that, like the real-space cutoff, this is a distance; it describes the smallest wavelength of plane waves to take into account. Consequently, a smaller value means a more precise (and more expensive) calculation.
MMTK provides default values for these parameter which are calculated as a function of the system size. However, these parameters are exaggerated in most cases of practical interest and can lead to excessive calculation times for large systems. It is preferable to determine suitable values empirically for the specific system to be simulated.
The method “screened” uses the real-space part of the Ewald sum with a charge-neutralizing surface charge density around the cutoff sphere, and no reciprocal sum (see article cited above). It requires the specification of the dictionary entries “cutoff” and “beta”.
Bases: MMTK.ForceFields.MMForceField.MMForceField
Amber 94 force field
Parameters: |
|
---|
Bases: MMTK.ForceFields.MMForceField.MMForceField
Amber 99 force field
Parameters: |
|
---|
Bases: MMTK.ForceFields.ForceField.ForceField
Effective harmonic force field for an ANM protein model
Parameters: |
|
---|
Bases: MMTK.ForceFields.ForceField.ForceField
Effective harmonic force field for a C-alpha protein model
Parameters: |
|
---|
Bases: MMTK.ForceFields.ForceField.ForceField
Deformation force field for protein normal mode calculations
The pair interaction force constant has the form k(r)=factor*exp(-(r**2-0.01)/range**2). The default value for range is appropriate for a C-alpha model of a protein. The offset of 0.01 is a convenience for defining factor; with this definition, factor is the force constant for a distance of 0.1nm.
Parameters: |
|
---|
Bases: MMTK.ForceFields.MMForceField.MMAtomParameters, MMTK.ForceFields.ForceField.CompoundForceField
Simplified harmonic force field for normal mode calculations
This force field is made up of the bonded terms from the Amber 94 force field with the equilibrium positions of all terms changed to the corresponding values in the input configuration, such that the input configuration becomes an energy minimum by construction. The nonbonded terms are replaced by a generic short-ranged deformation term.
Bases: MMTK.ForceFields.NonBondedInteractions.LJForceField
Lennard-Jones force field
The Lennard-Jones parameters are taken from the atom attributes LJ_radius and LJ_energy. The pair interaction energy has the form U(r)=4*LJ_energy*((LJ_radius/r)**12-(LJ_radius/r)**6).
Parameters: | cutoff (float) – a cutoff value or None, meaning no cutoff. Pair interactions in periodic systems are calculated using the minimum-image convention; the cutoff should therefore never be larger than half the smallest edge length of the elementary cell. |
---|
Bases: MMTK.ForceFields.MMForceField.MMForceField
Force field for water simulations with the SPC/E model
Parameters: |
|
---|
Force field consistency tests
Test force constants by comparing to the numerical derivatives of the gradients.
Parameters: |
|
---|
Test gradients by comparing to numerical derivatives of the energy.
Parameters: |
|
---|
Harmonic restraint terms that can be added to any force field
Example:
from MMTK import *
from MMTK.ForceFields import Amber99ForceField
from MMTK.ForceFields.Restraints import HarmonicDistanceRestraint
universe = InfiniteUniverse()
universe.protein = Protein('bala1')
force_field = Amber99ForceField() + HarmonicDistanceRestraint(universe.protein[0][1].peptide.N,
universe.protein[0][1].peptide.O,
0.5, 10.)
universe.setForceField(force_field)
Bases: MMTK.ForceFields.ForceField.ForceField
Harmonic angle restraint between three atoms
Parameters: |
|
---|
Bases: MMTK.ForceFields.ForceField.ForceField
Harmonic dihedral angle restraint between four atoms
Parameters: |
|
---|
Bases: MMTK.ForceFields.ForceField.ForceField
Harmonic distance restraint between two atoms
Parameters: |
|
---|
Bases: MMTK.ForceFields.ForceField.ForceField
Harmonic potential with respect to a fixed point in space
Parameters: |
|
---|
Fourier basis for low-frequency normal mode calculations
This module provides a basis that is suitable for the calculation of low-frequency normal modes. The basis is derived from vector fields whose components are stationary waves in a box surrounding the system. For a description, see
K. HinsenAnalysis of domain motions by approximate normal mode calculationsProteins 33 (1998): 417-429
Bases: object
Collective-motion basis for low-frequency normal mode calculations
A FourierBasis behaves like a sequence of ParticleVector objects. The vectors are B{not} orthonormal, because orthonormalization is handled automatically by the normal mode class.
Parameters: |
|
---|
Estimate the number of basis vectors for a given universe and cutoff
Parameters: |
|
---|---|
Returns: | the number of basis vectors in a FourierBasis |
Return type: | int |
Estimate the cutoff that yields a given number of basis vectors for a given universe.
Parameters: |
|
---|---|
Returns: | the wavelength cutoff and the precise number of basis vectors |
Return type: | tuple (float, int) |
Elementary geometrical objects and operations
There are essentially two kinds of geometrical objects: shape objects (spheres, planes, etc.), from which intersections can be calculated, and lattice objects, which define a regular arrangements of points.
Bases: MMTK.Geometry.RhombicLattice
Body-Centered Cubic lattice
A Body-Centered Cubic lattice has two points per elementary cell.
Parameters: |
|
---|
Bases: MMTK.Geometry.GeometricalObject3D
Rectangular box aligned with the coordinate axes
Parameters: |
|
---|
Bases: MMTK.Geometry.RhombicLattice
Bravais lattice
A Bravais lattice is a special case of a general rhombic lattice in which the elementary cell contains only one point.
Parameters: |
|
---|
Bases: MMTK.Geometry.GeometricalObject3D
2D circle in 3D space
Parameters: |
|
---|
Bases: MMTK.Geometry.GeometricalObject3D
Cone
Parameters: |
|
---|
Bases: MMTK.Geometry.GeometricalObject3D
Cylinder
Parameters: |
|
---|
Bases: MMTK.Geometry.RhombicLattice
Face-Centered Cubic lattice
A Face-Centered Cubic lattice has four points per elementary cell.
Parameters: |
|
---|
Bases: object
3D shape object
This is an abstract base class. To create 3D objects, use one of its subclasses.
Parameters: | point (Scientific.Geometry.Vector) – a point in 3D space |
---|---|
Returns: | True of the point is inside the volume of the object |
Return type: | bool |
Parameters: | point (Scientific.Geometry.Vector) – a point in 3D space |
---|---|
Returns: | True of the point lies on the surface of the object |
Return type: | bool |
Bases: object
General lattice
Lattices are special sequence objects that contain vectors (points on the lattice) or objects that are constructed as functions of these vectors. Lattice objects behave like lists, i.e. they permit indexing, length inquiry, and iteration by ‘for’-loops. Note that the lattices represented by these objects are finite, they have a finite (and fixed) number of repetitions along each lattice vector.
This is an abstract base class. To create lattice objects, use one of its subclasses.
Bases: MMTK.Geometry.GeometricalObject3D
Line
Parameters: |
|
---|
Parameters: | point (Scientific.Geometry.Vector) – a point in space |
---|---|
Returns: | the smallest distance of the point from the line |
Return type: | float |
Bases: MMTK.Geometry.GeometricalObject3D
2D plane in 3D space
Parameters: | args – three points (of type Scientific.Geometry.Vector) |
---|
that are not collinear, or a point in the plane and the normal vector of the plane
Bases: MMTK.Geometry.Lattice
Rhombic lattice
Parameters: |
|
---|
Bases: MMTK.Geometry.BravaisLattice
Simple Cubic lattice
A Simple Cubic lattice is a special case of a Bravais lattice in which the elementary cell is a cube.
Parameters: |
|
---|
Bases: MMTK.Geometry.GeometricalObject3D
Sphere
Parameters: |
|
---|
Parameters: | confs (sequence of (float, Vector, Vector)) – the weight, reference position, and alternate position for each atom |
---|---|
Returns: | the quaternion representing the rotation, the center of mass in the reference configuration, the center of mass in the alternate configuraton, and the RMS distance after the optimal superposition |
Manipulation of molecular configurations in terms of internal coordinates
Bases: MMTK.InternalCoordinates.InternalCoordinate
Bond angle
A BondAngle object permits calculating and modifying the angle between two bonds in a molecule, under the condition that the bonds are not part of a circular bond structure (but it is not a problem to have a circular bond structure elsewhere in the molecule). Modifying the bond angle rotates the parts of the molecule on both sides of the central atom around an axis passing through the central atom and perpendicular to the plane defined by the two bonds in such a way that there is no overall rotation of the molecule. The central atom and any other atoms bonded to it do not move.
The initial construction of the BondAngle object can be expensive (the bond structure of the molecule must be analyzed). It is therefore advisable to keep the object rather than recreate it frequently. Note that if you only want to calculate bond angles (no modification), the method Universe.angle is simpler and faster.
Parameters: |
---|
Parameters: | conf (Configuration) – a configuration (defaults to the current configuration) |
---|---|
Returns: | the size of the angle in the configuration conf |
Return type: | float |
Bases: MMTK.InternalCoordinates.InternalCoordinate
Bond length coordinate
A BondLength object permits calculating and modifying the length of a bond in a molecule, under the condition that the bond is not part of a circular bond structure (but it is not a problem to have a circular bond structure elsewhere in the molecule). Modifying the bond length moves the parts of the molecule on both sides of the bond along the bond direction in such a way that the center of mass of the molecule does not change.
The initial construction of the BondLength object can be expensive (the bond structure of the molecule must be analyzed). It is therefore advisable to keep the object rather than recreate it frequently. Note that if you only want to calculate bond lengths (no modification), the method Universe.distance is simpler and faster.
Parameters: |
---|
Parameters: | conf (Configuration) – a configuration (defaults to the current configuration) |
---|---|
Returns: | the length of the bond in the configuration conf |
Return type: | float |
Bases: MMTK.InternalCoordinates.InternalCoordinate
Dihedral angle
A DihedralAngle object permits calculating and modifying the dihedral angle defined by three consecutive bonds in a molecule, under the condition that the central bond is not part of a circular bond structure (but it is not a problem to have a circular bond structure elsewhere in the molecule). Modifying the dihedral angle rotates the parts of the molecule on both sides of the central bond around this central bond in such a way that there is no overall rotation of the molecule.
The initial construction of the DihedralAngle object can be expensive (the bond structure of the molecule must be analyzed). It is therefore advisable to keep the object rather than recreate it frequently. Note that if you only want to calculate bond angles (no modification), the method Universe.dihedral is simpler and faster.
Parameters: |
---|
Parameters: | conf (Configuration) – a configuration (defaults to the current configuration) |
---|---|
Returns: | the size of the dihedral angle in the configuration conf |
Return type: | float |
Energy minimizers
Bases: MMTK.Minimization.Minimizer
Conjugate gradient minimizer
The minimizer can handle fixed atoms, but no distance constraints. It is fully thread-safe.
The minimization is started by calling the minimizer object. All the keyword options can be specified either when creating the minimizer or when calling it.
The following data categories and variables are available for output:
category “configuration”: configuration and box size (for periodic universes)
category “gradients”: energy gradients for each atom
- category “energy”: potential energy and
norm of the potential energy gradient
Parameters: |
|
---|
Bases: MMTK.Minimization.Minimizer
Steepest-descent minimizer
The minimizer can handle fixed atoms, but no distance constraints. It is fully thread-safe.
The minimization is started by calling the minimizer object. All the keyword options (see documnentation of __init__) can be specified either when creating the minimizer or when calling it.
The following data categories and variables are available for output:
category “configuration”: configuration and box size (for periodic universes)
category “gradients”: energy gradients for each atom
- category “energy”: potential energy and
norm of the potential energy gradient
Parameters: |
|
---|
Molecular surfaces and volumes.
Identifies contacts between two molecules. A contact is defined as a pair of atoms whose distance is less than contact_factor*(r1+r2+cutoff), where r1 and r2 are the atomic van-der-Waals radii.
Parameters: |
|
---|---|
Returns: | a list of Contact objects that describe atomic contacts between object1 and object2. |
Return type: | list |
Parameters: |
|
---|---|
Returns: | the molecular surface and volume of object |
Return type: | tuple |
Parameters: |
|
---|---|
Returns: | a dictionary that maps the surface atoms to their exposed surface areas |
Return type: | dict |
Parameters: |
|
---|---|
Returns: | a dictionary that maps the surface atoms to a tuple containing three surface-related quantities: the exposed surface area, a list of points in the exposed surface, and a gradient vector pointing outward from the surface. |
Return type: | dict |
Molecule factory for creating chemical objects
Bases: object
MoleculeFactory
A MoleculeFactory serves to create molecules without reference to database definitions. Molecules and groups are defined in terms of atoms, groups, and bonds. Each MoleculeFactory constitutes an independent set of definitions. Definitions within a MoleculeFactory can refer to each other.
Each MoleculeFactory stores a set of Group objects which are referred to by names. The typical operation sequence is to create a new group and then add atoms, bonds, and subgroups. It is also possible to define coordinates and arbitrary attributes (in particular for force fields). In the end, a finished object can be retrieved as a Molecule object.
Add an atom to a group
Parameters: |
|
---|
Add a bond to a group
Parameters: |
|
---|
Normal modes
Brownian normal modes
Bases: MMTK.NormalModes.Core.Mode
Single Brownian normal mode
Mode objects are created by indexing a BrownianModes object. They contain the atomic displacements corresponding to a single mode. In addition, the inverse of the relaxation time corresponding to the mode is stored in the attribute “inv_relaxation_time”.
Note: the Brownian mode vectors are not friction weighted and therefore not orthogonal to each other.
Bases: MMTK.NormalModes.Core.NormalModes
Brownian modes describe the independent relaxation motions of a harmonic system with friction. They are obtained by diagonalizing the friction-weighted force constant matrix.
In order to obtain physically reasonable normal modes, the configuration of the universe must correspond to a local minimum of the potential energy.
Individual modes (see BrownianMode) can be extracted by indexing with an integer. Looping over the modes is possible as well.
Brownian modes describe the independent relaxation motions of a harmonic system with friction. They are obtained by diagonalizing the friction-weighted force constant matrix.
In order to obtain physically reasonable normal modes, the configuration of the universe must correspond to a local minimum of the potential energy.
A BrownianModes object behaves like a sequence of modes. Individual modes (see BrownianMode) can be extracted by indexing with an integer. Looping over the modes is possible as well.
Parameters: |
|
---|
Parameters: |
|
---|---|
Returns: | the Elastic Incoherent Structure Factor (EISF) as a function of angular wavenumber |
Return type: | Scientific.Functions.Interpolation.InterpolatingFunction |
Parameters: |
|
---|---|
Returns: | the Coherent Scattering Function as a function of time |
Return type: | Scientific.Functions.Interpolation.InterpolatingFunction |
Parameters: |
|
---|---|
Returns: | the Incoherent Scattering Function as a function of time |
Return type: | Scientific.Functions.Interpolation.InterpolatingFunction |
Parameters: |
|
---|---|
Returns: | the averaged mean-square displacement of the atoms in subset as a function of time |
Return type: | Scientific.Functions.Interpolation.InterpolatingFunction |
Parameters: | item (int) – the index of a normal mode |
---|---|
Returns: | the unscaled mode vector |
Return type: | BrownianMode |
Parameters: |
|
---|---|
Returns: | the Static Structure Factor as a function of angular wavenumber |
Return type: | Scientific.Functions.Interpolation.InterpolatingFunction |
Energetic normal modes
Bases: MMTK.NormalModes.Core.Mode
Single energetic normal mode
Mode objects are created by indexing a MMTK.NormalModes.EnergeticModes.EnergeticModes object. They contain the atomic displacements corresponding to a single mode. In addition, the force constant corresponding to the mode is stored in the attribute “force_constant”.
Bases: MMTK.NormalModes.Core.NormalModes
Energetic modes describe the principal axes of an harmonic approximation to the potential energy surface of a system. They are obtained by diagonalizing the force constant matrix without prior mass-weighting.
In order to obtain physically reasonable normal modes, the configuration of the universe must correspond to a local minimum of the potential energy.
Individual modes (see class EnergeticMode) can be extracted by indexing with an integer. Looping over the modes is possible as well.
Parameters: |
|
---|
Parameters: | item (int) – the index of a normal mode |
---|---|
Returns: | the unscaled mode vector |
Return type: | EnergeticMode |
Vibrational normal modes
Bases: MMTK.NormalModes.Core.Mode
Single vibrational normal mode
Mode objects are created by indexing a VibrationalModes object. They contain the atomic displacements corresponding to a single mode. In addition, the frequency corresponding to the mode is stored in the attribute “frequency”.
Note: the normal mode vectors are not mass weighted, and therefore not orthogonal to each other.
Bases: MMTK.NormalModes.Core.NormalModes
Vibrational modes describe the independent vibrational motions of a harmonic system. They are obtained by diagonalizing the mass-weighted force constant matrix.
In order to obtain physically reasonable normal modes, the configuration of the universe must correspond to a local minimum of the potential energy.
Individual modes (see VibrationalMode) can be extracted by indexing with an integer. Looping over the modes is possible as well.
Parameters: |
|
---|
Parameters: |
|
---|---|
Returns: | the Elastic Incoherent Structure Factor (EISF) as a function of angular wavenumber |
Return type: | Scientific.Functions.Interpolation.InterpolatingFunction |
Parameters: |
|
---|---|
Returns: | the Incoherent Scattering Function as a function of time |
Return type: | Scientific.Functions.Interpolation.InterpolatingFunction |
Parameters: |
|
---|---|
Returns: | the averaged mean-square displacement of the atoms in subset as a function of time |
Return type: | Scientific.Functions.Interpolation.InterpolatingFunction |
Parameters: | item (int) – the index of a normal mode |
---|---|
Returns: | the unscaled mode vector |
Return type: | VibrationalMode |
Nucleic acid chains
Bases: MMTK.Biopolymers.Residue
Nucleic acid residue
Nucleotides are a special kind of group. Like any other group, they are defined in the chemical database. Each residue has two or three subgroups (‘sugar’ and ‘base’, plus ‘phosphate’ except for 5’-terminal residues) and is usually connected to other residues to form a nucleotide chain. The database contains three variants of each residue (5’-terminal, 3’-terminal, non-terminal).
Parameters: |
|
---|
Bases: MMTK.Biopolymers.ResidueChain
Nucleotide chain
Nucleotide chains consist of nucleotides that are linked together. They are a special kind of molecule, i.e. all molecule operations are available.
Nucleotide chains act as sequences of residues. If n is a NucleotideChain object, then
len(n) yields the number of nucleotides
n[i] yields nucleotide number i
- n[i:j] yields the subchain from nucleotide number i up to but
excluding nucleotide number j
Parameters: |
|
---|
Returns: | the sugar and phosphate groups of all nucleotides |
---|---|
Return type: | Collection |
Returns: | the base groups of all nucleotides |
---|---|
Return type: | Collection |
Bases: MMTK.NucleicAcids.NucleotideChain
A contiguous part of a nucleotide chain
NucleotideSubChain objects are the result of slicing operations on NucleotideChain objects. They cannot be created directly. NucleotideSubChain objects permit all operations of NucleotideChain objects, but cannot be added to a universe.
PDB files
This module provides classes that represent molecules in a PDB file. They permit various manipulations and the creation of MMTK objects. Note that the classes defined in this module are specializations of classed defined in Scientific.IO.PDB; the methods defined in that module are also available.
Bases: Scientific.IO.PDB.Structure
Everything in a PDB file
A PDBConfiguration object represents the full contents of a PDB file. It can be used to create MMTK objects for all or part of the molecules, or to change the configuration of an existing system.
Parameters: |
|
---|
Sets the configuration of object from the coordinates in the PDB file. The object must be compatible with the PDB file, i.e. contain the same subobjects and in the same order. This is usually only guaranteed if the object was created by the method
createAll() from a PDB file with the same layout. :param object: a chemical object or collection of chemical objects
Parameters: |
|
---|---|
Returns: | a collection containing all molecules in the unit cell, obtained by copying and moving the molecules from the asymmetric unit according to the crystallographic symmetry operations. |
Return type: |
Returns: | a collection containing all objects contained in the PDB file, i.e. the combination of the objects returned by createPeptideChains(), createNucleotideChains(), and createMolecules(). The parameters have the same meaning as for createMolecules(). |
---|---|
Return type: | Collection |
Parameters: |
|
---|---|
Returns: | a collection of Molecule objects, one for each molecule in the PDB file. Each PDB residue not describing an amino acid or nucleotide residue is considered a molecule. |
Return type: |
Returns: | a list of NucleotideChain objects, one for each nucleotide chain in the PDB file. The parameter model has the same meaning as for the NucleotideChain constructor. |
---|---|
Return type: | list |
Returns: | a list of PeptideChain objects, one for each peptide chain in the PDB file. The parameter model has the same meaning as for the PeptideChain constructor. |
---|---|
Return type: | list |
Constructs an empty universe (OrthrhombicPeriodicUniverse or ParallelepipedicPeriodicUniverse) representing the unit cell of the crystal. If the PDB file does not define a unit cell at all, an InfiniteUniverse is returned.
Returns: | a universe |
---|---|
Return type: | Universe |
alias of PDBMolecule
alias of PDBNucleotideChain
alias of PDBPeptideChain
alias of PDBConfiguration
Bases: Scientific.IO.PDB.Molecule
Molecule in a PDB file
See the description of Scientific.IO.PDB.Molecule for the constructor and additional methods. In MMTK, PDBMolecule objects are usually obtained from a PDBConfiguration object via its attribute molecules (see the documentation of Scientific.IO.PDB.Structure). A molecule is by definition any residue in a PDB file that is not an amino acid or nucleotide residue.
@param name: the name of the group @type name: C{str} @param atoms: a list of atoms (or C{None} for no atoms) @type atoms: C{list} or C{NoneType} @param number: the PDB residue number (or C{None}) @type number: C{int} or C{NoneType}
Bases: Scientific.IO.PDB.NucleotideChain, MMTK.PDB.PDBChain
Nucleotide chain in a PDB file
See the description of Scientific.IO.PDB.NucleotideChain for the constructor and additional methods. In MMTK, PDBNucleotideChain objects are usually obtained from a PDBConfiguration object via its attribute nucleotide_chains (see the documentation of Scientific.IO.PDB.Structure).
@type residues: C{list} or C{NoneType} @param chain_id: a one-letter chain identifier or C{None} @type chain_id: C{str} or C{NoneType} @param segment_id: a multi-character segment identifier or C{None} @type segment_id: C{str} or C{NoneType}
Returns: | a NucleotideChain object corresponding to the nucleotide chain in the PDB file. The parameter model has the same meaning as for the NucleotideChain constructor. |
---|---|
Return type: | NucleotideChain |
Bases: object
PDB file for output
Parameters: |
|
---|
Write an object to the file
Parameters: |
|
---|
Bases: Scientific.IO.PDB.PeptideChain, MMTK.PDB.PDBChain
Peptide chain in a PDB file
See the description of Scientific.IO.PDB.PeptideChain for the constructor and additional methods. In MMTK, PDBPeptideChain objects are usually obtained from a PDBConfiguration object via its attribute peptide_chains (see the documentation of Scientific.IO.PDB.Structure).
@type residues: C{list} or C{NoneType} @param chain_id: a one-letter chain identifier or C{None} @type chain_id: C{str} or C{NoneType} @param segment_id: a multi-character segment identifier or C{None} @type segment_id: C{str} or C{NoneType}
Returns: | a PeptideChain object corresponding to the peptide chain in the PDB file. The parameter model has the same meaning as for the PeptideChain constructor. |
---|---|
Return type: | PeptideChain |
Molecule factory defined by a PDB file
This module permits the construction of molecular objects that correspond exactly to the contents of a PDB file. It is used for working with experimental data. Note that most force fields cannot be applied to the systems generated in this way because the molecule factory does not know any force field parameters.
Bases: MMTK.MoleculeFactory.MoleculeFactory
A PDBMoleculeFactory generates molecules and universes from the contents of a PDBConfiguration. Nothing is added or left out (except as defined by the optional residue and atom filters), and the atom and residue names are exactly those of the original PDB file.
Parameters: |
|
---|
Constructs a universe (OrthrhombicPeriodicUniverse or ParallelepipedicPeriodicUniverse) representing the unit cell of the crystal and adds the molecules representing the asymmetric unit.
Returns: | a universe |
---|---|
Return type: | Universe |
Constructs Molecule objects corresponding to the contents of the PDBConfiguration. Each peptide or nucleotide chain becomes one molecule. For residues that are neither amino acids nor nucleic acids, each residue becomes one molecule.
Chain molecules (peptide and nucleotide chains) can be iterated over to retrieve the individual residues. The residues can also be accessed as attributes whose names are the three-letter residue name (upper case) followed by an underscore and the residue number from the PDB file (e.g. ‘GLY_34’).
Each object that corresponds to a PDB residue (i.e. each residue in a chain and each non-chain molecule) has the attributes ‘residue_name’ and ‘residue_number’. Each atom has the attributes ‘serial_number’, ‘occupancy’ and ‘temperature_factor’. Atoms for which a ANISOU record exists also have an attribute ‘u’ whose value is a tensor object.
Returns: | a list of Molecule objects |
---|---|
Return type: | list |
Constructs a universe (OrthrhombicPeriodicUniverse or ParallelepipedicPeriodicUniverse) representing the unit cell of the crystal and adds all the molecules it contains, i.e. the molecules of the asymmetric unit and its images obtained by applying the crystallographic symmetry operations.
Parameters: | compact (bool) – if True, the images are shifted such that their centers of mass lie inside the unit cell. |
---|---|
Returns: | a universe |
Return type: | Universe |
Quantities defined for each particle in a universe
Bases: MMTK.ParticleProperties.ParticleVector
Configuration of a universe
Configuration 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.
Parameters: |
|
---|
Bases: object
Property defined for each particle
This is an abstract base class; for creating instances, use one of its subclasses.
ParticleProperty objects store properties that are defined per particle, such as mass, position, velocity, etc. The value corresponding to a particular atom can be retrieved or changed by indexing with the atom object.
Copy all values from another compatible ParticleProperty object.
Parameters: | other – the data source |
---|
alias of ParticleProperty
Multiply all values by a factor
Parameters: | factor (float) – the scale factor |
---|
Return a collection containing all atoms a for which condition(property[a]) is True.
Parameters: | condition (callable) – a test function |
---|
Bases: MMTK.ParticleProperties.ParticleProperty
Scalar property defined for each particle
ParticleScalar objects can be added to each other and multiplied with scalars.
Parameters: |
|
---|
Parameters: | function – a function that is applied to each data value |
---|---|
Returns: | a new ParticleScalar object containing the function results |
alias of ParticleScalar
Bases: MMTK.ParticleProperties.ParticleProperty
Rank-2 tensor property defined for each particle
ParticleTensor objects can be added to each other and multiplied with scalars or ParticleScalar objects; all of these operations result in another ParticleTensor object.
Parameters: |
|
---|
alias of ParticleTensor
Bases: MMTK.ParticleProperties.ParticleProperty
Vector property defined for each particle
ParticleVector objects can be added to each other and multiplied with scalars or ParticleScalar objects; all of these operations result in another ParticleVector object. Multiplication with a vector or another ParticleVector object yields a ParticleScalar object containing the dot products for each particle. Multiplications that treat ParticleVectors as vectors in a 3N-dimensional space are implemented as methods.
Parameters: |
|
---|
Parameters: | other (ParticleVector) – another ParticleVector |
---|---|
Returns: | the dot product with other, treating both operands as 3N-dimensional vectors. |
Parameters: | other (ParticleVector) – another ParticleVector |
---|---|
Returns: | the dyadic product with other |
Return type: | ParticleTensor |
Returns: | the length (norm) of the vector for each particle |
---|---|
Return type: | ParticleScalar |
Parameters: | other (ParticleVector) – another ParticleVector |
---|---|
Returns: | the mass-weighted dot product with other treating both operands as 3N-dimensional vectors |
Return type: | float |
Returns: | the mass-weighted norm of the ParticleVector seen as a 3N-dimensional vector |
---|---|
Return type: | float |
Returns: | the norm of the ParticleVector seen as a 3N-dimensional vector |
---|---|
Return type: | float |
alias of ParticleVector
Returns: | the norm of the ParticleVector seen as a 3N-dimensional vector |
---|---|
Return type: | float |
Parameters: | object – any object |
---|---|
Returns: | True if object is a Configuration |
Return type: | bool |
Parameters: | object – any object |
---|---|
Returns: | True if object is a ParticleProperty |
Return type: | bool |
A friction constant model for Cα models of proteins
Peptide chains and proteins
Bases: MMTK.Proteins.PeptideChain
Peptide chains connected by disulfide bridges
A group of peptide chains connected by disulfide bridges must be considered a single molecule due to the presence of chemical bonds. Such a molecule is represented by a ConnectedChains object. These objects are created automatically when a Protein object is assembled. They are normally not used directly by application programs. When a chain with disulfide bridges to other chains is extracted from a Protein object, the return value is a SubChain object that indirectly refers to a ConnectedChains object.
Bases: MMTK.Biopolymers.ResidueChain
Peptide chain
Peptide chains consist of amino acid residues that are linked by peptide bonds. They are a special kind of molecule, i.e. all molecule operations are available.
Peptide chains act as sequences of residues. If p is a PeptideChain object, then
len(p) yields the number of residues
p[i] yields residue number i
- p[i:j] yields the subchain from residue number i up to
but excluding residue number j
Parameters: |
|
---|
Returns: | the peptide groups of all residues |
---|---|
Return type: | Collection |
Returns: | a list of the (phi, psi) backbone angles for each residue |
---|---|
Return type: | list of tuple of float |
Parameters: |
|
---|
Returns: | the primary sequence as a list of three-letter residue codes. |
---|---|
Return type: | list |
Returns: | the sidechain groups of all residues |
---|---|
Return type: | Collection |
Bases: MMTK.ChemicalObjects.Complex
Protein
A Protein object is a special kind of Complex object which is made up of peptide chains and possibly ligands.
If the atoms in the peptide chains that make up a protein have defined positions, sulfur bridges within chains and between chains will be constructed automatically during protein generation based on a distance criterion between cystein sidechains.
Proteins act as sequences of chains. If p is a Protein object, then
Parameters: |
|
---|
Returns: | the peptide groups of all residues in all chains |
---|---|
Return type: | Collection |
Returns: | a list of the (phi, psi) backbone angles for all residue in all chains |
---|---|
Return type: | list of list of tuple of float |
Returns: | all residues in all chains |
---|---|
Return type: | Collection |
Parameters: | types (sequence of str) – a sequence of residue codes (one- or three-letter) |
---|---|
Returns: | all residues whose type (one- or three-letter code) is contained in types |
Return type: | Collection |
Returns: | the sidechain groups of all residues in all chains |
---|---|
Return type: | Collection |
Bases: MMTK.Biopolymers.Residue
Amino acid residue
Amino acid residues are a special kind of group. They are defined in the chemical database. Each residue has two subgroups (‘peptide’ and ‘sidechain’) and is usually connected to other residues to form a peptide chain. The database contains three variants of each residue (N-terminal, C-terminal, non-terminal) and various models (all-atom, united-atom, Cα).
Parameters: |
|
---|
Returns: | an object representing the chi angle and allowing to modify it |
---|---|
Return type: | MMTK.InternalCoordinates.DihedralAngle |
Returns: | an object representing the phi angle and allowing to modify it |
---|---|
Return type: | MMTK.InternalCoordinates.DihedralAngle |
Returns: | the values of the backbone dihedral angles phi and psi. |
---|---|
Return type: | tuple (float, float) |
Bases: MMTK.Proteins.PeptideChain
A contiguous part of a peptide chain
SubChain objects are the result of slicing operations on PeptideChain objects. They cannot be created directly. SubChain objects permit all operations of PeptideChain objects, but cannot be added to a universe.
Random quantities for use in molecular simulations
Returns: | a vector drawn from a uniform distribution on the surface of a unit sphere. |
---|---|
Return type: | Scientific.Geometry.Vector |
Parameters: | n – the number of direction vectors |
---|---|
Returns: | a list of n vectors drawn from a uniform distribution on the surface of a unit sphere. If n is negative, returns a deterministic list of not more than -n vectors of unit length (useful for testing purposes). |
Return type: | list |
Parameters: |
|
---|---|
Returns: | a set of vectors drawn from a Gaussian distribution with a given width centered around zero. |
Return type: |
Parameters: |
|
---|---|
Returns: | a vector drawn from a uniform distribution within a rectangular box with edge lengths a, b, c. |
Return type: | Scientific.Geometry.Vector |
Parameters: | r (float) – the radius of a sphere |
---|---|
Returns: | a vector drawn from a uniform distribution within a sphere of radius r. |
Return type: | Scientific.Geometry.Vector |
Parameters: | max_angle (float) – the upper limit for the rotation angle |
---|---|
Returns: | a random rotation with a uniform axis distribution and angles drawn from a uniform distribution between -max_angle and max_angle. |
Return type: | Scientific.Geometry.Transformations.Rotation |
Parameters: |
|
---|---|
Returns: | a random velocity vector for a particle of a given mass at a given temperature |
Return type: | Scientific.Geometry.Vector |
Solvation of solute molecules
Scales up the universe and adds as many solvent molecules as are necessary to obtain the specified solvent density, taking account of the solute molecules that are already present in the universe. The molecules are placed at random positions in the scaled-up universe, but without overlaps between any two molecules.
Parameters: |
---|
Parameters: | |
---|---|
Returns: | the number of solvent molecules that must be added to the universe, in addition to whatever it already contains, to obtain the given solvent density. |
Return type: | int |
Shrinks the universe, which must have been scaled up by addSolvent, back to its original size. The compression is performed in small steps, in between which some energy minimization and molecular dynamics steps are executed. The molecular dynamics is run at the given temperature, and an optional trajectory can be specified in which intermediate configurations are stored.
Parameters: |
|
---|
Linear subspaces for infinitesimal motions
This module implements subspaces for infinitesimal (or finite small-amplitude) atomic motions. They can be used in normal mode calculations or for analyzing complex motions. For an explanation, see:
K. Hinsen and G.R. KnellerProjection methods for the analysis of complex motions in macromoleculesMol. Sim. 23:275-292 (2000)
Bases: MMTK.Subspace.Subspace
Subspace for the motion of linked rigid bodies
This class describes the same subspace as RigidBodyMotionSubspace, and is used by the latter. For collections of several chains of linked rigid bodies, RigidBodyMotionSubspace is more efficient.
Parameters: |
|
---|
Bases: MMTK.Subspace.Subspace
Subspace of pair-distance motions
A pair-distance motion subspace is the subspace which contains the relative motions of any number of atom pairs along their distance vector, e.g. bond elongation between two bonded atoms.
Parameters: |
|
---|
Bases: MMTK.Subspace.Subspace
Subspace of rigid-body motions
A rigid-body motion subspace is the subspace which contains the rigid-body motions of any number of chemical objects.
Parameters: |
|
---|
Bases: object
Subspace of infinitesimal atomic motions
Parameters: |
|
---|
Construct a basis for the subspace by orthonormalization of the input vectors using Singular Value Decomposition. The basis consists of a sequence of ParticleVector objects that are orthonormal in configuration space. :returns: the basis
Parameters: | vector (ParticleVector) – a particle vector |
---|---|
Returns: | the projection of the vector onto the orthogonal complement of the subspace. |
Parameters: | vector (ParticleVector) – a particle vector |
---|---|
Returns: | the projection of the vector onto the subspace. |
Trajectory files and their contents
Bases: MMTK.Trajectory.TrajectoryOutput
Protocol file output action
A LogOutput object can be used in the action list of any trajectory-generating operation. It writes any of the available data to a text file.
Parameters: |
|
---|
Bases: object
Trajectory data for a single particle
A ParticleTrajectory object is created by calling the method readParticleTrajectory() on a Trajectory object.
If pt is a ParticleTrajectory object, then
- len(pt) is the number of steps stored in it
- pt[i] is the value at step i (a vector)
Bases: MMTK.Trajectory.TrajectoryOutput
Restart trajectory output action
A RestartTrajectoryOutput object is used in the action list of any trajectory-generating operation. It writes those variables to a trajectory that the trajectory generator declares as necessary for restarting.
Parameters: |
|
---|
Bases: object
Rigid-body trajectory data
A RigidBodyTrajectory object is created by calling the method readRigidBodyTrajectory() on a Trajectory object.
If rbt is a RigidBodyTrajectory object, then
- len(rbt) is the number of steps stored in it
- rbt[i] is the value at step i (a vector for the center of mass and a quaternion for the orientation)
Bases: MMTK.Trajectory.TrajectoryGenerator
Trajectory generator for single steps
A SnapshotGenerator is used for manual assembly of trajectory files. At each call it writes one step to the trajectory, using the current state of the universe (configuration, velocities, etc.) and data provided explicitly with the call.
Each call to the SnapshotGenerator object produces one step. All the keyword options can be specified either when creating the generator or when calling it.
Parameters: |
|
---|
Bases: MMTK.Trajectory.LogOutput
Standard protocol output action
A StandardLogOutput object can be used in the action list of any trajectory-generating operation. It is a specialization of LogOutput to the most common case and writes data in the categories “time” and “energy” to the standard output stream.
Parameters: | skip (int) – the number of steps to skip between two action runs |
---|
Bases: object
Reference to a subset of a trajectory
A SubTrajectory object is created by slicing a Trajectory object or another SubTrajectory object. It provides all the operations defined on Trajectory objects.
Bases: MMTK.Trajectory.TrajectoryVariable
Reference to a subset of a TrajectoryVariable
A SubVariable object is created by slicing a TrajectoryVariable object or another SubVariable object. It provides all the operations defined on TrajectoryVariable objects.
Bases: object
Trajectory file
The data in a trajectory file can be accessed by step or by variable. If t is a Trajectory object, then:
- len(t) is the number of steps
- t[i] is the data for step i, in the form of a dictionary that maps variable names to data
- t[i:j] and t[i:j:n] return a SubTrajectory object that refers to a subset of the total number of steps (no data is copied)
- t.variable returns the value of the named variable at all time steps. If the variable is a simple scalar, it is read completely and returned as an array. If the variable contains data for each atom, a TrajectoryVariable object is returned from which data at specific steps can be obtained by further indexing operations.
The routines that generate trajectories decide what variables are used and what they contain. The most frequently used variable is “configuration”, which stores the positions of all atoms. Other common variables are “time”, “velocities”, “temperature”, “pressure”, and various energy terms whose name end with “_energy”.
Parameters: |
|
---|
Close the trajectory file. Must be called after writing to ensure that all buffered data is written to the file. No data access is possible after closing a file.
Make sure that all data that has been written to the trajectory is also written to the file.
Read trajectory information for a single atom but for multiple time steps.
Parameters: |
|
---|---|
Returns: | the trajectory for a single atom |
Return type: |
Read the positions for an object at multiple time steps and extract the rigid-body motion (center-of-mass position plus orientation as a quaternion) by an optimal-transformation fit.
Parameters: |
|
---|---|
Returns: | the trajectory for a single rigid body |
Return type: |
Returns: | a list of the names of all variables that are stored in the trajectory |
---|---|
Return type: | list of str |
Show an animation of the trajectory using an external visualization program.
Parameters: |
|
---|
Bases: object
Trajectory action base class
Subclasses of this base class implement the actions that can be inserted into trajectory generation at regular intervals.
Bases: object
Trajectory generator base class
This base class implements the common aspects of everything that generates trajectories: integrators, minimizers, etc.
Bases: MMTK.Trajectory.TrajectoryAction
Trajectory output action
A TrajectoryOutput object can be used in the action list of any trajectory-generating operation. It writes any of the available data to a trajectory file. It is possible to use several TrajectoryOutput objects at the same time in order to produce multiple trajectories from a single run.
Parameters: |
|
---|
Bases: object
Trajectory file set
A TrajectorySet permits to treat a sequence of trajectory files like a single trajectory for reading data. It behaves exactly like a Trajectory object. The trajectory files must all contain data for the same system. The variables stored in the individual files need not be the same, but only variables common to all files can be accessed.
Note: depending on how the sequence of trajectories was constructed, the first configuration of each trajectory might be the same as the last one in the preceding trajectory. To avoid counting it twice, specify (filename, 1, None, 1) for all but the first trajectory in the set.
Parameters: |
|
---|
Bases: MMTK.Trajectory.TrajectoryVariable
Variable in a trajectory set
A TrajectorySetVariable object is created by extracting a variable from a TrajectorySet object if that variable contains data for each atom and is thus potentially large. It behaves exactly like a TrajectoryVariable object.
Bases: object
Variable in a trajectory
A TrajectoryVariable object is created by extracting a variable from a Trajectory object if that variable contains data for each atom and is thus potentially large. No data is read from the trajectory file when a TrajectoryVariable object is created; the read operation takes place when the TrajectoryVariable is indexed with a specific step number.
If t is a TrajectoryVariable object, then:
- len(t) is the number of steps
- t[i] is the data for step i, in the form of a ParticleScalar, a ParticleVector, or a Configuration object, depending on the variable
- t[i:j] and t[i:j:n] return a SubVariable object that refers to a subset of the total number of steps
Units and physical constants
This module defines constants and prefactors that convert from various units to MMTK’s internal unit system. There are also some common physical constants.
MMTK’s unit system is defined by:
All formulas that do not contain electrical quantities (charge, electric/magnetic field, ...) have the same form in this unit system as in the SI system. The energy unit that results from the choices given above is kJ/mol.
The constants defined in this module are:
- SI Prefixes: ato, femto, pico, nano, micro, milli, centi, deci,
deca, hecto, kilo, mega, giga, tera, peta
Length units: m, cm, mm, nm, pm, fm, Ang, Bohr
Angle units: rad, deg
Volume units: l
Time units: s, ns, ps, fs
Frequency units: Hz, invcm (wavenumbers)
Mass units: amu, g, kg
Quantity-of-matter units: mol
Energy units: J, kJ, cal (thermochemical), kcal, Hartree, Bohr
Temperature units: K
Force units: N, dyn
Pressure units: Pa, MPa, GPa, bar, kbar, atm
Electrostatic units: C, A, V, D, eV, e
Physical constants:
- c (speed of light)
- Nav (Avogadro number)
- h (Planck constant)
- hbar (Planck constant divided by 2*Pi)
- k_B (Boltzmann constant)
- eps0 (permittivity of vacuum)
- me (electron mass)
Other:
- akma_time (the time unit in the DCD trajectory format)
- electrostatic_energy (the prefactor in Coulomb’s law)
Universes
Bases: MMTK.Universe.OrthorhombicPeriodicUniverse
Periodic universe with cubic elementary cell.
Parameters: |
|
---|
Bases: MMTK.Universe.Universe
Infinite (unbounded and nonperiodic) universe.
Parameters: | forcefield (ForceField) – a force field, or None for no force field |
---|
Bases: MMTK.Universe.Periodic3DUniverse
Periodic universe with orthorhombic elementary cell.
Parameters: |
|
---|
Bases: MMTK.Universe.Periodic3DUniverse
Periodic universe with parallelepipedic elementary cell.
Parameters: |
|
---|
Bases: MMTK.Collections.GroupOfAtoms, MMTK.Visualization.Viewable
Universe
A universe represents a complete model of a chemical system, i.e. the molecules, their environment (topology, boundary conditions, thermostats, etc.), and optionally a force field.
The class Universe is an abstract base class that defines properties common to all kinds of universes. To create universe objects, use one of its subclasses.
In addition to the methods listed below, universe objects support the following operations (u is any universe object, o is any chemical object):
- len(u) yields the number of chemical objects in the universe
- u[i] returns object number i
- u.name = o adds o to the universe and also makes it accessible as an attribute
- del u.name removes the object that was assigned to u.name from the universe
Acquire the configuration change lock. This lock should be acquired before starting an algorithm that changes the configuration continuously, e.g. minimization or molecular dynamics algorithms. This guarantees the proper order of execution when several such operations are started in succession. For example, when a minimization should be followed by a dynamics run, the use of this flag permits both operations to be started as background tasks which will be executed one after the other, permitting other threads to run in parallel.
The configuration change lock should not be confused with the universe state lock. The former guarantees the proper sequence of long-running algorithms, whereas the latter guarantees the consistency of the data. A dynamics algorithm, for example, keeps the configuration change lock from the beginning to the end, but acquires the universe state lock only immediately before modifying configuration and velocities, and releases it immediately afterwards.
Parameters: | waitflag (bool) – if true, the method waits until the lock becomes available; this is the most common mode. If false, the method returns immediately even if another thread holds the lock. |
---|---|
Returns: | a flag indicating if the lock was successfully acquired (1) or not (0). |
Return type: | int |
Acquire the universe read state lock. Any application that uses threading must acquire this lock prior to accessing the current state of the universe, in particular its configuration (particle positions). This guarantees the consistency of the data; while any thread holds the read state lock, no other thread can obtain the write state lock that permits modifying the state. The read state lock should be released as soon as possible.
The read state lock can be acquired only if no thread holds the write state lock. If the read state lock cannot be acquired immediately, the thread will be blocked until it becomes available. Any number of threads can acquire the read state lock simultaneously.
Acquire the universe write state lock. Any application that uses threading must acquire this lock prior to modifying the current state of the universe, in particular its configuration (particle positions). This guarantees the consistency of the data; while any thread holds the write state lock, no other thread can obtain the read state lock that permits accessing the state. The write state lock should be released as soon as possible.
The write state lock can be acquired only if no other thread holds either the read state lock or the write state lock. If the write state lock cannot be acquired immediately, the thread will be blocked until it becomes available.
Adds object to the universe. If object is a Collection, all elements of the Collection are added to the universe.
Parameters: |
|
---|
Update the current configuration of the universe by adding the given displacement vector.
Parameters: |
|
---|
Modifies the velocities to be compatible with the distance constraints, i.e. projects out the velocity components along the constrained distances.
Parameters: |
|
---|
Parameters: |
|
---|---|
Returns: | the angle between the distance vectors p1-p2 and p3-p2 |
Return type: | float |
Returns: | the basis vectors of the elementary cell of a periodic universe, or None for a non-periodic universe |
---|---|
Return type: | NoneType or list |
Parameters: | vector – a point in the universe expressed in box coordinates |
---|---|
Returns: | the real-space equivalent of vector |
Return type: | Scientific.Geometry.Vector |
Fractional coordinates are defined only for periodic universes; their components have values between 0. and 1.
Parameters: | vector (Scientific.Geometry.Vector) – a point in the universe |
---|---|
Returns: | the fractional coordinate equivalent of vector |
Return type: | Scientific.N.array_type |
Returns: | the volume of the elementary cell of a periodic universe, None for a non-periodic universe |
---|---|
Return type: | NoneType or float |
Return the atomic charges defined by the universe’s force field.
Returns: | the charges of all atoms in the universe |
---|---|
Return type: | ParticleScalar |
Returns: | the configuration object describing the current configuration of the universe. Note that this is not a copy of the current state, but a reference: the positions in the configuration object will change when coordinate changes are applied to the universe in whatever way. |
---|---|
Return type: | Configuration |
Parameters: |
|
---|---|
Returns: | the difference vector between the two configurations for each atom, taking into account the universe topology (e.g. minimum-image convention). |
Return type: |
Parameters: |
|
---|---|
Returns: | configuration conf (default: current configuration) corrected by the contiguous object offsets for that configuration. |
Return type: |
Parameters: |
|
---|---|
Returns: | a set of displacement vectors relative to the conf which, when added to the configuration, create a configuration in which none of the objects is split across the edge of the elementary cell. For nonperiodic universes the return value is None. |
Return type: |
This operation is thread-safe; it won’t return inconsistent data even when another thread is modifying the configuration.
Returns: | a copy of the current configuration |
---|---|
Return type: | Configuration |
Parameters: |
|
---|---|
Returns: | the dihedral angle between the plane containing the distance vectors p1-p2 and p3-p2 and the plane containing the distance vectors p2-p3 and p4-p3 |
Return type: | float |
Parameters: |
|
---|---|
Returns: | the distance between p1 and p2, i.e. the length of the distance vector |
Return type: | float |
Parameters: |
|
---|---|
Returns: | the distance vector between p1 and p2 (i.e. the vector from p1 to p2) in the configuration conf, taking into account the universe’s topology. |
Parameters: |
|
---|---|
Returns: | the potential energy of interaction between the atoms in subset1 and the atoms in subset2. If subset2 is None, the interactions within subset1 are calculated. It both subsets are None, the potential energy of the whole universe is returned. |
Return type: | float |
Returns: | the energy and the force constants |
---|---|
Return type: | (float, SymmetricPairTensor) |
Returns: | the energy and the energy gradients |
---|---|
Return type: | (float, ParticleVector) |
Returns: | the energy, its gradients, and the force constants |
---|---|
Return type: | (float, ParticleVector, SymmetricPairTensor) |
Returns: | a dictionary containing the energy values for each energy term separately. The energy terms are defined by the force field. |
---|---|
Return type: | dict |
Enforces the previously defined distance constraints by modifying the configuration and velocities.
Parameters: |
|
---|
Parameters: | klass (class) – an optional class argument |
---|---|
Returns: | a list of all environment objects in the universe. If klass is given, only objects that are instances of klass are returned. |
Return type: | list |
Fractional coordinates are defined only for periodic universes; their components have values between 0. and 1.
Parameters: | array (Scientific.N.array_type) – an array of fractional coordinates |
---|---|
Returns: | the real-space equivalent of vector |
Return type: | Scientific.Geometry.Vector |
Parameters: | name (str) – the name of an atom attribute |
---|---|
Returns: | the values of the boolean attribute ‘name’ for each atom in the universe, or False for atoms that do not have the attribute. |
Return type: | ParticleScalar |
Parameters: |
|
---|---|
Returns: | the values of the attribute ‘name’ for each atom in the universe. |
Return type: |
Parameters: | name (str) – the name of an atom attribute |
---|---|
Returns: | the values of the boolean attribute ‘name’ for each atom in the universe, or False for atoms that do not have the attribute. |
Return type: | ParticleScalar |
Parameters: |
|
---|---|
Returns: | the values of the attribute ‘name’ for each atom in the universe. |
Return type: |
Generate random velocities for all atoms from a Boltzmann distribution.
Parameters: | temperature (float) – the reference temperature for the Boltzmann distribution |
---|
Returns: | the largest possible distance between any two points that can be represented independent of orientation, i.e. the radius of the largest sphere that fits into the simulation cell. Returns None if no such upper limit exists. |
---|---|
Return type: | NoneType or float |
Apply a function to all objects in the universe and return the list of the results. If the results are chemical objects, a Collection object is returned instead of a list.
Parameters: | function (callable) – the function to be applied |
---|---|
Returns: | the list or collection of the results |
Returns: | the masses of all atoms in the universe |
---|---|
Return type: | ParticleScalar |
Parameters: | klass (class) – an optional class argument |
---|---|
Returns: | a list of all chemical objects in the universe. If klass is given, only objects that are instances of klass are returned. |
Return type: | list |
Returns: | a random point from a uniform distribution within the universe. This operation is defined only for finite-volume universes, e.g. periodic universes. |
---|---|
Return type: | Scientific.Geometry.Vector |
Box coordinates are defined only for periodic universes; their components have values between -0.5 and 0.5; these extreme values correspond to the walls of the simulation box.
Parameters: | vector – a point in the universe |
---|---|
Returns: | the box coordinate equivalent of vector, or the original vector if no box coordinate system exists |
Return type: | Scientific.Geometry.Vector |
Returns: | the reciprocal basis vectors of the elementary cell of a periodic universe, or None for a non-periodic universe |
---|---|
Return type: | NoneType or list |
Removes object from the universe. If object is a Collection, each of its elements is removed. The object to be removed must be in the universe.
Parameters: | object – the object (chemical or environment) to be removed |
---|
Scale all velocities by a common factor in order to obtain the specified temperature.
Parameters: |
|
---|
Parameters: |
|
---|---|
Returns: | a Collection of all objects in the universe that lie within the box whose diagonally opposite corners are given by p1 and p2. |
Parameters: |
|
---|---|
Returns: | a Collection of all objects in the universe whose distance from point lies between r1 and r2. |
Update the current configuration of the universe by copying the given input configuration.
Parameters: |
|
---|
Parameters: | forcefield (ForceField) – the new forcefield for this universe |
---|
Set the state of the universe to the one stored in a trajectory. This operation is thread-safe; it blocks other threads that want to access the configuration or velocities while the data is being updated.
Parameters: |
|
---|
Update the current velocities of the universe by copying the given input velocities.
Parameters: |
|
---|
Returns: | the current velocities of all atoms, or None if no velocities are defined. Note that this is not a copy of the current state but a reference to it; its data will change whenever any changes are made to the current velocities. |
---|---|
Return type: | ParticleVector |
Visualization of chemical objects, including animation
This module provides visualization of chemical objects and animated visualization of normal modes and sequences of configurations, including trajectories. Visualization depends on external visualization programs. On Unix systems, these programs are defined by environment variables. Under Windows NT, the system definitions for files with extension “pdb” and “wrl” are used.
A viewer for PDB files can be defined by the environment variable ‘PDBVIEWER’. For showing a PDB file, MMTK will execute a command consisting of the value of this variable followed by a space and the name of the PDB file.
A viewer for VRML files can be defined by the environment variable ‘VRMLVIEWER’. For showing a VRML file, MMTK will execute a command consisting of the value of this variable followed by a space and the name of the VRML file.
Since there is no standard for launching viewers for animation, MMTK supports only two programs: VMD and XMol. MMTK detects these programs by inspecting the value of the environment variable ‘PDBVIEWER’. This value must be the file name of the executable, and must give “vmd” or “xmol” after stripping off an optional directory specification.
Bases: object
Any viewable chemical object
This is a mix-in class that defines a general visualization method for all viewable objects, i.e. chemical objects (atoms, molecules, etc.), collections, and universes.
Parameters: |
|
---|---|
Returns: | a list of graphics objects that represent the object for which the method is called. |
Return type: | list |
Define the program used to view PDB files.
Parameters: |
|
---|
Define the program used to view VRML files.
Parameters: |
|
---|
Launches an animation using an external viewer.
Parameters: |
|
---|
Launches an animation based on a trajectory using an external viewer.
Parameters: |
|
---|
XML format for describing molecular systems
Note: this format is not used by any other program at the moment. It should be considered experimental and subject to change.
Bases: MMTK.MoleculeFactory.MoleculeFactory
XML molecule factory
An XML molecule factory reads an XML specification of a molecular system and builds the molecule objects and universe described therein. The universe can be obtained through the attribute universe.
Parameters: | file – the name of an XML file, or a file object |
---|