Class RefinedCoordinates

java.lang.Object
ffx.xray.refine.RefinedParameter
ffx.xray.refine.RefinedCoordinates

public class RefinedCoordinates extends RefinedParameter
Represents a set of coordinates that can be refined during a refinement process. This class encapsulates an Atom object and any additional atoms that are constrained to follow its coordinates.
  • Field Summary

    Fields inherited from class ffx.xray.refine.RefinedParameter

    atom, constrainedAtoms, constrainedAtomsThatScatter, index
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new RefinableCoordinates instance for the specified atom.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds an atom to the list of constrained atoms for the given primary atom.
    void
    Adds an atom to the list of constrained atoms that contribute to experimental scattering.
    void
    getAcceleration(double[] acceleration)
    Updates a subset of the parameter array with the XYZ acceleration components of the primary atom.
    double[]
    getCoordinates(double[] xyz)
    Retrieves the XYZ coordinates of the primary atom, updating the provided array or returning a new array if the input array is null.
    void
    getGradient(double[] gradient)
    Updates the gradient array with the contributions from the primary atom and any constrained atoms that scatter.
    void
    getMass(double[] mass, double defaultMass)
    Updates the provided array with the atomic mass of the primary atom.
    int
    Retrieves the number of parameters associated with this refineable.
    void
    getParameters(double[] parameters)
    Updates a subset of the parameter array with the XYZ coordinates of the primary atom.
    void
    getPreviousAcceleration(double[] previousAcceleration)
    Updates a subset of the parameter array with the XYZ previous acceleration components of the primary atom.
    void
    getVelocity(double[] velocity)
    Updates a subset of the parameter array with the XYZ velocity components of the primary atom.
    void
    setAcceleration(double[] acceleration)
    Sets the acceleration components for the primary atom.
    void
    setCoordinates(double[] xyz)
    Sets the coordinates of the primary atom and updates the coordinates of all constrained atoms to match the new values.
    void
    setOptimizationScaling(double[] optimizationScaling)
    Sets the scaling factors for optimization parameters at specific indices.
    void
    setParameters(double[] parameters)
    Updates the XYZ coordinates of the primary atom and all associated constrained atoms using the provided parameters array.
    void
    setPreviousAcceleration(double[] previousAcceleration)
    Sets the previous acceleration components for the primary atom.
    void
    setVelocity(double[] velocity)
    Sets the velocity components of the primary atom using the provided parameters array.
     
    void
    Initialize the coordinate gradient to zero.

    Methods inherited from class ffx.xray.refine.RefinedParameter

    getIndex, setIndex

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • RefinedCoordinates

      public RefinedCoordinates(Atom atom)
      Constructs a new RefinableCoordinates instance for the specified atom. This instance represents a set of coordinates that can be refined, with the given atom serving as the primary reference point during the refinement process. Changes to the primary atom's coordinates will also affect any constrained atoms associated with this instance.
      Parameters:
      atom - the Atom whose coordinates are being refined; this atom serves as the primary reference point for the refinement process.
  • Method Details

    • addConstrainedAtom

      public void addConstrainedAtom(Atom atom)
      Description copied from class: RefinedParameter
      Adds an atom to the list of constrained atoms for the given primary atom. This method defines the relationship between the primary atom and other atoms that are constrained or related as part of the refinement process.
      Specified by:
      addConstrainedAtom in class RefinedParameter
      Parameters:
      atom - the atom to be added as a constrained atom associated with the primary atom.
    • addConstrainedAtomThatScatters

      public void addConstrainedAtomThatScatters(Atom atom)
      Description copied from class: RefinedParameter
      Adds an atom to the list of constrained atoms that contribute to experimental scattering.
      Specified by:
      addConstrainedAtomThatScatters in class RefinedParameter
      Parameters:
      atom - the atom to be added as a constrained atom that has scattering contributions.
    • getCoordinates

      public double[] getCoordinates(@Nullable double[] xyz)
      Retrieves the XYZ coordinates of the primary atom, updating the provided array or returning a new array if the input array is null.
      Parameters:
      xyz - an array of doubles where the XYZ coordinates should be stored. If the input array is null, a new double array will be created and returned.
      Returns:
      an array of doubles containing the XYZ coordinates of the primary atom. If the input array is not null, it will be updated with the coordinates and returned.
    • setCoordinates

      public void setCoordinates(double[] xyz)
      Sets the coordinates of the primary atom and updates the coordinates of all constrained atoms to match the new values.
      Parameters:
      xyz - an array of doubles representing the XYZ coordinates to be set for the primary atom and its constrained atoms
    • getNumberOfParameters

      public int getNumberOfParameters()
      Description copied from class: RefinedParameter
      Retrieves the number of parameters associated with this refineable. Concrete implementations define how the parameters are determined and counted.
      Specified by:
      getNumberOfParameters in class RefinedParameter
      Returns:
      the number of parameters related to this refinement process.
    • getParameters

      public void getParameters(double[] parameters)
      Updates a subset of the parameter array with the XYZ coordinates of the primary atom.
      Specified by:
      getParameters in class RefinedParameter
      Parameters:
      parameters - an array of doubles where the XYZ coordinates of the primary atom will be stored. The x, y, and z values are assigned sequentially starting at the current index value.
    • setParameters

      public void setParameters(double[] parameters)
      Updates the XYZ coordinates of the primary atom and all associated constrained atoms using the provided parameters array.
      Specified by:
      setParameters in class RefinedParameter
      Parameters:
      parameters - an array of doubles containing all refined parameters.
    • getVelocity

      public void getVelocity(double[] velocity)
      Updates a subset of the parameter array with the XYZ velocity components of the primary atom.
      Specified by:
      getVelocity in class RefinedParameter
      Parameters:
      velocity - an array of doubles where the XYZ velocity components of the primary atom will be stored. The x, y, and z components are assigned sequentially starting at the current index value.
    • setVelocity

      public void setVelocity(double[] velocity)
      Sets the velocity components of the primary atom using the provided parameters array. The velocity is updated with values sequentially extracted from the array at the current index.
      Specified by:
      setVelocity in class RefinedParameter
      Parameters:
      velocity - an array of doubles containing velocity data. The x, y, and z components of the velocity are taken sequentially starting at the current index.
    • getAcceleration

      public void getAcceleration(double[] acceleration)
      Updates a subset of the parameter array with the XYZ acceleration components of the primary atom.
      Specified by:
      getAcceleration in class RefinedParameter
      Parameters:
      acceleration - an array of doubles where the XYZ acceleration components of the primary atom will be stored. The x, y, and z components are assigned sequentially starting at the current index value.
    • setAcceleration

      public void setAcceleration(double[] acceleration)
      Sets the acceleration components for the primary atom. The method extracts the x, y, and z components of acceleration from the provided array starting at a specified index and assigns them to the primary atom.
      Specified by:
      setAcceleration in class RefinedParameter
      Parameters:
      acceleration - an array of doubles containing the XYZ acceleration components. The x, y, and z components are retrieved sequentially from the array starting at the current index.
    • getPreviousAcceleration

      public void getPreviousAcceleration(double[] previousAcceleration)
      Updates a subset of the parameter array with the XYZ previous acceleration components of the primary atom.
      Specified by:
      getPreviousAcceleration in class RefinedParameter
      Parameters:
      previousAcceleration - an array of doubles where the XYZ previous acceleration components of the primary atom will be stored. The x, y, and z components are assigned sequentially starting at the current index value.
    • setPreviousAcceleration

      public void setPreviousAcceleration(double[] previousAcceleration)
      Sets the previous acceleration components for the primary atom. The method extracts the x, y, and z components of previous acceleration from the provided array starting at a specified index and assigns them to the primary atom.
      Specified by:
      setPreviousAcceleration in class RefinedParameter
      Parameters:
      previousAcceleration - an array of doubles containing the XYZ previous acceleration components. The x, y, and z components are retrieved sequentially from the array starting at the current index.
    • setOptimizationScaling

      public void setOptimizationScaling(double[] optimizationScaling)
      Sets the scaling factors for optimization parameters at specific indices. This method updates a portion of the provided array with predefined scaling values.
      Specified by:
      setOptimizationScaling in class RefinedParameter
      Parameters:
      optimizationScaling - an array of doubles representing scaling factors for optimization. The method modifies specific indices within this array.
    • zeroGradient

      public void zeroGradient()
      Initialize the coordinate gradient to zero.
      Specified by:
      zeroGradient in class RefinedParameter
    • getGradient

      public void getGradient(double[] gradient)
      Updates the gradient array with the contributions from the primary atom and any constrained atoms that scatter. The XYZ gradient values are retrieved for each relevant atom and added to the corresponding indices of the provided gradient array.
      Specified by:
      getGradient in class RefinedParameter
      Parameters:
      gradient - an array of doubles where the gradient contributions will be accumulated.
    • getMass

      public void getMass(double[] mass, double defaultMass)
      Updates the provided array with the atomic mass of the primary atom.
      Specified by:
      getMass in class RefinedParameter
      Parameters:
      mass - an array of doubles where the atomic mass will be stored.
      defaultMass - the default mass is ignored for coordinates.
    • toString

      public String toString()
      Overrides:
      toString in class Object