Class DeepTensor
Defined in File DeepTensor.h
Class Documentation
-
class deepmd::DeepTensor
Deep Tensor.
Public Functions
-
DeepTensor()
Deep Tensor constructor without initialization.
-
DeepTensor(const std::string &model, const int &gpu_rank = 0, const std::string &name_scope = "")
Deep Tensor constructor with initialization..
- Parameters
model – [in] The name of the frozen model file.
gpu_rank – [in] The GPU rank. Default is 0.
file_content – [in] The content of the model file. If it is not empty, DP will read from the string instead of the file.
-
void init(const std::string &model, const int &gpu_rank = 0, const std::string &name_scope = "")
Initialize the Deep Tensor.
- Parameters
model – [in] The name of the frozen model file.
gpu_rank – [in] The GPU rank. Default is 0.
file_content – [in] The content of the model file. If it is not empty, DP will read from the string instead of the file.
-
void print_summary(const std::string &pre) const
Print the DP summary to the screen.
- Parameters
pre – [in] The prefix to each line.
-
void compute(std::vector<VALUETYPE> &value, const std::vector<VALUETYPE> &coord, const std::vector<int> &atype, const std::vector<VALUETYPE> &box)
Evaluate the value by using this model.
- Parameters
value – [out] The value to evalute, usually would be the atomic tensor.
coord – [in] The coordinates of atoms. The array should be of size 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 9.
-
void compute(std::vector<VALUETYPE> &value, const std::vector<VALUETYPE> &coord, const std::vector<int> &atype, const std::vector<VALUETYPE> &box, const int nghost, const InputNlist &inlist)
Evaluate the value by using this model.
- Parameters
value – [out] The value to evalute, usually would be the atomic tensor.
coord – [in] The coordinates of atoms. The array should be of size 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 9.
nghost – [in] The number of ghost atoms.
inlist – [in] The input neighbour list.
-
void compute(std::vector<VALUETYPE> &global_tensor, std::vector<VALUETYPE> &force, std::vector<VALUETYPE> &virial, const std::vector<VALUETYPE> &coord, const std::vector<int> &atype, const std::vector<VALUETYPE> &box)
Evaluate the global tensor and component-wise force and virial.
- Parameters
global_tensor – [out] The global tensor to evalute.
force – [out] The component-wise force of the global tensor, size odim x natoms x 3.
virial – [out] The component-wise virial of the global tensor, size odim x 9.
coord – [in] The coordinates of atoms. The array should be of size 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 9.
-
void compute(std::vector<VALUETYPE> &global_tensor, 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 &inlist)
Evaluate the global tensor and component-wise force and virial.
- Parameters
global_tensor – [out] The global tensor to evalute.
force – [out] The component-wise force of the global tensor, size odim x natoms x 3.
virial – [out] The component-wise virial of the global tensor, size odim x 9.
coord – [in] The coordinates of atoms. The array should be of size 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 9.
nghost – [in] The number of ghost atoms.
inlist – [in] The input neighbour list.
-
void compute(std::vector<VALUETYPE> &global_tensor, std::vector<VALUETYPE> &force, std::vector<VALUETYPE> &virial, std::vector<VALUETYPE> &atom_tensor, std::vector<VALUETYPE> &atom_virial, const std::vector<VALUETYPE> &coord, const std::vector<int> &atype, const std::vector<VALUETYPE> &box)
Evaluate the global tensor and component-wise force and virial.
- Parameters
global_tensor – [out] The global tensor to evalute.
force – [out] The component-wise force of the global tensor, size odim x natoms x 3.
virial – [out] The component-wise virial of the global tensor, size odim x 9.
atom_tensor – [out] The atomic tensor value of the model, size natoms x odim.
atom_virial – [out] The component-wise atomic virial of the global tensor, size odim x natoms x 9.
coord – [in] The coordinates of atoms. The array should be of size 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 9.
-
void compute(std::vector<VALUETYPE> &global_tensor, std::vector<VALUETYPE> &force, std::vector<VALUETYPE> &virial, std::vector<VALUETYPE> &atom_tensor, 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 &inlist)
Evaluate the global tensor and component-wise force and virial.
- Parameters
global_tensor – [out] The global tensor to evalute.
force – [out] The component-wise force of the global tensor, size odim x natoms x 3.
virial – [out] The component-wise virial of the global tensor, size odim x 9.
atom_tensor – [out] The atomic tensor value of the model, size natoms x odim.
atom_virial – [out] The component-wise atomic virial of the global tensor, size odim x natoms x 9.
coord – [in] The coordinates of atoms. The array should be of size 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 9.
nghost – [in] The number of ghost atoms.
inlist – [in] The input neighbour list.
-
inline int numb_types() const
Get the number of types.
- Returns
The number of types.
-
inline int output_dim() const
Get the output dimension.
- Returns
The output dimension.
-
inline const std::vector<int> &sel_types() const
-
DeepTensor()