Function sequant::spintrace

Function Documentation

ExprPtr sequant::spintrace(const ExprPtr &expr, container::svector<container::svector<Index>> ext_index_groups = {}, bool spinfree_index_spaces = true)

Transforms an expression from spin orbital to spin-free (spatial) orbital form.

Given an expression, this function extracts all indices and adds a spin attribute to all the indices in the expression. A map is generated with all possible spin permutations and substituted in the expression. Based on spin symmetry of particle indices: the non-zero terms are expanded, the spin labels removed and a sum of all non-zero expressions is returned.

Warning

The result of this function is not simplified since this is a building block for more specialized spin-tracing functions

Parameters:
  • exprExprPtr with spin orbital indices

  • ext_index_groups – groups of external indices

  • spinfree_index_spaces – if true, will assume that all index spaces are spin-free and will remove spin from all indices of the result before returning

Returns:

an expression with spin integrated/adapted