JuliaAtoms / EnergyExpressions.jl

Other
1 stars 1 forks source link

Correct sign of matrix elements for permuted configurations #9

Open jagot opened 5 years ago

jagot commented 5 years ago

For indistinguishable particles, the order of appearance in the configuration does not matter (hence the Slater determinant). At the moment, when generating matrix elements, EnergyExpressions.jl does not take this into account. In the examples below, the matrix elements between configuration a and each of the other configurations should be equal.

using EnergyExpressions

h = OneBodyHamiltonian() + CoulombInteraction()

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

Matrix(Matrix(h, [a, b, c]))
3×3 Array{EnergyExpressions.NBodyMatrixElement,2}:
 (a|a) + (b|b) + F(b,a) - G(b,a)  - (a|c) + [b a|c b] - [b a|b c]    (a|c) + [b a|b c] - [b a|c b]
 - (c|a) + [c b|b a] - [c b|a b]  (b|b) + (c|c) + F(c,b) - G(c,b)    - (c|c) - (b|b) + G(c,b) - F(c,b)
 (c|a) + [b c|b a] - [b c|a b]    - (b|b) - (c|c) + G(b,c) - F(b,c)  (c|c) + (b|b) + F(b,c) - G(b,c)
a = SlaterDeterminant([:a, :b, :c])
b = SlaterDeterminant([:b, :c, :d])
c = SlaterDeterminant([:d, :b, :c])

Matrix(Matrix(h, [a, b, c]))
3×3 Array{EnergyExpressions.NBodyMatrixElement,2}:
 (a|a) + (b|b) + (c|c) + F(b,a) - G(b,a) + F(c,a) - G(c,a) + F(c,b) - G(c,b)  (a|d) - [b a|d b] + [b a|b d] - [c a|d c] + [c a|c d]                        (a|d) + [b a|b d] - [b a|d b] + [c a|c d] - [c a|d c]
 (d|a) - [d b|b a] + [d b|a b] - [d c|c a] + [d c|a c]                        (b|b) + (c|c) + (d|d) + F(c,b) - G(c,b) + F(d,b) - G(d,b) + F(d,c) - G(d,c)  (d|d) + (b|b) + (c|c) - G(d,b) + F(d,b) - G(d,c) + F(d,c) + F(c,b) - G(c,b)
 (d|a) + [b d|b a] - [b d|a b] + [c d|c a] - [c d|a c]                        (b|b) + (c|c) + (d|d) + F(c,b) - G(c,b) - G(b,d) + F(b,d) - G(c,d) + F(c,d)  (d|d) + (b|b) + (c|c) + F(b,d) - G(b,d) + F(c,d) - G(c,d) + F(c,b) - G(c,b)
a = SlaterDeterminant([:a, :b, :c, :d])
b = SlaterDeterminant([:c, :d, :e, :f])
c = SlaterDeterminant([:e, :f, :c, :d])
d = SlaterDeterminant([:f, :e, :c, :d])
e = SlaterDeterminant([:e, :f, :d, :c])
f = SlaterDeterminant([:f, :e, :d, :c])

Matrix(Matrix(h, [a, b, c, d, e, f]))
6×6 Array{EnergyExpressions.NBodyMatrixElement,2}:
 (a|a) + (b|b) + (c|c) + (d|d) + F(b,a) - G(b,a) + … + F(c,b) - G(c,b) + F(d,b) - G(d,b) + F(d,c) - G(d,c)  [b a|f e] - [b a|e f]                                                                                        …  - [b a|e f] + [b a|f e]
 [f e|b a] - [f e|a b]                                                                                      (c|c) + (d|d) + (e|e) + (f|f) + F(d,c) - G(d,c) + … + F(e,d) - G(e,d) + F(f,d) - G(f,d) + F(f,e) - G(f,e)       (f|f) + (e|e) + (d|d) + (c|c) - G(f,e) + F(f,e) + … - G(e,d) + F(e,d) - G(e,c) + F(e,c) - G(d,c) + F(d,c)
 [f e|b a] - [f e|a b]                                                                                      (c|c) + (d|d) + (e|e) + (f|f) + F(d,c) - G(d,c) + … - G(d,e) + F(d,e) - G(d,f) + F(d,f) + F(f,e) - G(f,e)       (f|f) + (e|e) + (d|d) + (c|c) - G(f,e) + F(f,e) + … + F(d,e) - G(d,e) + F(c,e) - G(c,e) - G(d,c) + F(d,c)
 [e f|b a] - [e f|a b]                                                                                      - (c|c) - (d|d) - (e|e) - (f|f) - F(d,c) + G(d,c) + … + G(d,e) - F(d,e) + G(d,f) - F(d,f) + G(e,f) - F(e,f)     - (f|f) - (e|e) - (d|d) - (c|c) - F(e,f) + G(e,f) + … - F(d,e) + G(d,e) - F(c,e) + G(c,e) + G(d,c) - F(d,c)
 - [f e|b a] + [f e|a b]                                                                                    - (c|c) - (d|d) - (e|e) - (f|f) + G(c,d) - F(c,d) + … + G(d,e) - F(d,e) + G(d,f) - F(d,f) - F(f,e) + G(f,e)     - (f|f) - (e|e) - (d|d) - (c|c) + G(f,e) - F(f,e) + … - F(d,e) + G(d,e) - F(c,e) + G(c,e) - F(c,d) + G(c,d)
 - [e f|b a] + [e f|a b]                                                                                    (c|c) + (d|d) + (e|e) + (f|f) - G(c,d) + F(c,d) + … - G(d,e) + F(d,e) - G(d,f) + F(d,f) - G(e,f) + F(e,f)    …  (f|f) + (e|e) + (d|d) + (c|c) + F(e,f) - G(e,f) + … + F(d,e) - G(d,e) + F(c,e) - G(c,e) + F(c,d) - G(c,d)