nvalchemi.csp.get_space_group_operations#

nvalchemi.csp.get_space_group_operations(space_group, *, dtype=torch.float32, device=None)[source]#

Return standard fractional operations for one space group.

Parameters:
  • space_group (int) – International space-group number in [1, 230].

  • dtype (torch.dtype, default=torch.float32) – Floating dtype for the returned operation tensor.

  • device (torch.device or str, optional) – Device for the returned tensor. The bundled table itself remains on CPU.

Returns:

operations – Fractional rotations in [..., :3] and translations in [..., 3]. For row-vector fractional coordinates, f_out = f @ R.T + t.

Return type:

torch.Tensor, shape [S, 3, 4]

Raises:
  • TypeError – If space_group is not a non-boolean integer or dtype is not a floating Torch dtype.

  • ValueError – If the International number is outside [1, 230].

Examples

>>> operations = get_space_group_operations(2)  # P-1 space group.
>>> print(operations)  # Identity, then inversion.
tensor([[[ 1.,  0.,  0.,  0.],
         [ 0.,  1.,  0.,  0.],
         [ 0.,  0.,  1.,  0.]],

        [[-1.,  0.,  0.,  0.],
         [ 0., -1.,  0.,  0.],
         [ 0.,  0., -1.,  0.]]])