Package generic_fns :: Package structure :: Module api_base :: Class Displacements
[hide private]
[frames] | no frames]

Class Displacements

source code

A special object for representing rotational and translational displacements between models.

Instance Methods [hide private]
 
__init__(self)
Initialise the storage objects.
source code
 
_calculate(self, model_from=None, model_to=None, coord_from=None, coord_to=None, centroid=None)
Calculate the rotational and translational displacements using the given coordinate sets.
source code
 
from_xml(self, str_node, dir=None, id=None)
Recreate the structural object from the XML structural object node.
source code
 
to_xml(self, doc, element)
Create XML elements for each model.
source code
Method Details [hide private]

_calculate(self, model_from=None, model_to=None, coord_from=None, coord_to=None, centroid=None)

source code 

Calculate the rotational and translational displacements using the given coordinate sets.

This uses the Kabsch algorithm (http://en.wikipedia.org/wiki/Kabsch_algorithm).

Parameters:
  • model_from (int) - The model number of the starting structure.
  • model_to (int) - The model number of the ending structure.
  • coord_from (numpy rank-2, Nx3 array) - The list of atomic coordinates for the starting structure.
  • coord_to (numpy rank-2, Nx3 array) - The list of atomic coordinates for the ending structure.
  • centroid (list of float or numpy rank-1, 3D array) - An alternative position of the centroid, used for studying pivoted systems.

from_xml(self, str_node, dir=None, id=None)

source code 

Recreate the structural object from the XML structural object node.

Parameters:
  • str_node (xml.dom.minicompat.Element instance) - The structural object XML node.
  • dir (str) - The name of the directory containing the results file.
  • id (str) - The specific structural object ID string. This can be 'scientific', 'internal', etc.

to_xml(self, doc, element)

source code 

Create XML elements for each model.

Parameters:
  • doc (xml.dom.minidom.Document instance) - The XML document object.
  • element (XML element object) - The element to add the displacement XML elements to.