dpgen2.exploration.task package

Contents

dpgen2.exploration.task package#

Subpackages#

Submodules#

dpgen2.exploration.task.caly_task_group module#

class dpgen2.exploration.task.caly_task_group.CalyTaskGroup[source]#

Bases: ExplorationTaskGroup

Attributes:
task_list

Get the list of ExplorationTask

Methods

add_group(group)

Add another group to the group.

add_task(task)

Add one task to the group.

count(value)

index(value, [start, [stop]])

Raises ValueError if the value is not present.

make_task()

Make the CALYPSO task group.

set_params(numb_of_species, name_of_atoms, ...)

Set calypso parameters

clear

make_task() ExplorationTaskGroup[source]#

Make the CALYPSO task group.

Returns:
task_grp: ExplorationTaskGroup

Return one calypso task group.

set_params(numb_of_species, name_of_atoms, numb_of_atoms, distance_of_ions=None, atomic_number=None, pop_size: int = 30, max_step: int = 5, system_name: str = 'CALYPSO', numb_of_formula: List[int] = [1, 1], pressure: float = 0.001, fmax: float = 0.01, volume: float = 0, ialgo: int = 2, pso_ratio: float = 0.6, icode: int = 15, numb_of_lbest: int = 4, numb_of_local_optim: int = 4, command: str = 'sh submit.sh', max_time: int = 9000, gen_type: int = 1, pick_up: bool = False, pick_step: int = 1, parallel: bool = False, split: bool = True, spec_space_group: List[int] = [2, 230], vsc: bool = True, ctrl_range: List[List[int]] = [[1, 10]], max_numb_atoms: int = 100, opt_step: int = 1000)[source]#

Set calypso parameters

dpgen2.exploration.task.conf_sampling_task_group module#

class dpgen2.exploration.task.conf_sampling_task_group.ConfSamplingTaskGroup[source]#

Bases: ExplorationTaskGroup

Attributes:
task_list

Get the list of ExplorationTask

Methods

add_group(group)

Add another group to the group.

add_task(task)

Add one task to the group.

count(value)

index(value, [start, [stop]])

Raises ValueError if the value is not present.

make_task()

Make the task group.

set_conf(conf_list[, n_sample, random_sample])

Set the configurations of exploration

clear

set_conf(conf_list: List[str], n_sample: int | None = None, random_sample: bool = False)[source]#

Set the configurations of exploration

Parameters:
conf_list str

A list of file contents

n_sample int

Number of samples drawn from the conf list each time make_task is called. If set to None, n_sample is set to length of the conf_list.

random_sample bool

If true the confs are randomly sampled, otherwise are consecutively sampled from the conf_list

dpgen2.exploration.task.customized_lmp_template_task_group module#

class dpgen2.exploration.task.customized_lmp_template_task_group.CustomizedLmpTemplateTaskGroup[source]#

Bases: ConfSamplingTaskGroup

Attributes:
task_list

Get the list of ExplorationTask

Methods

add_group(group)

Add another group to the group.

add_task(task)

Add one task to the group.

count(value)

index(value, [start, [stop]])

Raises ValueError if the value is not present.

make_task()

Make the task group.

set_conf(conf_list[, n_sample, random_sample])

Set the configurations of exploration

set_lmp(numb_models, custom_shell_commands)

Set lammps task.

clear

make_task() CustomizedLmpTemplateTaskGroup[source]#

Make the task group.

set_lmp(numb_models: int, custom_shell_commands: List[str], revisions: dict = {}, traj_freq: int = 10, input_lmp_conf_name: str = 'conf.lmp', input_lmp_tmpl_name: str = 'in.lammps', input_plm_tmpl_name: str | None = None, input_extra_files: List[str] = [], output_dir_pattern: str | List[str] = '*', output_lmp_conf_name: str = 'conf.lmp', output_lmp_tmpl_name: str = 'in.lammps', output_plm_tmpl_name: str | None = None) None[source]#

Set lammps task.

Parameters:
numb_modelsint

Number of models

custom_shell_commandsstr

Customized shell commands to be run for each configuration. The commands require input_lmp_conf_name as input conf file, input_lmp_tmpl_name and input_plm_tmpl_name as templates, and input_extra_files as extra input files. By running the commands a series folders in pattern output_dir_pattern are supposed to be generated, and each folder is supposed to contain a configuration file output_lmp_conf_name, a lammps template file output_lmp_tmpl_name and a plumed template file output_plm_tmpl_name.

revisionsdict

Revision dictionary. Provided in {key: [enumerated values]} format

traj_freqint

Frequency along trajectory of checking model deviation

input_lmp_conf_namestr

