Miscellaneous functions#

Utilities for working with tensors as well as translating between element symbols and atomic numbers.

tad_dftd3.util.pack(tensors, axis=0, value=0, size=None, return_mask=False)[source]#

Pad a list of variable length tensors with zeros, or some other value, and pack them into a single tensor.

Parameters
  • tensors (Sliceable) – List of tensors to be packed, all with identical dtypes.

  • axis (int) – Axis along which tensors should be packed; 0 for first axis -1 for the last axis, etc. This will be a new dimension.

  • value (Any) – The value with which the tensor is to be padded.

  • size – Size of each dimension to which tensors should be padded. This to the largest size encountered along each dimension.

Returns

padded – Input tensors padded and packed into a single tensor.

Return type

Tensor

tad_dftd3.util.to_number(symbols)[source]#

Obtain atomic numbers from element symbols.