sponge.partition.GridNeighbours
- class sponge.partition.GridNeighbours(cutoff: float, coordinate: Tensor, pbc_box: Tensor = None, atom_mask: Tensor = None, exclude_index: Tensor = None, num_neighbours: int = None, cell_capacity: int = None, num_cell_cut: int = 1, cutoff_scale: float = 1.2, cell_cap_scale: float = 1.25, grid_num_scale: float = 1.5)[source]
Neighbour list calculated by grids
- Parameters
cutoff (float) – Cutoff distance.
coordinate (Tensor) – Tensor of shape \((B, A, D)\). Data type is float32. position coordinates of atoms in the simulation system.
pbc_box (Tensor, optional) – Tensor of shape \((B, A, D)\). Data type is float32. Box size of periodic boundary condition. Default:
None
.atom_mask (Tensor, optional) – Tensor of shape \((B, A)\). Data type is bool_. Mask of atoms in the system. Default:
None
.exclude_index (Tensor, optional) – Tensor of shape \((B, A, Ex)\). Data type is int32. Index of neighbour atoms which could be excluded from the neighbour list. Default:
None
.num_neighbours (int, optional) – Number of neighbours. If
None
is given, this value will be calculated by the ratio of the number of neighbouring grids to the total number of grids. Default:None
.cell_capacity (int, optional) – Capacity number of atoms in grid cell. If
None
is given, this value will be multiplied by a factor of the maximum number of atoms in the grid cell at the initial coordinate. Default:None
.num_cell_cut (int, optional) – Number of subdivision of grid cells according to the cutoff. Default: 1
cutoff_scale (float, optional) – Factor to scale the cutoff distance. Default: 1.2
cell_cap_scale (float, optional) – Factor to scale cell_capacity. Default: 1.25
grid_num_scale (float, optional) – Scale factor to calculate num_neighbours by the ratio of grids. If num_neighbours is not
None
, it will not be used. Default: 1.5
Note
B: Number of simulation walker.
A: Number of atoms in system.
N: Number of neighbour atoms.
D: Dimension of position coordinates.
Ex: Maximum number of excluded neighbour atoms.
- Supported Platforms:
Ascend
GPU
Examples
>>> import sponge >>> from sponge.partition import GridNeighbours >>> import mindspore >>> from mindspore import Tensor >>> coordinate = Tensor([[[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]]]) >>> grid_neighbours = GridNeighbours(0.5, coordinate) >>> grid_neighbours(coordinate) (Tensor(shape=[1, 2, 2], dtype=Int32, value= [[[0, 1], [0, 1]]]), Tensor(shape=[1, 2, 2], dtype=Bool, value= [[[False, True], [ True, False]]]))