dpgen2.op package
Submodules
dpgen2.op.collect_data module
- class dpgen2.op.collect_data.CollectData(*args, **kwargs)[source]
Bases:
OP
Collect labeled data and add to the iteration dataset.
After running FP tasks, the labeled data are scattered in task directories. This OP collect the labeled data in one data directory and add it to the iteration data. The data generated by this iteration will be place in ip[“name”] subdirectory of the iteration data directory.
- Attributes:
- key
- workflow_name
Methods
execute
(ip)Execute the OP.
Get the signature of the inputs
Get the signature of the outputs
convert_to_graph
exec_sign_check
from_graph
function
get_info
get_input_artifact_link
get_input_artifact_storage_key
get_opio_info
get_output_artifact_link
get_output_artifact_storage_key
register_output_artifact
superfunction
- default_optional_parameter = {'mixed_type': False}
- execute(ip: OPIO) OPIO [source]
Execute the OP. This OP collect data scattered in directories given by ip[‘labeled_data’] in to one dpdata.Multisystems and store it in a directory named name. This directory is appended to the list iter_data.
- Parameters:
- ipdict
Input dict with components:
name: (str) The name of this iteration. The data generated by this iteration will be place in a sub-directory of name.
labeled_data: (Artifact(List[Path])) The paths of labeled data generated by FP tasks of the current iteration.
iter_data: (Artifact(List[Path])) The data paths previous iterations.
- Returns:
- Any
Output dict with components: - iter_data: (Artifact(List[Path])) The data paths of previous and the current iteration data.
dpgen2.op.md_settings module
- class dpgen2.op.md_settings.MDSettings(ens: str, dt: float, nsteps: int, trj_freq: int, temps: List[float] | None = None, press: List[float] | None = None, tau_t: float = 0.1, tau_p: float = 0.5, pka_e: float | None = None, neidelay: int | None = None, no_pbc: bool = False, use_clusters: bool = False, relative_epsilon: float | None = None, relative_v_epsilon: float | None = None, ele_temp_f: float | None = None, ele_temp_a: float | None = None)[source]
Bases:
object
Methods
to_str
dpgen2.op.prep_dp_train module
- class dpgen2.op.prep_dp_train.PrepDPTrain(*args, **kwargs)[source]
Bases:
OP
Prepares the working directories for DP training tasks.
A list of (numb_models) working directories containing all files needed to start training tasks will be created. The paths of the directories will be returned as op[“task_paths”]. The identities of the tasks are returned as op[“task_names”].
- Attributes:
- key
- workflow_name
Methods
execute
(ip)Execute the OP.
Get the signature of the inputs
Get the signature of the outputs
convert_to_graph
exec_sign_check
from_graph
function
get_info
get_input_artifact_link
get_input_artifact_storage_key
get_opio_info
get_output_artifact_link
get_output_artifact_storage_key
register_output_artifact
superfunction
- execute(ip: OPIO) OPIO [source]
Execute the OP.
- Parameters:
- ipdict
Input dict with components:
template_script: (str or List[str]) A template of the training script. Can be a str or List[str]. In the case of str, all training tasks share the same training input template, the only difference is the random number used to initialize the network parameters. In the case of List[str], one training task uses one template from the list. The random numbers used to initialize the network parameters are differnt. The length of the list should be the same as numb_models.
numb_models: (int) Number of DP models to train.
- Returns:
- opdict
Output dict with components:
task_names: (List[str]) The name of tasks. Will be used as the identities of the tasks. The names of different tasks are different.
task_paths: (Artifact(List[Path])) The parepared working paths of the tasks. The order fo the Paths should be consistent with op[“task_names”]
dpgen2.op.prep_lmp module
- class dpgen2.op.prep_lmp.PrepLmp(*args, **kwargs)[source]
Bases:
OP
Prepare the working directories for LAMMPS tasks.
A list of working directories (defined by ip[“task”]) containing all files needed to start LAMMPS tasks will be created. The paths of the directories will be returned as op[“task_paths”]. The identities of the tasks are returned as op[“task_names”].
- Attributes:
- key
- workflow_name
Methods
execute
(ip)Execute the OP.
Get the signature of the inputs
Get the signature of the outputs
convert_to_graph
exec_sign_check
from_graph
function
get_info
get_input_artifact_link
get_input_artifact_storage_key
get_opio_info
get_output_artifact_link
get_output_artifact_storage_key
register_output_artifact
superfunction
- execute(ip: OPIO) OPIO [source]
Execute the OP.
- Parameters:
- ipdict
Input dict with components: - lmp_task_grp : (BigParameter(Path)) Can be pickle loaded as a ExplorationTaskGroup. Definitions for LAMMPS tasks
- Returns:
- opdict
Output dict with components:
task_names: (List[str]) The name of tasks. Will be used as the identities of the tasks. The names of different tasks are different.
task_paths: (Artifact(List[Path])) The parepared working paths of the tasks. Contains all input files needed to start the LAMMPS simulation. The order fo the Paths should be consistent with op[“task_names”]
dpgen2.op.run_dp_train module
- class dpgen2.op.run_dp_train.RunDPTrain(*args, **kwargs)[source]
Bases:
OP
Execute a DP training task. Train and freeze a DP model.
A working directory named task_name is created. All input files are copied or symbol linked to directory task_name. The DeePMD-kit training and freezing commands are exectuted from directory task_name.
- Attributes:
- key
- workflow_name
Methods
execute
(ip)Execute the OP.
Get the signature of the inputs
Get the signature of the outputs
convert_to_graph
decide_init_model
exec_sign_check
from_graph
function
get_info
get_input_artifact_link
get_input_artifact_storage_key
get_opio_info
get_output_artifact_link
get_output_artifact_storage_key
normalize_config
register_output_artifact
skip_training
superfunction
training_args
write_data_to_input_script
write_other_to_input_script
- default_optional_parameter = {'finetune_mode': 'no', 'mixed_type': False}
- execute(ip: OPIO) OPIO [source]
Execute the OP.
- Parameters:
- ipdict
Input dict with components:
config: (dict) The config of training task. Check RunDPTrain.training_args for definitions.
task_name: (str) The name of training task.
task_path: (Artifact(Path)) The path that contains all input files prepareed by PrepDPTrain.
init_model: (Artifact(Path)) A frozen model to initialize the training.
init_data: (Artifact(List[Path])) Initial training data.
iter_data: (Artifact(List[Path])) Training data generated in the DPGEN iterations.
- Returns:
- Any
Output dict with components: - script: (Artifact(Path)) The training script. - model: (Artifact(Path)) The trained frozen model. - lcurve: (Artifact(Path)) The learning curve file. - log: (Artifact(Path)) The log file of training.
- Raises:
- FatalError
On the failure of training or freezing. Human intervention needed.
- dpgen2.op.run_dp_train.config_args()
dpgen2.op.run_lmp module
- class dpgen2.op.run_lmp.RunLmp(*args, **kwargs)[source]
Bases:
OP
Execute a LAMMPS task.
A working directory named task_name is created. All input files are copied or symbol linked to directory task_name. The LAMMPS command is exectuted from directory task_name. The trajectory and the model deviation will be stored in files op[“traj”] and op[“model_devi”], respectively.
- Attributes:
- key
- workflow_name
Methods
execute
(ip)Execute the OP.
Get the signature of the inputs
Get the signature of the outputs
convert_to_graph
exec_sign_check
from_graph
function
get_info
get_input_artifact_link
get_input_artifact_storage_key
get_opio_info
get_output_artifact_link
get_output_artifact_storage_key
lmp_args
normalize_config
register_output_artifact
superfunction
- execute(ip: OPIO) OPIO [source]
Execute the OP.
- Parameters:
- ipdict
Input dict with components:
config: (dict) The config of lmp task. Check RunLmp.lmp_args for definitions.
task_name: (str) The name of the task.
task_path: (Artifact(Path)) The path that contains all input files prepareed by PrepLmp.
models: (Artifact(List[Path])) The frozen model to estimate the model deviation. The first model with be used to drive molecular dynamics simulation.
- Returns:
- Any
Output dict with components: - log: (Artifact(Path)) The log file of LAMMPS. - traj: (Artifact(Path)) The output trajectory. - model_devi: (Artifact(Path)) The model deviation. The order of recorded model deviations should be consistent with the order of frames in traj.
- Raises:
- TransientError
On the failure of LAMMPS execution. Handle different failure cases? e.g. loss atoms.
- dpgen2.op.run_lmp.config_args()
dpgen2.op.select_confs module
- class dpgen2.op.select_confs.SelectConfs(*args, **kwargs)[source]
Bases:
OP
Select configurations from exploration trajectories for labeling.
- Attributes:
- key
- workflow_name
Methods
execute
(ip)Execute the OP.
Get the signature of the inputs
Get the signature of the outputs
convert_to_graph
exec_sign_check
from_graph
function
get_info
get_input_artifact_link
get_input_artifact_storage_key
get_opio_info
get_output_artifact_link
get_output_artifact_storage_key
register_output_artifact
superfunction
validate_trajs
- execute(ip: OPIO) OPIO [source]
Execute the OP.
- Parameters:
- ipdict
Input dict with components:
conf_selector: (ConfSelector) Configuration selector.
type_map: (List[str]) The type map.
trajs: (Artifact(List[Path])) The trajectories generated in the exploration.
model_devis: (Artifact(List[Path])) The file storing the model deviation of the trajectory. The order of model deviation storage is consistent with that of the trajectories. The order of frames of one model deviation storage is also consistent with tat of the corresponding trajectory.
- Returns:
- Any
Output dict with components: - report: (ExplorationReport) The report on the exploration. - conf: (Artifact(List[Path])) The selected configurations.