DeePMD-kit API

class deepmd.Data.DataSets(sys_path, set_prefix, seed=None, shuffle_test=True)
check_batch_size(batch_size)
check_test_size(test_size)
get_batch(batch_size)

returned property prefector [4] in order: energy, force, virial, atom_ener

get_ener()
get_natoms()
get_natoms_2(ntypes)
get_natoms_vec(ntypes)
get_numb_set()
get_set(data, idx=None)
get_sys_numb_batch(batch_size)
get_test()

returned property prefector [4] in order: energy, force, virial, atom_ener

get_type_map()
load_batch_set(set_name)
load_data(set_name, data_name, shape, is_necessary=True)
load_energy(set_name, nframes, nvalues, energy_file, atom_energy_file)

return : coeff_ener, ener, coeff_atom_ener, atom_ener

load_set(set_name, shuffle=True)
load_test_set(set_name, shuffle_test)
load_type(sys_path)
load_type_map(sys_path)
numb_aparam()
numb_fparam()
reset_iter()
set_numb_batch(batch_size)
stats_energy()
class deepmd.Data.DeepmdData(sys_path, set_prefix='set', shuffle_test=True, type_map=None, modifier=None)
add(key, ndof, atomic=False, must=False, high_prec=False, type_sel=None, repeat=1)
avg(key)
check_batch_size(batch_size)
check_test_size(test_size)
get_atom_type()
get_batch(batch_size)
get_data_dict()
get_natoms()
get_natoms_vec(ntypes)
get_ntypes()
get_numb_batch(batch_size, set_idx)
get_numb_set()
get_sys_numb_batch(batch_size)
get_test(ntests=-1)
get_type_map()
reduce(key_out, key_in)
reset_get_batch()
class deepmd.DataModifier.DipoleChargeModifier(model_name, model_charge_map, sys_charge_map, ewald_h=1, ewald_beta=1)
build_fv_graph()
eval(coord, box, atype, eval_fv=True)
eval_fv(coords, cells, atom_types, ext_f)
modify_data(data)
class deepmd.DataSystem.DataSystem(systems, set_prefix, batch_size, test_size, rcut, run_opt=None)
check_type_map_consistency(type_map_list)
compute_energy_shift()
format_name_length(name, width)
get_batch(sys_idx=None, sys_weights=None, style='prob_sys_size')
get_batch_size()
get_nbatches()
get_nsystems()
get_ntypes()
get_sys(sys_idx)
get_test(sys_idx=None)
get_type_map()
numb_fparam()
print_summary(run_opt)
process_sys_weights(sys_weights)
class deepmd.DataSystem.DeepmdDataSystem(systems, batch_size, test_size, rcut, set_prefix='set', shuffle_test=True, type_map=None, modifier=None)
add(key, ndof, atomic=False, must=False, high_prec=False, type_sel=None, repeat=1)
add_dict(adict)
compute_energy_shift(rcond=0.001, key='energy')
get_batch(sys_idx=None, sys_probs=None, auto_prob_style='prob_sys_size')

Get a batch of data from the data system

sys_idx: int
The index of system from which the batch is get. If sys_idx is not None, sys_probs and auto_prob_style are ignored If sys_idx is None, automatically determine the system according to sys_probs or auto_prob_style, see the following.
sys_probs: list of float
The probabilitis of systems to get the batch. Summation of positive elements of this list should be no greater than 1. Element of this list can be negative, the probability of the corresponding system is determined automatically by the number of batches in the system.
auto_prob_style: float

Determine the probability of systems automatically. The method is assigned by this key and can be - “prob_uniform” : the probability all the systems are equal, namely 1.0/self.get_nsystems() - “prob_sys_size” : the probability of a system is proportional to the number of batches in the system - “prob_sys_size;stt_idx:end_idx:weight;stt_idx:end_idx:weight;…” :

the list of systems is devided into blocks. A block is specified by stt_idx:end_idx:weight, where stt_idx is the starting index of the system, end_idx is then ending (not including) index of the system, the probabilities of the systems in this block sums up to weight, and the relatively probabilities within this block is proportional to the number of batches in the system.
get_batch_size()
get_data_dict()
get_nbatches()
get_nsystems()
get_ntypes()
get_sys(idx)
get_sys_ntest(sys_idx=None)

Get number of tests for the currently selected system, or one defined by sys_idx.

get_test(sys_idx=None, n_test=-1)
get_type_map()
print_summary(run_opt, sys_probs=None, auto_prob_style='prob_sys_size')
reduce(key_out, key_in)
class deepmd.DeepDipole.DeepDipole(model_file, load_prefix='load', default_tf_graph=False)
class deepmd.DeepEval.DeepEval(model_file, load_prefix='load', default_tf_graph=False)

common methods for DeepPot, DeepWFC, DeepPolar, …

make_natoms_vec(atom_types)
reverse_map(vec, imap)
sort_input(coord, atom_type, sel_atoms=None)
class deepmd.DeepEval.DeepTensor(model_file, variable_name, variable_dof, load_prefix='load', default_tf_graph=False)

Evaluates a tensor model

