Class DeepSpinModelDevi#

Inheritance Relationships#

Base Type#

Class Documentation#

class DeepSpinModelDevi : public deepmd::DeepBaseModelDevi#

Public Functions

DeepSpinModelDevi()#

DP model deviation constructor without initialization.

virtual ~DeepSpinModelDevi()#
DeepSpinModelDevi(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:
  • models[in] The names of the frozen model files.

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

  • file_contents[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:
  • models[in] The names of the frozen model files.

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

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

template<typename VALUETYPE>
void compute(std::vector<ENERGYTYPE> &all_ener, std::vector<std::vector<VALUETYPE>> &all_force, std::vector<std::vector<VALUETYPE>> &all_force_mag, std::vector<std::vector<VALUETYPE>> &all_virial, const std::vector<VALUETYPE> &coord, const std::vector<VALUETYPE> &spin, const std::vector<int> &atype, const std::vector<VALUETYPE> &box, 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 spin models.

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

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

  • all_force_mag[out] The magnetic 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.

  • spin[in] The spins of atoms, [0, 0, 0] if no spin. 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.

  • 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.

template<typename VALUETYPE>
void compute(std::vector<ENERGYTYPE> &all_ener, std::vector<std::vector<VALUETYPE>> &all_force, std::vector<std::vector<VALUETYPE>> &all_force_mag, 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<VALUETYPE> &spin, const std::vector<int> &atype, const std::vector<VALUETYPE> &box, 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 spin models.

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

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

  • all_force_mag[out] The magnetic 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.

  • spin[in] The spins of atoms, [0, 0, 0] if no spin. 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.

  • 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.

template<typename VALUETYPE>
void compute(std::vector<ENERGYTYPE> &all_ener, std::vector<std::vector<VALUETYPE>> &all_force, std::vector<std::vector<VALUETYPE>> &all_force_mag, std::vector<std::vector<VALUETYPE>> &all_virial, const std::vector<VALUETYPE> &coord, const std::vector<VALUETYPE> &spin, 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, magnetic force and virial by using these DP spin models.

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

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

  • all_force_mag[out] The magnetic 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.

  • spin[in] The spins of atoms, [0, 0, 0] if no spin. 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.

template<typename VALUETYPE>
void compute(std::vector<ENERGYTYPE> &all_ener, std::vector<std::vector<VALUETYPE>> &all_force, std::vector<std::vector<VALUETYPE>> &all_force_mag, 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<VALUETYPE> &spin, 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, magnetic force, virial, atomic energy, and atomic virial by using these DP spin models.

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

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

  • all_force_mag[out] The magnetic 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.

  • spin[in] The spins of atoms, [0, 0, 0] if no spin. 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.

Protected Attributes

std::vector<std::shared_ptr<deepmd::DeepSpin>> dps#