deepmd.entrypoints package

Submodule that contains all the DeePMD-Kit entry point scripts.

deepmd.entrypoints.compress(*, input: str, output: str, extrapolate: int, step: float, frequency: str, checkpoint_folder: str, training_script: str, mpi_log: str, log_path: Optional[str], log_level: int, **kwargs)[source]

Compress model.

The table is composed of fifth-order polynomial coefficients and is assembled from two sub-tables. The first table takes the step parameter as the domain’s uniform step size, while the second table takes 10 * step as it’s uniform step size. The range of the first table is automatically detected by the code, while the second table ranges from the first table’s upper boundary(upper) to the extrapolate(parameter) * upper.

Parameters
inputstr

frozen model file to compress

outputstr

compressed model filename

extrapolateint

scale of model extrapolation

stepfloat

uniform step size of the tabulation’s first table

frequencystr

frequency of tabulation overflow check

checkpoint_folderstr

trining checkpoint folder for freezing

training_scriptstr

training script of the input frozen model

mpi_logstr

mpi logging mode for training

log_pathOptional[str]

if speccified log will be written to this file

log_levelint

logging level

**kwargs

additional arguments

deepmd.entrypoints.convert(*, FROM: str, input_model: str, output_model: str, **kwargs)[source]
deepmd.entrypoints.doc_train_input(*, out_type: str = 'rst', **kwargs)[source]

Print out trining input arguments to console.

deepmd.entrypoints.freeze(*, checkpoint_folder: str, output: str, node_names: Optional[str] = None, nvnmd_weight: Optional[str] = None, united_model: bool = False, **kwargs)[source]

Freeze the graph in supplied folder.

Parameters
checkpoint_folderstr

location of the folder with model

outputstr

output file name

node_namesOptional[str], optional

names of nodes to output, by default None

nvnmd_weightOptional[str], optional

nvnmd weight file

united_modelbool

when in multi-task mode, freeze all nodes into one unit model

**kwargs

other arguments

deepmd.entrypoints.make_model_devi(*, models: list, system: str, set_prefix: str, output: str, frequency: int, real_error: bool = False, atomic: bool = False, relative: Optional[float] = None, relative_v: Optional[float] = None, **kwargs)[source]

Make model deviation calculation.

Parameters
modelslist

A list of paths of models to use for making model deviation

systemstr

The path of system to make model deviation calculation

set_prefixstr

The set prefix of the system

outputstr

The output file for model deviation results

frequencyint

The number of steps that elapse between writing coordinates in a trajectory by a MD engine (such as Gromacs / Lammps). This paramter is used to determine the index in the output file.

real_errorbool, default: False

If True, calculate the RMS real error instead of model deviation.

atomicbool, default: False

If True, calculate the force model deviation of each atom.

relativefloat, default: None

If given, calculate the relative model deviation of force. The value is the level parameter for computing the relative model deviation of the force.

relative_vfloat, default: None

If given, calculate the relative model deviation of virial. The value is the level parameter for computing the relative model deviation of the virial.

**kwargs

Arbitrary keyword arguments.

deepmd.entrypoints.neighbor_stat(*, system: str, rcut: float, type_map: List[str], one_type: bool = False, **kwargs)[source]

Calculate neighbor statistics.

Parameters
systemstr

system to stat

rcutfloat

cutoff radius

type_maplist[str]

type map

one_typebool, optional, default=False

treat all types as a single type

**kwargs

additional arguments

Examples

>>> neighbor_stat(system='.', rcut=6., type_map=["C", "H", "O", "N", "P", "S", "Mg", "Na", "HW", "OW", "mNa", "mCl", "mC", "mH", "mMg", "mN", "mO", "mP"])
min_nbor_dist: 0.6599510670195264
max_nbor_size: [23, 26, 19, 16, 2, 2, 1, 1, 72, 37, 5, 0, 31, 29, 1, 21, 20, 5]
deepmd.entrypoints.start_dpgui(*, port: int, bind_all: bool, **kwargs)[source]

Host DP-GUI server.

Parameters
portint

The port to serve DP-GUI on.

bind_allbool

Serve on all public interfaces. This will expose your DP-GUI instance to the network on both IPv4 and IPv6 (where available).

**kwargs

additional arguments

Raises
ModuleNotFoundError

The dpgui package is not installed

deepmd.entrypoints.test(*, model: str, system: str, datafile: str, set_prefix: str, numb_test: int, rand_seed: Optional[int], shuffle_test: bool, detail_file: str, atomic: bool, **kwargs)[source]

Test model predictions.

Parameters
modelstr

