pyviblib.molecule
index
/usr/lib/python2.4/site-packages/pyviblib/molecule.py

Module for handling molecules.
 
The following classes are exported :
    Atom      --  describing atoms
    Bond      --  describing bonds
    Molecule  --  describing molecules

 
Modules
       
pyviblib.io.parsers
pyviblib.calc.spectra
pyviblib.calc.vibrations

 
Classes
       
__builtin__.object
Atom
Bond
Molecule

 
class Atom(__builtin__.object)
    Class for describing atoms.
 
An atom can be a part of a bond.
 
The following read-only properties are exposed :
    index   -- one-based index of the atom
    coord   -- coordinates of the atom (one-based ndarray)
    element -- element for the atom (pyviblib.util.pse.Element)
 
  Methods defined here:
__init__(self, index, coord, element)
Constructor of the class.
 
Positional arguments :
index   -- one-based index of the atom
coord   -- coordinates of the atom (one-based ndarray)
element -- element for the atom (pyviblib.util.pse.Element)

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Atom' objects>
list of weak references to the object (if defined)

 
class Bond(__builtin__.object)
    Class for describing bonds.
 
A bond is made up of two atoms and can be a part of a molecule.
 
The following read-only properties are exposed :
    atom1       -- first atom comprising the bond
    atom2       -- second atom comprising the bond
    is_hydrogen -- whether it is a hydrogen bond
 
The following public methods are exposed :
    length()
 
  Methods defined here:
__init__(self, atom1, atom2, is_hydrogen=False)
Constructor of the class.
 
Positional arguments :
atom1   -- first atom comprising the bond (Atom)
atom2   -- second atom comprising the bond (Atom)
 
Keyword arguments :
is_hydrogen -- whether it is a hydrogen bond (default False)
__str__(self)
Text description of the bond.
length(self)
Calculate the bond length.

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Bond' objects>
list of weak references to the object (if defined)

 
class Molecule(__builtin__.object)
    Class for describing molecules.
 
A molecule consists of atoms and bonds.
The bonds can be automatically generated from the cartesian coordinates of
the atoms.
 
The following read-only properties are exposed :
    parser            -- parser object used to create the molecule
    elements          -- elements for the atoms
                         (one-based list of pyviblib.util.pse.Element)
    masses            -- masses (a.m.u.) of the atoms (one-based ndarray)
    atoms             -- atoms (null-based list of Atom)
    Natoms            -- number of atoms (int)
    bonds             -- bonds (null-based list of Bond)
    bonds_matrix      -- matrix of the bonds (one-based ndarray)
                         If a bond between atoms a and b exists, then
                         bonds_matrix[a, b] = 1
    nrot              -- number of rotational degrees of freedom (int)
                         
    the properties below are set if the normal modes are available :
    (tr/rot is an abbreviated form of translations/rotations)
    
    NFreq             -- number of frequencies (int, -1 unless set)
    Lx                -- cartesian excursions (one-based ndarray)
                         shape : (1 + NFreq, 1 + Natoms, 4)
    Lx_norm           -- normalized cartesian excursions (one-based ndarray)
                         shape : (1 + NFreq, 1 + Natoms, 4)
    
    L_tr_rot          -- mass-weighted excursions for tr/rot
                         (one-based ndarray)
                         shape : (4 + nrot, 1 + Natoms, 4)
    Lx_tr_rot         -- cartesian excursions for tr/rot
                         (one-based ndarray)
                         shape : (4 + nrot, 1 + Natoms, 4)
    Lx_tr_rot_norm    -- normalized cartesian excursions for tr/rot
                         (one-based ndarray)
                         shape : (4 + nrot, 1 + Natoms, 4)
    hessian           -- hessian (one-based ndarray)
                         shape : (1 + Natoms, 4, 1 + Natoms, 4)
 
The following readable and writable properties are exposed :
    coords            -- cartesian coordinates (one-based ndarray)
                         shape : (1 + Natoms, 4)
    name              -- name of the molecule (string)
    raman_roa_tensors -- Raman/ROA tensors (set if the data available)
                         (pyviblib.calc.spectra.RamanROATensors)
    ir_vcd_tensors    -- IR/VCD tensors (set if the data available)
                         (pyviblib.calc.spectra.IRVCDTensors)
 
    the properties below are set if the normal modes are available :
 
    freqs             -- wavenumbers of the vibrations in cm**(-1)
                         (one-based ndarray)
    L                 -- mass-weighted excursions (one-based ndarray)
                         shape : (1 + NFreq, 1 + Natoms, 4)
 
The following public methods are exposed :
    update_masses()
    distance()
    angle()
    dihedral()
 
  Methods defined here:
__eq__(self, mol)
Overloaded version of the comparison operator.
 
Two Molecule objects are considered to be equal if their elements,
coordinates and the normal modes are the same.
 
Positional arguments :
mol -- object to compare with
__init__(self, parser)
Constructor of the class.
 
Positional arguments :
parser -- parser object
          (subclass of pyviblib.io.parsers.AbstractFileParser)
angle(self, i1, i2, i3)
Return the angle in grad between atoms.
 
Positional arguments :
i1 -- one-based index of the first atom
i2 -- one-based index of the second atom
i3 -- one-based index of the third atom
dihedral(self, i1, i2, i3, i4)
Return the dihedral angle in grad between atoms.
 
Positional arguments :
i1 -- one-based index of the first atom
i2 -- one-based index of the second atom
i3 -- one-based index of the third atom
i4 -- one-based index of the fourth atom
distance(self, i1, i2)
Return the distance between atoms.
 
Positional arguments :
i1 -- one-based index of the first atom
i2 -- one-based index of the second atom
update_masses(self, data_pairs)
Modify the masses of atoms.
 
Positional arguments :
data_pairs -- information about the atoms (null-based ndarray)
              shape : (Natoms_to_modify, 2)
              atom numbers are one-based
 
              Example :
                a1  new_mass1
                a2  new_mass2

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Molecule' objects>
list of weak references to the object (if defined)

 
Data
        __all__ = ['Atom', 'Bond', 'Molecule']
__author__ = 'Maxim Fedorovsky'

 
Author
        Maxim Fedorovsky