dptools.cli package
- class dptools.cli.BaseCLI(parser)
Bases:
objectBase class for CLI commands. More or less just a template for reference.
- Parameters:
parser (argparse.ArgumentParser) – argparse parser for parsing CLI command arguments
- add_args()
Command specific arguments
- help_info = ''
- main(args)
Command specific main method
- class dptools.cli.MyFormatter(prog, indent_increment=2, max_help_position=24, width=None)
Bases:
ArgumentDefaultsHelpFormatterHelpFormatter that replaces reST refs in docstrings with readthedocs URLs to print to console. Also dedents and retains docstring format.
- dptools.cli.main()
Submodules
dptools.cli.convert module
- class dptools.cli.convert.CLI(parser)
Bases:
BaseCLIConvert between structure ASE/VASP/LAMMPS file types.
Examples:
$ dptools convert thing.cif thing.traj $ dptools convert md_000/vasprun.xml md_001/vasprun.xml full_md.traj $ dptools convert md_???/vasprun.xml full_md.traj # equivalent to above $ dptools convert -i ::10 vasprun.xml condensed_traj.traj
- add_args()
Command specific arguments
- get_kwargs(inputs)
- help_info = 'Convert between structure file types (e.g., .xml to .db)'
- main(args)
Command specific main method
dptools.cli.get module
- class dptools.cli.get.CLI(parser)
Bases:
BaseCLIGet params.yaml for specific simulation type. Can also be used to get in.json file (deepmd-kit training parameters).
Examples:
$ dptools get cellopt $ dptools get list # see available simulation options $ dptools get nvt-md $ dptools get nvt-md.900K # custom simulation params $ dptools get in.json # get training param file
- add_args()
Command specific arguments
- help_info = 'Get params.yaml for specific simulation type'
- main(args)
Command specific main method
dptools.cli.info module
- class dptools.cli.info.CLI(parser)
Bases:
BaseCLIDisplay information on set DP models and Slurm parameters.
Examples:
$ dptools info # display all set environments $ dptools info -m water # display specific labelled environment
- add_args()
Command specific arguments
- static get_env_name(env_file)
Get corresponding name for .env.* file, e.g. water from .env.water.
- Parameters:
env_file (str) – path to .env file to get corresponding label (name).
- Returns:
label (str) – name of environment that is appended to .env file.
- help_info = 'Show loaded DP models and sbatch parameters'
- main(args)
Command specific main method
- set_info(env_file)
Get and set all env key-value info.
- Parameters:
env_file (str) – path to .env file to get and set info for.
- summarize()
Print out semi-formatted env info.
dptools.cli.input module
- class dptools.cli.input.CLI(parser)
Bases:
BaseCLICreate deepmd-kit training set folder from ASE .db, .traj, or vasprun.xml files.
Examples:
$ dptools input 00_system1.db 00_system2.db $ dptools input 0*_sys*.db # equivalent to above $ dptools input 00_system1/vasprun.xml 00_system2/vasprun.xml $ dptools input -p /path/to/dataset/folder 0*.db
- add_args()
Command specific arguments
- help_info = 'Set up deepmd-kit training input from ASE/VASP output'
- main(args)
Command specific main method
- set_name(input_file)
dptools.cli.parity module
- class dptools.cli.parity.CLI(parser)
Bases:
BaseCLIGenerate parity plots comparing DP model accuracy for energy and force (and stress if available) predictions with ab-initio values.
Examples:
$ dptools parity $ dptools parity /path/to/dataset/system*/test/set* $ dptools parity -m ../old_graph.pb test_set.traj $ dptools parity -l mae
- add_args()
Command specific arguments
- help_info = 'Generate energy and force (and stress if available) prediction parity plots for DP model'
- main(args)
Command specific main method
- static read_systems()
Load test sets from system paths in in.json training parameter file.
- Returns:
list of str – Paths to system test sets found in training json file.
dptools.cli.reset module
- class dptools.cli.reset.CLI(parser)
Bases:
BaseCLIReset models or sbatch parameters for environments made using
dptools set ....Examples:
$ dptools reset all $ dptools reset -m water all $ dptools reset sbatch
- add_args()
Command specific arguments
- help_info = 'Reset model or sbatch params for default or labeled dptools env'
- main(args)
Command specific main method
dptools.cli.run module
- class dptools.cli.run.CLI(parser)
Bases:
BaseCLIRun LAMMPS simulations using trained DP models.
Examples:
$ dptools run opt start.traj # simple atomic position optimization $ dptools run cellopt start.traj # simple unit cell optimization $ dptools run /path/to/params.yaml start.traj # custom param file simulation $ dptools run -s eos 0*/start.traj # submit slurm job eos simulations on multiple structures $ dptools run -s -m water nvt-md start.traj # submit slurm nvt-md run using set water model
- add_args()
Command specific arguments
- help_info = "Run simulation using trained DP model (USE COMMAND 'dptools set path/to/graph.pb' first)"
- main(args)
Command specific main method
- run()
Sequentially setup and run simulations on all structure inputs.
- set_model(model_label)
Load specific model (if model_label is not None) and set corresponding graph and type_map.
- Parameters:
model_label (str or None) – Label of specific model environment to load.
- set_params(calc_arg)
Set simulation parameters either from simulation keyword or params.yaml file.
Note
If using parameter file, you must at least retain the .yaml extension.
- Parameters:
calc_arg (str) – simulation keyword (e.g. opt) or path to params.yaml file.
- set_structures(structures)
Read and set structure inputs as ase.Atoms objects and set corresponding dirs. Only reads last index unless calc_type == spe, in which case single points are ran on all images of structure file.
- Parameters:
structures (list of str) – Paths to structure inputs to run simulations on (.traj, .xyz, .cif, etc.).
- submit_jobs(sub=True)
Setup and (optionally) submit slurm jobs on all structure inputs.
- Parameters:
sub (bool, optional) – Submits slurm jobs if True, else only writes input files without submitting.
dptools.cli.sample module
- class dptools.cli.sample.CLI(parser)
Bases:
BaseCLIIntelligently select new training configurations using an ensemble of models and the approach described in DP-GEN (DOI: 10.1016/j.cpc.2020.107206).
Examples:
$ dptools sample -n 200 nvt-md.traj $ dptools sample -n 100 --lo 0.05 --hi 0.25 nvt-md.traj $ dptools sample -m water_ensemble -p npt-md.traj
- add_args()
Command specific arguments
- help_info = 'Select new training configs from MD traj using force prediction deviations from ensemble of DPs'
- load_ensemble(ensemble)
- main(args)
Command specific main method
- plot(steps=False)
- sample(configs, args)
- set_configs(configs)
dptools.cli.set module
- class dptools.cli.set.CLI(parser)
Bases:
BaseCLISet DP models, Slurm settings, calculation parameters, or deepmd-kit training parameters
Examples:
$ dptools set /home/user/projects/dp_models/h2o.pb $ dptools set 00/graph.pb 01/graph.pb 02/graph.pb 03/graph.pb # ensemble $ dptools set -m water /home/user/projects/dp_models/h2o.pb $ dptools set -m hpc_para parallel_settings.sh $ dptools set -m hpc_serial serial_settings.sh $ dptools set params.yaml $ dptools set /path/to/in.json
- add_args()
Command specific arguments
- help_info = 'Set DP model defaults, calculation parameters, or sbatch settings'
- main(args)
Command specific main method
- set(thing, **kwargs)
Set file parameters to .env or simulation parameters to yaml file.
Note
Multiple .pb inputs allowed for setting model ensembles.
- Parameters:
thing (str) – Path to file you want to set (.pb, .sh, .yaml, or .json file).
dptools.cli.train module
- class dptools.cli.train.CLI(parser)
Bases:
BaseCLISetup and submit jobs to train single or ensemble of deepmd-kit models.
Examples:
$ dptools train /path/to/dataset # simple single model $ dptools train -e /path/to/dataset # ensemble (4) of models $ dptools train -e -s /path/to/dataset # submit 4 slurm jobs to train ensemble $ dptools train -p /path/to/training/dir /path/to/dataset # specify dir to train in $ dptools train -i /path/to/in.json /path/to/dataset # specify in.json parameter file
- add_args()
Command specific arguments
- static get_hpc_info()
- help_info = 'Setup and submit jobs to train deepmd-kit models'
- link_dirs(in_json)
Find and add all system training and validation set folders found in dataset directory to in_json.
- Parameters:
in_json (dict) – jsonnable dictionary with deepmd-kit training parameters.
- main(args)
Command specific main method
- set_types(in_json)
Load type_map.json from dataset directory and add types to in_json.
- Parameters:
in_json (dict) – jsonnable dictionary with deepmd-kit training parameters.
- setup()
Loads training parameter json file, updates with relevant info (random seeds, training/validation dirs, type map), and writes to training dir.
- submit_jobs()
Write and submit Slurm job(s) to train model or ensemble of models.
- static write_json(src, dest)
Writes training parameter json file to specified training directory.
- Parameters:
src (dict) – jsonnable dictionary with deepmd-kit training parameters.
dest (str) – Path to training directory to write .json file to