path where model is stored

systemstr

system directory

datafilestr

the path to the list of systems to test

set_prefixstr

string prefix of set

numb_testint

munber of tests to do. 0 means all data.

rand_seedOptional[int]

seed for random generator

shuffle_testbool

whether to shuffle tests

detail_fileOptional[str]

file where test details will be output

atomicbool

whether per atom quantities should be computed

**kwargs

additional arguments

Raises
RuntimeError

if no valid system was found

deepmd.entrypoints.train_dp(*, INPUT: str, init_model: Optional[str], restart: Optional[str], output: str, init_frz_model: str, mpi_log: str, log_level: int, log_path: Optional[str], is_compress: bool = False, skip_neighbor_stat: bool = False, finetune: Optional[str] = None, **kwargs)

Run DeePMD model training.

Parameters
INPUTstr

json/yaml control file

init_modelOptional[str]

path prefix of checkpoint files or None

restartOptional[str]

path prefix of checkpoint files or None

outputstr

path for dump file with arguments

init_frz_modelstr

path to frozen model or None

mpi_logstr

mpi logging mode

log_levelint

logging level defined by int 0-3

log_pathOptional[str]

logging file path or None if logs are to be output only to stdout

is_compressbool

indicates whether in the model compress mode

skip_neighbor_statbool, default=False

skip checking neighbor statistics

finetuneOptional[str]

path to pretrained model or None

**kwargs

additional arguments

Raises
RuntimeError

if distributed training job name is wrong

deepmd.entrypoints.transfer(*, old_model: str, raw_model: str, output: str, **kwargs)[source]

Transfer operation from old fron graph to new prepared raw graph.

Parameters
old_modelstr

frozen old graph model

raw_modelstr

new model that will accept ops from old model

outputstr

new model with transfered parameters will be saved to this location

**kwargs

additional arguments

Submodules

deepmd.entrypoints.compress module

Compress a model, which including tabulating the embedding-net.

deepmd.entrypoints.compress.compress(*, input: str, output: str, extrapolate: int, step: float, frequency: str, checkpoint_folder: str, training_script: str, mpi_log: str, log_path: Optional[str], log_level: int, **kwargs)[source]

Compress model.

The table is composed of fifth-order polynomial coefficients and is assembled from two sub-tables. The first table takes the step parameter as the domain’s uniform step size, while the second table takes 10 * step as it’s uniform step size. The range of the first table is automatically detected by the code, while the second table ranges from the first table’s upper boundary(upper) to the extrapolate(parameter) * upper.

Parameters
inputstr

frozen model file to compress

outputstr

compressed model filename

extrapolateint

scale of model extrapolation

stepfloat

uniform step size of the tabulation’s first table

frequencystr

frequency of tabulation overflow check

checkpoint_folderstr

trining checkpoint folder for freezing

training_scriptstr

training script of the input frozen model

mpi_logstr

mpi logging mode for training

log_pathOptional[str]

if speccified log will be written to this file

log_levelint

logging level

**kwargs

additional arguments

deepmd.entrypoints.convert module

deepmd.entrypoints.convert.convert(*, FROM: str, input_model: str, output_model: str, **kwargs)[source]

deepmd.entrypoints.doc module

deepmd.entrypoints.doc.doc_train_input(*, out_type: str = 'rst', **kwargs)[source]

Print out trining input arguments to console.

deepmd.entrypoints.freeze module

Script for freezing TF trained graph so it can be used with LAMMPS and i-PI.

References

https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc

deepmd.entrypoints.freeze.freeze(*, checkpoint_folder: str, output: str, node_names: Optional[str] = None, nvnmd_weight: Optional[str] = None, united_model: bool = False, **kwargs)[source]

Freeze the graph in supplied folder.

Parameters
checkpoint_folderstr

location of the folder with model

outputstr

output file name

node_namesOptional[str], optional

names of nodes to output, by default None

nvnmd_weightOptional[str], optional

nvnmd weight file

united_modelbool

when in multi-task mode, freeze all nodes into one unit model

**kwargs

other arguments

deepmd.entrypoints.gui module

deepmd.entrypoints.gui.start_dpgui(*, port: int, bind_all: bool, **kwargs)[source]

Host DP-GUI server.

Parameters
portint

The port to serve DP-GUI on.

bind_allbool

Serve on all public interfaces. This will expose your DP-GUI instance to the network on both IPv4 and IPv6 (where available).

**kwargs

additional arguments

Raises
ModuleNotFoundError

The dpgui package is not installed

deepmd.entrypoints.ipi module

Use dp_ipi inside the Python package.

