8. Command line interface

DeePMD-kit: A deep learning package for many-body potential energy representation and molecular dynamics

usage: dp [-h] [--version]
          {transfer,train,freeze,test,compress,doc-train-input,model-devi,convert-from,neighbor-stat,train-nvnmd,gui}
          ...

8.1. Named Arguments

--version

show program’s version number and exit

8.2. Valid subcommands

command

Possible choices: transfer, train, freeze, test, compress, doc-train-input, model-devi, convert-from, neighbor-stat, train-nvnmd, gui

8.3. Sub-commands

8.3.1. transfer

pass parameters to another model

dp transfer [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH]
            [-r RAW_MODEL] [-O OLD_MODEL] [-o OUTPUT]

8.3.1.1. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

-r, --raw-model

the model receiving parameters

Default: “raw_frozen_model.pb”

-O, --old-model

the model providing parameters

Default: “old_frozen_model.pb”

-o, --output

the model after passing parameters

Default: “frozen_model.pb”

8.3.2. train

train a model

dp train [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH]
         [-m {master,collect,workers}]
         [-i INIT_MODEL | -r RESTART | -f INIT_FRZ_MODEL | -t FINETUNE]
         [-o OUTPUT] [--skip-neighbor-stat]
         INPUT

8.3.2.1. Positional Arguments

INPUT

the input parameter file in json or yaml format

8.3.2.2. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

-m, --mpi-log

Possible choices: master, collect, workers

Set the manner of logging when running with MPI. ‘master’ logs only on main process, ‘collect’ broadcasts logs from workers to master and ‘workers’ means each process will output its own log

Default: “master”

-i, --init-model

Initialize the model by the provided path prefix of checkpoint files.

-r, --restart

Restart the training from the provided path prefix of checkpoint files.

-f, --init-frz-model

Initialize the training from the frozen model.

-t, --finetune

Finetune the frozen pretrained model.

-o, --output

The output file of the parameters used in training.

Default: “out.json”

--skip-neighbor-stat

Skip calculating neighbor statistics. Sel checking, automatic sel, and model compression will be disabled.

Default: False

examples:

dp train input.json dp train input.json –restart model.ckpt dp train input.json –init-model model.ckpt

8.3.3. freeze

freeze the model

dp freeze [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH]
          [-c CHECKPOINT_FOLDER] [-o OUTPUT] [-n NODE_NAMES] [-w NVNMD_WEIGHT]
          [--united-model]

8.3.3.1. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

-c, --checkpoint-folder

Path to checkpoint, either a folder containing checkpoint or the checkpoint prefix

Default: “.”

-o, --output

name of graph, will output to the checkpoint folder

Default: “frozen_model.pb”

-n, --node-names

the frozen nodes, if not set, determined from the model type

-w, --nvnmd-weight

the name of weight file (.npy), if set, save the model’s weight into the file

--united-model

When in multi-task mode, freeze all nodes into one united model

Default: False

examples:

dp freeze dp freeze -o graph.pb

8.3.4. test

test the model

dp test [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH] [-m MODEL]
        [-s SYSTEM | -f DATAFILE] [-S SET_PREFIX] [-n NUMB_TEST]
        [-r RAND_SEED] [--shuffle-test] [-d DETAIL_FILE] [-a]

8.3.4.1. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

-m, --model

Frozen model file to import

Default: “frozen_model.pb”

-s, --system

The system dir. Recursively detect systems in this directory

Default: “.”

-f, --datafile

The path to file of test list.

-S, --set-prefix

The set prefix

Default: “set”

-n, --numb-test

The number of data for test. 0 means all data.

Default: 0

-r, --rand-seed

The random seed

--shuffle-test

Shuffle test data

Default: False

-d, --detail-file

The prefix to files where details of energy, force and virial accuracy/accuracy per atom will be written

-a, --atomic

Test the accuracy of atomic label, i.e. energy / tensor (dipole, polar)

Default: False

examples:

dp test -m graph.pb -s /path/to/system -n 30

8.3.5. compress

compress a model

dp compress [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH]
            [-m {master,collect,workers}] [-i INPUT] [-o OUTPUT] [-s STEP]
            [-e EXTRAPOLATE] [-f FREQUENCY] [-c CHECKPOINT_FOLDER]
            [-t TRAINING_SCRIPT]

8.3.5.1. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

-m, --mpi-log

Possible choices: master, collect, workers

Set the manner of logging when running with MPI. ‘master’ logs only on main process, ‘collect’ broadcasts logs from workers to master and ‘workers’ means each process will output its own log

Default: “master”

-i, --input

The original frozen model, which will be compressed by the code

Default: “frozen_model.pb”

-o, --output

The compressed model

Default: “frozen_model_compressed.pb”

-s, --step

Model compression uses fifth-order polynomials to interpolate the embedding-net. It introduces two tables with different step size to store the parameters of the polynomials. The first table covers the range of the training data, while the second table is an extrapolation of the training data. The domain of each table is uniformly divided by a given step size. And the step(parameter) denotes the step size of the first table and the second table will use 10 * step as it’s step size to save the memory. Usually the value ranges from 0.1 to 0.001. Smaller step means higher accuracy and bigger model size

Default: 0.01

-e, --extrapolate

