Package ffx.algorithms.cli
Class AlgorithmsScript
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Script
ffx.utilities.FFXScript
ffx.algorithms.cli.AlgorithmsScript
- All Implemented Interfaces:
groovy.lang.GroovyObject
Base class for scripts in the Algorithms package, providing some key functions.
- Since:
- 1.0
- Author:
- Michael J. Schnieders
-
Field Summary
Modifier and TypeFieldDescriptionAn active MolecularAssembly passed into the current context or loaded by the Script from a file argument.An instance of AlgorithmFunctions passed into the current context.An instance of the AlgorithmListener interface.protected File
The directory in which to place output files. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Reclaims resources associated with all Potential objects associated with this script.getActiveAssemblies
(String filename) If a filename is supplied, open it and return the MolecularAssemblies.getActiveAssembly
(String filename) If a filename is supplied, open it and return the MolecularAssembly.Returns a List of all Potential objects associated with this script.boolean
init()
Initialize this Script based on the specified command line arguments.protected File
saveDirFile
(File file) Return a File in the base directory with the same name as the input file.void
setActiveAssembly
(MolecularAssembly molecularAssembly) Set the Active Assembly.void
setBaseDir
(File baseDir) Sets the directory this script should save files to.void
updateTitle
(double energy) Update the title line of the structure with Energy and Density.Methods inherited from class ffx.utilities.FFXScript
getScript, helpString, listGroovyScripts, run
Methods inherited from class groovy.lang.Script
evaluate, evaluate, getBinding, getProperty, invokeMethod, print, printf, printf, println, println, run, setBinding, setProperty
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClass
-
Field Details
-
algorithmFunctions
An instance of AlgorithmFunctions passed into the current context. -
activeAssembly
An active MolecularAssembly passed into the current context or loaded by the Script from a file argument. -
algorithmListener
An instance of the AlgorithmListener interface. -
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
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.
-
setBaseDir
Sets the directory this script should save files to. Mostly used for tests.- Parameters:
baseDir
- Directory to save output to.
-
saveDirFile
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
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
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
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.
-