Class DeepPot#
Defined in File deepmd.hpp
Inheritance Relationships#
Base Type#
public deepmd::hpp::DeepBaseModel(Class DeepBaseModel)
Class Documentation#
- class DeepPot : public deepmd::hpp::DeepBaseModel#
Deep Potential.
Public Functions
- inline DeepPot()#
DP constructor without initialization.
- inline ~DeepPot()#
- inline DeepPot(const std::string &model, const int &gpu_rank = 0, const std::string &file_content = "")#
DP constructor with initialization.
- Parameters:
model – [in] The name of the frozen model file.
gpu_rank – [in] The GPU rank.
file_content – [in] The content of the frozen model file.
- inline void init(const std::string &model, const int &gpu_rank = 0, const std::string &file_content = "")#
Initialize the DP.
- Parameters:
model – [in] The name of the frozen model file.
gpu_rank – [in] The GPU rank.
file_content – [in] The content of the frozen model file.
- inline int dim_chg_spin() const#
Get the dimension of the charge/spin embedding input.
- Returns:
The dimension of the charge/spin input (0 if the model has no charge/spin embedding).
- inline void set_charge_spin(const std::vector<double> &charge_spin)#
Fix the charge/spin condition served for the rest of the run. It becomes the condition of every later evaluation that is not given one explicitly. Intended to be called once, before the first evaluation.
- Parameters:
charge_spin – [in] The condition, of length dim_chg_spin().
- inline void compute_edges_gpu(double *d_atom_energy, double *d_force, double *d_atom_virial, const double *d_coord, const int *d_atype, const int *d_edge_index, const double *d_edge_vec, const int nloc, const int nedge, const std::vector<double> &fparam, const std::vector<double> &aparam, const int nall_nodes = 0, const InputNlist *comm_nlist = nullptr)#
Evaluate a device-resident edge graph with FP64 edge vectors.
Edge, coordinate, type, and output pointers reside on the model device. Frame and atomic parameters remain host-resident because LAMMPS assembles them from computes, fixes, and pair-style settings.
- inline void compute_edges_gpu(double *d_atom_energy, double *d_force, double *d_atom_virial, const double *d_coord, const int *d_atype, const int *d_edge_index, const float *d_edge_vec, const int nloc, const int nedge, const std::vector<double> &fparam, const std::vector<double> &aparam, const int nall_nodes = 0, const InputNlist *comm_nlist = nullptr)#
Evaluate a device-resident edge graph with FP32 edge vectors.
- inline void compute_canonical_graph_gpu(double *d_atom_energy, double *d_force, double *d_atom_virial, const int64_t *d_atype, const uint32_t *d_source, const float *d_edge_vec, const int64_t *d_destination_row_ptr, const int64_t *d_source_row_ptr, const uint32_t *d_source_order, const int nloc, const int nall_nodes, const int64_t edge_storage)#
Evaluate a compact canonical graph on the model device.
- inline bool supports_device_edge_inference() const#
Query whether the loaded artifact supports device-edge inference.
- inline bool uses_fp32_edge_vectors() const#
Query whether the loaded artifact expects FP32 edge vectors.
- inline bool uses_canonical_graph_inference() const#
Query whether the compact canonical graph ABI is active.
- template<typename VALUETYPE, typename ENERGYVTYPE>
inline void compute(ENERGYVTYPE &ener, std::vector<VALUETYPE> &force, std::vector<VALUETYPE> &virial, const std::vector<VALUETYPE> &coord, 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>(), const std::vector<VALUETYPE> &charge_spin = std::vector<VALUETYPE>())# Evaluate the energy, force and virial by using this DP.
Warning
Natoms should not be zero when computing multiple frames.
- Parameters:
ener – [out] The system energy.
force – [out] The force on each atom.
virial – [out] The virial.
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 (PBC) or empty (no PBC).
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.
charge_spin – [in] The charge/spin input. The array can be of size: nframes x dim_chg_spin. dim_chg_spin. Then all frames are assumed to be provided with the same charge_spin. Leave it empty to use the model’s stored default_chg_spin.
- template<typename VALUETYPE, typename ENERGYVTYPE>
inline void compute(ENERGYVTYPE &ener, std::vector<VALUETYPE> &force, std::vector<VALUETYPE> &virial, std::vector<VALUETYPE> &atom_energy, std::vector<VALUETYPE> &atom_virial, const std::vector<VALUETYPE> &coord, 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>(), const std::vector<VALUETYPE> &charge_spin = std::vector<VALUETYPE>())# Evaluate the energy, force, virial, atomic energy, and atomic virial by using this DP.
Warning
Natoms should not be zero when computing multiple frames.
- Parameters:
ener – [out] The system energy.
force – [out] The force on each atom.
virial – [out] The virial.
atom_energy – [out] The atomic energy.
atom_virial – [out] The atomic virial.
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 (PBC) or empty (no PBC).
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.
charge_spin – [in] The charge/spin input. The array can be of size: nframes x dim_chg_spin. dim_chg_spin. Then all frames are assumed to be provided with the same charge_spin. Leave it empty to use the model’s stored default_chg_spin.
- template<typename VALUETYPE, typename ENERGYVTYPE>
inline void compute(ENERGYVTYPE &ener, std::vector<VALUETYPE> &force, std::vector<VALUETYPE> &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>(), const std::vector<VALUETYPE> &charge_spin = std::vector<VALUETYPE>())# Evaluate the energy, force and virial by using this DP with the neighbor list.
Warning
Natoms should not be zero when computing multiple frames.
- Parameters:
ener – [out] The system energy.
force – [out] The force on each atom.
virial – [out] The virial.
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 (PBC) or empty (no PBC).
nghost – [in] The number of ghost atoms.
nlist – [in] The neighbor 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.
charge_spin – [in] The charge/spin input. The array can be of size: nframes x dim_chg_spin. dim_chg_spin. Then all frames are assumed to be provided with the same charge_spin. Leave it empty to use the model’s stored default_chg_spin.
- template<typename VALUETYPE, typename ENERGYVTYPE>
inline void compute(ENERGYVTYPE &ener, std::vector<VALUETYPE> &force, std::vector<VALUETYPE> &virial, std::vector<VALUETYPE> &atom_energy, std::vector<VALUETYPE> &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>(), const std::vector<VALUETYPE> &charge_spin = std::vector<VALUETYPE>())# Evaluate the energy, force, virial, atomic energy, and atomic virial by using this DP with the neighbor list.
Warning
Natoms should not be zero when computing multiple frames.
- Parameters:
ener – [out] The system energy.
force – [out] The force on each atom.
virial – [out] The virial.
atom_energy – [out] The atomic energy.
atom_virial – [out] The atomic virial.
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 (PBC) or empty (no PBC).
nghost – [in] The number of ghost atoms.
nlist – [in] The neighbor 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.
charge_spin – [in] The charge/spin input. The array can be of size: nframes x dim_chg_spin. dim_chg_spin. Then all frames are assumed to be provided with the same charge_spin. Leave it empty to use the model’s stored default_chg_spin.
- template<typename VALUETYPE, typename ENERGYVTYPE>
inline void compute_mixed_type(ENERGYVTYPE &ener, std::vector<VALUETYPE> &force, std::vector<VALUETYPE> &virial, const int &nframes, const std::vector<VALUETYPE> &coord, 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 this DP with the mixed type.
- Parameters:
ener – [out] The system energy.
force – [out] The force on each atom.
virial – [out] The virial.
nframes – [in] The number of frames.
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 (PBC) or empty (no PBC).
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.
- template<typename VALUETYPE, typename ENERGYVTYPE>
inline void compute_mixed_type(ENERGYVTYPE &ener, std::vector<VALUETYPE> &force, std::vector<VALUETYPE> &virial, std::vector<VALUETYPE> &atom_energy, std::vector<VALUETYPE> &atom_virial, const int &nframes, const std::vector<VALUETYPE> &coord, 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 this DP with the mixed type.
- Parameters:
ener – [out] The system energy.
force – [out] The force on each atom.
virial – [out] The virial.
atom_energy – [out] The atomic energy.
atom_virial – [out] The atomic virial.
nframes – [in] The number of frames.
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 (PBC) or empty (no PBC).
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.
- inline DeepPot()#