Package ffx.xray
Class ScaleBulkEnergy
java.lang.Object
ffx.xray.ScaleBulkEnergy
- All Implemented Interfaces:
OptimizationInterface
Fit bulk solvent and aniso B scaling terms to correct calculated structure factors against data
- Since:
- 1.0
- Author:
- Timothy D. Fenn
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleandestroy()Destroys this Potential and frees up any associated resources, particularly worker Threads.doubleenergy(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[]getCoordinates(double[] parameters) Load the current value of the parameters.intGet the number of variables being operated on.doublegetR()doublegetRfree()double[]Get the problem scaling.doubleGet the total energy of the systemvoidsetCoordinates(double[] parameters) Set the current value of the parameters.voidsetScaling(double[] scaling) Scale the problem.doubletarget(double[] x, double[] g, boolean gradient, boolean print) ScaleBulk target energy.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ffx.numerics.OptimizationInterface
energy, energyAndGradient, getUnderlyingPotentials, scaleCoordinates, scaleCoordinatesAndGradient, unscaleCoordinates
-
Method Details
-
destroy
public boolean destroy()Destroys this Potential and frees up any associated resources, particularly worker Threads. Default implementation is to return true (assume destruction successful).- Specified by:
destroyin interfaceOptimizationInterface- Returns:
- If resource reclamation successful, or resources already reclaimed.
-
energy
public double energy(double[] x) This method is called repeatedly to compute the function energy.- Specified by:
energyin interfaceOptimizationInterface- Parameters:
x- Input parameters.- Returns:
- Function value at
x.
-
energyAndGradient
public double energyAndGradient(double[] x, double[] g) This 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.
-
getR
public double getR() -
getRfree
public double getRfree() -
getCoordinates
public double[] getCoordinates(double[] parameters) 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:
getCoordinatesin interfaceOptimizationInterface- Parameters:
parameters- Supplied array.- Returns:
- The array filled with parameter values.
-
setCoordinates
public void setCoordinates(double[] parameters) Set 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.
-
getNumberOfVariables
public int getNumberOfVariables()Get the number of variables being operated on.- Specified by:
getNumberOfVariablesin interfaceOptimizationInterface- Returns:
- Number of variables.
-
getScaling
public double[] getScaling()Get the problem scaling.- Specified by:
getScalingin interfaceOptimizationInterface- Returns:
- The scaling value used for each variable.
-
setScaling
public void setScaling(@Nullable double[] scaling) Scale 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()Get the total energy of the system- Specified by:
getTotalEnergyin interfaceOptimizationInterface- Returns:
- the total energy
-
target
public double target(double[] x, double[] g, boolean gradient, boolean print) ScaleBulk target energy.- Parameters:
x- The parameter array.g- The gradient of the parameter array.gradient- If true, compute the gradient.print- If true, enable verbose printing.- Returns:
- The target energy.
-