deepmd.pt.utils.neighbor_stat#

Classes#

NeighborStatOP

Class for getting neighbor statistics data information.

NeighborStat

Neighbor statistics using pure NumPy.

Module Contents#

class deepmd.pt.utils.neighbor_stat.NeighborStatOP(ntypes: int, rcut: float, mixed_types: bool)[source]#

Bases: torch.nn.Module

Class for getting neighbor statistics data information.

Parameters:
ntypes

The num of atom types

rcut

The cut-off radius

mixed_typesbool, optional

If True, treat neighbors of all types as a single type.

rcut[source]#
ntypes[source]#
mixed_types[source]#
forward(coord: torch.Tensor, atype: torch.Tensor, cell: torch.Tensor | None) tuple[torch.Tensor, torch.Tensor][source]#

Calculate the neareest neighbor distance between atoms, maximum nbor size of atoms and the output data range of the environment matrix.

Parameters:
coord

The coordinates of atoms.

atype

The atom types.

cell

The cell.

Returns:
torch.Tensor

The minimal squared distance between two atoms, in the shape of (nframes,)

torch.Tensor

The maximal number of neighbors

class deepmd.pt.utils.neighbor_stat.NeighborStat(ntypes: int, rcut: float, mixed_type: bool = False)[source]#

Bases: deepmd.utils.neighbor_stat.NeighborStat

Neighbor statistics using pure NumPy.

Parameters:
ntypesint

The num of atom types

rcutfloat

The cut-off radius

mixed_typebool, optional, default=False

Treat all types as a single type.

op[source]#
auto_batch_size[source]#
iterator(data: deepmd.utils.data_system.DeepmdDataSystem) collections.abc.Iterator[tuple[numpy.ndarray, float, str]][source]#

Abstract method for producing data.

Yields:
np.ndarray

The maximal number of neighbors

float

The squared minimal distance between two atoms

str

The directory of the data system

_execute(coord: numpy.ndarray, atype: numpy.ndarray, cell: numpy.ndarray | None)[source]#

Execute the operation.

Parameters:
coord

The coordinates of atoms.

atype

The atom types.

cell

The cell.