JuliaAtoms / EnergyExpressions.jl

Other
1 stars 1 forks source link

IdentityOperator does not respect orthogonalities #10

Open jagot opened 5 years ago

jagot commented 5 years ago

Slightly related to #8. When evaluating the matrix element of IdentityOperator{1} between two configurations, the following occurs:

using EnergyExpressions
import EnergyExpressions: NBodyMatrixElement

a=SlaterDeterminant([:a, :b])
b=SlaterDeterminant([:c, :b])

I₁ = NBodyMatrixElement(a, IdentityOperator{1}(), b, overlap_matrix(a,b))
⟨a|𝐈₁|c⟩

which is obviously wrong, since a and c were not declared as non-orthogonal. It is however not so as to overload iszero for OrbitalMatrixElements of IdentityOperator{N} and require the bra and ket to be equal, since the constituent orbitals may be non-orthogonal. Maybe such OrbitalMatrixElements should be automatically converted to OrbitalOverlaps?