Package ffx.potential.cli
Class PotentialCommand
java.lang.Object
ffx.utilities.FFXCommand
ffx.potential.cli.PotentialCommand
- Direct Known Subclasses:
Energy
Base class for scripts in the Potentials 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.A temporary directory that contains script artifacts.An instance of PotentialFunctions passed into the current context.Fields inherited from class ffx.utilities.FFXCommand
args, color, help, logger, parseResult, version
-
Constructor Summary
ConstructorDescriptionDefault constructor.PotentialCommand
(FFXContext ffxContext) Create a Script using the supplied Binding. -
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.getBaseDirString
(String dirFromFilename) Check that we can write into the current base directory.Returns a List of all Potential objects associated with this script.boolean
init()
Initialize this Script based on the specified command line arguments.void
setActiveAssembly
(MolecularAssembly molecularAssembly) Set the Active Assembly.Methods inherited from class ffx.utilities.FFXCommand
getCommand, getFfxContext, helpString, listCommands, run
-
Field Details
-
potentialFunctions
An instance of PotentialFunctions passed into the current context. -
activeAssembly
An active MolecularAssembly passed into the current context or loaded by the Script from a file argument. -
baseDir
A temporary directory that contains script artifacts. Temporary files are often created by unit tests and then deleted.
-
-
Constructor Details
-
PotentialCommand
public PotentialCommand()Default constructor. -
PotentialCommand
Create a Script using the supplied Binding.- Parameters:
ffxContext
- Properties and variables to use.
-
-
Method Details
-
destroyPotentials
public boolean destroyPotentials()Reclaims resources associated with all Potential objects associated with this script.- Returns:
- If all Potentials had resources reclaimed.
-
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 PotentialScript fails (a NPE results).- Parameters:
molecularAssembly
- The MolecularAssembly that should be active.
-
getPotentials
Returns a List of all Potential objects associated with this script. Should be written to tolerate nulls, as many tests run help() and exit without instantiating their Potentials.- 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 potential functions.
- Overrides:
init
in classFFXCommand
- Returns:
- boolean Returns true if the script should continue and false to exit.
-
getBaseDirString
Check that we can write into the current base directory. If not, update the baseDir based on the supplied filename, including updating the script Binding instance.- Parameters:
dirFromFilename
- Set the base directory variablebaseDir
using this filename if its not set to a writeable directory.- Returns:
- Return the base directory as a String (including an appended
File.separator
).
-
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.
-