Package ffx.potential.extended
Class ExtendedSystem
java.lang.Object
ffx.potential.extended.ExtendedSystem
- All Implemented Interfaces:
OptimizationInterface
,Potential
ExtendedSystem class.
- Since:
- 1.0
- Author:
- Andrew Thiel
-
Nested Class Summary
Nested classes/interfaces inherited from interface ffx.numerics.Potential
Potential.STATE, Potential.VARIABLE_TYPE
-
Field Summary
Modifier and TypeFieldDescriptionfinal boolean
final AminoAcidUtils.AminoAcid3[]
Array of AminoAcid3 initialized to match the number of atoms in the system.final int[]
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 -
Constructor Summary
ConstructorDescriptionExtendedSystem
(MolecularAssembly mola, double pH, File esvFile) Construct extended system with the provided configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIndElecDeriv
(int atomI, double titrationEnergy, double tautomerEnergy) Add Induced Elec deriv to appropriate dU/dL term given the atom index and its contributions.void
addPermElecDeriv
(int atomI, double titrationEnergy, double tautomerEnergy) Add Perm Elec deriv to appropriate dU/dL term given the atom index and its contributions.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.void
copyESVHistogramTo
(int[][] histogram) Changes this ESV's histogram to equal the one passeddouble
energy
(double[] x) This method is called repeatedly to compute the function energy.double
energyAndGradient
(double[] x, double[] g) This method is called repeatedly to compute the function energy and gradient.double[]
getAcceleration
(double[] acceleration) getAcceleration.getBiasDecomposition.double
Sum up total bias (Ubias = UpH + Udiscr - Umod)double
getConstantPh.Returns the list of Constraints associated with this Potential.double[]
getCoordinates
(double[] parameters) Load the current value of the parameters.double[]
get array of dU/dL for each titrating residueGet the Potential Energy terms that is active.int[][]
getESVHistogram
(int[][] histogram) Overwrites the histogram passed into it and returns the new one out ~output never used?Atom[]
All atoms of the fully-protonated system (not just those affected by this system).double[]
Gets a copy of the array of doubles that matches the nESVs correspoding to each titration and tautomer lambdaint[]
Companion to getExtendedAtoms() for vdw::setAtoms and pme::setAtoms.Return the List of Extended Residues which = TitratingResidueList + TautomerizingResidueListgetLambdaList.double[]
getMass()
Get the mass of each degree of freedom.int
Get the number of variables being operated on.double[]
getPreviousAcceleration
(double[] previousAcceleration) getPreviousAcceleration.double[]
Get the problem scaling.getState()
int
getTautomerESVIndex
(int i) Return the List of Tautomerizing Residuesdouble
getTautomerLambda
(int atomIndex) get Tautomer Lambda for an extended atomdouble
getTautomerLambda
(Residue residue) Gets the tautomer lambda for the input residue if the residue is tautomerizingdouble[]
double
double
double[]
double[]
double[]
Return the List of Titrating Residuesint
getTitrationESVIndex
(int i) get the index of the extended residue list that corresponds to this atomdouble
getTitrationLambda
(int atomIndex) get Titration Lambda for an extended atomdouble
getTitrationLambda
(Residue residue) Gets the titration lambda for the input residue if the residue is titratingdouble
Get the total energy of the systemGet the type of all variables.void
getVdwPrefactor
(int atomIndex, double[] vdwPrefactorAndDerivs) Calculate prefactor for scaling the van der Waals based on titration/tautomer state if titrating protondouble[]
getVelocity
(double[] velocity) getVelocity.void
Zero out each array element of the indElec ESV arrayvoid
Zero out each array element of the permElec ESV arrayvoid
Zero out each array element of the vdW ESV arrayboolean
isTautomer
(Residue residue) Returns the tautomerizibility of a residueboolean
isTautomerizing
(int atomIndex) Returns whether an atom is tautomerizingboolean
isTitratable
(Residue residue) Returns the titratibility of the passed residueboolean
isTitrating
(int atomIndex) Returns whether an atom is titratingboolean
isTitratingHeavy
(int atomIndex) Questions whether the current non-hydrogen atom's polarizability is changing in response to lambda being updated.boolean
isTitratingHydrogen
(int atomIndex) Questions whether the current hydrogen's polarizability is changing in response to lambda being updated.double[]
Applies a chain rule term to the derivative to account for taking a derivative of lambda = sin(theta)^2void
preForce()
Processes lambda values based on propagation of theta value from Stochastic integrator in Molecular dynamicsvoid
Calculate the Deprotonation Fraction from the ESV histogramboolean
readESVInfoFrom
(File esvFile) Method overwrites whatever is in the extended system at the time with the read data.void
Reset initialized lambdas to a naive guess based on the model pKa for each extended residuevoid
setAcceleration
(double[] acceleration) setAcceleration.void
setConstantPh
(double pH) setConstantPh.void
Set the Potential Energy terms that should be active.void
setFixedTautomerState
(boolean fixTautomerState) Does not allow for changes to the tautomer states of tautomerizing residuesvoid
setFixedTitrationState
(boolean fixTitrationState) Does not allow for changes to the tautomer states of titrating residuesvoid
setPreviousAcceleration
(double[] previousAcceleration) setPreviousAcceleration.void
setRestartFile
(File esvFile) Sets the restartFile field of this extended system to the passed file.void
setScaling
(double[] scaling) Scale the problem.void
setTautomerLambda
(Residue residue, double lambda) Set the tautomer lambda of a residue and update corresponding thetavoid
setTautomerLambda
(Residue residue, double lambda, boolean changeThetas) Set the tautomer lambda of a residue and update corresponding theta if desiredvoid
setTemperature
(double set) setTemperature.void
setTitrationLambda
(Residue residue, double lambda) Set the titration lambda of a residue and update corresponding thetavoid
setTitrationLambda
(Residue residue, double lambda, boolean changeThetas) Set the titration lambda of a residue and update corresponding theta if desiredvoid
setVelocity
(double[] velocity) setVelocity.boolean
writeESVInfoTo
(File esvFile) Writes out the current state of the extended system to the specified file without setting the file to that location.void
writeLambdaHistogram
(boolean printHistograms) Execute writeLambdaHistogrm from esvFilter that is contained within ExtendedSystem Prints the ESV histogram for each titrating residuevoid
Execute writeESV from esvFilter that is contained within ExtendedSystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ffx.numerics.OptimizationInterface
destroy, energy, energyAndGradient, getUnderlyingPotentials, scaleCoordinates, scaleCoordinatesAndGradient, unscaleCoordinates
Methods inherited from interface ffx.numerics.Potential
writeAdditionalRestartInfo
-
Field Details
-
guessTitrState
public final boolean guessTitrState -
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[] tautomerDirectionsArray 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
Construct extended system with the provided configuration.- Parameters:
mola
- aMolecularAssembly
object.
-
-
Method Details
-
isTitratable
Returns the titratibility of the passed residue -
getDerivatives
public double[] getDerivatives()get array of dU/dL for each titrating residue- Returns:
- esvDeriv a double[]
-
getTitrationLambda
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
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
-
isTautomer
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:
-
getSpecialResidueList
-
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
Set the tautomer lambda of a residue and update corresponding theta- Parameters:
residue
-lambda
-
-
setTautomerLambda
Set the tautomer lambda of a residue and update corresponding theta if desired- Parameters:
residue
- residue to set the lambda oflambda
- value to set the residue tochangeThetas
- whether to change the theta positions ~comes with information loss~
-
setTitrationLambda
Set the titration lambda of a residue and update corresponding theta- Parameters:
residue
- residue to set the lambda oflambda
- value to set the residue to
-
setTitrationLambda
Set the titration lambda of a residue and update corresponding theta if desired- Parameters:
residue
- residue to set the lambda oflambda
- value to set the residue tochangeThetas
- whether 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
Return the List of Titrating Residues- Returns:
- titratingResidueList
-
getTautomerizingResidueList
Return the List of Tautomerizing Residues- Returns:
- tautomerizingResidueList
-
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
getLambdaList.- Returns:
- a
String
object.
-
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
-
getBiasEnergy
public double getBiasEnergy()Sum up total bias (Ubias = UpH + Udiscr - Umod)- Returns:
- totalBiasEnergy
-
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
- Returns:
- titrationUtils master copy from ExtendedSystem.
-
setRestartFile
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
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
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 -
getAcceleration
public double[] getAcceleration(double[] acceleration) Description copied from interface:Potential
getAcceleration.- Specified by:
getAcceleration
in interfacePotential
- Parameters:
acceleration
- an array ofinvalid reference
double
- Returns:
- an array of
invalid reference
double
-
getThetaAccel
public double[] getThetaAccel() -
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 interfaceOptimizationInterface
- Parameters:
x
- Input parameters.g
- Output gradients with respect to each parameter.- Returns:
- Function value at
x
.
-
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 interfacePotential
- Returns:
- All Constraints.
-
getEnergyTermState
Description copied from interface:Potential
Get the Potential Energy terms that is active.- Specified by:
getEnergyTermState
in interfacePotential
- Returns:
- the STATE
-
setEnergyTermState
Description copied from interface:Potential
Set the Potential Energy terms that should be active.- Specified by:
setEnergyTermState
in interfacePotential
- 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. -
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[]
-
getThetaMassArray
public double[] getThetaMassArray() -
getPreviousAcceleration
public double[] getPreviousAcceleration(double[] previousAcceleration) Description copied from interface:Potential
getPreviousAcceleration.- Specified by:
getPreviousAcceleration
in interfacePotential
- Parameters:
previousAcceleration
- an array ofinvalid reference
double
- Returns:
- an array of
invalid reference
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 interfaceOptimizationInterface
- Parameters:
x
- Input parameters.- Returns:
- Function value at
x
.
-
getVariableTypes
Description copied from interface:Potential
Get the type of all variables.- Specified by:
getVariableTypes
in interfacePotential
- Returns:
- The VARIABLE_TYPE of each variable.
-
getVelocity
public double[] getVelocity(double[] velocity) Description copied from interface:Potential
getVelocity.- Specified by:
getVelocity
in interfacePotential
- Parameters:
velocity
- an array ofinvalid reference
double
- Returns:
- an array of
invalid reference
double
-
getThetaVelocity
public double[] getThetaVelocity() -
setAcceleration
public void setAcceleration(double[] acceleration) Description copied from interface:Potential
setAcceleration.- Specified by:
setAcceleration
in interfacePotential
- Parameters:
acceleration
- an array ofinvalid reference
double
-
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 interfaceOptimizationInterface
- Parameters:
parameters
- Supplied array.- Returns:
- The array filled with parameter values.
-
setPreviousAcceleration
public void setPreviousAcceleration(double[] previousAcceleration) Description copied from interface:Potential
setPreviousAcceleration.- Specified by:
setPreviousAcceleration
in interfacePotential
- Parameters:
previousAcceleration
- an array ofinvalid reference
double
-
setVelocity
public void setVelocity(double[] velocity) Description copied from interface:Potential
setVelocity.- Specified by:
setVelocity
in interfacePotential
- Parameters:
velocity
- an array ofinvalid reference
double
-
getState
-
getThetaPosition
public double[] getThetaPosition() -
getNumberOfVariables
public int getNumberOfVariables()Description copied from interface:OptimizationInterface
Get the number of variables being operated on.- Specified by:
getNumberOfVariables
in interfaceOptimizationInterface
- Returns:
- Number of variables.
-
getScaling
public double[] getScaling()Description copied from interface:OptimizationInterface
Get the problem scaling.- Specified by:
getScaling
in interfaceOptimizationInterface
- 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 interfaceOptimizationInterface
- 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 interfaceOptimizationInterface
- Returns:
- the total energy
-