deepmd.entrypoints.ipi.dp_ipi()[source]

dp_ipi.

deepmd.entrypoints.main module

DeePMD-Kit entry point module.

deepmd.entrypoints.main.get_ll(log_level: str) int[source]

Convert string to python logging level.

Parameters
log_levelstr

allowed input values are: DEBUG, INFO, WARNING, ERROR, 3, 2, 1, 0

Returns
int

one of python logging module log levels - 10, 20, 30 or 40

deepmd.entrypoints.main.main(args: Optional[Union[List[str], Namespace]] = None)[source]

DeePMD-Kit entry point.

Parameters
argsList[str] or argparse.Namespace, optional

list of command line arguments, used to avoid calling from the subprocess, as it is quite slow to import tensorflow; if Namespace is given, it will be used directly

Raises
RuntimeError

if no command was input

deepmd.entrypoints.main.main_parser() ArgumentParser[source]

DeePMD-Kit commandline options argument parser.

Returns
argparse.ArgumentParser

main parser of DeePMD-kit

deepmd.entrypoints.main.parse_args(args: Optional[List[str]] = None) Namespace[source]

Parse arguments and convert argument strings to objects.

Parameters
argsList[str]

list of command line arguments, main purpose is testing default option None takes arguments from sys.argv

Returns
argparse.Namespace

the populated namespace

deepmd.entrypoints.neighbor_stat module

deepmd.entrypoints.neighbor_stat.neighbor_stat(*, system: str, rcut: float, type_map: List[str], one_type: bool = False, **kwargs)[source]

Calculate neighbor statistics.

Parameters
systemstr

system to stat

rcutfloat

cutoff radius

type_maplist[str]

type map

one_typebool, optional, default=False

treat all types as a single type

**kwargs

additional arguments

Examples

>>> neighbor_stat(system='.', rcut=6., type_map=["C", "H", "O", "N", "P", "S", "Mg", "Na", "HW", "OW", "mNa", "mCl", "mC", "mH", "mMg", "mN", "mO", "mP"])
min_nbor_dist: 0.6599510670195264
max_nbor_size: [23, 26, 19, 16, 2, 2, 1, 1, 72, 37, 5, 0, 31, 29, 1, 21, 20, 5]

deepmd.entrypoints.test module

Test trained DeePMD model.

deepmd.entrypoints.test.test(*, model: str, system: str, datafile: str, set_prefix: str, numb_test: int, rand_seed: Optional[int], shuffle_test: bool, detail_file: str, atomic: bool, **kwargs)[source]

Test model predictions.

Parameters
modelstr

path where model is stored

systemstr

system directory

datafilestr

the path to the list of systems to test

set_prefixstr

string prefix of set

numb_testint

munber of tests to do. 0 means all data.

rand_seedOptional[int]

seed for random generator

shuffle_testbool

whether to shuffle tests

detail_fileOptional[str]

file where test details will be output

atomicbool

whether per atom quantities should be computed

**kwargs

additional arguments

Raises
RuntimeError

if no valid system was found

deepmd.entrypoints.train module

DeePMD training entrypoint script.

Can handle local or distributed training.

deepmd.entrypoints.train.train(*, INPUT: str, init_model: Optional[str], restart: Optional[str], output: str, init_frz_model: str, mpi_log: str, log_level: int, log_path: Optional[str], is_compress: bool = False, skip_neighbor_stat: bool = False, finetune: Optional[str] = None, **kwargs)[source]

Run DeePMD model training.

Parameters
INPUTstr

json/yaml control file

init_modelOptional[str]

path prefix of checkpoint files or None

restartOptional[str]

path prefix of checkpoint files or None

outputstr

path for dump file with arguments

init_frz_modelstr

path to frozen model or None

mpi_logstr

mpi logging mode

log_levelint

logging level defined by int 0-3

log_pathOptional[str]

logging file path or None if logs are to be output only to stdout

is_compressbool

indicates whether in the model compress mode

skip_neighbor_statbool, default=False

skip checking neighbor statistics

finetuneOptional[str]

path to pretrained model or None

**kwargs

additional arguments

Raises
RuntimeError

if distributed training job name is wrong

deepmd.entrypoints.transfer module

Module used for transfering parameters between models.

deepmd.entrypoints.transfer.transfer(*, old_model: str, raw_model: str, output: str, **kwargs)[source]

Transfer operation from old fron graph to new prepared raw graph.

Parameters
old_modelstr

frozen old graph model

raw_modelstr

new model that will accept ops from old model

outputstr

new model with transfered parameters will be saved to this location

**kwargs

additional arguments