Class DeepTensor

Class Documentation

class DeepTensor

Deep Tensor.

Public Functions

DeepTensor()

Deep Tensor constructor without initialization.

~DeepTensor()
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.

  • name_scope[in] Name scopes of operations.

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.

  • name_scope[in] Name scopes of operations.

void print_summary(const std::string &pre) const

Print the DP summary to the screen.

Parameters

pre[in] The prefix to each line.

template<typename VALUETYPE>
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.

template<typename VALUETYPE>
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.

template<typename VALUETYPE>
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.

template<typename VALUETYPE>
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.

template<typename VALUETYPE>
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.

template<typename VALUETYPE>
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.

double cutoff() const

Get the cutoff radius.

Returns

The cutoff radius.

int numb_types() const

Get the number of types.

Returns

The number of types.

int output_dim() const

Get the output dimension.

Returns

The output dimension.

const std::vector<int> &sel_types() const

Get the list of sel types.

Returns

The list of sel types.

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.