eval(coords, cells, atom_types, atomic=True)
get_ntypes()
get_rcut()
get_sel_type()
get_type_map()
class deepmd.DeepPolar.DeepGlobalPolar(model_file, default_tf_graph=False)
eval(coords, cells, atom_types)
class deepmd.DeepPolar.DeepPolar(model_file, default_tf_graph=False)
class deepmd.DeepPot.DeepPot(model_file, default_tf_graph=False)
eval(coords, cells, atom_types, fparam=None, aparam=None, atomic=False)
eval_inner(coords, cells, atom_types, fparam=None, aparam=None, atomic=False)
get_dim_aparam()
get_dim_fparam()
get_ntypes()
get_rcut()
get_type_map()
class deepmd.DeepWFC.DeepWFC(model_file, default_tf_graph=False)
class deepmd.DescrptLocFrame.DescrptLocFrame(jdata)
build(coord_, atype_, natoms, box_, mesh, suffix='', reuse=None)
compute_input_stats(data_coord, data_box, data_atype, natoms_vec, mesh)
get_dim_out()
get_nlist()
get_ntypes()
get_rcut()
get_rot_mat()
prod_force_virial(atom_ener, natoms)
class deepmd.DescrptSeA.DescrptSeA(jdata)
build(coord_, atype_, natoms, box_, mesh, suffix='', reuse=None)
compute_input_stats(data_coord, data_box, data_atype, natoms_vec, mesh)
get_dim_out()
get_dim_rot_mat_1()
get_nlist()
get_ntypes()
get_rcut()
get_rot_mat()
prod_force_virial(atom_ener, natoms)
class deepmd.DescrptSeAR.DescrptSeAR(jdata)
build(coord_, atype_, natoms, box, mesh, suffix='', reuse=None)
compute_input_stats(data_coord, data_box, data_atype, natoms_vec, mesh)
get_dim_out()
get_nlist_a()
get_nlist_r()
get_ntypes()
get_rcut()
prod_force_virial(atom_ener, natoms)
class deepmd.DescrptSeR.DescrptSeR(jdata)
build(coord_, atype_, natoms, box_, mesh, suffix='', reuse=None)
compute_input_stats(data_coord, data_box, data_atype, natoms_vec, mesh)
get_dim_out()
get_nlist()
get_ntypes()
get_rcut()
prod_force_virial(atom_ener, natoms)
class deepmd.EwaldRecp.EwaldRecp(hh, beta)
eval(coord, charge, box)
class deepmd.Fitting.DipoleFittingSeA(jdata, descrpt)
build(input_d, rot_mat, natoms, reuse=None, suffix='')
get_out_size()
get_sel_type()
class deepmd.Fitting.EnerFitting(jdata, descrpt)
build(inputs, input_dict, natoms, reuse=None, suffix='')
compute_input_stats(all_stat, protection)
compute_output_stats(all_stat)
get_numb_aparam()
get_numb_fparam()
class deepmd.Fitting.GlobalPolarFittingSeA(jdata, descrpt)
build(input_d, rot_mat, natoms, reuse=None, suffix='')
get_out_size()
get_sel_type()
class deepmd.Fitting.PolarFittingLocFrame(jdata, descrpt)
build(input_d, rot_mat, natoms, reuse=None, suffix='')
get_out_size()
get_sel_type()
class deepmd.Fitting.PolarFittingSeA(jdata, descrpt)
build(input_d, rot_mat, natoms, reuse=None, suffix='')
compute_input_stats(all_stat, protection=0.01)
get_out_size()
get_sel_type()
class deepmd.Fitting.WFCFitting(jdata, descrpt)
build(input_d, rot_mat, natoms, reuse=None, suffix='')
get_out_size()
get_sel_type()
get_wfc_numb()
class deepmd.LearningRate.LearningRateExp(jdata)
build(global_step, stop_batch=None)
start_lr()
value(batch)
class deepmd.Loss.EnerDipoleLoss(jdata, **kwarg)
build(learning_rate, natoms, model_dict, label_dict, suffix)
print_header()
print_on_training(sess, natoms, feed_dict_test, feed_dict_batch)
class deepmd.Loss.EnerStdLoss(jdata, **kwarg)
build(learning_rate, natoms, model_dict, label_dict, suffix)
print_header()
print_on_training(sess, natoms, feed_dict_test, feed_dict_batch)
class deepmd.Loss.TensorLoss(jdata, **kwarg)
build(learning_rate, natoms, model_dict, label_dict, suffix)
print_header()
print_on_training(sess, natoms, feed_dict_test, feed_dict_batch)
class deepmd.Model.DipoleModel(jdata, descrpt, fitting)
class deepmd.Model.GlobalPolarModel(jdata, descrpt, fitting)
class deepmd.Model.Model(jdata, descrpt, fitting)
build(coord_, atype_, natoms, box, mesh, input_dict, suffix='', reuse=None)
data_stat(data)
get_ntypes()
get_rcut()
get_type_map()
model_type = 'ener'
class deepmd.Model.PolarModel(jdata, descrpt, fitting)
class deepmd.Model.TensorModel(jdata, descrpt, fitting, var_name)
build(coord_, atype_, natoms, box, mesh, input_dict, suffix='', reuse=None)
data_stat(data)
get_ntypes()
get_out_size()
get_rcut()
get_sel_type()
get_type_map()
class deepmd.Model.WFCModel(jdata, descrpt, fitting)
deepmd.Model.make_all_stat(data, nbatches, merge_sys=True)

pack data for statistics Parameters ———- data:

The data
merge_sys: bool (True)
Merge system data
all_stat:

A dictionary of list of list storing data for stat. if merge_sys == False data can be accessed by

all_stat[key][sys_idx][batch_idx][frame_idx]
else merge_sys == True can be accessed by
all_stat[key][batch_idx][frame_idx]
deepmd.Model.merge_sys_stat(all_stat)
deepmd.Network.one_layer(inputs, outputs_size, activation_fn=<function tanh>, precision=tf.float64, stddev=1.0, bavg=0.0, name='linear', reuse=None, seed=None, use_timestep=False, trainable=True, useBN=False)
class deepmd.TabInter.TabInter(filename)
get()
reinit(filename)
class deepmd.Trainer.NNPTrainer(jdata, run_opt)
build(data, stop_batch=0)
get_global_step()
print_head()
test_on_the_fly(fp, data, feed_dict_batch)
train(data)