-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/reduced density matrix (#276)
* 21-july-2024 rDM * 21-july-2024 rDM * 21-july-2024 rDM * 21-july-2024 rDM2 * 21-july-2024 rDM * Update hamiltonians.md * Update hamiltonians.md * Update ReducedDensityMatrix.jl * Update ReducedDensityMatrix.jl * Update ReducedDensityMatrix.jl * Update DensityMatrixDiagonal.jl * Update ReducedDensityMatrix.jl - Changed names of the operators - debugged the code for off-diagonal terms in operators. * Update src/Hamiltonians/ReducedDensityMatrix.jl Co-authored-by: Joachim Brand <joachim.brand@gmail.com> * Update Hamiltonians.jl * Update hamiltonians.md * Update Hamiltonians.jl * Update Hamiltonians.jl * Update DensityMatrixDiagonal.jl * Update Hamiltonians.jl * Update Hamiltonians.jl * Update ReducedDensityMatrix.jl * Update ReducedDensityMatrix.jl * Update ReducedDensityMatrix.jl * Update ReducedDensityMatrix.jl * Update ReducedDensityMatrix.jl * Update src/Hamiltonians/ReducedDensityMatrix.jl Co-authored-by: Joachim Brand <joachim.brand@gmail.com> * Update src/Hamiltonians/ReducedDensityMatrix.jl Co-authored-by: Joachim Brand <joachim.brand@gmail.com> * Update src/Hamiltonians/ReducedDensityMatrix.jl Co-authored-by: Joachim Brand <joachim.brand@gmail.com> * Update src/Hamiltonians/ReducedDensityMatrix.jl Co-authored-by: Joachim Brand <joachim.brand@gmail.com> * Update src/Hamiltonians/ReducedDensityMatrix.jl Co-authored-by: Joachim Brand <joachim.brand@gmail.com> * Update src/Hamiltonians/ReducedDensityMatrix.jl Co-authored-by: Joachim Brand <joachim.brand@gmail.com> * Update src/Hamiltonians/ReducedDensityMatrix.jl Co-authored-by: mtsch <matijacufar@gmail.com> * Update src/Hamiltonians/ReducedDensityMatrix.jl Co-authored-by: Joachim Brand <joachim.brand@gmail.com> * Update ReducedDensityMatrix.jl * Update src/Hamiltonians/Hamiltonians.jl Co-authored-by: Joachim Brand <joachim.brand@gmail.com> * Rename ReducedDensityMatrix.jl to reduced_density_matrix.jl --------- Co-authored-by: Joachim Brand <joachim.brand@gmail.com> Co-authored-by: mtsch <matijacufar@gmail.com>
- Loading branch information
1 parent
c846fb6
commit ecda02c
Showing
5 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
""" | ||
SingleParticleExcitation(i, j) <: AbstractHamiltonian | ||
Represent the ``{i,j}`` element of the single-particle reduced density matrix: | ||
```math | ||
\\hat{ρ}^{(1)}_{i,j} = \\hat a^†_{i} \\hat a_{j} | ||
``` | ||
where `i <: Int` and `j <: Int` specify the mode numbers. | ||
# See also | ||
* [`single_particle_density`](@ref) | ||
* [`SingleParticleDensity`](@ref) | ||
* [`TwoParticleExcitation`](@ref) | ||
""" | ||
struct SingleParticleExcitation{I,J} <: AbstractHamiltonian{Float64} | ||
end | ||
|
||
SingleParticleExcitation(I::Int,J::Int) = SingleParticleExcitation{I,J}() | ||
|
||
function Base.show(io::IO, spd::SingleParticleExcitation{I,J}) where {I,J} | ||
print(io, "SingleParticleExcitation($(I), $(J))") | ||
end | ||
|
||
LOStructure(::Type{<:SingleParticleExcitation}) = AdjointUnknown() | ||
|
||
function diagonal_element(spd::SingleParticleExcitation{I,J}, add::SingleComponentFockAddress) where {I,J} | ||
if I != J | ||
return 0.0 | ||
end | ||
src = find_mode(add, J) | ||
return src.occnum | ||
end | ||
|
||
function num_offdiagonals(spd::SingleParticleExcitation{I,J}, address::SingleComponentFockAddress) where {I,J} | ||
if I == J | ||
return 0 | ||
else | ||
return 1 | ||
end | ||
end | ||
|
||
function get_offdiagonal(spd::SingleParticleExcitation{I,J}, add::SingleComponentFockAddress, chosen) where {I,J} | ||
src = find_mode(add, J) | ||
dst = find_mode(add,I) | ||
address, value = excitation(add, (dst,), (src,)) | ||
return address, value | ||
end | ||
|
||
""" | ||
TwoParticleExcitation(i, j, k, l) <: AbstractHamiltonian | ||
Represent the ``{ij, kl}`` element of the two-particle reduced density matrix: | ||
```math | ||
\\hat{ρ}^{(2)}_{ij, kl} = \\hat a^†_{i} \\hat a^†_{j} \\hat a_{l} \\hat a_{k} | ||
``` | ||
where `i`, `j`, `k`, and `l` (all `<: Int`) specify the mode numbers. | ||
# See also | ||
* [`single_particle_density`](@ref) | ||
* [`SingleParticleDensity`](@ref) | ||
* [`SingleParticleExcitation`](@ref) | ||
""" | ||
struct TwoParticleExcitation{I,J,K,L} <: AbstractHamiltonian{Float64} | ||
end | ||
|
||
TwoParticleExcitation(I::Int,J::Int,K::Int,L::Int) = TwoParticleExcitation{I,J,K,L}() | ||
|
||
function Base.show(io::IO, spd::TwoParticleExcitation{I,J,K,L}) where {I,J,K,L} | ||
print(io, "TwoParticleExcitation($(I), $(J), $(K), $(L))") | ||
end | ||
|
||
LOStructure(::Type{<:TwoParticleExcitation}) = AdjointUnknown() | ||
|
||
function diagonal_element(spd::TwoParticleExcitation{I,J,K,L}, add::SingleComponentFockAddress) where {I,J,K,L} | ||
if (I, J) == (K, L) || (I, J) == (L, K) | ||
src = find_mode(add, (L, K)) | ||
dst = find_mode(add,(I, J)) | ||
address, value = excitation(add, dst, src) | ||
return value | ||
else | ||
return 0.0 | ||
end | ||
end | ||
|
||
function num_offdiagonals(spd::TwoParticleExcitation{I,J,K,L}, address::SingleComponentFockAddress) where {I,J,K,L} | ||
if (I, J) == (K, L) | ||
return 0 | ||
else | ||
return 1 | ||
end | ||
end | ||
|
||
function get_offdiagonal(spd::TwoParticleExcitation{I,J,K,L}, add::SingleComponentFockAddress, chosen) where {I,J,K,L} | ||
src = find_mode(add, (L, K)) | ||
dst = find_mode(add,(I, J)) | ||
address, value = excitation(add, (dst...,), (src...,)) | ||
return address, value | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters