dpgen2.fp package

Submodules

dpgen2.fp.abacus module

class dpgen2.fp.abacus.FpOpAbacusInputs(input_file: str | Path, pp_files: Dict[str, str | Path], element_mass: Dict[str, float] | None = None, kpt_file: str | Path | None = None, orb_files: Dict[str, str | Path] | None = None, deepks_descriptor: str | Path | None = None, deepks_model: str | Path | None = None)[source]

Bases: AbacusInputs

Methods

get_mass(element_list)

Get the mass of elements.

read_inputf(inputf)

Read INPUT and transfer to a dict.

write_deepks()

Check if INPUT is a deepks job, if yes, will return the deepks descriptor file name, else will return None.

write_pporb(element_list)

Based on element list, write the pp/orb files, and return a list of the filename.

args

get_deepks_descriptor

get_deepks_model

get_input

get_orb

get_pp

set_deepks_descriptor

set_deepks_model

set_input

set_mass

set_orb

set_pp

write_input

write_kpt

static args()[source]
class dpgen2.fp.abacus.PrepFpOpAbacus(*args, **kwargs)[source]

Bases: OP

Attributes:
key
workflow_name

Methods

execute(ip)

Run the OP

get_input_sign()

Get the signature of the inputs

get_output_sign()

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]

Run the OP

classmethod get_input_sign()[source]

Get the signature of the inputs

classmethod get_output_sign()[source]

Get the signature of the outputs

class dpgen2.fp.abacus.RunFpOpAbacus(*args, **kwargs)[source]

Bases: OP

Attributes:
key
workflow_name

Methods

execute(ip)

Run the OP

get_input_sign()

Get the signature of the inputs

get_output_sign()

Get the signature of the outputs

args

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

static args()[source]
execute(ip: OPIO) OPIO[source]

Run the OP

classmethod get_input_sign()[source]

Get the signature of the inputs

classmethod get_output_sign()[source]

Get the signature of the outputs

dpgen2.fp.deepmd module

Prep and Run Gaussian tasks.

class dpgen2.fp.deepmd.DeepmdInputs(**kwargs: Any)[source]

Bases: object

Methods

args

static args() List[Argument][source]
class dpgen2.fp.deepmd.PrepDeepmd(*args, **kwargs)[source]

Bases: PrepFp

Attributes:
key
workflow_name

Methods

execute(ip)

Execute the OP.

get_input_sign()

Get the signature of the inputs

get_output_sign()

Get the signature of the outputs

prep_task(conf_frame, inputs)

Define how one Deepmd task is prepared.

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

prep_task(conf_frame: System, inputs)[source]

Define how one Deepmd task is prepared.

Parameters:
conf_framedpdata.System

One frame of configuration in the dpdata format.

inputsstr or dict

This parameter is useless in deepmd.

class dpgen2.fp.deepmd.RunDeepmd(*args, **kwargs)[source]

Bases: RunFp

Attributes:
key
workflow_name

Methods

args()

The argument definition of the run_task method.

execute(ip)

Execute the OP.

get_input_sign()

Get the signature of the inputs

get_output_sign()

Get the signature of the outputs

input_files()

The mandatory input files to run a Deepmd task.

normalize_config([data, strict])

Normalized the argument.

optional_input_files()

The optional input files to run a Deepmd task.

run_task(teacher_model_path, out, log)

Defines how one FP task runs

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

static args() List[Argument][source]

The argument definition of the run_task method.

Returns:
arguments: List[dargs.Argument]

List of dargs.Argument defines the arguments of run_task method.

input_files() List[str][source]

The mandatory input files to run a Deepmd task.

Returns:
files: List[str]

A list of madatory input files names.

optional_input_files() List[str][source]

The optional input files to run a Deepmd task.

Returns:
files: List[str]

A list of optional input files names.

run_task(teacher_model_path: BinaryFileInput, out: str, log: str) Tuple[str, str][source]

Defines how one FP task runs

Parameters:
commandstr

The command of running Deepmd task

outstr

The name of the output data file.

Returns:
out_name: str

The file name of the output data in the dpdata.LabeledSystem format.

log_name: str

The file name of the log.

dpgen2.fp.gaussian module

Prep and Run Gaussian tasks.

class dpgen2.fp.gaussian.GaussianInputs(**kwargs: Any)[source]

Bases: object

Methods

args()

The arguments of the GaussianInputs class.

static args() List[Argument][source]

The arguments of the GaussianInputs class.

class dpgen2.fp.gaussian.PrepGaussian(*args, **kwargs)[source]

Bases: PrepFp

Attributes:
key
workflow_name

Methods

execute(ip)

Execute the OP.

get_input_sign()

Get the signature of the inputs

get_output_sign()

Get the signature of the outputs

prep_task(conf_frame, inputs)

Define how one Gaussian task is prepared.

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

prep_task(conf_frame: System, inputs: GaussianInputs)[source]

Define how one Gaussian task is prepared.

Parameters:
conf_framedpdata.System

One frame of configuration in the dpdata format.

inputsGaussianInputs

The GaussianInputs object handels all other input files of the task.

class dpgen2.fp.gaussian.RunGaussian(*args, **kwargs)[source]

Bases: RunFp

Attributes:
key
workflow_name

Methods

args()

The argument definition of the run_task method.

execute(ip)

Execute the OP.

get_input_sign()

Get the signature of the inputs

get_output_sign()

Get the signature of the outputs

input_files()

The mandatory input files to run a Gaussian task.

normalize_config([data, strict])

Normalized the argument.

optional_input_files()

The optional input files to run a Gaussian task.

run_task(command, out)

Defines how one FP task runs

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

static args() List[Argument][source]

The argument definition of the run_task method.

Returns:
arguments: List[dargs.Argument]

List of dargs.Argument defines the arguments of run_task method.

input_files() List[str][source]

The mandatory input files to run a Gaussian task.

Returns:
files: List[str]

A list of madatory input files names.

optional_input_files() List[str][source]

The optional input files to run a Gaussian task.

Returns:
files: List[str]

A list of optional input files names.

run_task(command: str, out: str) Tuple[str, str][source]

Defines how one FP task runs

Parameters:
commandstr

The command of running gaussian task

outstr

The name of the output data file.

Returns:
out_name: str

The file name of the output data in the dpdata.LabeledSystem format.

log_name: str

The file name of the log.

dpgen2.fp.prep_fp module

class dpgen2.fp.prep_fp.PrepFp(*args, **kwargs)[source]

Bases: OP, ABC

Prepares the working directories for first-principles (FP) tasks.

A list of (same length as ip[“confs”]) working directories containing all files needed to start FP 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_input_sign()

Get the signature of the inputs

get_output_sign()

Get the signature of the outputs

prep_task(conf_frame, inputs)

Define how one FP task is prepared.

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:

  • config : (dict) Should have config[‘inputs’], which defines the input files of the FP task.

  • confs : (Artifact(List[Path])) Configurations for the FP tasks. Stored in folders as deepmd/npy format. Can be parsed as dpdata.MultiSystems.

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 FP. The order fo the Paths should be consistent with op[“task_names”]

classmethod get_input_sign()[source]

Get the signature of the inputs

classmethod get_output_sign()[source]

Get the signature of the outputs

abstract prep_task(conf_frame: System, inputs: Any)[source]

Define how one FP task is prepared.

Parameters:
conf_framedpdata.System

One frame of configuration in the dpdata format.

inputsAny

The class object handels all other input files of the task. For example, pseudopotential file, k-point file and so on.

dpgen2.fp.run_fp module

class dpgen2.fp.run_fp.RunFp(*args, **kwargs)[source]

Bases: OP, ABC

Execute a first-principles (FP) task.

A working directory named task_name is created. All input files are copied or symbol linked to directory task_name. The FP command is exectuted from directory task_name. The op[“labeled_data”] in “deepmd/npy” format (HF5 in the future) provided by dpdata will be created.

Attributes:
key
workflow_name

Methods

args()

The argument definition of the run_task method.

execute(ip)

Execute the OP.

get_input_sign()

Get the signature of the inputs

get_output_sign()

Get the signature of the outputs

input_files()

The mandatory input files to run a FP task.

normalize_config([data, strict])

Normalized the argument.

optional_input_files()

The optional input files to run a FP task.

run_task(**kwargs)

Defines how one FP task runs

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

abstract static args() List[Argument][source]

The argument definition of the run_task method.

Returns:
arguments: List[dargs.Argument]

List of dargs.Argument defines the arguments of run_task method.

execute(ip: OPIO) OPIO[source]

