Class RefinementModel

java.lang.Object
ffx.xray.refine.RefinementModel

public class RefinementModel extends Object
RefinementModel class.
Since:
1.0
Author:
Timothy D. Fenn
  • Constructor Details

    • RefinementModel

      public RefinementModel(MolecularAssembly[] molecularAssemblies)
      Constructor for RefinementModel.
      Parameters:
      molecularAssemblies - an array of MolecularAssembly objects.
    • RefinementModel

      public RefinementModel(RefinementMode refinementMode, MolecularAssembly[] molecularAssemblies)
      Constructor for RefinementModel.
      Parameters:
      refinementMode - The refinement mode in use.
      molecularAssemblies - an array of MolecularAssembly objects.
  • Method Details

    • setRefinementMode

      public void setRefinementMode(RefinementMode mode)
      Sets the refinement mode and adjusts the refined parameters based on the provided mode. Clears the current list of refined parameters and populates it with the relevant parameters (coordinates, B-factors, or occupancies) if they are included in the specified refinement mode. Finally, updates the parameter indices.
      Parameters:
      mode - the refinement mode to set, which determines the types of parameters to include (e.g., coordinates, B-factors, occupancies)
    • getScatteringAtoms

      public Atom[] getScatteringAtoms()
      Getter for the field totalAtomArray.
      Returns:
      the totalAtomArray
    • getActiveAtoms

      public Atom[] getActiveAtoms()
      Getter for the field activeAtomArray.
      Returns:
      the activeAtomArray
    • getAltMolecules

      public List<List<Molecule>> getAltMolecules()
      Getter for the field altMolecules.
      Returns:
      the altMolecules
    • getAltResidues

      public List<List<Residue>> getAltResidues()
      Getter for the field altResidues.
      Returns:
      the altResidues
    • getMolecularAssemblies

      public MolecularAssembly[] getMolecularAssemblies()
      Retrieves the array of MolecularAssembly objects.
      Returns:
      An array of MolecularAssembly objects.
    • getBFactorRestraints

      public List<Atom[]> getBFactorRestraints()
      List of Atom pairs that define B-factor restraints. There is a covalent bond between each pair.
      Returns:
      The bond list.
    • addAssemblyGradient

      public void addAssemblyGradient(int assembly, double[] gradient)
      Adds the coordinate gradient from an alternate conformer to the overall coordinate gradient. Each active atom from the alternate conformer stores its XYZ gradient and its index into the overall refinement gradient array.
      Parameters:
      assembly - The index of the molecular assembly to retrieve active atoms from.
      gradient - The overall gradient array where the computed gradient data is aggregated.
    • toString

      public String toString()
      Provides a string representation of the refinement model, including details about the number of atoms, active atoms, atoms in use, and the refinement variables.
      Overrides:
      toString in class Object
      Returns:
      A string describing the refinement model, including the total number of atoms, the number of atoms currently being used, the number of active atoms, and the number of refinement variables categorized by XYZ coordinates, B-Factors, and occupancies.
    • getRefinementMode

      public RefinementMode getRefinementMode()
      Retrieves the current refinement mode set in the object.
      Returns:
      the refinement mode of the object as a RefinementMode enum.
    • getRefinedParameters

      public List<RefinedParameter> getRefinedParameters()
      Retrieves a list of refined parameters.
      Returns:
      a list containing the refined parameters.
    • getNumParameters

      public int getNumParameters()
      Calculates the total number of parameters to be refined based on the specified refinement mode. The parameters may include atomic coordinates, B-factors, and occupancies depending on the mode.
      Returns:
      The total number of parameters that need to be refined based on the specified mode.
    • getNumCoordParameters

      public int getNumCoordParameters()
      Calculates the number of coordinate parameters to be refined based on the specified refinement mode. If the mode includes coordinates, the number of parameters is determined by the size of the coordinate atom list.
      Returns:
      The number of coordinate parameters that need to be refined. Returns 0 if the mode does not include coordinates.
    • getNumBFactorParameters

      public int getNumBFactorParameters()
      Calculates the total number of B-factor parameters based on the specified refinement mode.
      Returns:
      the total number of B-factor parameters, considering whether they are anisotropic or isotropic.
    • getNumOccupancyParameters

      public int getNumOccupancyParameters()
      Calculates the number of occupancy parameters based on the provided refinement mode.
      Returns:
      the number of occupancy parameters if occupancies are included; otherwise, returns 0
    • getNumANISOU

      public int getNumANISOU()
      Counts and returns the total number of ANISOU records present.
      Returns:
      the number of ANISOU records as an integer
    • getParameters

      public void getParameters(double[] x)
      Get parameter values and store them into the provided array based on the refinement mode. This method extracts and sets coordinates, B-factors, and occupancies for the atoms depending on the specified refinement mode.
      Parameters:
      x - The array into which the parameter values are loaded. The array should be large enough to accommodate all required parameters based on the refinement mode.
    • setParameters

      public void setParameters(double[] x)
      Set parameter values into the refinement model based on the provided refinement mode. The method updates coordinates, B-factors, and occupancies for atoms, depending on what is specified by the refinement mode.
      Parameters:
      x - An array of doubles containing the new parameter values. The values should be ordered as required by the refinement mode: first coordinates, then B-factors, and finally occupancies, if applicable.
    • getVelocity

      public void getVelocity(double[] x)
      Get parameter velocities and store them into the provided array based on the refinement mode. This method extracts and sets coordinates, B-factors, and occupancies for the atoms depending on the specified refinement mode.
      Parameters:
      x - The array into which the parameter velocities are loaded. The array should be large enough to accommodate all required parameter velocities based on the refinement mode.
    • setVelocity

      public void setVelocity(double[] x)
      Set parameter velocities into the refinement model based on the provided refinement mode. The method updates coordinates, B-factors, and occupancies for atoms, depending on what is specified by the refinement mode.
      Parameters:
      x - An array of doubles containing the new parameter velocities. The values should be ordered as required by the refinement mode: first coordinates, then B-factors, and finally occupancies, if applicable.
    • getAcceleration

      public void getAcceleration(double[] x)
      Retrieves acceleration values for all refined parameters in the list using the provided array.
      Parameters:
      x - an array of doubles to store acceleration values for each parameter
    • setAcceleration

      public void setAcceleration(double[] x)
      Sets the acceleration values for all parameters in the parameters list.
      Parameters:
      x - an array of double values representing the acceleration to be set for each parameter
    • getPreviousAcceleration

      public void getPreviousAcceleration(double[] x)
      Retrieves previous acceleration values for all refined parameters in the list using the provided array.
      Parameters:
      x - an array of doubles to store previous acceleration values for each parameter
    • setPreviousAcceleration

      public void setPreviousAcceleration(double[] x)
      Sets the previous acceleration values for all parameters in the parameters list.
      Parameters:
      x - an array of double values representing the previous acceleration to be set for each parameter
    • getMass

      public void getMass(double[] mass)
      Populates the provided array with mass values retrieved from all refined parameters.
      Parameters:
      mass - an array where the mass values will be stored.
    • loadOptimizationScaling

      public void loadOptimizationScaling(double[] optimizationScaling)
      Loads the optimization scale factors into all refined parameters.
      Parameters:
      optimizationScaling - an array of scale factors to be applied to each refined parameter
    • zeroGradient

      public void zeroGradient()
      Zero out the gradient for all atoms being refined.
    • getGradient

      public void getGradient(double[] gradient)
      Loads the gradient values into the respective refined parameters based on the current refinement mode.
      Parameters:
      gradient - an array of double values representing the gradient to be loaded.