Convert two-body operator into sum of squared one-body operators.

As in arXiv:1808.02625, this function decomposes \(\sum_{pqrs} h_{pqrs} a^\dagger_p a^\dagger_q a_r a_s\) as \(\sum_{l} \lambda_l (\sum_{pq} g_{lpq} a^\dagger_p a_q)^2\) l is truncated to take max value L so that \(\sum_{l=0}^{L-1} (\sum_{pq} |g_{lpq}|)^2 |\lambda_l| < x\)

two_bodycoefficients (ndarray): an N x N x N x N numpy array giving the \(h{pqrs}\) tensor. This tensor must be 8-fold symmetric (real integrals). truncation_threshold (optional Float): the value of x, above. final_rank (optional int): if provided, this specifies the value of L at which to truncate. This overrides truncation_threshold. spin_basis (bool): True if the two-body terms are passed in spin orbital basis. False if already in spatial orbital basis.

eigenvalues (ndarray of floats): length L array giving the \(\lambda_l\). one_bodysquares (ndarray of floats): L x N x N array of floats corresponding to the value of \(g{pql}\). one_body_correction (ndarray): One-body correction terms that result from reordering to chemist ordering, in spin-orbital basis. truncationvalue (float): after truncation, this is the value \(\sum{l=0}^{L-1} (\sum{pq} |g{lpq}|)^2 |\lambda_l| < x\)

TypeError Invalid two-body coefficient tensor specification.