The domain range of the first table is automatically detected by the code: [d_low, d_up]. While the second table ranges from the first table’s upper boundary(d_up) to the extrapolate(parameter) * d_up: [d_up, extrapolate * d_up]

Default: 5

-f, --frequency

The frequency of tabulation overflow check(Whether the input environment matrix overflow the first or second table range). By default do not check the overflow

Default: -1

-c, --checkpoint-folder

path to checkpoint folder

Default: “model-compression”

-t, --training-script

The training script of the input frozen model

examples:

dp compress dp compress -i graph.pb -o compressed.pb

8.3.6. doc-train-input

print the documentation (in rst format) of input training parameters.

dp doc-train-input [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH]
                   [--out-type {rst,json}]

8.3.6.1. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

--out-type

Possible choices: rst, json

The output type

Default: “rst”

8.3.7. model-devi

calculate model deviation

dp model-devi [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH]
              [-m MODELS [MODELS ...]] [-s SYSTEM] [-S SET_PREFIX] [-o OUTPUT]
              [-f FREQUENCY] [--real_error] [--atomic] [--relative RELATIVE]
              [--relative_v RELATIVE_V]

8.3.7.1. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

-m, --models

Frozen models file to import

Default: [‘graph.000.pb’, ‘graph.001.pb’, ‘graph.002.pb’, ‘graph.003.pb’]

-s, --system

The system directory. Recursively detect systems in this directory.

Default: “.”

-S, --set-prefix

The set prefix

Default: “set”

-o, --output

The output file for results of model deviation

Default: “model_devi.out”

-f, --frequency

The trajectory frequency of the system

Default: 1

--real_error

Calculate the RMS real error of the model. The real data should be given in the systems.

Default: False

--atomic

Print the force model deviation of each atom.

Default: False

--relative

Calculate the relative model deviation of force. The level parameter for computing the relative model deviation of the force should be given.

--relative_v

Calculate the relative model deviation of virial. The level parameter for computing the relative model deviation of the virial should be given.

examples:

dp model-devi -m graph.000.pb graph.001.pb graph.002.pb graph.003.pb -s ./data -o model_devi.out

8.3.8. convert-from

convert lower model version to supported version

dp convert-from [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH]
                [-i INPUT_MODEL] [-o OUTPUT_MODEL]
                [{auto,0.12,1.0,1.1,1.2,1.3,2.0,pbtxt}]

8.3.8.1. Positional Arguments

FROM

Possible choices: auto, 0.12, 1.0, 1.1, 1.2, 1.3, 2.0, pbtxt

The original model compatibility

Default: “auto”

8.3.8.2. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

-i, --input-model

the input model

Default: “frozen_model.pb”

-o, --output-model

the output model If OUTPUT_MODEL ends with ‘.pbtxt’, the provided model will be converted to pbtxt format, without version conversion.

Default: “convert_out.pb”

examples:

dp convert-from -i graph.pb -o graph_new.pb dp convert-from auto -i graph.pb -o graph_new.pb dp convert-from 1.0 -i graph.pb -o graph_new.pb

8.3.9. neighbor-stat

Calculate neighbor statistics

dp neighbor-stat [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH]
                 [-s SYSTEM] -r RCUT -t TYPE_MAP [TYPE_MAP ...] [--one-type]

8.3.9.1. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

-s, --system

The system dir. Recursively detect systems in this directory

Default: “.”

-r, --rcut

cutoff radius

-t, --type-map

type map

--one-type

treat all types as a single type. Used with se_atten descriptor.

Default: False

examples:

dp neighbor-stat -s data -r 6.0 -t O H

8.3.10. train-nvnmd

train nvnmd model

dp train-nvnmd [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH]
               [-i INIT_MODEL] [-r RESTART] [-s {s1,s2}]
               [--skip-neighbor-stat]
               INPUT

8.3.10.1. Positional Arguments

INPUT

the input parameter file in json format

8.3.10.2. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

-i, --init-model

Initialize the model by the provided path prefix of checkpoint files.

-r, --restart

Restart the training from the provided prefix of checkpoint files.

-s, --step

Possible choices: s1, s2

steps to train model of NVNMD: s1 (train CNN), s2 (train QNN)

Default: “s1”

--skip-neighbor-stat

Skip calculating neighbor statistics. Sel checking, automatic sel, and model compression will be disabled.

Default: False

examples:

dp train-nvnmd input_cnn.json -s s1 dp train-nvnmd input_qnn.json -s s2 dp train-nvnmd input_cnn.json -s s1 –restart model.ckpt dp train-nvnmd input_cnn.json -s s2 –init-model model.ckpt

8.3.11. gui

Serve DP-GUI.

dp gui [-h] [-v {DEBUG,3,INFO,2,WARNING,1,ERROR,0}] [-l LOG_PATH] [-p PORT]
       [--bind_all]

8.3.11.1. Named Arguments

-v, --log-level

Possible choices: DEBUG, 3, INFO, 2, WARNING, 1, ERROR, 0

set verbosity level by string or number, 0=ERROR, 1=WARNING, 2=INFO and 3=DEBUG

Default: “INFO”

-l, --log-path

set log file to log messages to disk, if not specified, the logs will only be output to console

-p, --port

The port to serve DP-GUI on.

Default: 6042

--bind_all

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

Default: False