Execute the OP.

Parameters:
ipdict

Input dict with components:

  • config: (dict) The config of FP task. Should have config[‘run’], which defines the runtime configuration of the FP task.

  • task_name: (str) The name of task.

  • task_path: (Artifact(Path)) The path that contains all input files prepareed by PrepFp.

Returns:
Output dict with components:
  • log: (Artifact(Path)) The log file of FP.
  • labeled_data: (Artifact(Path)) The path to the labeled data in “deepmd/npy” format provided by dpdata.
Raises:
TransientError

On the failure of FP execution.

FatalError

When mandatory files are not found.

classmethod get_input_sign()[source]

Get the signature of the inputs

classmethod get_output_sign()[source]

Get the signature of the outputs

abstract input_files() List[str][source]

The mandatory input files to run a FP task.

Returns:
files: List[str]

A list of madatory input files names.

classmethod normalize_config(data: Dict = {}, strict: bool = True) Dict[source]

Normalized the argument.

Parameters:
dataDict

The input dict of arguments.

strictbool

Strictly check the arguments.

Returns:
data: Dict

The normalized arguments.

abstract optional_input_files() List[str][source]

The optional input files to run a FP task.

Returns:
files: List[str]

A list of optional input files names.

abstract run_task(**kwargs) Tuple[str, str][source]

Defines how one FP task runs

Parameters:
**kwargs

Keyword args defined by the developer. The fp/run_config session of the input file will be passed to this function.

Returns:
out_name: str

The file name of the output data. Should be in dpdata.LabeledSystem format.

log_name: str

The file name of the log.

dpgen2.fp.vasp module

class dpgen2.fp.vasp.PrepVasp(*args, **kwargs)[source]

Bases: PrepFp

Attributes:
key
workflow_name

Methods

execute(ip)

Execute the OP.

get_input_sign()

Get the signature of the inputs

get_output_sign()

Get the signature of the outputs

prep_task(conf_frame, vasp_inputs)

Define how one Vasp task is prepared.

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

prep_task(conf_frame: System, vasp_inputs: VaspInputs)[source]

Define how one Vasp task is prepared.

Parameters:
conf_framedpdata.System

One frame of configuration in the dpdata format.

vasp_inputsVaspInputs

The VaspInputs object handels all other input files of the task.

class dpgen2.fp.vasp.RunVasp(*args, **kwargs)[source]

Bases: RunFp

Attributes:
key
workflow_name

Methods

args()

The argument definition of the run_task method.

execute(ip)

Execute the OP.

get_input_sign()

Get the signature of the inputs

get_output_sign()

Get the signature of the outputs

input_files()

The mandatory input files to run a vasp task.

normalize_config([data, strict])

Normalized the argument.

optional_input_files()

The optional input files to run a vasp task.

run_task(command, out, log)

Defines how one FP task runs

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

static args()[source]

The argument definition of the run_task method.

Returns:
arguments: List[dargs.Argument]

List of dargs.Argument defines the arguments of run_task method.

input_files() List[str][source]

The mandatory input files to run a vasp task.

Returns:
files: List[str]

A list of madatory input files names.

optional_input_files() List[str][source]

The optional input files to run a vasp task.

Returns:
files: List[str]

A list of optional input files names.

run_task(command: str, out: str, log: str) Tuple[str, str][source]

Defines how one FP task runs

Parameters:
commandstr

The command of running vasp task

outstr

The name of the output data file.

logstr

The name of the log file

Returns:
out_name: str

The file name of the output data in the dpdata.LabeledSystem format.

log_name: str

The file name of the log.

dpgen2.fp.vasp_input module

class dpgen2.fp.vasp_input.VaspInputs(kspacing: float | List[float], incar: str, pp_files: Dict[str, str], kgamma: bool = True)[source]

Bases: object

Attributes:
incar_template
potcars

Methods

args

incar_from_file

make_kpoints

make_potcar

normalize_config

potcars_from_file

static args()[source]
incar_from_file(fname: str)[source]
property incar_template
make_kpoints(box: ndarray) str[source]
make_potcar(atom_names) str[source]
static normalize_config(data={}, strict=True)[source]
property potcars
potcars_from_file(dict_fnames: Dict[str, str])[source]
dpgen2.fp.vasp_input.make_kspacing_kpoints(box, kspacing, kgamma)[source]