find_index_order#

find_index_order(two_body_tensor, *, rtol=1e-05, atol=1e-08)[source]#

Return the index-order convention of the provided rank-four tensor.

The index convention is determined by checking symmetries of the tensor. If the indexing convention can be determined, then one of IndexType.CHEMIST, IndexType.PHYSICIST, or IndexType.INTERMEDIATE is returned. The IndexType.INTERMEDIATE indexing may be obtained by applying _chem_to_phys() to the physicists’ convention or _phys_to_chem() to the chemists’ convention. If the tests for each of these conventions fail, then IndexType.UNKNOWN is returned.

Note

The first of IndexType.CHEMIST, IndexType.PHYSICIST, and IndexType.INTERMEDIATE, in that order, to pass the tests is returned. If two_body_tensor has accidental symmetries, it may in fact satisfy more than one set of symmetry tests. For example, if all elements have the same value, then the symmetries for all three index orders are satisfied.

Parameters:
  • two_body_tensor (np.ndarray | SparseArray | SymmetricTwoBodyIntegrals) – the rank-four tensor whose index order to determine.

  • rtol (float) – the relative tolerance used during the comparison.

  • atol (float) – the absolute tolerance used during the comparison.

Returns:

The index order of the provided rank-four tensor.

Return type:

IndexType