Class DeepTensor

Class Documentation

class DeepTensor

Deep Tensor.

Public Functions

inline DeepTensor()

Deep Tensor constructor without initialization.

inline ~DeepTensor()
inline DeepTensor(const std::string &model, const int &gpu_rank = 0, const std::string &name_scope = "")

DeepTensor constructor with initialization.

Parameters:

model[in] The name of the frozen model file.

inline void init(const std::string &model, const int &gpu_rank = 0, const std::string &name_scope = "")

Initialize the DeepTensor.

Parameters:

model[in] The name of the frozen model file.

template<typename VALUETYPE>
inline void compute(std::vector<VALUETYPE> &tensor, const std::vector<VALUETYPE> &coord, const std::vector<int> &atype, const std::vector<VALUETYPE> &box)

Evaluate the tensor, force and virial by using this Deep Tensor.

Parameters:
  • tensor[out] The atomic tensor.

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

template<typename VALUETYPE>
inline void compute(std::vector<VALUETYPE> &tensor, const std::vector<VALUETYPE> &coord, const std::vector<int> &atype, const std::vector<VALUETYPE> &box, const int nghost, const InputNlist &lmp_list)

Evaluate the tensor, force and virial by using this Deep Tensor with the neighbor list.

Parameters:
  • tensor[out] The tensor.

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

template<typename VALUETYPE>
inline 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, force and virial by using this Deep Tensor.

Parameters:
  • global_tensor[out] The global tensor.

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

template<typename VALUETYPE>
inline 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, force, virial, atomic tensor, and atomic virial by using this Deep Tensor.

Parameters:
  • global_tensor[out] The global tensor.

  • force[out] The force on each atom.

  • virial[out] The virial.

  • atom_tensor[out] The atomic tensor.

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

template<typename VALUETYPE>
inline 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 &lmp_list)

Evaluate the global tensor, force and virial by using this Deep Tensor with the neighbor list.

Parameters:
  • global_tensor[out] The global tensor.

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

template<typename VALUETYPE>
inline 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 &lmp_list)

Evaluate the global tensor, force, virial, atomic tensor, and atomic virial by using this Deep Tensor with the neighbor list.

Parameters:
  • global_tensor[out] The global tensor.

  • force[out] The force on each atom.

  • virial[out] The virial.

  • atom_tensor[out] The atomic tensor.

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

inline double 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 output_dim() const

Get the output dimension.

Returns:

The output dimension.

inline std::vector<int> sel_types() const
inline void print_summary(const std::string &pre) const

Print the summary of DeePMD-kit, including the version and the build information.

Parameters:

pre[in] The prefix to each line.

inline void get_type_map(std::string &type_map)

Get the type map (element name of the atom types) of this model.

Parameters:

type_map[out] The type map of this model.