CLAMP: Class Library for Advanced Molecular Properties
In this directory are a number of
Python files that define an
object-oriented library for molecular modeling. This document is a
brief (and incomplete) reference for those files.
People interested in using Python for molecular modeling should also
check out Konrad Hinsen's excellent
Molecular Modeling Tool Kit (MMTK), which is a much more mature
product. Ultimately, I hope to build CLAMP on top of MMTK, but while
CLAMP is still under development I wanted more flexibility.
Table of contents:
- Molecule library
- Atom library
- Element library
- MolVTK library
- Viewing Jaguar Orbitals
- The MSC File Format
- Tutorial for using CLAMP
Objects and methods for defining molecules.
Data objects include:
- mol = Molecule('New Molecule')
- Initialize the molecule
- mol.name
- The name of the molecule (here 'New Molecule')
- mol.atomlist
- A list of atoms in mol. Atoms are a data type given in
the Atom.py class library file (v.i.).
- mol.bondlist
- A list of bonds in mol. For now, bonds are simply a
tuple of two atoms.
- mol.fraglist
- A list of fragments in mol. Fragments are currently
defined as a list of a number of atoms, which refer to the
ordering in mol.atomlist.
- mol.mass
- The total mass of mol.
- mol.spin
- The total spin of mol. For the multiplicity take 2*mol.spin +
1. Default value of 0.
- mol.charge
- The charge on the molecule. Default value of 0.
- mol.com
- A Vector() object defining the center of mass. Default
Vector(0,0,0).
- mol.fragmentbuffersize
- A cutoff value for including external atoms in the bufferzone
of a fragment in a divide-and-conquer calculation. Default
value of 4.
Methods include:
- __init__
- Initialize the molecule object. E.g. mol1 = Molecule().
- getnuke()
- Get the nuclear repulsion energy of the molecule.
- get_bonds_by_distance()
- Create a bondlist based on the distance between atoms in the
molecule.
- addatom(atom)
- Append atom to the atomlist.
- getnbf()
- Compute the number of basis functions in the molecule. Only
6-31G** is implemented now.
- updatespin()
- Compute the (lowest possible) spin based on the atoms and the
charge.
- rd(form,file)
- Input a molecule from file. Formats include XYZ, XBS, JAG, SYS,
MSC, or None.
- pr(form,file)
- Output a molecule to a file. Formats include XYZ, XBS, JAG,
SYS, MSC, or None. If no format is supplied a generic format is
used.
Objects and methods for defining atoms.
Data objects include:
- at = Atom(x,y,z,atomic_number)
- Initialize an atom at position (x,y,z) with atomic_number.
- at.r
- A Vector object containing (x,y,z)
- at.atno
- The atomic number of at.
- at.mass
- The atomic mass of at.
- at.symbol
- The elemental symbol of at.
- at.nbf
- The number of basis functions contained on at. Currently only
6-31G** is represented.
- at.name
- The elemental name (e.g. 'hydrogen') of at.
Methods include:
- __init__
- Initialize the atom. at = Atom(x,y,z,atomic_number)
- pr(form,file)
- Print the atom to file. If no file is supplied the output goes
to sys.stdout. Formats include XYZ, JAG, MSC, SYS, or XBS. If
no format is supplied an XYZ format is used.
- getnbf()
- Returns the number of basis functions on the atom.
Reference database for elemental information. Note that this is not a
class library, but a set of lists and dictionaries. In general,
object[i] returns the property for element number i corresponding to
object. Currently only data through atomic number 18 (Ar) is
programmed.
Data objects include
- symbol
- The atomic symbol, e.g. 'C', 'H', etc.
- name
- The atomic name, e.g. 'carbon', 'hydrogen', etc.
- mass
- The atomic mass, including isotopes.
- nbf
- The number of basis functions for the atom, currently just for
the 6-31G** basis set.
- rint
- The red color intensity used for displaying the molecule in a
CPK-type environment.
- gint
- The green color intensity used for displaying the molecule in a
CPK-type environment.
- bint
- The blue color intensity used for displaying the molecule in a
CPK-type environment.
- rcov
- The covalent radius of the element.
- rvdw
- The van der Waals radius of the element.
- sym2no
- A dictionary that converts the symbol (e.g. 'C') to the atomic
number (e.g. 6).
- name2no
- A dictionary that converts the element name (e.g. 'carbon') to the
atomic number (e.g. 6).
A set of methods and objects for displaying a molecule using the
Visualization Tool Kit.
An example for how to use the viewer is here.
Methods include:
- __init__
- Initialize a new molecular viewer. E.g. viewer = MolVTK()
- viewer.addAtom(at)
- Adds at to the viewer environment. Represents the atom as a
sphere, with color given by the Element.py defaults.
- viewer.addBond(at1,at2)
- Adds a cylindrical bond between atoms at1 and at2.
- viewer.addJagOrbs(filename,contour_value)
- Adds the orbitals from the plotfile in filename and constructs
the molecular surface specified by contour_value. Uses the
marching cubes features of VTK.
- viewer.Loop
- Starts the viewer and window/mouse interaction.
We have recently developed some tools for viewing Jaguar orbitals with
CLAMP. More information is available here.
We are beginning to create a flexible file format for molecular
modeling. The format is currently in its infancy. Ultimately it will
look a great deal like the Biograf file format. Currently it looks
nothing like it.
Currently under construction. Here are some examples in the meantime.
Create your own 3-d file viewer.
Convert xyz (and other) file formats to a
Jaguar input file.
Last modified: Thu Mar 17 08:06:32 2005