Input conf file name for the shell commands.

input_lmp_tmpl_namestr

Template file name of lammps input

input_plm_tmpl_namestr

Template file name of the plumed input

input_extra_filesList[str]

Extra files that may be needed to execute the shell commands

output_dir_patternUnion[str, List[str]]

Pattern of resultant folders generated by the shell commands.

output_lmp_conf_namestr

Generated conf file name.

output_lmp_tmpl_namestr

Generated lmp input file name.

output_plm_tmpl_namestr

Generated plm input file name.

dpgen2.exploration.task.diffcsp_task_group module#

class dpgen2.exploration.task.diffcsp_task_group.DiffCSPTaskGroup(trj_freq: int = 10, fmax: float = 0.0001, steps: int = 200, timeout: int | None = None)[source]#

Bases: ExplorationTaskGroup

Attributes:
task_list

Get the list of ExplorationTask

Methods

add_group(group)

Add another group to the group.

add_task(task)

Add one task to the group.

count(value)

index(value, [start, [stop]])

Raises ValueError if the value is not present.

make_task()

Make the DiffCSP task group.

clear

make_task() DiffCSPTaskGroup[source]#

Make the DiffCSP task group.

Returns:
task_grp: DiffCSPTaskGroup

Return one DiffCSP task group.

dpgen2.exploration.task.lmp_template_task_group module#

class dpgen2.exploration.task.lmp_template_task_group.LmpTemplateTaskGroup[source]#

Bases: ConfSamplingTaskGroup

Attributes:
task_list

Get the list of ExplorationTask

Methods

add_group(group)

Add another group to the group.

add_task(task)

Add one task to the group.

count(value)

index(value, [start, [stop]])

Raises ValueError if the value is not present.

make_task()

Make the task group.

set_conf(conf_list[, n_sample, random_sample])

Set the configurations of exploration

clear

make_cont

set_lmp

make_cont(templates: list, revisions: dict)[source]#
make_task() LmpTemplateTaskGroup[source]#

Make the task group.

set_lmp(numb_models: int, lmp_template_fname: str, plm_template_fname: str | None = None, revisions: dict = {}, traj_freq: int = 10, extra_pair_style_args: str = '', pimd_bead: str | None = None) None[source]#
dpgen2.exploration.task.lmp_template_task_group.find_only_one_key(lmp_lines, key)[source]#
dpgen2.exploration.task.lmp_template_task_group.revise_by_keys(lmp_lines, keys, values)[source]#
dpgen2.exploration.task.lmp_template_task_group.revise_lmp_input_dump(lmp_lines, trj_freq, pimd_bead=None)[source]#
dpgen2.exploration.task.lmp_template_task_group.revise_lmp_input_model(lmp_lines, task_model_list, trj_freq, extra_pair_style_args='', pimd_bead=None, deepmd_version='1')[source]#
dpgen2.exploration.task.lmp_template_task_group.revise_lmp_input_plm(lmp_lines, in_plm, out_plm='output.plumed')[source]#

dpgen2.exploration.task.make_task_group_from_config module#

dpgen2.exploration.task.make_task_group_from_config.caly_normalize(data)[source]#
dpgen2.exploration.task.make_task_group_from_config.caly_task_group_args()[source]#
dpgen2.exploration.task.make_task_group_from_config.caly_task_grp_args()[source]#
dpgen2.exploration.task.make_task_group_from_config.config_strip_confidx(config)[source]#
dpgen2.exploration.task.make_task_group_from_config.customized_lmp_template_task_group_args()[source]#
dpgen2.exploration.task.make_task_group_from_config.diffcsp_normalize(config)[source]#
dpgen2.exploration.task.make_task_group_from_config.diffcsp_task_group_args()[source]#
dpgen2.exploration.task.make_task_group_from_config.lmp_normalize(data)[source]#
dpgen2.exploration.task.make_task_group_from_config.lmp_task_group_args()[source]#
dpgen2.exploration.task.make_task_group_from_config.lmp_template_task_group_args()[source]#
dpgen2.exploration.task.make_task_group_from_config.make_calypso_task_group_from_config(config)[source]#
dpgen2.exploration.task.make_task_group_from_config.make_diffcsp_task_group_from_config(config)[source]#
dpgen2.exploration.task.make_task_group_from_config.make_lmp_task_group_from_config(numb_models, mass_map, config)[source]#
dpgen2.exploration.task.make_task_group_from_config.npt_task_group_args()[source]#
dpgen2.exploration.task.make_task_group_from_config.variant_task_group()[source]#

dpgen2.exploration.task.npt_task_group module#

class dpgen2.exploration.task.npt_task_group.NPTTaskGroup[source]#

