Package jgromacs.analysis

# Class Distances

java.lang.Object
jgromacs.analysis.Distances

public class Distances extends Object
Collection of methods for analysing distances

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`ALPHACARBON`
`static final int`
`CLOSEST`
`static final int`
`CLOSESTHEAVY`

## Constructor Summary

Constructors
Constructor
Description
`Distances()`

## Method Summary

Modifier and Type
Method
Description
`static Atom`
`findClosestAtom(Structure s, IndexSet atomset, IndexSet referenceset)`
Returns the atom from a given atom set that is closest to a reference set of atoms
`static PointList`
`findFrameWhereClosest(Trajectory t, int atomindex1, int atomindex2)`
Returns the frame in which two atoms are closest to each other in a simulation
`static PointList`
`findFrameWhereMostDistant(Trajectory t, int atomindex1, int atomindex2)`
Returns the frame in which two atoms are most distant from each other in a simulation
`static Jama.Matrix`
`getAtomicDistanceMatrix(Structure s)`
Calculates the distance matrix of all atoms in a structure
`static Jama.Matrix`
`getAtomicDistanceMatrix(Structure s, IndexSet indices)`
Calculates the distance matrix of atoms of given indices in a structure
`static Jama.Matrix`
`getAtomicDistanceMatrix(Structure s, IndexSet indices1, IndexSet indices2)`
Calculates the distance matrix between two sets of atoms
`static IndexSet`
`getAtomIndicesInRadius(Structure s, Atom atom, double radius)`
Returns the index set of atoms in a structure that are closer to a reference atom than a given radius
`static IndexSet`
`getAtomIndicesInRadius(Structure s, IndexSet referenceindices, double radius)`
Returns the index set of atoms in a structure that are closer to a reference set of atoms than a given radius
`static IndexSet`
`getAtomIndicesInRadius(Structure s, IndexSet atomIndices, IndexSet referenceIndices, double radius)`
Returns the index set of atoms from a set of atoms that are closer to a reference set than a given radius
`static IndexSet`
`getAtomIndicesInRadius(Structure s, Point3D point, double radius)`
Returns the index set of atoms in a structure that are closer to a reference point than a given radius
`static Jama.Matrix`
`getContactMatrix(PointList points, double cutoff)`
Calculates the contact matrix from a point list
`static Jama.Matrix`
`getContactMatrix(Structure s, int distanceBetween, double cutoff)`
Calculates the contact matrix of residues in a structure by the given method
`static Jama.Matrix`
`getContactOfMeanMatrix(Trajectory t, int distanceBetween, double cutoff)`
Calculates the contact matrix based on the mean residue distance matrix in a trajectory
`static Jama.Matrix`
`getDistanceMatrix(PointList points)`
Calculates the distance matrix from a point list
`static double`
`getDistanceOfAtomToAtomSet(Structure s, int atomindex, IndexSet referenceset)`
Calculates the distance of an atom to a reference set of atoms (i.e.
`static double`
`getDistanceOfTwoAtomSets(Structure s, IndexSet indices1, IndexSet indices2)`
Calculates the distance between two sets of atoms (i.e.
`static double`
`getDistanceRange(Trajectory t, int atomindex1, int atomindex2)`
Returns the range (max-min) of the distance of two atoms in a trajectory
`static ArrayList<Double>`
`getDistanceTimeSeries(Trajectory t, int atomindex1, int atomindex2)`
Returns the time series of the distance of two atoms in a trajectory
`static ArrayList<Double>`
`getDistanceTimeSeries(Trajectory t, int atomindex, IndexSet referenceset)`
Returns the time series of the distance of a single atom and a set of atoms in a trajectory
`static ArrayList<Double>`
`getDistanceTimeSeries(Trajectory t, IndexSet indices1, IndexSet indices2)`
Returns the time series of the distance of two sets of atoms in a trajectory
`static FrameIndexSet`
`getFramesWhereAtomIsCloseToPoint(Trajectory t, int atomindex, Point3D point, double cutoff)`
Returns the list of frames in the trajectory where an atoms is closer to a reference point than a given cutoff
`static FrameIndexSet`
`getFramesWhereAtomIsDistantFromPoint(Trajectory t, int atomindex, Point3D point, double cutoff)`
Returns the list of frames in the trajectory where an atoms is more distant from a reference point than a given cutoff
`static FrameIndexSet`
`getFramesWhereAtomsAreClose(Trajectory t, int atomindex1, int atomindex2, double cutoff)`
Returns the list of frames in a trajectory where two atoms are closer to each other than the given cutoff
`static FrameIndexSet`
`getFramesWhereAtomsAreDistant(Trajectory t, int atomindex1, int atomindex2, double cutoff)`
Returns the list of frames in a trajectory where two atoms are more distant from each other than the given cutoff
`static Jama.Matrix`
`getFrequencyContactMatrix(Trajectory t, int distanceBetween, double cutoff, double frequency)`
Calculates the contact matrix of residues where two residues are said to be in contact if they are in contact in at least the given percentage of frames of the trajectory
`static double`
`getMaximalDistance(Trajectory t, int atomindex1, int atomindex2)`
Returns the maximal distance of two atoms in a trajectory
`static Jama.Matrix`
`getMeanAtomicDistanceMatrix(Trajectory t)`
Calculates the mean distance matrix of all atoms in a trajectory
`static Jama.Matrix`
`getMeanAtomicDistanceMatrix(Trajectory t, IndexSet indices)`
Calculates the mean distance matrix of atoms of given indices in a trajectory
`static double`
`getMeanDistance(Trajectory t, int atomindex1, int atomindex2)`
Returns the mean of the distance of two atoms in a trajectory
`static Jama.Matrix`
`getMeanResidueDistanceMatrix(Trajectory t, int distanceBetween)`
Calculates the mean distance matrix of residues in a trajectory by the given method
`static double`
`getMinimalDistance(Trajectory t, int atomindex1, int atomindex2)`
Returns the minimal distance of two atoms in a trajectory
`static Jama.Matrix`
`getResidueDistanceMatrix(Structure s, int distanceBetween)`
Calculates the distance matrix of residues in a structure by the given method
`static double`
`getVarianceOfDistance(Trajectory t, int atomindex1, int atomindex2)`
Returns the variance of the distance of two atoms in a trajectory

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### ALPHACARBON

public static final int ALPHACARBON

See Also:
  - Constant Field Values

### CLOSEST

public static final int CLOSEST

See Also:
  - Constant Field Values

### CLOSESTHEAVY

public static final int CLOSESTHEAVY

See Also:
  - Constant Field Values

## Constructor Details

### Distances

public Distances()

## Method Details

### getDistanceMatrix

public static Jama.Matrix getDistanceMatrix(PointList points)
Calculates the distance matrix from a point list

Parameters:
  `points` - point list
Returns:
  distance matrix

### getAtomicDistanceMatrix

public static Jama.Matrix getAtomicDistanceMatrix(Structure s)
Calculates the distance matrix of all atoms in a structure

Parameters:
  `s` - structure
Returns:
  distance matrix

### getAtomicDistanceMatrix

public static Jama.Matrix getAtomicDistanceMatrix(Structure s, IndexSet indices)
Calculates the distance matrix of atoms of given indices in a structure

Parameters:
  `s` - structure
  `indices` - index set
Returns:
  distance matrix

### getAtomicDistanceMatrix

public static Jama.Matrix getAtomicDistanceMatrix(Structure s, IndexSet indices1, IndexSet indices2)
Calculates the distance matrix between two sets of atoms

Parameters:
  `s` - structure
  `indices1` - index set 1
  `indices2` - index set 2
Returns:
  distance matrix

### getResidueDistanceMatrix

public static Jama.Matrix getResidueDistanceMatrix(Structure s, int distanceBetween)
Calculates the distance matrix of residues in a structure by the given method

Parameters:
  `s` - structure
  `distanceBetween` - which atoms are used for calculating the distances (ALPHACARBON: alpha carbon atoms, CLOSEST: closest atoms of two residues, CLOSESTHEAVY: closest heavy atoms of two residues)
Returns:
  distance matrix

### getMeanAtomicDistanceMatrix

public static Jama.Matrix getMeanAtomicDistanceMatrix(Trajectory t)
Calculates the mean distance matrix of all atoms in a trajectory

Parameters:
  `t` - trajecotry
Returns:
  mean distance matrix

### getMeanAtomicDistanceMatrix

public static Jama.Matrix getMeanAtomicDistanceMatrix(Trajectory t, IndexSet indices)
Calculates the mean distance matrix of atoms of given indices in a trajectory

Parameters:
  `t` - trajecotry
  `indices` - index set
Returns:
  mean distance matrix

### getMeanResidueDistanceMatrix

public static Jama.Matrix getMeanResidueDistanceMatrix(Trajectory t, int distanceBetween)
Calculates the mean distance matrix of residues in a trajectory by the given method

Parameters:
  `t` - trajectory
  `distanceBetween` - which atoms are used for calculating the distances (ALPHACARBON: alpha carbon atoms, CLOSEST: closest atoms of two residues, CLOSESTHEAVY: closest heavy atoms of two residues)
Returns:
  mean distance matrix

### getContactMatrix

public static Jama.Matrix getContactMatrix(PointList points, double cutoff)
Calculates the contact matrix from a point list

Parameters:
  `points` - point list
  `cutoff` - distance cutoff
Returns:
  contact matrix

### getContactMatrix

public static Jama.Matrix getContactMatrix(Structure s, int distanceBetween, double cutoff)
Calculates the contact matrix of residues in a structure by the given method

Parameters:
  `s` - structure
  `distanceBetween` - which atoms are used for calculating the distances (ALPHACARBON: alpha carbon atoms, CLOSEST: closest atoms of two residues, CLOSESTHEAVY: closest heavy atoms of two residues)
  `cutoff` - distance cutoff
Returns:
  contact matrix

### getContactOfMeanMatrix

public static Jama.Matrix getContactOfMeanMatrix(Trajectory t, int distanceBetween, double cutoff)
Calculates the contact matrix based on the mean residue distance matrix in a trajectory

Parameters:
  `t` - trajectory
  `distanceBetween` - which atoms are used for calculating the distances (ALPHACARBON: alpha carbon atoms, CLOSEST: closest atoms of two residues, CLOSESTHEAVY: closest heavy atoms of two residues)
  `cutoff` - distance cutoff
Returns:
  contact matrix

### getFrequencyContactMatrix

public static Jama.Matrix getFrequencyContactMatrix(Trajectory t, int distanceBetween, double cutoff, double frequency)
Calculates the contact matrix of residues where two residues are said to be in contact if they are in contact in at least the given percentage of frames of the trajectory

Parameters:
  `t` - trajectory
  `distanceBetween` - which atoms are used for calculating the distances (ALPHACARBON: alpha carbon atoms, CLOSEST: closest atoms of two residues, CLOSESTHEAVY: closest heavy atoms of two residues)
  `cutoff` - distance cutoff
  `frequency` - minimal frequency of frames in which two residues are in contact
Returns:
  contact matrix

### getDistanceTimeSeries

public static ArrayList<Double> getDistanceTimeSeries(Trajectory t, int atomindex1, int atomindex2)
Returns the time series of the distance of two atoms in a trajectory

Parameters:
  `t` - trajectory
  `atomindex1` - index of first atom
  `atomindex2` - index of second atom
Returns:
  time series of distance

### getDistanceTimeSeries

public static ArrayList<Double> getDistanceTimeSeries(Trajectory t, int atomindex, IndexSet referenceset)
Returns the time series of the distance of a single atom and a set of atoms in a trajectory

Parameters:
  `t` - trajectory
  `atomindex` - index of atom
  `referenceset` - index set of reference atoms
Returns:
  time series of distance

### getDistanceTimeSeries

public static ArrayList<Double> getDistanceTimeSeries(Trajectory t, IndexSet indices1, IndexSet indices2)
Returns the time series of the distance of two sets of atoms in a trajectory

Parameters:
  `t` - trajectory
  `indices1` - first index set
  `indices2` - second index set
Returns:
  time series of distance

### getMeanDistance

public static double getMeanDistance(Trajectory t, int atomindex1, int atomindex2)
Returns the mean of the distance of two atoms in a trajectory

Parameters:
  `t` - trajectory
  `atomindex1` - index of first atom
  `atomindex2` - index of second atom
Returns:
  mean of distance

### getVarianceOfDistance

public static double getVarianceOfDistance(Trajectory t, int atomindex1, int atomindex2)
Returns the variance of the distance of two atoms in a trajectory

Parameters:
  `t` - trajectory
  `atomindex1` - index of first atom
  `atomindex2` - index of second atom
Returns:
  variance of distance

### getMinimalDistance

public static double getMinimalDistance(Trajectory t, int atomindex1, int atomindex2)
Returns the minimal distance of two atoms in a trajectory

Parameters:
  `t` - trajectory
  `atomindex1` - index of first atom
  `atomindex2` - index of second atom
Returns:
  minimal distance

### getMaximalDistance

public static double getMaximalDistance(Trajectory t, int atomindex1, int atomindex2)
Returns the maximal distance of two atoms in a trajectory

Parameters:
  `t` - trajectory
  `atomindex1` - index of first atom
  `atomindex2` - index of second atom
Returns:
  maximal distance

### getDistanceRange

public static double getDistanceRange(Trajectory t, int atomindex1, int atomindex2)
Returns the range (max-min) of the distance of two atoms in a trajectory

Parameters:
  `t` - trajectory
  `atomindex1` - index of first atom
  `atomindex2` - index of second atom
Returns:
  size of distance interval

### getAtomIndicesInRadius

public static IndexSet getAtomIndicesInRadius(Structure s, Point3D point, double radius)
Returns the index set of atoms in a structure that are closer to a reference point than a given radius

Parameters:
  `s` - structure
  `point` - reference point
  `radius` - distance radius
Returns:
  atom indices

### getAtomIndicesInRadius

public static IndexSet getAtomIndicesInRadius(Structure s, Atom atom, double radius)
Returns the index set of atoms in a structure that are closer to a reference atom than a given radius

Parameters:
  `s` - structure
  `atom` - reference atom
  `radius` - distance radius
Returns:
  atom indices

### getAtomIndicesInRadius

public static IndexSet getAtomIndicesInRadius(Structure s, IndexSet referenceindices, double radius)
Returns the index set of atoms in a structure that are closer to a reference set of atoms than a given radius

Parameters:
  `s` - structure
  `referenceindices` - index set of reference atoms
  `radius` - distance radius
Returns:
  atom indices

### getAtomIndicesInRadius

public static IndexSet getAtomIndicesInRadius(Structure s, IndexSet atomIndices, IndexSet referenceIndices, double radius)
Returns the index set of atoms from a set of atoms that are closer to a reference set than a given radius

Parameters:
  `s` - structure
  `atomIndices` - index set of atoms tested
  `referenceIndices` - index set of reference atoms
  `radius` - distance radius
Returns:
  atom indices

### findFrameWhereClosest

public static PointList findFrameWhereClosest(Trajectory t, int atomindex1, int atomindex2)
Returns the frame in which two atoms are closest to each other in a simulation

Parameters:
  `t` - trajectory
  `atomindex1` - index of first atom
  `atomindex2` - index of second atom
Returns:
  frame of trajectory

### findFrameWhereMostDistant

public static PointList findFrameWhereMostDistant(Trajectory t, int atomindex1, int atomindex2)
Returns the frame in which two atoms are most distant from each other in a simulation

Parameters:
  `t` - trajectory
  `atomindex1` - index of first atom
  `atomindex2` - index of second atom
Returns:
  frame of trajectory

### getDistanceOfAtomToAtomSet

public static double getDistanceOfAtomToAtomSet(Structure s, int atomindex, IndexSet referenceset)
Calculates the distance of an atom to a reference set of atoms (i.e. the minimum of all pairwise distances)

Parameters:
  `s` - structure
  `atomindex` - index of atom
  `referenceset` - index set of reference atoms
Returns:
  minimal distance

### getDistanceOfTwoAtomSets

public static double getDistanceOfTwoAtomSets(Structure s, IndexSet indices1, IndexSet indices2)
Calculates the distance between two sets of atoms (i.e. the minimum of all pairwise distances)

Parameters:
  `s` - structure
  `indices1` - first index set
  `indices2` - second index set
Returns:
  minimal distance

### findClosestAtom

public static Atom findClosestAtom(Structure s, IndexSet atomset, IndexSet referenceset)
Returns the atom from a given atom set that is closest to a reference set of atoms

Parameters:
  `s` - structure
  `atomset` - index set of atoms
  `referenceset` - index set of reference atoms
Returns:
  closest atom

### getFramesWhereAtomsAreClose

public static FrameIndexSet getFramesWhereAtomsAreClose(Trajectory t, int atomindex1, int atomindex2, double cutoff)
Returns the list of frames in a trajectory where two atoms are closer to each other than the given cutoff

Parameters:
  `t` - trajectory
  `atomindex1` - index of first atom
  `atomindex2` - index of second atom
  `cutoff` - distance cutoff
Returns:
  frame list

### getFramesWhereAtomsAreDistant

public static FrameIndexSet getFramesWhereAtomsAreDistant(Trajectory t, int atomindex1, int atomindex2, double cutoff)
Returns the list of frames in a trajectory where two atoms are more distant from each other than the given cutoff

Parameters:
  `t` - trajectory
  `atomindex1` - index of first atom
  `atomindex2` - index of second atom
  `cutoff` - distance cutoff
Returns:
  frame list

### getFramesWhereAtomIsCloseToPoint

public static FrameIndexSet getFramesWhereAtomIsCloseToPoint(Trajectory t, int atomindex, Point3D point, double cutoff)
Returns the list of frames in the trajectory where an atoms is closer to a reference point than a given cutoff

Parameters:
  `t` - trajectory
  `atomindex` - index of atom
  `point` - reference point
  `cutoff` - distance cutoff
Returns:
  frame list

### getFramesWhereAtomIsDistantFromPoint

public static FrameIndexSet getFramesWhereAtomIsDistantFromPoint(Trajectory t, int atomindex, Point3D point, double cutoff)
Returns the list of frames in the trajectory where an atoms is more distant from a reference point than a given cutoff

Parameters:
  `t` - trajectory
  `atomindex` - index of atom
  `point` - reference point
  `cutoff` - distance cutoff
Returns:
  frame list