pestifer.util.coord module

Some calculations based on atom coordinates

pestifer.util.coord.build_tmat(RotMat: ndarray, TransVec: ndarray) ndarray[source]

Builds a 4 x 4 homogeneous transformation matrix

Parameters:
pestifer.util.coord.coorddf_from_pdb(pdb, segtypes=False)[source]

Read a PDB file and return a DataFrame with atom coordinates and other information.

Parameters:
  • pdb (str) – Path to the PDB file.

  • segtypes (bool, optional) – If True, include segment types in the DataFrame. Default is False.

Returns:

DataFrame with atom coordinates and other information.

Return type:

pd.DataFrame

pestifer.util.coord.lawofcos(a: ndarray, b: ndarray) float[source]

return the cosine of the angle defined by vectors a and b if they share a vertex (the LAW OF COSINES)

Parameters:
  • a (np.ndarray) – First vector

  • b (np.ndarray) – Second vector

pestifer.util.coord.measure_dihedral(a1, a2, a3, a4)[source]

Measure dihedral angle IN RADIANS of a1->a2–a3->a4

Parameters:
  • a1 (Atom) – Atom objects with x, y, z attributes

  • a2 (Atom) – Atom objects with x, y, z attributes

  • a3 (Atom) – Atom objects with x, y, z attributes

  • a4 (Atom) – Atom objects with x, y, z attributes

Returns:

Dihedral angle in radians between the four atoms a1, a2, a3, a4 in radians.

Return type:

float

pestifer.util.coord.mic_shift(point, ref, box)[source]

Given a point, a reference point, and a box, return the point shifted into the periodic box defined by the reference point.

Parameters:
  • point (np.ndarray) – The point to be shifted, as a 3-element array.

  • ref (np.ndarray) – The reference point, as a 3-element array.

  • box (np.ndarray) – The box dimensions, as a 3x3 array where each row is a basis vector defining the periodic box.

pestifer.util.coord.positionN(res, tmat)[source]

Given residue res, calculate the nominal position of the amide nitrogen in the next residue based on the positions of CA, C, and O.

Parameters:
  • res (Residue) – Residue object with atoms CA, C, and O (or OT1)

  • tmat (numpy.ndarray) – 4x4 homogeneous transformation matrix

Returns:

rN

Return type:

position of N atom (np.ndarray(3))