Bases: ConfSamplingTaskGroup

Attributes:
task_list

Get the list of ExplorationTask

Methods

add_group(group)

Add another group to the group.

add_task(task)

Add one task to the group.

count(value)

index(value, [start, [stop]])

Raises ValueError if the value is not present.

make_task()

Make the LAMMPS task group.

set_conf(conf_list[, n_sample, random_sample])

Set the configurations of exploration

set_md(numb_models, mass_map, temps[, ...])

Set MD parameters

clear

make_task() NPTTaskGroup[source]#

Make the LAMMPS task group.

Returns:
task_grp: ExplorationTaskGroup

The returned lammps task group. The number of tasks is nconf*nT*nP. nconf is set by n_sample parameter of set_conf. nT and nP are lengths of the temps and press parameters of set_md.

set_md(numb_models, mass_map, temps: List[float], press: List[float] | None = None, ens: str = 'npt', dt: float = 0.001, nsteps: int = 1000, trj_freq: int = 10, 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_f_epsilon: float | None = None, relative_v_epsilon: float | None = None, ele_temp_f: float | None = None, ele_temp_a: float | None = None, pimd_bead: str | None = None)[source]#

Set MD parameters

dpgen2.exploration.task.stage module#

class dpgen2.exploration.task.stage.ExplorationStage[source]#

Bases: object

The exploration stage.

Methods

add_task_group(grp)

Add an exploration group

clear()

Clear all exploration group.

make_task()

Make the LAMMPS task group.

add_task_group(grp: ExplorationTaskGroup)[source]#

Add an exploration group

Parameters:
grpExplorationTaskGroup

The added exploration task group

clear()[source]#

Clear all exploration group.

make_task() BaseExplorationTaskGroup[source]#

Make the LAMMPS task group.

Returns:
task_grp: BaseExplorationTaskGroup

The returned lammps task group. The number of tasks is equal to the summation of task groups defined by all the exploration groups added to the stage.

dpgen2.exploration.task.task module#

class dpgen2.exploration.task.task.ExplorationTask[source]#

Bases: object

Define the files needed by an exploration task.

Methods

add_file(fname, fcont)

Add file to the task

files()

Get all files for the task.

Examples

>>> # this example dumps all files needed by the task.
>>> files = exploration_task.files()
... for file_name, file_content in files.items():
...     with open(file_name, 'w') as fp:
...         fp.write(file_content)
add_file(fname: str, fcont: str)[source]#

Add file to the task

Parameters:
fnamestr

The name of the file

fcontstr

The content of the file.

files() Dict[source]#

Get all files for the task.

Returns:
filesdict

The dict storing all files for the task. The file name is a key of the dict, and the file content is the corresponding value.

dpgen2.exploration.task.task_group module#

class dpgen2.exploration.task.task_group.BaseExplorationTaskGroup[source]#

Bases: Sequence

A group of exploration tasks. Implemented as a list of ExplorationTask.

Attributes:
task_list

Get the list of ExplorationTask

Methods

add_group(group)

Add another group to the group.

add_task(task)

Add one task to the group.

count(value)

index(value, [start, [stop]])

Raises ValueError if the value is not present.

clear

add_group(group: ExplorationTaskGroup)[source]#

Add another group to the group.

add_task(task: ExplorationTask)[source]#

Add one task to the group.

clear() None[source]#
property task_list: List[ExplorationTask]#

Get the list of ExplorationTask

class dpgen2.exploration.task.task_group.ExplorationTaskGroup[source]#

Bases: ABC, BaseExplorationTaskGroup

Attributes:
task_list

Get the list of ExplorationTask

Methods

add_group(group)

Add another group to the group.

add_task(task)

Add one task to the group.

count(value)

index(value, [start, [stop]])

Raises ValueError if the value is not present.

make_task()

Make the task group.

clear

abstract make_task() ExplorationTaskGroup[source]#

Make the task group.

class dpgen2.exploration.task.task_group.FooTask(conf_name='conf.lmp', conf_cont='', inpu_name='in.lammps', inpu_cont='')[source]#

Bases: ExplorationTask

Methods

add_file(fname, fcont)

Add file to the task

files()

Get all files for the task.

class dpgen2.exploration.task.task_group.FooTaskGroup(numb_task)[source]#

Bases: BaseExplorationTaskGroup

Attributes:
task_list

Get the list of ExplorationTask

Methods

add_group(group)

Add another group to the group.

add_task(task)

Add one task to the group.

count(value)

index(value, [start, [stop]])

Raises ValueError if the value is not present.

clear

property task_list#

Get the list of ExplorationTask