Class DistanceMatrix

java.lang.Object
ffx.algorithms.optimize.manybody.DistanceMatrix

public class DistanceMatrix extends Object
Calculates a residue-residue distance matrix.

Residue-residue distance is defined as the shortest atom-atom distance in any possible rotamer-rotamer pair if the residues are neighbors (central atom-central atom distances are within a cutoff). Otherwise, distances are set to a default of Double.MAX_VALUE.

The intent of using a neighbor list is to avoid tediously searching rotamer- rotamer pairs when two residues are so far apart we will never need the exact distance. We use the distance matrix for adding residues to the sliding window and determining whether to set 3-body energy to 0.0.

If the central atoms are too distant from each other, we can safely assume no atoms will ever be close enough for addition to sliding window or to cause explicit calculation of 3-body energy.

  • Constructor Summary

    Constructors
    Constructor
    Description
    DistanceMatrix(MolecularAssembly molecularAssembly, AlgorithmListener algorithmListener, Residue[] allResiduesArray, List<Residue> allResiduesList, RotamerOptimization.DistanceMethod distanceMethod, double distance, double twoBodyCutoffDist, double threeBodyCutoffDist, boolean lazyMatrix)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    checkDistMatrix(int i, int ri, int j, int rj)
    Gets the raw distance between two rotamers using lazy loading of the distance matrix.
    boolean
    checkPairDistThreshold(int i, int ri, int j, int rj)
    Checks if the i,ri,j,rj pair exceeds the pair distance thresholds.
    boolean
    checkQuadDistThreshold(int i, int ri, int j, int rj, int k, int rk, int l, int rl)
    Checks if the i,ri,j,rj,k,rk,l,rl quad exceeds the 3-body threshold, or if any component exceeds the pair/triple distance thresholds.
    boolean
    checkTriDistThreshold(int i, int ri, int j, int rj, int k, int rk)
    Checks if the i,ri,j,rj,k,rk triple exceeds the 3-body threshold, or if any component exceeds the pair distance threshold.
    double
    get2BodyDistance(int i, int ri, int j, int rj)
    Checks the distance matrix, finding the shortest distance between two residues' rotamers or any rotamers from two residues under any symmetry operator; will evaluate this if distance matrix not already filled.
    double
    get3BodyResidueDistance(int i, int ri, int j, int rj, int k, int rk)
    Returns the RMS separation distance for the closest rotamers of three residues' 2-body distances.
    double
    get4BodyResidueDistance(int i, int ri, int j, int rj, int k, int rk, int l, int rl)
    Returns the RMS separation distance for the closest rotamers of 6 2-body distances from four residues.
    double
    getRawNBodyDistance(int... resRot)
    Returns the RMS distance between an arbitrary set of rotamers.
    double
    getResidueDistance(int i, int ri, int j, int rj)
    Checks the distance matrix, finding the shortest distance between the closest rotamers of two residues.
    double
    interResidueDistance(double[][] resi, double[][] resj, SymOp symOp)
    Calculates the minimum distance between two sets of coordinates in a given symmetry operator.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • checkDistMatrix

      public double checkDistMatrix(int i, int ri, int j, int rj)
      Gets the raw distance between two rotamers using lazy loading of the distance matrix. Intended uses: helper method for get2BodyDistance, and for checking for superpositions.
      Parameters:
      i - A residue index.
      ri - A rotamer index for i.
      j - A residue index j!=i.
      rj - A rotamer index for j.
      Returns:
      dist(i, ri, j, rj), ignoring distance matrix method used.
    • checkPairDistThreshold

      public boolean checkPairDistThreshold(int i, int ri, int j, int rj)
      Checks if the i,ri,j,rj pair exceeds the pair distance thresholds.
      Parameters:
      i - A residue index.
      ri - A rotamer index for i.
      j - A residue index j!=i.
      rj - A rotamer index for j.
      Returns:
      If i,ri,j,rj is greater than the threshold distance.
    • checkQuadDistThreshold

      public boolean checkQuadDistThreshold(int i, int ri, int j, int rj, int k, int rk, int l, int rl)
      Checks if the i,ri,j,rj,k,rk,l,rl quad exceeds the 3-body threshold, or if any component exceeds the pair/triple distance thresholds.
      Parameters:
      i - A residue index.
      ri - A rotamer index for i.
      j - A residue index j!=i.
      rj - A rotamer index for j.
      k - A residue index k!=i, k!=j.
      rk - A rotamer index for k.
      l - A residue index l!=i, l!=j, l!=k.
      rl - A rotamer index for l.
      Returns:
      If i,ri,j,rj,k,rk,l,rl is greater than the threshold distances.
    • checkTriDistThreshold

      public boolean checkTriDistThreshold(int i, int ri, int j, int rj, int k, int rk)
      Checks if the i,ri,j,rj,k,rk triple exceeds the 3-body threshold, or if any component exceeds the pair distance threshold.
      Parameters:
      i - A residue index.
      ri - A rotamer index for i.
      j - A residue index j!=i.
      rj - A rotamer index for j.
      k - A residue index k!=i, k!=j.
      rk - A rotamer index for k.
      Returns:
      If i,ri,j,rj,k,rk is greater than the threshold distances.
    • get2BodyDistance

      public double get2BodyDistance(int i, int ri, int j, int rj)
      Checks the distance matrix, finding the shortest distance between two residues' rotamers or any rotamers from two residues under any symmetry operator; will evaluate this if distance matrix not already filled. Default is to find the shortest distance between two residues rather than between two rotamers.
      Parameters:
      i - Residue i
      ri - Rotamer for i
      j - Residue j
      rj - Rotamer for j
      Returns:
      Shortest distance
    • get3BodyResidueDistance

      public double get3BodyResidueDistance(int i, int ri, int j, int rj, int k, int rk)
      Returns the RMS separation distance for the closest rotamers of three residues' 2-body distances. Defaults to Double.MAX_VALUE when there are pair distances outside cutoffs.
      Parameters:
      i - Residue i
      ri - Rotamer for i
      j - Residue j
      rj - Rotamer for j
      k - Residue k
      rk - Rotamer for k
      Returns:
      RMS separation distance
    • get4BodyResidueDistance

      public double get4BodyResidueDistance(int i, int ri, int j, int rj, int k, int rk, int l, int rl)
      Returns the RMS separation distance for the closest rotamers of 6 2-body distances from four residues. Defaults to Double.MAX_VALUE when there are pair distances outside cutoffs.
      Parameters:
      i - Residue i
      ri - Rotamer for i
      j - Residue j
      rj - Rotamer for j
      k - Residue k
      rk - Rotamer for k
      l - Residue l
      rl - Rotamer for l
      Returns:
      RMS separation distance
    • getRawNBodyDistance

      public double getRawNBodyDistance(int... resRot)
      Returns the RMS distance between an arbitrary set of rotamers.
      Parameters:
      resRot - Residue index-rotamer index pairs.
      Returns:
      RMS distance, or Double.MAX_VALUE if ill-defined.
    • getResidueDistance

      public double getResidueDistance(int i, int ri, int j, int rj)
      Checks the distance matrix, finding the shortest distance between the closest rotamers of two residues.
      Parameters:
      i - Residue i
      ri - Rotamer for i
      j - Residue j
      rj - Rotamer for j
      Returns:
      Shortest distance
    • interResidueDistance

      public double interResidueDistance(double[][] resi, double[][] resj, SymOp symOp)
      Calculates the minimum distance between two sets of coordinates in a given symmetry operator.
      Parameters:
      resi - Coordinates of i by [atom][xyz]
      resj - Coordinates of j by [atom][xyz]
      symOp - Symmetry operator to apply
      Returns:
      Minimum distance