Class AlgorithmsScript

java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Script
ffx.utilities.FFXScript
ffx.algorithms.cli.AlgorithmsScript
All Implemented Interfaces:
groovy.lang.GroovyObject

public class AlgorithmsScript extends FFXScript
Base class for scripts in the Algorithms package, providing some key functions.
Since:
1.0
Author:
Michael J. Schnieders
  • Field Details

    • algorithmFunctions

      public AlgorithmFunctions algorithmFunctions
      An instance of AlgorithmFunctions passed into the current context.
    • activeAssembly

      public MolecularAssembly activeAssembly
      An active MolecularAssembly passed into the current context or loaded by the Script from a file argument.
    • algorithmListener

      public AlgorithmListener algorithmListener
      An instance of the AlgorithmListener interface.
    • baseDir

      protected File baseDir
      The directory in which to place output files. Mostly for tests.
  • Constructor Details

    • AlgorithmsScript

      public AlgorithmsScript()
    • AlgorithmsScript

      public AlgorithmsScript(groovy.lang.Binding binding)
  • Method Details

    • destroyPotentials

      public boolean destroyPotentials()
      Reclaims resources associated with all Potential objects associated with this script.
      Returns:
      If all Potentials had resources reclaimed.
    • getPotentials

      public List<Potential> getPotentials()
      Returns a List of all Potential objects associated with this script.
      Returns:
      All Potentials. Sometimes empty, never null.
    • init

      public boolean init()
      Initialize this Script based on the specified command line arguments.

      Execute the BaseScript init method, then load algorithm functions.

      Overrides:
      init in class FFXScript
      Returns:
      boolean Returns true if the script should continue and false to exit.
    • setBaseDir

      public void setBaseDir(File baseDir)
      Sets the directory this script should save files to. Mostly used for tests.
      Parameters:
      baseDir - Directory to save output to.
    • saveDirFile

      protected File saveDirFile(File file)
      Return a File in the base directory with the same name as the input file.

      This will just be the original file if baseDir was never set, which is the case for production runs.

      Parameters:
      file - File to find a save location for.
      Returns:
      Returns a File in the base directory with the same name as the input file.
    • getActiveAssembly

      public MolecularAssembly getActiveAssembly(@Nullable String filename)
      If a filename is supplied, open it and return the MolecularAssembly. Otherwise, the current activeAssembly is returned (which may be null).
      Parameters:
      filename - Filename to open.
      Returns:
      The active assembly.
    • getActiveAssemblies

      public MolecularAssembly[] getActiveAssemblies(@Nullable String filename)
      If a filename is supplied, open it and return the MolecularAssemblies. Otherwise, the current activeAssembly is returned (which may be null).
      Parameters:
      filename - Filename to open.
      Returns:
      The active assemblies.
    • setActiveAssembly

      public void setActiveAssembly(MolecularAssembly molecularAssembly)
      Set the Active Assembly. This is a work-around for a strange Groovy static compilation bug where direct assignment of activeAssembly in Groovy scripts that extend AlgorithmsScript fails (a NPE results).
      Parameters:
      molecularAssembly - The MolecularAssembly that should be active.
    • updateTitle

      public void updateTitle(double energy)
      Update the title line of the structure with Energy and Density.
      Parameters:
      energy - Newly minimized energy value.