sponge.potential.PotentialCell

View Source On Gitee
class sponge.potential.PotentialCell(num_energies: int = 1, energy_names: Union[str, List[str]] = 'potential', length_unit: str = None, energy_unit: str = None, use_pbc: bool = None, name: str = 'potential', **kwargs)[source]

Base class for potential energy. The PotentialCell is a special subclass of EnergyCell. The main difference with EnergyCell is that normally EnergyCell only outputs one energy term, so that EnergyCell returns a Tensor of the shape (B, 1). And a PotentialCell can output multiple energy items, so it returns a Tensor of the shape (B, E). Besides, by default the units of PotentialCell are equal to the global units.

Note

B: Batchsize, i.e. number of walkers in simulation. E: Number of energy terms.

Parameters
  • num_energies (int) – Number of the outputs of energy terms. Default: 1.

  • energy_names (Union[str, List[str]]) – Names of energy terms. Default: "potential".

  • length_unit (str) – Length unit. If None is given, it will be assigned with the global length unit. Default: None.

  • energy_unit (str) – Energy unit. If None is given, it will be assigned with the global energy unit. Default: None.

  • use_pbc (bool) – Whether to use periodic boundary condition.

  • name (str) – Name of energy. Default: "potential".

  • kwargs (dict) – Other parameters dictionary.

Inputs:
  • coordinates (Tensor) - Tensor of shape (B, A, D). Data type is float. Position coordinate of atoms in system.

  • neighbour_index (Tensor) - Tensor of shape (B, A, N). Data type is int. Index of neighbour atoms. Default: None.

  • neighbour_mask (Tensor) - Tensor of shape (B, A, N). Data type is bool. Mask for neighbour atoms. Default: None.

  • neighbour_vector (Tensor) - Tensor of shape (B, A, N, D). Data type is bool. Vectors from central atom to neighbouring atoms. Default: None.

  • neighbour_distances (Tensor) - Tensor of shape (B, A, N). Data type is float. Distance between neighbours atoms. Default: None.

  • pbc_box (Tensor) - Tensor of shape (B, D). Data type is float. Tensor of PBC box. Default: None.

Outputs:

potential, Tensor of shape (B, E). Data type is float.

Supported Platforms:

Ascend GPU

property energy_names: List[str]

List of strings of energy names.

Returns

List[str], strings of energy names.

property exclude_index: mindspore.common.tensor.Tensor

Exclude index.

Returns

Tensor, exclude index.

property num_energies: int

Number of energy components.

Returns

int, number of energy components.

set_exclude_index(exclude_index: Tensor)[source]

Set excluded index.

Parameters

exclude_index (Tensor) – Excluded index of the system.

Returns

Tensor, excluded index.

set_pbc(use_pbc: bool = None)[source]

Set PBC box.

Parameters

use_pbc (bool) – Whether to use periodic boundary condition.