Class ExtendedSystem

java.lang.Object
ffx.potential.extended.ExtendedSystem
All Implemented Interfaces:
OptimizationInterface, Potential

public class ExtendedSystem extends Object implements Potential
ExtendedSystem class.
Since:
1.0
Author:
Andrew Thiel
  • Field Details

    • guessTitrState

      public final boolean guessTitrState
    • residueNames

      public final AminoAcidUtils.AminoAcid3[] residueNames
      Array of AminoAcid3 initialized to match the number of atoms in the system. Used to know how to apply vdW or electrostatic ESV terms for the atom.
    • tautomerDirections

      public final int[] tautomerDirections
      Array of ints that is initialized to match the number of atoms in the molecular assembly. 1 indicates that the tautomer lambda direction is normal. -1 indicates that the tautomer lambda direction is reversed (1-x). 0 indicates that the atom is not a tautomerizing atom.
  • Constructor Details

    • ExtendedSystem

      public ExtendedSystem(MolecularAssembly mola, double pH, File esvFile)
      Construct extended system with the provided configuration.
      Parameters:
      mola - a MolecularAssembly object.
  • Method Details

    • getSpecialResidueList

      public ArrayList<Double> getSpecialResidueList()
    • getDerivatives

      public double[] getDerivatives()
      get array of dU/dL for each titrating residue
      Returns:
      esvDeriv a double[]
    • getTitrationLambda

      public double getTitrationLambda(Residue residue)
      Gets the titration lambda for the input residue if the residue is titrating
      Parameters:
      residue - a titrating residue
      Returns:
      the titration lambda for the residue
    • getTautomerLambda

      public double getTautomerLambda(Residue residue)
      Gets the tautomer lambda for the input residue if the residue is tautomerizing
      Parameters:
      residue - a tautomer residue
      Returns:
      the tautomer lambda for the residue
    • isTitratable

      public boolean isTitratable(Residue residue)
      Returns the titratibility of the passed residue
    • isTautomer

      public boolean isTautomer(Residue residue)
      Returns the tautomerizibility of a residue
    • isTitrating

      public boolean isTitrating(int atomIndex)
      Returns whether an atom is titrating
    • isTautomerizing

      public boolean isTautomerizing(int atomIndex)
      Returns whether an atom is tautomerizing
    • isTitratingHeavy

      public boolean isTitratingHeavy(int atomIndex)
      Questions whether the current non-hydrogen atom's polarizability is changing in response to lambda being updated. Only affects carboxylic oxygen and sulfur.
      Parameters:
      atomIndex -
      Returns:
    • setFixedTautomerState

      public void setFixedTautomerState(boolean fixTautomerState)
      Does not allow for changes to the tautomer states of tautomerizing residues
    • setFixedTitrationState

      public void setFixedTitrationState(boolean fixTitrationState)
      Does not allow for changes to the tautomer states of titrating residues
    • reGuessLambdas

      public void reGuessLambdas()
      Reset initialized lambdas to a naive guess based on the model pKa for each extended residue
    • setTautomerLambda

      public void setTautomerLambda(Residue residue, double lambda)
      Set the tautomer lambda of a residue and update corresponding theta
      Parameters:
      residue -
      lambda -
    • setTautomerLambda

      public void setTautomerLambda(Residue residue, double lambda, boolean changeThetas)
      Set the tautomer lambda of a residue and update corresponding theta if desired
      Parameters:
      residue - residue to set the lambda of
      lambda - value to set the residue to
      changeThetas - whether or not to change the theta positions ~comes with information loss~
    • setTitrationLambda

      public void setTitrationLambda(Residue residue, double lambda)
      Set the titration lambda of a residue and update corresponding theta
      Parameters:
      residue - residue to set the lambda of
      lambda - value to set the residue to
    • setTitrationLambda

      public void setTitrationLambda(Residue residue, double lambda, boolean changeThetas)
      Set the titration lambda of a residue and update corresponding theta if desired
      Parameters:
      residue - residue to set the lambda of
      lambda - value to set the residue to
      changeThetas - whether or not to change the theta positions ~comes with information loss~
    • getESVHistogram

      public int[][] getESVHistogram(int[][] histogram)
      Overwrites the histogram passed into it and returns the new one out ~output never used?~
      Parameters:
      histogram - 2D histogram list with the tautomer and titration states compressed to a 1D array
      Returns:
      another compressed histogram
    • copyESVHistogramTo

      public void copyESVHistogramTo(int[][] histogram)
      Changes this ESV's histogram to equal the one passed
      Parameters:
      histogram - histogram to set this ESV histogram to
    • initEsvVdw

      public void initEsvVdw()
      Zero out each array element of the vdW ESV array
    • initEsvPermElec

      public void initEsvPermElec()
      Zero out each array element of the permElec ESV array
    • initEsvIndElec

      public void initEsvIndElec()
      Zero out each array element of the indElec ESV array
    • getTitrationLambda

      public double getTitrationLambda(int atomIndex)
      get Titration Lambda for an extended atom
      Parameters:
      atomIndex -
      Returns:
      titrationLambdas[atomIndex]
    • getTitrationESVIndex

      public int getTitrationESVIndex(int i)
      get the index of the extended residue list that corresponds to this atom
      Parameters:
      i -
      Returns:
      titrationIndexMap[i]
    • getTautomerLambda

      public double getTautomerLambda(int atomIndex)
      get Tautomer Lambda for an extended atom
      Parameters:
      atomIndex -
      Returns:
      tautomerLambdas[atomIndex]
    • getTautomerESVIndex

      public int getTautomerESVIndex(int i)
    • getTitratingResidueList

      public List<Residue> getTitratingResidueList()
      Return the List of Titrating Residues
      Returns:
      titratingResidueList
    • getTautomerizingResidueList

      public List<Residue> getTautomerizingResidueList()
      Return the List of Tautomerizing Residues
      Returns:
      tautomerizingResidueList
    • getExtendedResidueList

      public List<Residue> getExtendedResidueList()
      Return the List of Extended Residues which = TitratingResidueList + TautomerizingResidueList
      Returns:
      extendedResidueList
    • getThetaMass

      public double getThetaMass()
    • getThetaFriction

      public double getThetaFriction()
    • getExtendedLambdas

      public double[] getExtendedLambdas()
      Gets a copy of the array of doubles that matches the nESVs correspoding to each titration and tautomer lambda
      Returns:
      double array of length nESVs
    • getLambdaList

      public String getLambdaList()
      getLambdaList.
      Returns:
      a String object.
    • getExtendedAtoms

      public Atom[] getExtendedAtoms()
      All atoms of the fully-protonated system (not just those affected by this system).
      Returns:
      an array of Atom objects.
    • getExtendedMolecule

      public int[] getExtendedMolecule()
      Companion to getExtendedAtoms() for vdw::setAtoms and pme::setAtoms.
      Returns:
      an array of
      invalid reference
      int
      objects.
    • getBiasEnergy

      public double getBiasEnergy()
      Sum up total bias (Ubias = UpH + Udiscr - Umod)
      Returns:
      totalBiasEnergy
    • getBiasDecomposition

      public String getBiasDecomposition()
      getBiasDecomposition.
      Returns:
      a String object.
    • getVdwPrefactor

      public void getVdwPrefactor(int atomIndex, double[] vdwPrefactorAndDerivs)
      Calculate prefactor for scaling the van der Waals based on titration/tautomer state if titrating proton
    • isTitratingHydrogen

      public boolean isTitratingHydrogen(int atomIndex)
      Questions whether the current hydrogen's polarizability is changing in response to lambda being updated.
      Parameters:
      atomIndex -
      Returns:
    • addVdwDeriv

      public void addVdwDeriv(int atomI, double vdwEnergy, double[] vdwPrefactorAndDerivI, double vdwPrefactorJ)
      Add van der Waals deriv to appropriate dU/dL term given the atom index and its contributions.
      Parameters:
      atomI -
      vdwEnergy -
      vdwPrefactorAndDerivI -
      vdwPrefactorJ -
    • addPermElecDeriv

      public void addPermElecDeriv(int atomI, double titrationEnergy, double tautomerEnergy)
      Add Perm Elec deriv to appropriate dU/dL term given the atom index and its contributions.
      Parameters:
      atomI -
      titrationEnergy -
      tautomerEnergy -
    • addIndElecDeriv

      public void addIndElecDeriv(int atomI, double titrationEnergy, double tautomerEnergy)
      Add Induced Elec deriv to appropriate dU/dL term given the atom index and its contributions.
      Parameters:
      atomI -
      titrationEnergy -
      tautomerEnergy -
    • getConstantPh

      public double getConstantPh()
      getConstantPh.
      Returns:
      a double.
    • setConstantPh

      public void setConstantPh(double pH)
      setConstantPh.
      Parameters:
      pH - a double.
    • getTitrationUtils

      public TitrationUtils getTitrationUtils()
      Returns:
      titrationUtils master copy from ExtendedSystem.
    • setRestartFile

      public void setRestartFile(File esvFile)
      Sets the restartFile field of this extended system to the passed file. This does not read the file, it only determines where the writeRestartFile() will write to.
      Parameters:
      esvFile -
    • writeESVInfoTo

      public boolean writeESVInfoTo(File esvFile)
      Writes out the current state of the extended system to the specified file without setting the file to that location.
      Parameters:
      esvFile - file to be written to
      Returns:
      whether the read was successful or not
    • readESVInfoFrom

      public boolean readESVInfoFrom(File esvFile)
      Method overwrites whatever is in the extended system at the time with the read data.

      CAUTION: If the old data is not written out to file before this is called, the data will be lost.

      Parameters:
      esvFile - esvFile to read
      Returns:
      whether the read was successful or not
    • setTemperature

      public void setTemperature(double set)
      setTemperature.
      Parameters:
      set - a double.
    • preForce

      public void preForce()
      Processes lambda values based on propagation of theta value from Stochastic integrator in Molecular dynamics
    • writeRestart

      public void writeRestart()
      Execute writeESV from esvFilter that is contained within ExtendedSystem
    • writeLambdaHistogram

      public void writeLambdaHistogram(boolean printHistograms)
      Execute writeLambdaHistogrm from esvFilter that is contained within ExtendedSystem Prints the ESV histogram for each titrating residue
    • printProtonationRatios

      public void printProtonationRatios()
      Calculate the Deprotonation Fraction from the ESV histogram
    • energyAndGradient

      public double energyAndGradient(double[] x, double[] g)
      Description copied from interface: OptimizationInterface
      This method is called repeatedly to compute the function energy and gradient.
      Specified by:
      energyAndGradient in interface OptimizationInterface
      Parameters:
      x - Input parameters.
      g - Output gradients with respect to each parameter.
      Returns:
      Function value at x.
    • postForce

      public double[] postForce()
      Applies a chain rule term to the derivative to account for taking a derivative of lambda = sin(theta)^2
      Returns:
      dE/dL a double[]
    • energy

      public double energy(double[] x)
      Description copied from interface: OptimizationInterface
      This method is called repeatedly to compute the function energy.
      Specified by:
      energy in interface OptimizationInterface
      Parameters:
      x - Input parameters.
      Returns:
      Function value at x.
    • getAcceleration

      public double[] getAcceleration(double[] acceleration)
      Description copied from interface: Potential
      getAcceleration.
      Specified by:
      getAcceleration in interface Potential
      Parameters:
      acceleration - an array of
      invalid reference
      double
      objects.
      Returns:
      an array of
      invalid reference
      double
      objects.
    • getThetaAccel

      public double[] getThetaAccel()
    • getCoordinates

      public double[] getCoordinates(double[] parameters)
      Description copied from interface: OptimizationInterface
      Load the current value of the parameters. If the supplied array is null or not large enough, a new one should be created. The filled array is returned.
      Specified by:
      getCoordinates in interface OptimizationInterface
      Parameters:
      parameters - Supplied array.
      Returns:
      The array filled with parameter values.
    • getConstraints

      public List<Constraint> getConstraints()
      Description copied from interface: Potential
      Returns the list of Constraints associated with this Potential. The default implementation returns an empty list.
      Specified by:
      getConstraints in interface Potential
      Returns:
      All Constraints.
    • getThetaPosition

      public double[] getThetaPosition()
    • getEnergyTermState

      public Potential.STATE getEnergyTermState()
      Description copied from interface: Potential
      Get the Potential Energy terms that is active.
      Specified by:
      getEnergyTermState in interface Potential
      Returns:
      the STATE
    • setEnergyTermState

      public void setEnergyTermState(Potential.STATE state)
      Description copied from interface: Potential
      Set the Potential Energy terms that should be active.
      Specified by:
      setEnergyTermState in interface Potential
      Parameters:
      state - include FAST varying energy terms, SLOW varying energy terms or BOTH.
    • getMass

      public double[] getMass()
      Description copied from interface: Potential
      Get the mass of each degree of freedom. This is required for molecular dynamics.
      Specified by:
      getMass in interface Potential
      Returns:
      The mass of each degree of freedom.
    • getThetaMassArray

      public double[] getThetaMassArray()
    • getNumberOfVariables

      public int getNumberOfVariables()
      Description copied from interface: OptimizationInterface
      Get the number of variables being operated on.
      Specified by:
      getNumberOfVariables in interface OptimizationInterface
      Returns:
      Number of variables.
    • getPreviousAcceleration

      public double[] getPreviousAcceleration(double[] previousAcceleration)
      Description copied from interface: Potential
      getPreviousAcceleration.
      Specified by:
      getPreviousAcceleration in interface Potential
      Parameters:
      previousAcceleration - an array of
      invalid reference
      double
      objects.
      Returns:
      an array of
      invalid reference
      double
      objects.
    • getScaling

      public double[] getScaling()
      Description copied from interface: OptimizationInterface
      Get the problem scaling.
      Specified by:
      getScaling in interface OptimizationInterface
      Returns:
      The scaling value used for each variable.
    • setScaling

      public void setScaling(double[] scaling)
      Description copied from interface: OptimizationInterface
      Scale the problem. A good choice for optimization is the square root of the median eigenvalue of a typical Hessian.
      Specified by:
      setScaling in interface OptimizationInterface
      Parameters:
      scaling - The scaling value to use for each variable.
    • getTotalEnergy

      public double getTotalEnergy()
      Description copied from interface: OptimizationInterface
      Get the total energy of the system
      Specified by:
      getTotalEnergy in interface OptimizationInterface
      Returns:
      the total energy
    • getState

      public SystemState getState()
    • getVariableTypes

      public Potential.VARIABLE_TYPE[] getVariableTypes()
      Description copied from interface: Potential
      Get the type of all variables.
      Specified by:
      getVariableTypes in interface Potential
      Returns:
      The VARIABLE_TYPE of each variable.
    • getVelocity

      public double[] getVelocity(double[] velocity)
      Description copied from interface: Potential
      getVelocity.
      Specified by:
      getVelocity in interface Potential
      Parameters:
      velocity - an array of
      invalid reference
      double
      objects.
      Returns:
      an array of
      invalid reference
      double
      objects.
    • getThetaVelocity

      public double[] getThetaVelocity()
    • setAcceleration

      public void setAcceleration(double[] acceleration)
      Description copied from interface: Potential
      setAcceleration.
      Specified by:
      setAcceleration in interface Potential
      Parameters:
      acceleration - an array of
      invalid reference
      double
      objects.
    • setPreviousAcceleration

      public void setPreviousAcceleration(double[] previousAcceleration)
      Description copied from interface: Potential
      setPreviousAcceleration.
      Specified by:
      setPreviousAcceleration in interface Potential
      Parameters:
      previousAcceleration - an array of
      invalid reference
      double
      objects.
    • setVelocity

      public void setVelocity(double[] velocity)
      Description copied from interface: Potential
      setVelocity.
      Specified by:
      setVelocity in interface Potential
      Parameters:
      velocity - an array of
      invalid reference
      double
      objects.