fold#

fold(eri, *, validate=True)[source]#

Folds an electronic integrals tensor.

This utility method combines fold_s4_to_s8(), fold_s1_to_s8() and fold_s1_to_s4() and attempts to fold the provided tensor as much as possible given these folding methods. Any ValueError raised by the methods above is caught. When this happens, this utility will try the next folding method.

Parameters:
  • eri (Tensor | ARRAY_TYPE) – a 4-, 2- or 1-dimensional array storing electronic integrals.

  • validate (bool) – when set to False, the requirements of eri are not validated.

Returns:

Either an instance of S8Integrals, S4Integrals or S1Integrals (in this order) depending on the first successful folding method.

Raises:

NotImplementedError – if eri is of an unsupported dimension.

Return type:

SymmetricTwoBodyIntegrals