Package lib :: Package structure :: Module superimpose
[hide private]
[frames] | no frames]

Module superimpose

source code

Module for handling all types of structural superimpositions.

Functions [hide private]
numpy rank-1, 3D array
find_centroid(coords)
Calculate the centroid of the structural coordinates.
source code
list of numpy rank-1 3D arrays, list of numpy rank-2 3D arrays, list of numpy rank-1 3D arrays
fit_to_first(models=None, coord=None, centre_type='centroid', elements=None, centroid=None)
Superimpose a set of structural models using the fit to first algorithm.
source code
list of numpy rank-1 3D arrays, list of numpy rank-2 3D arrays, list of numpy rank-1 3D arrays
fit_to_mean(models=None, coord=None, centre_type='centroid', elements=None, centroid=None, verbosity=1)
Superimpose a set of structural models using the fit to first algorithm.
source code
numpy rank-1 3D array, float, numpy rank-2 3D array, numpy rank-1 3D array, float, numpy rank-1 3D array
kabsch(name_from=None, name_to=None, coord_from=None, coord_to=None, centre_type='centroid', elements=None, centroid=None, verbosity=1)
Calculate the rotational and translational displacements between the two given coordinate sets.
source code
numpy rank-2, 3D array
kabsch_rotation(coord_from=None, coord_to=None, centroid_from=None, centroid_to=None)
Calculate the rotation via SVD.
source code
Variables [hide private]
  __package__ = 'lib.structure'

Imports: deepcopy, pi, diag, dot, eye, float64, outer, sign, transpose, zeros, det, norm, svd, centre_of_mass, calc_mean_structure, R_to_axis_angle, R_to_euler_zyz


Function Details [hide private]

find_centroid(coords)

source code 

Calculate the centroid of the structural coordinates.

Parameters:
  • coord (numpy rank-2, Nx3 array) - The atomic coordinates.
Returns: numpy rank-1, 3D array
The centroid.

fit_to_first(models=None, coord=None, centre_type='centroid', elements=None, centroid=None)

source code 

Superimpose a set of structural models using the fit to first algorithm.

Parameters:
  • models (list of int) - The list of models to superimpose.
  • coord (list of numpy rank-2, Nx3 arrays) - The list of coordinates of all models to superimpose. The first index is the models, the second is the atomic positions, and the third is the xyz coordinates.
  • centroid (list of float or numpy rank-1, 3D array) - An alternative position of the centroid to allow for different superpositions, for example of pivot point motions.
  • centre_type (str) - The type of centre to superimpose over. This can either be the standard centroid superimposition or the CoM could be used instead.
  • elements (list of str) - The list of elements corresponding to the atoms.
Returns: list of numpy rank-1 3D arrays, list of numpy rank-2 3D arrays, list of numpy rank-1 3D arrays
The lists of translation vectors, rotation matrices, and rotation pivots.

fit_to_mean(models=None, coord=None, centre_type='centroid', elements=None, centroid=None, verbosity=1)

source code 

Superimpose a set of structural models using the fit to first algorithm.

Parameters:
  • models (list of int) - The list of models to superimpose.
  • coord (list of numpy rank-2, Nx3 arrays) - The list of coordinates of all models to superimpose. The first index is the models, the second is the atomic positions, and the third is the xyz coordinates.
  • centre_type (str) - The type of centre to superimpose over. This can either be the standard centroid superimposition or the CoM could be used instead.
  • elements (list of str) - The list of elements corresponding to the atoms.
  • centroid (list of float or numpy rank-1, 3D array) - An alternative position of the centroid to allow for different superpositions, for example of pivot point motions.
  • verbosity (int) - The amount of information to print out. If 0, nothing will be printed.
Returns: list of numpy rank-1 3D arrays, list of numpy rank-2 3D arrays, list of numpy rank-1 3D arrays
The lists of translation vectors, rotation matrices, and rotation pivots.

kabsch(name_from=None, name_to=None, coord_from=None, coord_to=None, centre_type='centroid', elements=None, centroid=None, verbosity=1)

source code 

Calculate the rotational and translational displacements between the two given coordinate sets.

This uses the Kabsch algorithm.

Parameters:
  • name_from (str) - The name of the starting structure, used for the printouts.
  • name_to (str) - The name of the ending structure, used for the printouts.
  • 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.
  • centre_type (str) - The type of centre to superimpose over. This can either be the standard centroid superimposition or the CoM could be used instead.
  • elements (list of str) - The list of elements corresponding to the atoms.
  • centroid (list of float or numpy rank-1, 3D array) - An alternative position of the centroid, used for studying pivoted systems.
Returns: numpy rank-1 3D array, float, numpy rank-2 3D array, numpy rank-1 3D array, float, numpy rank-1 3D array
The translation vector T, translation distance d, rotation matrix R, rotation axis r, rotation angle theta, and the rotational pivot defined as the centroid of the ending structure.

kabsch_rotation(coord_from=None, coord_to=None, centroid_from=None, centroid_to=None)

source code 

Calculate the rotation via SVD.

Parameters:
  • 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_from (numpy rank-1, 3D array) - The starting centroid.
  • centroid_to (numpy rank-1, 3D array) - The ending centroid.
Returns: numpy rank-2, 3D array
The rotation matrix.