triqs.operators.util.hamiltonians.diagonal_part

triqs.operators.util.hamiltonians.diagonal_part(H)[source]

Extract the density part from an operator H.

The density part is a sum of all those monomials of H that are products of occupation number operators \(n_1 n_2 n_3 \ldots\).

Parameters:

H (Operator) – The operator from which the density part is extracted.

Returns:

n_part – The density part of H.

Return type:

Operator