Class EnergyExpansion

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

public class EnergyExpansion extends Object
  • Constructor Details

  • Method Details

    • allocate2BodyJobMap

      public HashMap<String,Integer> allocate2BodyJobMap(Residue[] residues, int nResidues, boolean reverseMap)
    • allocate3BodyJobMap

      public HashMap<String,Integer> allocate3BodyJobMap(Residue[] residues, int nResidues, boolean reverseMap)
    • allocate4BodyJobMap

      public void allocate4BodyJobMap(Residue[] residues, int nResidues)
    • allocateSelfJobMap

      public HashMap<String,Integer> allocateSelfJobMap(Residue[] residues, int nResidues, boolean reverseMap)
    • compute2BodyEnergy

      public double compute2BodyEnergy(Residue[] residues, int i, int ri, int j, int rj)
      Computes a pair energy, defined as energy with all side-chains but two turned off, minus the sum of backbone and component self energies.
      Parameters:
      residues - Residues under optimization.
      i - A residue index.
      ri - A rotamer index for residue i.
      j - A residue index j!=i.
      rj - A rotamer index for residue j.
      Returns:
      Epair(ri, rj)=E2(ri,rj)-Eself(ri)-Eself(rj)-Eenv/bb.
    • compute3BodyEnergy

      public double compute3BodyEnergy(Residue[] residues, int i, int ri, int j, int rj, int k, int rk)
      Computes a 3-body energy, defined as the energy with all sidechains but three turned off, minus the sum of backbone and component self/2-Body energies.
      Parameters:
      residues - Residues under optimization.
      i - A residue index.
      ri - A rotamer index for residue i.
      j - A residue index j!=i.
      rj - A rotamer index for residue j.
      k - A residue index k!=j k!=i.
      rk - A rotamer index for residue k.
      Returns:
      Etri(ri, rj)=E3(ri,rj,rk)-Epair(ri,rj)-Epair(ri,rk)-Epair(rj,rk)-Eself(ri)-Eself(rj)-Eself(rk)-Eenv/bb.
    • compute4BodyEnergy

      public double compute4BodyEnergy(Residue[] residues, int i, int ri, int j, int rj, int k, int rk, int l, int rl)
      Computes a 4-body energy, defined as the energy with all sidechains but four turned off, minus the sum of backbone and component self/2-Body/3-body energies.
      Parameters:
      residues - Residues under optimization.
      i - A residue index.
      ri - A rotamer index for residue i.
      j - A residue index j!=i.
      rj - A rotamer index for residue j.
      k - A residue index k!=j k!=i.
      rk - A rotamer index for residue k.
      l - A residue index l!=i l!=j l!=k.
      rl - A rotamer index for residue l.
      Returns:
      The 4-body energy.
    • computeSelfEnergy

      public double computeSelfEnergy(Residue[] residues, int i, int ri)
      Computes a self energy, defined as energy with all side-chains but one turned off, minus the backbone energy.

      If a residue has multiple titration states represented by its set of rotamers, then a pH-dependent bias is included.

      Parameters:
      residues - Residues under optimization.
      i - A residue index.
      ri - A rotamer index for residue i.
      Returns:
      Eself(ri)=E1(ri)-Eenv/bb.
    • getTotalRotamerPhBias

      public double getTotalRotamerPhBias(List<Residue> residues, int[] rotamers, double pH, double KpH)
      Compute the total rotamer Ph bias for an array of residues.
      Parameters:
      residues - The array of residues.
      rotamers - The array of rotamer indices for each residue.
      Returns:
      The total Ph bias.
    • get2Body

      public double get2Body(int i, int ri, int j, int rj)
      Return a previously computed 2-body energy.
      Parameters:
      i - Residue i.
      ri - Rotamer ri of residue i.
      j - Residue j.
      rj - Rotamer rj of residue j.
      Returns:
      The 2-Body energy.
    • get3Body

      public double get3Body(Residue[] residues, int i, int ri, int j, int rj, int k, int rk)
      Return a previously computed 3-body energy.
      Parameters:
      residues - an array of Residue objects.
      i - Residue i.
      ri - Rotamer ri of residue i.
      j - Residue j.
      rj - Rotamer rj of residue j.
      k - Residue k.
      rk - Rotamer rk of residue k.
      Returns:
      The 3-Body energy.
    • getBackboneEnergy

      public double getBackboneEnergy()
    • setBackboneEnergy

      public void setBackboneEnergy(double backboneEnergy)
    • getFourBodyEnergyMap

      public Map<Integer,Integer[]> getFourBodyEnergyMap()
    • getSelf

      public double getSelf(int i, int ri)
      Return a previously computed self-energy.
      Parameters:
      i - Residue i.
      ri - Rotamer ri of residue i.
      Returns:
      The self-energy.
    • getSelf

      public double getSelf(int i, int ri, Rotamer rot, boolean excludeFMod)
      Return a previously computed self-energy.
      Parameters:
      i - Residue i.
      ri - Rotamer ri of residue i.
      Returns:
      The self-energy.
    • getSelfEnergyMap

      public Map<Integer,Integer[]> getSelfEnergyMap()
    • getThreeBodyEnergyMap

      public Map<Integer,Integer[]> getThreeBodyEnergyMap()
    • getTwoBodyEnergyMap

      public Map<Integer,Integer[]> getTwoBodyEnergyMap()
    • loadEnergyRestart

      public int loadEnergyRestart(File restartFile, Residue[] residues)
    • loadEnergyRestart

      public int loadEnergyRestart(File restartFile, Residue[] residues, int boxIteration, int[] cellIndices)
    • lowestPairEnergy

      public double lowestPairEnergy(Residue[] residues, int i, int ri, int j)
      Return the lowest pair-energy for residue (i,ri) with residue j.
      Parameters:
      residues - Residue array.
      i - Residue i index.
      ri - Residue i rotamer index.
      j - Residue j index.
      Returns:
      Lowest pair energy.
    • lowestSelfEnergy

      public double lowestSelfEnergy(Residue[] residues, int i)
      Return the lowest self-energy for residue i.
      Parameters:
      residues - Array if residues.
      i - Index of residue i.
      Returns:
      Returns the lowest self-energy for residue i.
    • minMaxE2

      public boolean minMaxE2(Residue[] residues, double[] minMax, int i, int ri, int j, int rj) throws IllegalArgumentException
      Calculates the minimum and maximum summations over additional residues for some pair ri-rj.
      Parameters:
      residues - Residues under consideration.
      minMax - Result array: 0 is min summation, 1 max summation.
      i - Residue i.
      ri - Rotamer for residue i.
      j - Residue j!=i.
      rj - Rotamer for residue j.
      Returns:
      False if ri-rj always clashes with other residues.
      Throws:
      IllegalArgumentException - If ri, rj, or ri-rj eliminated.
    • minMaxPairEnergy

      public boolean minMaxPairEnergy(Residue[] residues, double[] minMax, int i, int ri, int j)
      Computes the maximum and minimum energy i,ri might have with j, and optionally (if three-body energies in use) third residues k.

      The return value should be redundant with minMax[0] being NaN.

      Parameters:
      residues - Array of residues under consideration.
      minMax - Index 0 to be filled by minimum energy, index 1 filled by maximum energy.
      i - Some residue i under consideration.
      ri - A rotamer for residue i.
      j - Some arbitrary residue i!=j.
      Returns:
      If a valid configuration between i,ri and j could be found.
    • set2Body

      public void set2Body(int i, int ri, int j, int rj, double e)
    • set2Body

      public void set2Body(int i, int ri, int j, int rj, double e, boolean quiet)
      Store a pair energy in the pairs energy matrix.
      Parameters:
      i - A residue index.
      ri - A rotamer for residue i.
      j - A residue index j != i.
      rj - A rotamer for residue j.
      e - Computed energy to store.
      quiet - Silence warnings about exceptions.
    • set3Body

      public void set3Body(Residue[] residues, int i, int ri, int j, int rj, int k, int rk, double e)
      set3Body.
      Parameters:
      residues - an array of Residue objects.
      i - a int.
      ri - a int.
      j - a int.
      rj - a int.
      k - a int.
      rk - a int.
      e - a double.
    • set3Body

      public void set3Body(Residue[] residues, int i, int ri, int j, int rj, int k, int rk, double e, boolean quiet) throws IllegalStateException
      Stores a triple energy in the triples energy matrix.
      Parameters:
      residues - an array of Residue objects.
      i - A residue index.
      ri - A rotamer for residue i.
      j - A residue index j != i.
      rj - A rotamer for residue j.
      k - A residue index k != j, k != i.
      rk - A rotamer for residue k.
      e - Computed energy to store.
      quiet - Silence warnings about exceptions.
      Throws:
      IllegalStateException - If threeBodyTerm is false.
    • setSelf

      public void setSelf(int i, int ri, double e)
    • setSelf

      public void setSelf(int i, int ri, double e, boolean quiet)
      Stores a self energy in the self energy matrix.
      Parameters:
      i - A residue index.
      ri - A rotamer for residue i.
      e - Computed energy to store.
      quiet - Silence warnings about exceptions.
    • turnOffAllResidues

      public void turnOffAllResidues(Residue[] residues)
    • turnOffResidue

      public void turnOffResidue(Residue residue)
    • turnOnAllResidues

      public void turnOnAllResidues(Residue[] residues)
    • turnOnResidue

      public void turnOnResidue(Residue residue, int ri)