deepmdplugins Modules

deepmdplugins.submit Module

class hzdplugins.deepmdplugins.submit.deepmdInputGenerator(model={}, learning_rate={}, loss={}, training={})[source]

Bases: object

deepmdInputGenerator will help us to generate the input file for the deepmd-kit

export(filename)[source]

export function can help us generate the json file

Parameters

filename (python string) – the name of the json file

output()[source]

This function can output the current stages of the input file for deepmd-kit, very useful for checking which parameter is still missing

setDescriptor_se_a(sel, rcut=6.0, rcut_smth=0.5, neuron=[10, 20, 40], axis_neuron=4, activation_function='tanh', resnet_dt=False, type_one_side=False, precision='float64', trainable=True, seed=1, exclude_types=[], set_davg_zero=False)[source]

The se_a is (I think) the most popular descriptor, so that I should only used it in here.

Parameters
  • sel (python list) – a list of integers. The length of the list should be the same as the number of atom types in the system. sel[i] gives the selected number of typi-i neighbors. sel[i] is recommended to be larger than the maximally possible number of type-i neighbors in the cut-ff radius.

  • rcut (python float, optional) – the cut-off radius, defaults to 6.0

  • rcut_smth (python float, optional) – the 1/r term is smoothed from rcut to rcut_smth, defaults to 0.5

  • neuron (python list, optional) – number of neurons in each hidden layers of the embedding net. When two layers are of the same size or one layer is twice as large as the previous layer, a skip connection is built. defaults to [10, 20, 40]. This list could influence the accuracy of our model.

  • axis_neuron (python int, optional) – size of the submatrix of G (embedding matrix), defaults to 4

  • activation_function (python str, optional) – the activation function in the embedding net, supported activation functions are: relu, relu6, softplus, sigmoid, tanh, gelu, defaults to ‘tanh’

  • seed (python int.) – random seed for parameter initialization. Usually it is set to be 1.

  • resnet_dt (bool, optional) – whether to use a timestep in the skip connection, defaults to False

  • type_one_side (bool, optional) – try to build N_types embedding nets. Otherwise, building N_types^2 embedding nets, defaults to False

  • precision (str, optional) – the precision of the float numbers, defaults to ‘float64’

  • trainable (bool, optional) – if the parameters in the embedding net is trainable, defaults to True

  • exclude_types (list, optional) – the excluded types, defaults to []

  • set_davg_zero (bool, optional) – set the normalization average to zero. This option should be set when atom_ener in the energy fitting is used, defaults to False

Returns

the descriptor (feature vector) for each atom

Return type

a python list?

setFittingNet(fntype='ener', numb_fparam=0, numb_aparm=0, neuron=[120, 120, 120], activation_function='tanh', precision='float64', resnet_dt=True, trainable=True, rcond=0.001, seed=1, atom_ener=[])[source]

The fitting of physical properties

Parameters
  • fntype (python str, optional) – the types of the fitting, usually we like to fit the energy (potential energy surface), but deep potential can also fit dipole, polar and also global_polar, defaults to ‘ener’.

  • numb_fparam (int, optional) – the dimension of the frame parameter. If set to > 0, file fparam.npy should be included to provided the input fparams, defaults to 0

  • numb_aparm (int, optional) – the dimension of atomic parameter. If set to > 0, the aparam.npy should be included to provided the input aparams, defaults to 0

  • neuron (list, optional) – the number of neurons in each hidden layers of the fitting net, defaults to [120, 120, 120]

  • activation_function (str, optional) – the activation function used in the neural network, defaults to ‘tanh’

  • precision (str, optional) – the precision for float numbers, defaults to ‘float64’

  • resnet_dt (bool, optional) – whether to use a timestep in the skip connection, defaults to True

  • trainable (bool, optional) – whether the parameter in the fitting net is trainable, defaults to True

  • rcond (float, optional) – the condition number used to determine the initial energy shift for each type of atoms, defaults to 0.001

  • seed (int, optional) – random seed for parameter initialization of the fitting net, defaults to 1

  • atom_ener (list, optional) – specify the atomic energy in vacuum for each type, defaults to []

Returns

a dictionary that can be prepared in the mode stages

Return type

python dictionary

setLearningRate(lr_type='exp', decay_steps=5000, start_lr=0.001, stop_lr=1e-08)[source]
setLoss(start_pref_e=0.02, limit_pref_e=1.0, start_pref_f=1000, limit_pref_f=1.0, start_pref_v=0.0, limit_pref_v=0.0)[source]
setModel(type_map, descriptor, fitting_net)[source]

This function can help us set the parameters for the model part

Parameters
  • type_map (python list) – a list of elements investigated in here

  • descriptor (python dictionary) – the parameters for the descriptor, this can be generated by using self.setDescriptor_se_a() method

  • fitting_net (python dictionary) – the parameters for the fitting new, this can be generated by using self.setFittingNet() method

setTraining(systems=['./'], set_prefix='set', stop_batch=1000000, seed=1, numb_test=10, disp_file='lcurve.out', disp_freq=50, save_freq=100, save_ckpt='model.ckpt', load_ckpt='model.ckpt', disp_training=True, time_training=True, profiling=True, profiling_file='timeline.json')[source]

This function can help us generate the parameters for the training section

Parameters
  • stop_batch (int, optional) – the number of batches that we want to train the model, defaults to 1000000

  • seed (int, optional) – the seed for generating the random number, defaults to 1

  • disp_file (str, optional) – the output file for the error, defaults to ‘lcurve.out’

  • disp_freq (str, optional) – output every disp_freq steps, defaults to ‘500’

  • save_freq (str, optional) – steps for saving the training data, defaults to ‘1000’

  • save_ckpt (str, optional) – the file for storing the training stage, defaults to ‘model.ckpt’

  • time_training (bool, optional) – output the training time for each step, defaults to True

  • profiling (bool, optional) – output the profile (cpu / gpu usages for training), defaults to True

  • profiling_file (str, optional) – filename of the profiling data, defaults to ‘timeline.json’

class hzdplugins.deepmdplugins.submit.dpgenInputGenerator[source]

Bases: object

dpgenInputGenerator will help us to generate the input json file for the dpgen package.

class hzdplugins.deepmdplugins.submit.lammpsInputGenerator(sys_name, data_file, dp_graph_file, temperature, timestep, run_num)[source]

Bases: object

lammpsInputGenerator will help us to generate the input file for LAMMPS (if we want to combine the deepmd with lammps)

There are four parts of the input file for LAMMPS: * Initilization * System definition * Simulation settings * Run a simulation

export(filename)[source]
output()[source]