Atoms#

class nfflr.Atoms(cell: Tensor, positions: Tensor, numbers: Tensor, *, batch_num_atoms: Iterable[int] | None = None)[source]#

Atoms: basic atomistic data structure supporting batching

The goal is to make it easy to work with a common representation, and transform it as needed to other formats.

  • DGLGraph

  • ALIGNNGraphTuple

  • PyG format

Parameters:
celltorch.Tensor

cell matrix / lattice parameters

positionstorch.Tensor

Cartesian coordinates

numberstorch.Tensor

atomic numbers

Other Parameters:
batch_num_atomsIterable[int], optional

batch size for struct-of-arrays batched Atoms

Attributes:
batch_num_atoms

Methods

batched()

Determine if multiple structures are batched together.

scaled_positions()

Convert cartesian coordinates to fractional coordinates.

to(device[, non_blocking])

Transfer atoms data to compute device.

batched() bool[source]#

Determine if multiple structures are batched together.

scaled_positions() Tensor[source]#

Convert cartesian coordinates to fractional coordinates.

Returns:
scaled_positionstorch.Tensor
to(device, non_blocking: bool = False)[source]#

Transfer atoms data to compute device.

Parameters:
devicetorch.device

compute device, e.g. “cpu”, “cuda”, “mps”

non_blockingbool, optional

attempt asynchronous transfer.