Package ffx.potential.utils
Interface PotentialsFunctions
- All Known Subinterfaces:
AlgorithmFunctions
- All Known Implementing Classes:
AlgorithmUtils
,PotentialsUtils
,UIUtils
public interface PotentialsFunctions
PotentialsFunctions describes core functionality for many Force Field X algorithms and scripts,
such as opening and closing structure files, basic force field energy evaluations, etc.
This is implemented in two locations: UIUtils in the User Interfaces package, and in PotentialsUtils in the Potentials package.
The UIUtils implementation is the default for Force Field X; on top of the core functionality, it also updates the FFX graphical user interface and tree structure.
The PotentialsUtils implementation lacks the extra functionality of the UIUtils implementation, and simply accomplishes the required task. This is used by our tests, and is also potentially useful for third parties who would like to use FFX without its GUI.
- Since:
- 1.0
- Author:
- Jacob M. Litman, Michael J. Schnieders
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close
(MolecularAssembly assembly) Performs any necessary shutdown operations on a MolecularAssembly, primarily shutting down Parallel Java threads and closing any other open resources.void
closeAll
(MolecularAssembly[] assemblies) Performs any necessary shutdown operations on an array of MolecularAssembly, primarily shutting down Parallel Java threads and closing any other open resources.energy
(MolecularAssembly assembly) Evaluates the energy of a MolecularAssembly and returns its ForceFieldEnergy object.energy
(MolecularAssembly[] molecularAssemblies) Evaluates the energy of each MolecularAssembly and returns their ForceFieldEnergy instances.default MolecularAssembly
Returns either the active assembly from the overlying UI, or the "active" molecular assembly from the last used SystemFilter.If available, returns CLI arguments; default implementation does not have access to CLI arguments, and throws UnsupportedOperationException.Returns the last SystemFilter created by this (can be null).boolean
isLocal()
True if using a local implementation (not in a user interfaces module).default MolecularAssembly
open.default MolecularAssembly[]
Opens an array of files and returns all created MolecularAssembly objects, setting any underlying Potential to use a certain number of threads.Opens a file and returns all created MolecularAssembly objects.Opens an array of files and returns the created MolecularAssembly objects.default MolecularAssembly[]
Opens a file and returns all created MolecularAssembly objects, setting any underlying Potential to use a certain number of threads.double
returnEnergy
(MolecularAssembly assembly) Returns the energy of a MolecularAssembly in kcal/mol (as a double) and prints the energy evaluationvoid
save
(MolecularAssembly assembly, File file) Saves the current state of a MolecularAssembly to an XYZ file.void
saveAsPDB
(MolecularAssembly[] assemblies, File file) Saves the current state of an array of MolecularAssembly instances to a PDB file.void
saveAsPDB
(MolecularAssembly assembly, File file) Saves the current state of a MolecularAssembly to a PDB file.void
saveAsPDB
(MolecularAssembly assembly, File file, boolean writeEnd, boolean append) void
saveAsPDBinP1
(MolecularAssembly assembly, File file) Saves the symmetry mates of a MolecularAssembly to PDB files.void
saveAsXYZ
(MolecularAssembly assembly, File file) Saves the current state of a MolecularAssembly to an XYZ file.void
saveAsXYZasReplicates
(MolecularAssembly assembly, File file, int[] replicatesVector) Saves the current state of a MolecularAssembly to an XYZ file as a replicates crystal.void
saveAsXYZinP1
(MolecularAssembly assembly, File file) Saves the current state of a MolecularAssembly to an XYZ file as a P1 crystal.double
time()
Logs time elapsed since last call.default File
versionFile
(File file) Versions a file, attempting to find an unused filename in the set filename, and filename_1 to filename_999.default String
versionFile
(String filename) Versions a file, attempting to find an unused filename in the set filename, and filename_1 to filename_999.
-
Field Details
-
logger
Constantlogger
-
-
Method Details
-
close
Performs any necessary shutdown operations on a MolecularAssembly, primarily shutting down Parallel Java threads and closing any other open resources.- Parameters:
assembly
- Assembly to close.
-
closeAll
Performs any necessary shutdown operations on an array of MolecularAssembly, primarily shutting down Parallel Java threads and closing any other open resources.- Parameters:
assemblies
- Assemblies to close.
-
energy
Evaluates the energy of a MolecularAssembly and returns its ForceFieldEnergy object.- Parameters:
assembly
- To evaluate- Returns:
- assembly's ForceFieldEnergy.
-
energy
Evaluates the energy of each MolecularAssembly and returns their ForceFieldEnergy instances.- Parameters:
molecularAssemblies
- An array of molecularAssembly instances.- Returns:
- An array of ForceFieldEnergy instances.
-
getActiveAssembly
Returns either the active assembly from the overlying UI, or the "active" molecular assembly from the last used SystemFilter.- Returns:
- A MolecularAssembly or null
-
getArguments
If available, returns CLI arguments; default implementation does not have access to CLI arguments, and throws UnsupportedOperationException.- Returns:
- CLI arguments
- Throws:
UnsupportedOperationException
- If unimplementedUnsupportedOperationException
- if any.
-
getFilter
SystemFilter getFilter()Returns the last SystemFilter created by this (can be null).- Returns:
- Last SystemFilter
-
isLocal
boolean isLocal()True if using a local implementation (not in a user interfaces module).- Returns:
- If a local implementation
-
open
open.- Parameters:
filename
- aString
object.- Returns:
- a
MolecularAssembly
object.
-
open
Opens an array of files and returns all created MolecularAssembly objects, setting any underlying Potential to use a certain number of threads. Default implementation simply ignores nThreads.- Parameters:
files
- an array ofString
objects.nThreads
- Use non-default num threads- Returns:
- Array of MolecularAssembly.
-
openAll
Opens a file and returns all created MolecularAssembly objects.- Parameters:
file
- Filename to open- Returns:
- Array of MolecularAssembly.
-
openAll
Opens an array of files and returns the created MolecularAssembly objects.- Parameters:
files
- Filenames to open.- Returns:
- Array of MolecularAssembly.
-
openAll
Opens a file and returns all created MolecularAssembly objects, setting any underlying Potential to use a certain number of threads. Default implementation simply ignores nThreads.- Parameters:
file
- Filename to opennThreads
- Use non-default num threads- Returns:
- Array of MolecularAssembly.
-
returnEnergy
Returns the energy of a MolecularAssembly in kcal/mol (as a double) and prints the energy evaluation- Parameters:
assembly
- To evaluate energy of- Returns:
- Potential energy (kcal/mol)
-
save
Saves the current state of a MolecularAssembly to an XYZ file.- Parameters:
assembly
- MolecularAssembly to savefile
- Destination .xyz
-
saveAsXYZinP1
Saves the current state of a MolecularAssembly to an XYZ file as a P1 crystal.- Parameters:
assembly
- MolecularAssembly to savefile
- Destination .xyz
-
saveAsXYZasReplicates
Saves the current state of a MolecularAssembly to an XYZ file as a replicates crystal.- Parameters:
assembly
- MolecularAssembly to savefile
- Destination .xyzreplicatesVector
- Dimensions for replicates crystal.
-
saveAsPDB
Saves the current state of a MolecularAssembly to a PDB file.- Parameters:
assembly
- MolecularAssembly to savefile
- Destination .pdb
-
saveAsPDB
Saves the current state of an array of MolecularAssembly instances to a PDB file.- Parameters:
assemblies
- MolecularAssembly array to savefile
- Destination .pdb
-
saveAsPDB
-
saveAsXYZ
Saves the current state of a MolecularAssembly to an XYZ file.- Parameters:
assembly
- MolecularAssembly to savefile
- Destination .xyz
-
saveAsPDBinP1
Saves the symmetry mates of a MolecularAssembly to PDB files.- Parameters:
assembly
- To savefile
- Destination file
-
time
double time()Logs time elapsed since last call.- Returns:
- Time.
-
versionFile
Versions a file, attempting to find an unused filename in the set filename, and filename_1 to filename_999.- Parameters:
filename
- To version- Returns:
- Versioned filename.
-
versionFile
Versions a file, attempting to find an unused filename in the set filename, and filename_1 to filename_999.- Parameters:
file
- To version- Returns:
- Versioned file
-