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 TypeMethodDescriptionboolean
destroy()
Destroys this Potential and frees up any associated resources, particularly worker Threads.double
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[]
getCoordinates
(double[] parameters) Load the current value of the parameters.int
Get the number of variables being operated on.double[]
Get the problem scaling.double
Get the total energy of the systemvoid
setScaling
(double[] scaling) Scale the problem.double
target
(double[] x, double[] g, boolean gradient, boolean print) targetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
destroy
in 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:
energy
in 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:
energyAndGradient
in interfaceOptimizationInterface
- Parameters:
x
- Input parameters.g
- Output gradients with respect to each parameter.- Returns:
- Function value at
x
.
-
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:
getCoordinates
in interfaceOptimizationInterface
- Parameters:
parameters
- Supplied array.- Returns:
- The array filled with parameter values.
-
getNumberOfVariables
public int getNumberOfVariables()Get the number of variables being operated on.- Specified by:
getNumberOfVariables
in interfaceOptimizationInterface
- Returns:
- Number of variables.
-
getScaling
public double[] getScaling()Get the problem scaling.- Specified by:
getScaling
in interfaceOptimizationInterface
- Returns:
- The scaling value used for each variable.
-
setScaling
public void setScaling(double[] scaling) 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()Get the total energy of the system- Specified by:
getTotalEnergy
in interfaceOptimizationInterface
- Returns:
- the total energy
-
target
public double target(double[] x, double[] g, boolean gradient, boolean print) target- Parameters:
x
- an array of double.g
- an array of double.gradient
- a boolean.print
- a boolean.- Returns:
- a double.
-