Package ffx.xray

Class SplineEnergy

java.lang.Object
ffx.xray.SplineEnergy
All Implemented Interfaces:
OptimizationInterface

public class SplineEnergy extends Object implements OptimizationInterface
Fit structure factors using spline coefficients
Since:
1.0
Author:
Timothy D. Fenn
See Also:
  • 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 interface OptimizationInterface
      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 interface OptimizationInterface
      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 interface OptimizationInterface
      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 interface OptimizationInterface
      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 interface OptimizationInterface
      Returns:
      Number of variables.
    • getScaling

      public double[] getScaling()
      Get the problem scaling.
      Specified by:
      getScaling in interface OptimizationInterface
      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 interface OptimizationInterface
      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 interface OptimizationInterface
      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.