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
FieldsModifier and TypeFieldDescriptionfinal booleanfinal 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 normalfinal boolean -
Constructor Summary
ConstructorsConstructorDescriptionExtendedSystem(MolecularAssembly mola, double pH, File esvFile) Construct extended system with the provided configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIndElecDeriv(int atomI, double titrationEnergy, double tautomerEnergy) Add Induced Elec deriv to appropriate dU/dL term given the atom index and its contributions.voidaddPermElecDeriv(int atomI, double titrationEnergy, double tautomerEnergy) Add Perm Elec deriv to appropriate dU/dL term given the atom index and its contributions.voidaddVdwDeriv(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.voidcopyESVHistogramTo(int[][] histogram) Changes this ESV's histogram to equal the one passeddoubleenergy(double[] x) This method is called repeatedly to compute the function energy.doubleenergyAndGradient(double[] x, double[] g) This method is called repeatedly to compute the function energy and gradient.double[]getAcceleration(double[] acceleration) getAcceleration.getBiasDecomposition.doubleSum up total bias (Ubias = UpH + Udiscr - Umod)doublegetConstantPh.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.intGet the number of variables being operated on.double[]getPreviousAcceleration(double[] previousAcceleration) getPreviousAcceleration.double[]Get the problem scaling.getState()intgetTautomerESVIndex(int i) Return the List of Tautomerizing ResiduesdoublegetTautomerLambda(int atomIndex) get Tautomer Lambda for an extended atomdoublegetTautomerLambda(Residue residue) Gets the tautomer lambda for the input residue if the residue is tautomerizingdouble[]doubledoubledouble[]double[]double[]Return the List of Titrating ResiduesintgetTitrationESVIndex(int i) get the index of the extended residue list that corresponds to this atomdoublegetTitrationLambda(int atomIndex) get Titration Lambda for an extended atomdoublegetTitrationLambda(Residue residue) Gets the titration lambda for the input residue if the residue is titratingdoubleGet the total energy of the systemGet the type of all variables.voidgetVdwPrefactor(int atomIndex, double[] vdwPrefactorAndDerivs) Calculate prefactor for scaling the van der Waals based on titration/tautomer state if titrating protondouble[]getVelocity(double[] velocity) getVelocity.voidZero out each array element of the indElec ESV arrayvoidZero out each array element of the permElec ESV arrayvoidZero out each array element of the vdW ESV arraybooleanisTautomer(Residue residue) Returns the tautomerizibility of a residuebooleanisTautomerizing(int atomIndex) Returns whether an atom is tautomerizingbooleanisTitratable(Residue residue) Returns the titratibility of the passed residuebooleanisTitrating(int atomIndex) Returns whether an atom is titratingbooleanisTitratingHeavy(int atomIndex) Questions whether the current non-hydrogen atom's polarizability is changing in response to lambda being updated.booleanisTitratingHydrogen(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)^2voidpreForce()Processes lambda values based on propagation of theta value from Stochastic integrator in Molecular dynamicsvoidCalculate the Deprotonation Fraction from the ESV histogrambooleanreadESVInfoFrom(File esvFile) Method overwrites whatever is in the extended system at the time with the read data.voidReset initialized lambdas to a naive guess based on the model pKa for each extended residuevoidsetAcceleration(double[] acceleration) setAcceleration.voidsetConstantPh(double pH) setConstantPh.voidsetCoordinates(double[] parameters) Set the current value of the parameters.voidSet the Potential Energy terms that should be active.voidsetFixedTautomerState(boolean fixTautomerState) Does not allow for changes to the tautomer states of tautomerizing residuesvoidsetFixedTitrationState(boolean fixTitrationState) Does not allow for changes to the tautomer states of titrating residuesvoidsetPreviousAcceleration(double[] previousAcceleration) setPreviousAcceleration.voidsetRestartFile(File esvFile) Sets the restartFile field of this extended system to the passed file.voidsetScaling(double[] scaling) Scale the problem.voidsetTautomerLambda(Residue residue, double lambda) Set the tautomer lambda of a residue and update corresponding thetavoidsetTautomerLambda(Residue residue, double lambda, boolean changeThetas) Set the tautomer lambda of a residue and update corresponding theta if desiredvoidsetTemperature(double set) setTemperature.voidsetTitrationLambda(Residue residue, double lambda) Set the titration lambda of a residue and update corresponding thetavoidsetTitrationLambda(Residue residue, double lambda, boolean changeThetas) Set the titration lambda of a residue and update corresponding theta if desiredvoidsetVelocity(double[] velocity) setVelocity.booleanwriteESVInfoTo(File esvFile) Writes out the current state of the extended system to the specified file without setting the file to that location.voidwriteLambdaHistogram(boolean printHistograms) Execute writeLambdaHistogrm from esvFilter that is contained within ExtendedSystem Prints the ESV histogram for each titrating residuevoidExecute writeESV from esvFilter that is contained within ExtendedSystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ffx.numerics.OptimizationInterface
destroy, energy, energyAndGradient, getUnderlyingPotentials, scaleCoordinates, scaleCoordinatesAndGradient, unscaleCoordinatesMethods 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. -
useTotalChargeCorrection
public final boolean useTotalChargeCorrection
-
-
Constructor Details
-
ExtendedSystem
Construct extended system with the provided configuration.- Parameters:
mola- aMolecularAssemblyobject.
-
-
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
Stringobject.
-
getExtendedAtoms
All atoms of the fully-protonated system (not just those affected by this system).- Returns:
- an array of
Atomobjects.
-
getExtendedMolecule
public int[] getExtendedMolecule()Companion to getExtendedAtoms() for vdw::setAtoms and pme::setAtoms.- Returns:
- the molecule ID for each extended atom.
-
getBiasEnergy
public double getBiasEnergy()Sum up total bias (Ubias = UpH + Udiscr - Umod)- Returns:
- totalBiasEnergy
-
getBiasDecomposition
getBiasDecomposition.- Returns:
- a
Stringobject.
-
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:PotentialgetAcceleration.- Specified by:
getAccelerationin interfacePotential- Parameters:
acceleration- an array of double values.- Returns:
- an array of double values.
-
getThetaAccel
public double[] getThetaAccel() -
energyAndGradient
public double energyAndGradient(double[] x, double[] g) Description copied from interface:OptimizationInterfaceThis method is called repeatedly to compute the function energy and gradient.- Specified by:
energyAndGradientin interfaceOptimizationInterface- Parameters:
x- Input parameters.g- Output gradients with respect to each parameter.- Returns:
- Function value at
x.
-
getConstraints
Description copied from interface:PotentialReturns the list of Constraints associated with this Potential. The default implementation returns an empty list.- Specified by:
getConstraintsin interfacePotential- Returns:
- All Constraints.
-
getEnergyTermState
Description copied from interface:PotentialGet the Potential Energy terms that is active.- Specified by:
getEnergyTermStatein interfacePotential- Returns:
- the STATE
-
setEnergyTermState
Description copied from interface:PotentialSet the Potential Energy terms that should be active.- Specified by:
setEnergyTermStatein interfacePotential- Parameters:
state- include FAST varying energy terms, SLOW varying energy terms or BOTH.
-
getMass
public double[] getMass()Description copied from interface:PotentialGet 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:PotentialgetPreviousAcceleration.- Specified by:
getPreviousAccelerationin interfacePotential- Parameters:
previousAcceleration- an array of double values.- Returns:
- an array of double values.
-
energy
public double energy(double[] x) Description copied from interface:OptimizationInterfaceThis method is called repeatedly to compute the function energy.- Specified by:
energyin interfaceOptimizationInterface- Parameters:
x- Input parameters.- Returns:
- Function value at
x.
-
getVariableTypes
Description copied from interface:PotentialGet the type of all variables.- Specified by:
getVariableTypesin interfacePotential- Returns:
- The VARIABLE_TYPE of each variable.
-
getVelocity
public double[] getVelocity(double[] velocity) Description copied from interface:PotentialgetVelocity.- Specified by:
getVelocityin interfacePotential- Parameters:
velocity- an array of double values.- Returns:
- an array of double values.
-
getThetaVelocity
public double[] getThetaVelocity() -
setAcceleration
public void setAcceleration(double[] acceleration) Description copied from interface:PotentialsetAcceleration.- Specified by:
setAccelerationin interfacePotential- Parameters:
acceleration- an array of double values.
-
getCoordinates
public double[] getCoordinates(double[] parameters) Description copied from interface:OptimizationInterfaceLoad 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:
getCoordinatesin interfaceOptimizationInterface- Parameters:
parameters- Supplied array.- Returns:
- The array filled with parameter values.
-
setCoordinates
public void setCoordinates(double[] parameters) Description copied from interface:OptimizationInterfaceSet the current value of the parameters. If the supplied array is null or not large enough, no action is taken.- Specified by:
setCoordinatesin interfaceOptimizationInterface- Parameters:
parameters- The array with parameter values.
-
setPreviousAcceleration
public void setPreviousAcceleration(double[] previousAcceleration) Description copied from interface:PotentialsetPreviousAcceleration.- Specified by:
setPreviousAccelerationin interfacePotential- Parameters:
previousAcceleration- an array of double values.
-
setVelocity
public void setVelocity(double[] velocity) Description copied from interface:PotentialsetVelocity.- Specified by:
setVelocityin interfacePotential- Parameters:
velocity- an array of double values.
-
getState
-
getThetaPosition
public double[] getThetaPosition() -
getNumberOfVariables
public int getNumberOfVariables()Description copied from interface:OptimizationInterfaceGet the number of variables being operated on.- Specified by:
getNumberOfVariablesin interfaceOptimizationInterface- Returns:
- Number of variables.
-
getScaling
public double[] getScaling()Description copied from interface:OptimizationInterfaceGet the problem scaling.- Specified by:
getScalingin interfaceOptimizationInterface- Returns:
- The scaling value used for each variable.
-
setScaling
public void setScaling(double[] scaling) Description copied from interface:OptimizationInterfaceScale the problem. A good choice for optimization is the square root of the median eigenvalue of a typical Hessian.- Specified by:
setScalingin interfaceOptimizationInterface- Parameters:
scaling- The scaling value to use for each variable.
-
getTotalEnergy
public double getTotalEnergy()Description copied from interface:OptimizationInterfaceGet the total energy of the system- Specified by:
getTotalEnergyin interfaceOptimizationInterface- Returns:
- the total energy
-