Package ffx.xray
Class SplineEnergy
java.lang.Object
ffx.xray.SplineEnergy
- All Implemented Interfaces:
OptimizationInterface
Fit structure factors using spline coefficients
- Since:
- 1.0
- Author:
- Timothy D. Fenn
- See Also:
-
Nested Class Summary
Nested Classes -
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.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) targetMethods 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.
-
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(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) target- Parameters:
x- an array of double.g- an array of double.gradient- a boolean.print- a boolean.- Returns:
- a double.
-