Im using sympy.physics.secondquant to expand [H,T] commutator but there are some terms that Im left with which need to be removed. Specifically I need to remove any terms where both operators are creation or annihilation operators. Is there any in built way to deal with individual terms of the expansion? Or some trick that anyone can think of to handle this?
pretty_dummies_dict = {
'above': 'bcde',
'below': 'jklm',
'general': 'pqrs'
}
comm1 = wicks(Commutator(H, T))
comm2 = evaluate_deltas(comm1)
comm3 = substitute_dummies(comm2,new_indices=True,pretty_indices=pretty_dummies_dict)
Here is the relevant part of the code that Im using to expand the commutator but comm3 always has a few unnecessary terms.