Class DeepPotModelDevi

Class Documentation

class deepmd::DeepPotModelDevi

Public Functions

DeepPotModelDevi()

DP model deviation constructor without initialization.

~DeepPotModelDevi()
DeepPotModelDevi(const std::vector<std::string> &models, const int &gpu_rank = 0, const std::vector<std::string> &file_contents = std::vector<std::string>())

DP model deviation constructor with initialization.

Parameters
  • model[in] The names of the frozen model files.

  • gpu_rank[in] The GPU rank. Default is 0.

  • file_content[in] The contents of the model files. If it is not empty, DP will read from the strings instead of the files.

void init(const std::vector<std::string> &models, const int &gpu_rank = 0, const std::vector<std::string> &file_contents = std::vector<std::string>())

Initialize the DP model deviation contrcutor.

Parameters
  • model[in] The names of the frozen model files.

  • gpu_rank[in] The GPU rank. Default is 0.

  • file_content[in] The contents of the model files. If it is not empty, DP will read from the strings instead of the files.

void compute(std::vector<ENERGYTYPE> &all_ener, std::vector<std::vector<VALUETYPE>> &all_force, std::vector<std::vector<VALUETYPE>> &all_virial, const std::vector<VALUETYPE> &coord, const std::vector<int> &atype, const std::vector<VALUETYPE> &box, const int nghost, const InputNlist &lmp_list, const int &ago, const std::vector<VALUETYPE> &fparam = std::vector<VALUETYPE>(), const std::vector<VALUETYPE> &aparam = std::vector<VALUETYPE>())

Evaluate the energy, force and virial by using these DP models.

Parameters
  • all_ener[out] The system energies of all models.

  • all_force[out] The forces on each atom of all models.

  • all_virial[out] The virials of all models.

  • coord[in] The coordinates of atoms. The array should be of size nframes x natoms x 3.

  • atype[in] The atom types. The list should contain natoms ints.

  • box[in] The cell of the region. The array should be of size nframes x 9.

  • nghost[in] The number of ghost atoms.

  • lmp_list[in] The input neighbour list.

  • ago[in] Update the internal neighbour list if ago is 0.

  • fparam[in] The frame parameter. The array can be of size : nframes x dim_fparam. dim_fparam. Then all frames are assumed to be provided with the same fparam.

  • aparam[in] The atomic parameter The array can be of size : nframes x natoms x dim_aparam. natoms x dim_aparam. Then all frames are assumed to be provided with the same aparam. dim_aparam. Then all frames and atoms are provided with the same aparam.

void compute(std::vector<ENERGYTYPE> &all_ener, std::vector<std::vector<VALUETYPE>> &all_force, std::vector<std::vector<VALUETYPE>> &all_virial, std::vector<std::vector<VALUETYPE>> &all_atom_energy, std::vector<std::vector<VALUETYPE>> &all_atom_virial, const std::vector<VALUETYPE> &coord, const std::vector<int> &atype, const std::vector<VALUETYPE> &box, const int nghost, const InputNlist &lmp_list, const int &ago, const std::vector<VALUETYPE> &fparam = std::vector<VALUETYPE>(), const std::vector<VALUETYPE> &aparam = std::vector<VALUETYPE>())

Evaluate the energy, force, virial, atomic energy, and atomic virial by using these DP models.

Parameters
  • all_ener[out] The system energies of all models.

  • all_force[out] The forces on each atom of all models.

  • all_virial[out] The virials of all models.

  • all_atom_energy[out] The atomic energies of all models.

  • all_atom_virial[out] The atomic virials of all models.

  • coord[in] The coordinates of atoms. The array should be of size nframes x natoms x 3.

  • atype[in] The atom types. The list should contain natoms ints.

  • box[in] The cell of the region. The array should be of size nframes x 9.

  • nghost[in] The number of ghost atoms.

  • lmp_list[in] The input neighbour list.

  • ago[in] Update the internal neighbour list if ago is 0.

  • fparam[in] The frame parameter. The array can be of size : nframes x dim_fparam. dim_fparam. Then all frames are assumed to be provided with the same fparam.

  • aparam[in] The atomic parameter The array can be of size : nframes x natoms x dim_aparam. natoms x dim_aparam. Then all frames are assumed to be provided with the same aparam. dim_aparam. Then all frames and atoms are provided with the same aparam.

inline VALUETYPE cutoff() const

Get the cutoff radius.

Returns

The cutoff radius.

inline int numb_types() const

Get the number of types.

Returns

The number of types.

inline int dim_fparam() const

Get the dimension of the frame parameter.

Returns

The dimension of the frame parameter.

inline int dim_aparam() const

Get the dimension of the atomic parameter.

Returns

The dimension of the atomic parameter.

void compute_avg(ENERGYTYPE &dener, const std::vector<ENERGYTYPE> &all_energy)

Compute the average energy.

Parameters
  • dener[out] The average energy.

  • all_energy[in] The energies of all models.

void compute_avg(VALUETYPE &dener, const std::vector<VALUETYPE> &all_energy)

Compute the average energy.

Parameters
  • dener[out] The average energy.

  • all_energy[in] The energies of all models.

void compute_avg(std::vector<VALUETYPE> &avg, const std::vector<std::vector<VALUETYPE>> &xx)

Compute the average of vectors.

Parameters
  • avg[out] The average of vectors.

  • xx[in] The vectors of all models.

void compute_std(std::vector<VALUETYPE> &std, const std::vector<VALUETYPE> &avg, const std::vector<std::vector<VALUETYPE>> &xx, const int &stride)

Compute the standard deviation of vectors.

Parameters
  • std[out] The standard deviation of vectors.

  • avg[in] The average of vectors.

  • xx[in] The vectors of all models.

  • stride[in] The stride to compute the deviation.

void compute_relative_std(std::vector<VALUETYPE> &std, const std::vector<VALUETYPE> &avg, const VALUETYPE eps, const int &stride)

Compute the relative standard deviation of vectors.

Parameters
  • std[out] The standard deviation of vectors.

  • avg[in] The average of vectors.

  • eps[in] The level parameter for computing the deviation.

  • stride[in] The stride to compute the deviation.

void compute_std_e(std::vector<VALUETYPE> &std, const std::vector<VALUETYPE> &avg, const std::vector<std::vector<VALUETYPE>> &xx)

Compute the standard deviation of atomic energies.

Parameters
  • std[out] The standard deviation of atomic energies.

  • avg[in] The average of atomic energies.

  • xx[in] The vectors of all atomic energies.

void compute_std_f(std::vector<VALUETYPE> &std, const std::vector<VALUETYPE> &avg, const std::vector<std::vector<VALUETYPE>> &xx)

Compute the standard deviation of forces.

Parameters
  • std[out] The standard deviation of forces.

  • avg[in] The average of forces.

  • xx[in] The vectors of all forces.

void compute_relative_std_f(std::vector<VALUETYPE> &std, const std::vector<VALUETYPE> &avg, const VALUETYPE eps)

Compute the relative standard deviation of forces.

Parameters
  • std[out] The relative standard deviation of forces.

  • avg[in] The relative average of forces.

  • eps[in] The level parameter for computing the deviation.