Potential Module¶
Abstract Base Class¶
- class orchestrator.potential.potential_base.Potential(kim_id, species, model_driver, kim_api='kim-api-collections-management', kim_item_type='simulator-model', model_name_prefix='Potential', param_files=None, training_files=None, potential_files=None, checkpoint_file='./orchestrator_checkpoint.json', checkpoint_name='potential', **kwargs)[source]¶
Bases:
Recorder,ABCAbstract base class to manage the construction of interatomic potentials
The potential class encapsulates the interatomic potential data and parameterization. Potentials can either be constructed from scratch or loaded from existing data, using infrastructure such as the KIM suite. Considering that each specific Potential implementation will require different parameters to specify, the constructor takes a single dictionary, trainer_args, and individual classes can set their own keywords and provide specific initialization.
- Parameters:
potential_args – general argument structure which is specified by individual implementations
- __init__(kim_id, species, model_driver, kim_api='kim-api-collections-management', kim_item_type='simulator-model', model_name_prefix='Potential', param_files=None, training_files=None, potential_files=None, checkpoint_file='./orchestrator_checkpoint.json', checkpoint_name='potential', **kwargs)[source]¶
set variables and initialize the recorder and default workflow
- Parameters:
kim_id (str) – kimcode to represent the item
species (list[str]) – list of strings containing element symbols
model_driver (str) – driver needed to run the potential
kim_api (str) – path to the kim-api-collections-manager executable.
kim_item_type (str) – what type of kim object to create an ID for. For potentials, this should be either “portable-model” or “simulator-model”, depending on whether the model uses a driver to implement its calculations, or runs commands in a simulator program (e.g. lammps, ASE) respectively.
param_files (list[str]) – list of file paths to the parameter files of the potential. May be order-sensitive.
training_files (list[str]) – list of files associated with the training of the potential
potential_files (list[str]) – list of all files associated with the potential, including the superset of param_files, training_files, and any other auxillary files.
checkpoint_file (str) – file name to save checkpoints in
checkpoint_name (str) – name of the checkpointed potential
- default_wf¶
default workflow to use within the potential class
- abstract checkpoint_potential()[source]¶
checkpoint the potential module into the checkpoint file
save necessary internal variables into a dict with key checkpoint_name and write to the (json) checkpoint file for restart capabilities
- abstract restart_potential()[source]¶
restart the potential module from the checkpoint file
check if the checkpoint_file has an entry matching the checkpoint_name and set internal variables accordingly if so
- abstract build_potential()[source]¶
parameterize the potential based on the passed trainer_args
This is the main method for the potential class
- abstract load_potential(path)[source]¶
parameterize the potential based on an existing potential at path
This method loads a potential saved by the
write_potential_to_file()method. The path should match what was used to save the potential. This will set the internal model object.- Parameters:
path (str) – path including filename where potential resides
- generate_new_kim_id(id_prefix)[source]¶
Generate a new kimcode for the potential
- Parameters:
id_prefix (str) – human-readable prefix for the kimcode to be generated, must contain only alphanumeric characters and underscores, must begin with a letter.
- Returns:
a correctly formatted kimcode
- Return type:
str
- get_potential_files(destination_path, kim_id=None, include_dependencies=False)[source]¶
Load a KIM model from a kimkit repository using the KIM ID
- Parameters:
destination_path (str) – path to save the resulting .txz file
kim_id (str) – kimcode of the item to be retrieved
include_dependencies (bool) – switch to include drivers of portable models, tests,
Default:False- Returns:
path to the tar archive at destination_path
- Return type:
str
- save_potential_files(kim_id=None, model_name_prefix=None, param_files=None, training_files=None, potential_files=None, model_driver=None, model_defn=None, model_init=None, work_dir='.', previous_item_name=None, metadata_dict=None, write_to_tmp_dir=True, import_to_kimkit=True, fork_potential=False)[source]¶
Wrapper method to save potential files in any location.
Default behavior is to save files into KIMkit after gathering them all in a temporary directory, but boolean flags control whether to save to KIMkit or use a permanent dir.
- Parameters:
kim_id (str) – Valid KIM Model ID, Alchemy_W__MO_000000999999_000
model_name_prefix (str) – Human readable prefix to a KIM Model ID, must be provided if kim_id is not
param_files (list(str)) – List of paths to parameter files. If there is more than one parameter file, the order matters. For example, for SNAP, the snapcoeff file comes first, then snapparam. See the README of the corresponding KIM Model Driver on openkim.org for more info.
training_files (list(str)) – files associated with the training of the potential.
potential_files (list(str)) – list of all files to be included in the potenttial. A superset of param_files, training_files, and any other auxillary files to be included. If param_files and training_files are not included they will be added automatically.
model_driver (str) – KIM ID of the corresponding KIM Model Driver. Must be in KIMkit
model_defn (str) – for simulator-models, commands needed to define the potential in the simulator (typically LAMMPS)
model_init (str) – for simulator-models, commands needed to initialize the model in the simulator (typically LAMMPS)
work_dir (str) – where to make temporary files
previous_item_name (str) – any name the item was referred to before this, that may be lingering in makefiles. Used by KIMkit to do a regex search to attempt to update makefiles to refer to the item’s kim_id
metadata_dict (dict) – dictionary of any kimkit metadata changes to be applied after version updating or forking the potential
write_to_tmp_dir (bool) – flag of whether to use a tempdir to write files outside of kimkit so they get cleaned up later.
import_to_kimkit (bool) – flag of whether to import the item into kimkit for longterm storage
fork_potential (bool) – if an item with this kim_id already exists in KIMkit, flag for whether to fork it and create a new one with a different kim_id.
- Returns:
id of the newly saved potential
- Return type:
str
- evaluate(atoms)[source]¶
Evaluate the energy, forces, and stress of a configuration of atoms specified in an ASE atoms object.
- Parameters:
atoms (ase.Atoms) – Atomic configuration as an ASE atoms object
- Returns:
potential energy, forces, and stress of the Atoms
- Return type:
numpy.float64, numpy.ndarray, numpy.ndarray
- install_potential_in_kim_api(potential_name='kim_potential', model_defn=None, model_init=None, install_locality='user', save_path='.', import_into_kimkit=True)[source]¶
set up potential so it can be used externally
For a KIM model, this entails installing the potential into the KIM API
Defaults to importing a potential into KIMkit and installing from within the KIMkit repository.
- Parameters:
potential_name (str) – name of the potential.,
Default: ‘kim_potential’model_defn (str) – for simulator-models, commands needed to initialize the potential in the simulator (typically LAMMPS)
install_locality (str) – kim-api-collections-management collection to install into. Options include “user”, “system”, “CWD”, and “environment”
Default: “user”save_path (str) – location where the files associated with the potential are on disk. The files should already be written to save_path.
Default: “.”import_into_kimkit (bool) – whether to import the potential into a kimkit repository and install into the kim_api from there
- Return type:
None- uninstall_potential_from_kim_api(kim_id=None)[source]¶
Remove a potential with a specified kim_id from the local KIM_API collections.
Defaults to self.kim_id if the attribute is set, otherwise uninstall another potential by passing kim_id.
- Parameters:
kim_id (str) – kim_id of a potential to delete
Concrete Implementations¶
DNN (Behler-Parrinello)¶
- class orchestrator.potential.dnn.KliffBPPotential(species, model_driver, cutoff_type, cutoff, hyperparams, norm, neurons, kim_api='kim-api-collections-management', kim_item_type='simulator-model', kim_id=None, model_name_prefix='DNN_Potential_Orchestrator_Generated', param_files=None, training_files=None, potential_files=None, checkpoint_file='./orchestrator_checkpoint.json', checkpoint_name='potential', **kwargs)[source]¶
Bases:
PotentialBuild a Beller-Parrinello DNN using KLIFF
any or all parameters defining the DNN can be provided as key value pairs in the trainer_args dict. Parameters that are not provided will be initialized to default values. Instantiating a KliffBPPotential object with an empty dict will therefore generate a “default” configuration. This DNN is built using KLIFF with a pytorch backend.
- Parameters:
potential_args – dict with the input parameters and their values as k,v pairs. Parameters include:
cutoff_type – kliff - type of cutoff in descriptor
cutoff – kliff - distance cutoff for descriptor
hyperparams – kliff - hyperparameters of BPDNN
norm – kliff - apply or not data normalization
neurons – kliff - number of neurons in each layer of the BPDNN
- __init__(species, model_driver, cutoff_type, cutoff, hyperparams, norm, neurons, kim_api='kim-api-collections-management', kim_item_type='simulator-model', kim_id=None, model_name_prefix='DNN_Potential_Orchestrator_Generated', param_files=None, training_files=None, potential_files=None, checkpoint_file='./orchestrator_checkpoint.json', checkpoint_name='potential', **kwargs)[source]¶
initialization of the BPDNN with trainer_args dict
- Parameters:
kim_id (str) – kimcode to represent the item
species (list[str]) – list of strings containing element symbols
model_driver (str) – driver needed to run the potential
kim_api (str) – path to the kim-api-collections-manager executable.
kim_item_type (str) – what type of kim object to create an ID for. For potentials, this should be either “portable-model” or “simulator-model”, depending on whether the model uses a driver to implement its calculations, or runs commands in a simulator program (e.g. lammps, ASE) respectively.
cutoff_type – kliff - type of cutoff in descriptor
cutoff – kliff - distance cutoff for descriptor
hyperparams – kliff - hyperparameters of BPNN
norm – kliff - apply or not data normalization
neurons – kliff - number of neurons in each layer of the DNN
param_files (list[str]) – list of file paths to the parameter files of the potential. May be order-sensitive.
training_files (list[str]) – list of files associated with the training of the potential
potential_files (list[str]) – list of all files associated with the potential, including the superset of param_files, training_files, and any other auxillary files.
checkpoint_file (str) – file name to save checkpoints in
checkpoint_name (str) – name of the checkpointed potential
- checkpoint_potential()[source]¶
checkpoint the potential module into the checkpoint file
save necessary internal variables into a dict with key checkpoint_name and write to the (json) checkpoint file for restart capabilities
- restart_potential()[source]¶
restart the potential module from the checkpoint file
check if the checkpoint_file has an entry matching the checkpoint_name and set internal variables accordingly if so
- build_potential()[source]¶
Build DNN potential using KLIFF
The parameters for the DNN potential were passed to the object in __init__ as the trainer_args dict. Unspecified parameters were set to default values (Si). In addition to returning the model, this method also sets it as the objects self.model attribute.
- Returns:
model parameterized by self.trainer_args
- Return type:
NeuralNetwork
- load_potential(path)[source]¶
parameterize the potential based on an existing potential at path
This method loads a potential saved by the
write_potential_to_file()method. The path should match what was used to save the potential. Filenames are automatically appended with .pkl if they do not include this extension. This method sets the internal model parameters according to the saved state.- Parameters:
path (str) – path string including filename where potential resides
- get_potential_files(destination_path, kim_id, include_dependencies=False)[source]¶
Load a DNN model from a kimkit repository using the KIM ID :type destination_path:
str:param destination_path: path to save the resulting .txz file- Parameters:
kim_id (str) – kimcode of the item to be retrieved
include_dependencies (bool) – switch to include drivers of portable models, tests,
Default:False- Returns:
path to the tar archive at destination_path
- Return type:
str
- install_potential_in_kim_api(potential_name='kim_potential', model_defn=None, model_init=None, install_locality='user', save_path='.', import_into_kimkit=True)[source]¶
set up potential so it can be used externally
For a KIM model, this entails installing the potential into the KIM API
- Parameters:
potential_name (str) – name of the potential.,
Default: ‘kim_potential’model_defn (str) – for simulator-models, commands needed to initialize the potential in the simulator (typically LAMMPS)
install_locality (str) – kim-api-collections-management collection to install into. Options include “user”, “system”, “CWD”, and “environment”
Default: “user”save_path – location where the files associated with the potential are on disk. The files should already be written to save_path.
Default: “.”- Return type:
None- evaluate(data)[source]¶
evaluate the potential for given data
- Parameters:
data – configuration data (atomic positions) to obtain forces, energy, and/or stresses from the potential
FitSNAP Potential¶
- class orchestrator.potential.fitsnap.FitSnapPotential(species, model_driver, settings_path, kim_api='kim-api-collections-management', kim_item_type='simulator-model', parameter_path=None, kim_id=None, model_name_prefix='FitSNAP_Potential_Orchestrator_Generated', param_files=None, training_files=None, potential_files=None, checkpoint_file='./orchestrator_checkpoint.json', checkpoint_name='potential', **kwargs)[source]¶
Bases:
PotentialBuild a potential using FitSnap
All parameters defining the snap potential are defined in the settings file described in the trainer_args dict.
NOTE: If building FitSNAP potentials as portable models, they will default to the OpenKIM model driver SNAP__MD_536750310735_000, which does not support explicit multielement potentials. Potentials that wish to use explicit multielement speicies should be saved as simulator-models instead.
- Parameters:
trainer_args – dict with the input parameters and their values as k,v pairs. Parameters include:
settings_path (
str)
- __init__(species, model_driver, settings_path, kim_api='kim-api-collections-management', kim_item_type='simulator-model', parameter_path=None, kim_id=None, model_name_prefix='FitSNAP_Potential_Orchestrator_Generated', param_files=None, training_files=None, potential_files=None, checkpoint_file='./orchestrator_checkpoint.json', checkpoint_name='potential', **kwargs)[source]¶
initialization of the FitSnap potential with trainer_args dict
- Parameters:
kim_id (str) – kimcode to represent the item
species (list[str]) – list of strings containing element symbols
model_driver (str) – driver needed to run the potential
kim_api (str) – path to the kim-api-collections-manager executable.
kim_item_type (str) – what type of kim object to create an ID for. For potentials, this should be either “portable-model” or “simulator-model”, depending on whether the model uses a driver to implement its calculations, or runs commands in a simulator program (e.g. lammps, ASE) respectively.
settings_path (str) – FitSnap settings file that include parameters for various sections such as bispectrum, calculator, solver
parameter_path (str) – path where the potential’s param_files will be written
param_files (list[str]) – list of file paths to the parameter files of the potential. May be order-sensitive.
training_files (list[str]) – list of files associated with the training of the potential
potential_files (list[str]) – list of all files associated with the potential, including the superset of param_files, training_files, and any other auxillary files.
checkpoint_file (str) – file name to save checkpoints in
checkpoint_name (str) – name of the checkpointed potential
- checkpoint_potential()[source]¶
checkpoint the potential module into the checkpoint file
save necessary internal variables into a dict with key checkpoint_name and write to the (json) checkpoint file for restart capabilities
- restart_potential()[source]¶
restart the potential module from the checkpoint file
check if the checkpoint_file has an entry matching the checkpoint_name and set internal variables accordingly if so
- build_potential()[source]¶
Build a snap potential using FitSnap
The settings file that includes parameters for the snap potential were passed to the object in __init__ as the trainer_args dict. In addition to returning the model, this method also sets it as the objects self.model attribute.
- Returns:
fitsnap model parameterized by parameters in the settings file
- Return type:
fitsnap instance
- load_potential(path)[source]¶
parameterize the potential based on an existing potential at path
- Parameters:
path (
str) – path string including filename where potential resides
- get_potential_files(destination_path, kim_id, include_dependencies=False)[source]¶
Load a KIM model from a kimkit repository using the KIM ID
- Parameters:
destination_path (str) – path to save the resulting .txz file
kim_id (str) – kimcode of the item to be retrieved
include_dependencies (bool) – switch to include drivers of portable models, tests,
Default:False- Returns:
path to the tar archive at destination_path
- Return type:
str
- install_potential_in_kim_api(potential_name='kim_potential', model_defn=None, model_init=None, install_locality='user', save_path='.', import_into_kimkit=True)[source]¶
set up potential so it can be used externally
For a KIM model, this entails installing the potential into the KIM API
- Parameters:
potential_name (str) – name of the potential.,
Default: ‘kim_potential’model_defn (str) – for simulator-models, commands needed to initialize the potential in the simulator (typically LAMMPS)
install_locality (str) – kim-api-collections-management collection to install into. Options include “user”, “system”, “CWD”, and “environment”
Default: “user”save_path – location where the files associated with the potential are on disk. The files should already be written to save_path.
Default: “.”- Return type:
None- convert_input_file_to_dict(path)[source]¶
Reads a fitsnap input file and creates a dictionary of the contents
- Parameters:
path (str) – path to the input file to be read
- Returns input_settings_dict:
settings read from FitSNAP input file
- Rtype input_settings_dict:
dict
- Return type:
dict
- create_fitsnap_input_file(settings, path)[source]¶
Creates a FitSNAP input file from a settings dictionary
See https://fitsnap.github.io/Run/Run_input.html for fitsnap input documentation. Dictionary should follow the same hierarchical format. See sister function convert_input_file_to_dict().
- Parameters:
settings (dict) – dictionary of FitSNAP settings
path (str) – location to save the FitSNAP input file
- Return type:
None
- get_params()[source]¶
return the parameters of the potential in a human readable format
- Returns:
parameters read from the .snapcoeff file
- Return type:
dict
ChIMES Potential¶
- class orchestrator.potential.chimes.ChIMES(polynomial_orders, cutoff_distances)[source]¶
Bases:
object
- class orchestrator.potential.chimes.ChIMESPotential(species, model_driver, kim_api, polynomial_orders, cutoff_distances, kim_item_type='simulator-model', parameter_path=None, kim_id=None, model_name_prefix='ChIMES_Potential_Orchestrator_Generated', param_files=None, training_files=None, potential_files=None, checkpoint_file='./orchestrator_checkpoint.json', checkpoint_name='potential', **kwargs)[source]¶
Bases:
PotentialBuild a potential using ChIMES
All parameters defining the ChIMES potential are defined in the settings file described in the trainer_args dict.
- Parameters:
trainer_args – dict with the input parameters and their values as k,v pairs. Parameters include:
settings_path
- __init__(species, model_driver, kim_api, polynomial_orders, cutoff_distances, kim_item_type='simulator-model', parameter_path=None, kim_id=None, model_name_prefix='ChIMES_Potential_Orchestrator_Generated', param_files=None, training_files=None, potential_files=None, checkpoint_file='./orchestrator_checkpoint.json', checkpoint_name='potential', **kwargs)[source]¶
initialization of the ChIMES potential with trainer_args dict
- Parameters:
species (list[str]) – list of strings containing element symbols
model_driver (str) – driver needed to run the potential
kim_api (str) – path to the kim-api-collections-manager executable.
polynomial_orders (list[int]) – list of polynomial orders to define the ChIMES potential
cutoff_distances (list[float]) – list of cutoff distances to define the ChIMES potential
kim_item_type (str) – what type of kim object to create an ID for. For potentials, this should be either “portable-model” or “simulator-model”, depending on whether the model uses a driver to implement its calculations, or runs commands in a simulator program (e.g. lammps, ASE) respectively.
parameter_path (str) – path where the potential’s param_files will be written
kim_id (str) – kimcode to represent the item
model_name_prefix (str) – human readable prefix to make a kim ID
param_files (list[str]) – list of file paths to the parameter files of the potential. May be order-sensitive.
training_files (list[str]) – list of files associated with the training of the potential
potential_files (list[str]) – list of all files associated with the potential, including the superset of param_files, training_files, and any other auxillary files.
checkpoint_file (str) – file name to save checkpoints in
checkpoint_name (str) – name of the checkpointed potential
- checkpoint_potential()[source]¶
checkpoint the potential module into the checkpoint file
save necessary internal variables into a dict with key checkpoint_name and write to the (json) checkpoint file for restart capabilities
- restart_potential()[source]¶
restart the potential module from the checkpoint file
check if the checkpoint_file has an entry matching the checkpoint_name and set internal variables accordingly if so
- build_potential()[source]¶
Build a chimes potential using ChIMES
The settings file that includes parameters for the ChIMES potential were passed to the object in __init__ as the trainer_args dict. In addition to returning the model, this method also sets it as the objects self.model attribute.
- Returns:
chimes model parameterized by parameters in the settings file
- Return type:
ChIMES instance
- load_potential(path)[source]¶
parameterize the potential based on an existing potential at path
- Parameters:
path (
str) – path string including filename where potential resides
- install_potential_in_kim_api(potential_name='kim_potential', model_defn=None, model_init=None, install_locality='user', save_path='.', import_into_kimkit=True)[source]¶
set up potential so it can be used externally
For a KIM model, this entails installing the potential into the KIM API
- Parameters:
potential_name (str) – name of the potential.,
Default: ‘kim_potential’model_defn (str) – for simulator-models, commands needed to initialize the potential in the simulator (typically LAMMPS)
install_locality (str) – kim-api-collections-management collection to install into. Options include “user”, “system”, “CWD”, and “environment-variable”
Default: “user”save_path – location where the files associated with the potential are on disk. The files should already be written to save_path.
Default: “.”- Return type:
NoneKIM Potential¶
- class orchestrator.potential.kim.KIMPotential(kim_id, species, model_driver, kim_api='kim-api-collections-management', kim_item_type='portable-model', model_name_prefix='KIM_Potential_Orchestrator_Generated', param_files=None, training_files=None, potential_files=None, checkpoint_file='./orchestrator_checkpoint.json', checkpoint_name='potential', **kwargs)[source]¶
Bases:
Potentialinitialization of an arbitrary KIM potential with trainer_args dict
the KIM ID of an existing KIMModel is provided as key-value pairs in the trainer_args dict.
- Parameters:
potential_args – dict with the input parameters and their values as k,v pairs. Parameters include:
kim_id (
str) – ID of an existing KIM potential
- __init__(kim_id, species, model_driver, kim_api='kim-api-collections-management', kim_item_type='portable-model', model_name_prefix='KIM_Potential_Orchestrator_Generated', param_files=None, training_files=None, potential_files=None, checkpoint_file='./orchestrator_checkpoint.json', checkpoint_name='potential', **kwargs)[source]¶
Load an existing KIM potential with Kliff
- Parameters:
kim_id (str) – kimcode to represent the item
species (list[str]) – list of strings containing element symbols
model_driver (str) – driver needed to run the potential
kim_api (str) – path to the kim-api-collections-manager executable.
kim_item_type (str) – what type of kim object to create an ID for. For potentials, this should be either “portable-model” or “simulator-model”, depending on whether the model uses a driver to implement its calculations, or runs commands in a simulator program (e.g. lammps, ASE) respectively.
param_files (list[str]) – list of file paths to the parameter files of the potential. May be order-sensitive.
training_files (list[str]) – list of files associated with the training of the potential
potential_files (list[str]) – list of all files associated with the potential, including the superset of param_files, training_files, and any other auxillary files.
checkpoint_file (str) – file name to save checkpoints in
checkpoint_name (str) – name of the checkpointed potential
- checkpoint_potential()[source]¶
checkpoint the potential module into the checkpoint file
save necessary internal variables into a dict with key checkpoint_name and write to the (json) checkpoint file for restart capabilities
- restart_potential()[source]¶
restart the potential module from the checkpoint file
check if the checkpoint_file has an entry matching the checkpoint_name and set internal variables accordingly if so
- build_potential()[source]¶
“Build” a KIM potential using KLIFF
The existing KIM potential is loaded based on the KIM ID passed on class instantiation in the trainer_args dict. Return the model and set the elf.model attribute as well.
- Returns:
pre-existing KIM model
- Return type:
KIMModel
- load_potential(path=None)[source]¶
Load a KIM model using the KIM ID
- Parameters:
path (str) – path including filename where potential resides, if not installed to the user namespace
Default:None- Returns:
pre-existing KIM model
- Return type:
KIMModel
- get_potential_files(destination_path, kim_id=None, include_dependencies=False)[source]¶
Load a KIM model from a kimkit repository using the KIM ID
- Parameters:
destination_path (str) – path to save the resulting .txz file
kim_id (str) – kimcode of the item to be retrieved
include_dependencies (bool) – switch to include drivers of portable models, tests,
Default:False- Returns:
path to the tar archive at destination_path
- Return type:
str
- get_params(**kwargs)[source]¶
Get potential parameter values.
The format of the keyword argument dictionary is:
kwargs = { param1: [idx1, idx2, idx3], param2: [idx1, idx2, idx3], }
- Returns:
A dictionary of current potential parameter values
- Return type:
dict
- set_params(**kwargs)[source]¶
Set potential parameter values.
The format of the keyword argument dictionary is:
kwargs = { param1: [[idx1, idx2, idx3], [val1, val2, val3]], param2: [[idx1, idx2, idx3], [val1, val2, val3]], }
- Parameters:
params (dict) – A dictionary of parameter values
- Return type:
dict
Potential Builder¶
- orchestrator.potential.factory.potential_factory = <orchestrator.utils.module_factory.ModuleFactory object>¶
default factory for potentials, includes DNN (Behler Parrinello) and KIM
- class orchestrator.potential.factory.PotentialBuilder(factory=<orchestrator.utils.module_factory.ModuleFactory object>)[source]¶
Bases:
ModuleBuilderConstructor for potentials added in the factory
set the factory to be used for the builder. The default is to use the potential_factory generated at the end of this module. A user defined ModuleFactory can optionally be supplied instead.
- Parameters:
factory (ModuleFactory) – a potential factory
Default:potential_factory- __init__(factory=<orchestrator.utils.module_factory.ModuleFactory object>)[source]¶
constructor for the PotentialBuilder, sets the factory to build from
- Parameters:
factory (ModuleFactory) – a potential factory
Default:potential_factory- build(potential_type, potential_args=None)[source]¶
Return an instance of the specified potential
The build method takes the specifier and input arguments to construct a concrete potential instance.
- Parameters:
potential_type (str) – token of a potential which has been added to the factory
potential_args – input arguments to instantiate the requested potential class
- Returns:
instantiated concrete Potential
- Return type:
- orchestrator.potential.factory.potential_builder = <orchestrator.potential.factory.PotentialBuilder object>¶
potential builder object which can be imported for use in other modules