jfeist / QuantumAlgebra.jl

Quantum operator algebra in Julia
MIT License
60 stars 10 forks source link

add macro to define a group of mutually anticommuting fermionic operators #11

Closed jfeist closed 3 years ago

jfeist commented 3 years ago

Using @anticommuting_fermion_group c d, you get a group of mutually anticommuting fermionic operators, e.g., to treat itinerant and localized electrons with different operators. Note that two different fermionic operators defined with independent @fermion_ops calls are assumed to refer to different (quasi-)particle species, and thus commute.

Example usage:

julia> using QuantumAlgebra; QuantumAlgebra.auto_normal_form()
julia> @anticommuting_fermion_group c d
julia> comm(cdag(),d())
2 c†() d()

julia> d(:i)*c(:k)
-c(k) d(i)

The operators within a group are ordered by definition order, not alphabetically as normally:

julia> @anticommuting_fermion_group y x
julia> x()*y()
-y() x()

For comparison, for different @fermion_ops:

julia> @fermion_ops g;
julia> @fermion_ops h;
julia> comm(gdag(),h())
0

julia> h()*g()
g() h()

Closes #9.

codecov[bot] commented 3 years ago

Codecov Report

Merging #11 (25b8446) into main (9c3ba81) will increase coverage by 1.14%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #11      +/-   ##
==========================================
+ Coverage   75.02%   76.16%   +1.14%     
==========================================
  Files          10       11       +1     
  Lines        1105     1179      +74     
==========================================
+ Hits          829      898      +69     
- Misses        276      281       +5     
Impacted Files Coverage Δ
src/QuantumAlgebra.jl 100.00% <ø> (ø)
src/alias.jl 100.00% <100.00%> (ø)
src/convert_to_expression.jl 84.37% <100.00%> (+0.50%) :arrow_up:
src/operator_defs.jl 95.97% <100.00%> (+0.27%) :arrow_up:
src/output.jl 90.64% <100.00%> (+0.49%) :arrow_up:
src/correlations.jl 67.74% <0.00%> (-1.01%) :arrow_down:
src/vacuum_expvals.jl 90.14% <0.00%> (-0.63%) :arrow_down:
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9c3ba81...25b8446. Read the comment docs.