pfd.exploration.task package

Subpackages

Submodules

pfd.exploration.task.caly_task_group module

class pfd.exploration.task.caly_task_group.CalyTaskGroup[source]

Bases: ExplorationTaskGroup

make_task() ExplorationTaskGroup[source]

Make the CALYPSO task group.

Returns:

task_grp – Return one calypso task group.

Return type:

ExplorationTaskGroup

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

pfd.exploration.task.conf_sampling_task_group module

class pfd.exploration.task.conf_sampling_task_group.ConfSamplingTaskGroup[source]

Bases: ExplorationTaskGroup

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

Set the configurations of exploration

Parameters:
  • str (conf_list) – A list of file contents

  • int (n_sample) – 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.

  • bool (random_sample) – If true the confs are randomly sampled, otherwise are consecutively sampled from the conf_list

pfd.exploration.task.customized_lmp_template_task_group module

class pfd.exploration.task.customized_lmp_template_task_group.CustomizedLmpTemplateTaskGroup[source]

Bases: ConfSamplingTaskGroup

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_models (int) – Number of models

  • custom_shell_commands (str) – 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.

  • revisions (dict) – Revision dictionary. Provided in {key: [enumerated values]} format

  • traj_freq (int) – Frequency along trajectory of checking model deviation

  • input_lmp_conf_name (str) – Input conf file name for the shell commands.

  • input_lmp_tmpl_name (str) – Template file name of lammps input

  • input_plm_tmpl_name (str) – Template file name of the plumed input

  • input_extra_files (List[str]) – Extra files that may be needed to execute the shell commands

  • output_dir_pattern (Union[str, List[str]]) – Pattern of resultant folders generated by the shell commands.

  • output_lmp_conf_name (str) – Generated conf file name.

  • output_lmp_tmpl_name (str) – Generated lmp input file name.

  • output_plm_tmpl_name (str) – Generated plm input file name.

pfd.exploration.task.gen_task_group module

pfd.exploration.task.gen_task_group.expl_grp_args_caly(config)[source]

Normalize input parameters of calypso exploration

Parameters:

config (dict) – input config

Returns:

normalized config

Return type:

dict

pfd.exploration.task.gen_task_group.expl_grp_args_lmps(config)[source]
pfd.exploration.task.gen_task_group.gen_expl_grp_caly(task)[source]
pfd.exploration.task.gen_task_group.gen_expl_grp_lmps(sys, type_map: List, mass_map: List, task)[source]

pfd.exploration.task.lmp_template_task_group module

class pfd.exploration.task.lmp_template_task_group.LmpTemplateTaskGroup[source]

Bases: ConfSamplingTaskGroup

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

Make the task group.

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

pfd.exploration.task.make_task_group_from_config module

pfd.exploration.task.make_task_group_from_config.caly_normalize(data, strict: bool = False)[source]
pfd.exploration.task.make_task_group_from_config.caly_task_group_args()[source]
pfd.exploration.task.make_task_group_from_config.caly_task_grp_args()[source]
pfd.exploration.task.make_task_group_from_config.config_strip_confidx(config)[source]
pfd.exploration.task.make_task_group_from_config.customized_lmp_template_task_group_args()[source]
pfd.exploration.task.make_task_group_from_config.lmp_normalize(data, strict: bool = False)[source]
pfd.exploration.task.make_task_group_from_config.lmp_task_group_args()[source]
pfd.exploration.task.make_task_group_from_config.lmp_template_task_group_args()[source]
pfd.exploration.task.make_task_group_from_config.make_calypso_task_group_from_config(config)[source]
pfd.exploration.task.make_task_group_from_config.make_lmp_task_group_from_config(numb_models, mass_map, config)[source]
pfd.exploration.task.make_task_group_from_config.npt_task_group_args()[source]
pfd.exploration.task.make_task_group_from_config.variant_task_group()[source]

pfd.exploration.task.npt_task_group module

class pfd.exploration.task.npt_task_group.NPTTaskGroup[source]

Bases: ConfSamplingTaskGroup

make_task() NPTTaskGroup[source]

Make the LAMMPS task group.

Returns:

task_grp – 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.

Return type:

ExplorationTaskGroup

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, model_name_pattern: str = 'model.%03d.pb')[source]

Set MD parameters

pfd.exploration.task.stage module

class pfd.exploration.task.stage.ExplorationStage[source]

Bases: object

The exploration stage.

add_task_group(grp: ExplorationTaskGroup)[source]

Add an exploration group

Parameters:

grp (ExplorationTaskGroup) – The added exploration task group

clear()[source]

Clear all exploration group.

make_task() BaseExplorationTaskGroup[source]

Make the LAMMPS task group.

Returns:

task_grp – 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.

Return type:

BaseExplorationTaskGroup

pfd.exploration.task.task module

class pfd.exploration.task.task.ExplorationTask[source]

Bases: object

Define the files needed by an exploration 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:
  • fname (str) – The name of the file

  • fcont (str) – The content of the file.

files() Dict[source]

Get all files for the task.

Returns:

files – 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.

Return type:

dict

pfd.exploration.task.task_group module

class pfd.exploration.task.task_group.BaseExplorationTaskGroup[source]

Bases: Sequence

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

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 pfd.exploration.task.task_group.ExplorationTaskGroup[source]

Bases: ABC, BaseExplorationTaskGroup

abstractmethod make_task() ExplorationTaskGroup[source]

Make the task group.

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

Bases: ExplorationTask

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

Bases: BaseExplorationTaskGroup

property task_list

Get the list of ExplorationTask

Module contents