quatfit

Quatfit routines for PDB2PQR

This module is used to find the coordinates of a new atom based on a reference set of coordinates and a definition set of coordinates.

Original Code by David J. Heisterberg, The Ohio Supercomputer Center, 1224 Kinnear Rd., Columbus, OH 43212-1163, (614)292-6036, djh@osc.edu, djh@ohstpy.bitnet, ohstpy::djh

Translated to C from fitest.f program and interfaced with Xmol program by Jan Labanowski, jkl@osc.edu, jkl@ohstpy.bitnet, ohstpy::jkl

Todo

There are many unnecessary parameters in this module due to FORTRAN/C assumptions about how the code should behave.

Code author: David Heisterberg

Code author: Jan Labanowski

Code author: Jens Erik Nielsen

Code author: Todd Dolinsky

pdb2pqr.quatfit.center(numpoints, refcoords)[source]

Center a molecule using equally weighted points.

Parameters:
  • numpoints (int) – number of points

  • refcoords ([[float, float, float]]) – list of reference coordinates, with each set a list of form [x,y,z]

Returns:

(center of the set of points, moved refcoords relative to refcenter)

pdb2pqr.quatfit.find_coordinates(numpoints, refcoords, defcoords, defatomcoords)[source]

Driver for the quaternion file.

Provide the coordinates as inputs and obtain the coordinates for the new atom as output.

Parameters:
  • numpoints (int) – the number of points in each list

  • refcoords ([[float, float, float]]) – the reference coordinates, a list of lists of form [x,y,z]

  • defcoords ([[float, float, float]]) – the definition coordinates, a list of lists of form [x,y,z]

  • defatomcoords ([[float, float, float]]) – the definition coordinates for the atom to be placed in the reference frame

Returns:

the coordinates of the new atom in the reference frame

Return type:

[[float, float, float]]

pdb2pqr.quatfit.jacobi(amat, nrot)[source]

Jacobi diagonalizer with sorted output, only good for 4x4 matrices.

Parameters:
  • amat – Matrix to diagonalize

  • nrot (int) – maximum number of sweeps

Returns:

(eigenvalues, eigenvectors)

pdb2pqr.quatfit.q2mat(quat)[source]

Generate a left rotation matrix from a normalized quaternion

Parameters:

quat ([[float, float, float, float]]) – the normalized quaternion

Returns:

the rotation matrix

pdb2pqr.quatfit.qchichange(initcoords, refcoords, angle)[source]

Change the chiangle of the reference coordinate.

Change the chiangle of the reference coordinate using the initcoords and the given angle.

Parameters:
  • initcoords ([[float, float, float]]) – coordinates based on the point and basis atoms (one-dimensional list)

  • difchi (float) – the angle to use

  • refcoords ([[float, float, float]]) – the atoms to analyze (list of many coordinates)

Returns:

the new coordinates of the atoms

Return type:

[[float, float, float]]

pdb2pqr.quatfit.qfit(numpoints, refcoords, defcoords)[source]

Method for getting new atom coordinates from sets of reference and definition coordinates.

Todo

Remove hard-coded parameters of function.

Parameters:
  • numpoints (int) – the number of points in each list

  • refcoords ([[float, float, float]]) – list of reference coordinates

  • defcoords ([[float, float, float]]) – list of definition coordinates

Returns:

(reference center, definition center, left rotation matrix)

Return type:

([[float, float, float]], [[float, float, float]], [[float, float, float]])

pdb2pqr.quatfit.qtransform(numpoints, defcoords, refcenter, fitcenter, rotation)[source]

Transform coordinates using the reference.

Transform the set of defcoords using the reference center, the fit center, and a rotation matrix.

Parameters:
  • numpoints (int) – the number of points in each list

  • defcoords ([[float, float, float]]) – set of coordinates to be transformed using the reference center and a rotation matrix

  • refcenter ([[float, float, float]]) – the reference center

  • fitcenter ([float, float, float]) – the definition center

  • rotation ([[float, float, float]]) – the rotation matrix

Returns:

the coordinates of the new point

Return type:

[[float, float, float]]

pdb2pqr.quatfit.qtrfit(numpoints, defcoords, refcoords, nrot)[source]

Find the best-fit quaternion.

Find the quaternion, q, [and left rotation matrix, u] that minimizes

\[| qTXq - Y | ^ 2 [|uX - Y| ^ 2]\]

This is equivalent to maximizing

\[Re(q^T X^T q Y)\]

The left rotation matrix, u, is obtained from q by

\[u = qT1q\]
Parameters:
  • numpoints (int) – the number of points in each list

  • defcoords ([[float, float, float]]) – list of definition coordinates, with each set a list of form [x,y,z]

  • refcoords ([[float, float, float]]) – list of fitted coordinates, with each set a list of form [x,y,z]

  • nrot (int) – the maximum number of Jacobi sweeps

Returns:

(the best-fit quaternion, the best-fit left rotation matrix)

pdb2pqr.quatfit.rotmol(numpoints, coor, lrot)[source]

Rotate a molecule

Parameters:
  • numpoints (int) – the number of points in the list

  • coor ([[float, float, float]]) – the input coordinates

  • lrot ([[float, float, float]]) – the left rotation matrix

Returns:

the rotated coordinates

Return type:

[[float, float, float]]

pdb2pqr.quatfit.translate(numpoints, refcoords, center_, mode)[source]

Translate a molecule using equally weighted points.

Parameters:
  • numpoints (int) – number of points

  • refcoords – list of reference coordinates, with each set a list of form [x,y,z]

  • center ([float, float, float]) – center of the system

  • mode – if 1, center will be subtracted from refcoords; if 2, center will be added to refcoords

Type:

list

Returns:

moved refcoords relative to refcenter

Return type:

[[float, float, float]]