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

Superimpose molecules using a quaternion fit.
 
This is a Python port of the QTRFIT algorithm written by David J. Heisterberg.
Copyright: Ohio Supercomputer Center, David J. Heisterberg, 1990.
See http://www.ccl.net/cca/software/SOURCES/C/quaternion-mol-fit/quatfit.c.
 
There is, however, a subtle difference between this implementation and the
original one. It lies in a way how the center of a molecule is calculated. We
use the plain weighting coefficients rather than square roots from them. This
corresponds to physically meaningful results.
 
The module exports the only function :
    fit() --  perform a quaternion fit

 
Functions
       
fit(pairs, coords_ref, coords_fit, weight)
Perform a quaternion fit.
 
Positional arguments :
pairs       --  atom pairs to be superimposed (null-based ndarray)
                shape : (npairs, 2) with npairs being the number of atom pairs
                atom numbers are one-based
                example : array([ [1, 1], [5, 5], [7, 7] ])
coords_ref  --  coordinates of the reference frame (one-based ndarray)
                shape : (Natoms_ref, 4) with Natoms_ref being the number
                of atoms in the reference frame
coords_fit  --  coordinates of the fitted frame (one-based ndarray)
                shape : (Natoms_fit, 4) with Natoms_fit being the number
                of atoms in the fitted frame
weight      --  weights for the atoms to be superimposed (one-based ndarray)
 
Return value is a dictionary with the following keys :
rms         : root mean square (RMS) deviation 
q           : quaternion (null-based ndarray of the length 4)
U           : left rotation matrix (one-based two-dimensional ndarray)
ref_center  : center of the reference molecule (one-based ndarray)
fit_center  : center of the fitted molecule (one-based ndarray)

 
Data
        __all__ = ['fit']
__author__ = 'Maxim Fedorovsky'

 
Author
        Maxim Fedorovsky