Lindblad Master Equation types and constructs. #18

Merged
merged 1 commit into from Jul 22, 2015

Conversation

Projects
None yet
2 participants
@amitjamadagni
Member

amitjamadagni commented Jul 11, 2015

Attempt at Lindblad Master Equation types and constructs.

WIP :

  • Tests
  • Docs
src/quequations.jl
@@ -26,11 +39,14 @@ function liouvillian_op(h::QuBase.AbstractQuMatrix)
sm = (n-1)*nb + m
sj = (j-1)*nb + i
lv = zero(Complex128)
+ for l=1:nlop
+ lv = lv + coeffs(collapse_ops[l])[m,i]*coeffs(collapse_ops[l]')[n,j]

This comment has been minimized.

@acroy

acroy Jul 13, 2015

Contributor

I think you don't need coeffs here and below. QuArrays should support getindex.

@acroy

acroy Jul 13, 2015

Contributor

I think you don't need coeffs here and below. QuArrays should support getindex.

src/quequations.jl
@@ -26,11 +39,14 @@ function liouvillian_op(h::QuBase.AbstractQuMatrix)
sm = (n-1)*nb + m
sj = (j-1)*nb + i
lv = zero(Complex128)

This comment has been minimized.

@acroy

acroy Jul 16, 2015

Contributor

This has to be lv = zero(eltype(Lvals)).

@acroy

acroy Jul 16, 2015

Contributor

This has to be lv = zero(eltype(Lvals)).

src/quequations.jl
- lv = zero(Complex128)
+ lv = zero(eltype(Lvals))
+ for l=1:nlop
+ lv = lv + collapse_ops[l][m,i]*collapse_ops[l]'[n,j]

This comment has been minimized.

@acroy

acroy Jul 16, 2015

Contributor

It's either collapse_ops[l]'[j,n] or conj(collapse_ops[l][n,j]) as you can see for instance from the implementation in QuDOS.

@acroy

acroy Jul 16, 2015

Contributor

It's either collapse_ops[l]'[j,n] or conj(collapse_ops[l][n,j]) as you can see for instance from the implementation in QuDOS.

@amitjamadagni

This comment has been minimized.

Show comment
Hide comment
@amitjamadagni

amitjamadagni Jul 21, 2015

Member

@acroy I hope this is ready. A review would be helpful.

Member

amitjamadagni commented Jul 21, 2015

@acroy I hope this is ready. A review would be helpful.

src/quequations.jl
+`hamiltonian` : Hamiltonain of the system
+""" ->
+liouvillian_op(hamiltonian::QuBase.AbstractQuMatrix) = lindblad_op(hamiltonian, [])
+
function liouvillian_tensor(h::QuBase.AbstractQuMatrix)
return -im*(tensor(eye(h), h) - tensor(h',eye(h)))

This comment has been minimized.

@acroy

acroy Jul 21, 2015

Contributor

Although we don't use it one should make it consistent with the output of liouvillian_op by removing the -im. This function also requires some documentation or at least a comment what it is good for.

@acroy

acroy Jul 21, 2015

Contributor

Although we don't use it one should make it consistent with the output of liouvillian_op by removing the -im. This function also requires some documentation or at least a comment what it is good for.

src/quequations.jl
+Returns the `lindblad operator` of the `QuLindbladMasterEq` type.
+""" ->
+function operator(qu_eq::QuLindbladMasterEq)
+ return lindblad_op(qu_eq.hamiltonian, qu_eq.collapse_ops)

This comment has been minimized.

@acroy

acroy Jul 21, 2015

Contributor

Sorry to ask this agin, but did we say the Linblad matrix should be cached and stored in the QuLindbladmasterEq to be consistent with the Liouville case?

@acroy

acroy Jul 21, 2015

Contributor

Sorry to ask this agin, but did we say the Linblad matrix should be cached and stored in the QuLindbladmasterEq to be consistent with the Liouville case?

@amitjamadagni

This comment has been minimized.

Show comment
Hide comment
@amitjamadagni

amitjamadagni Jul 22, 2015

Member

@acroy done ! My bad I forgot the Lindblad matrix case, very sorry for that.

Member

amitjamadagni commented Jul 22, 2015

@acroy done ! My bad I forgot the Lindblad matrix case, very sorry for that.

src/quequations.jl
+`lindblad` : Lindblad operator of the system
+""" ->
+immutable QuLindbladMasterEq{H<:QuBase.AbstractQuMatrix} <: QuEquation
+ lindblad::H

This comment has been minimized.

@acroy

acroy Jul 22, 2015

Contributor

It is better to keep the Hamiltionian and the collapse ops as well as we will need them for MCWF. The outer constructors should only accept Hamiltonian and a list of collapse ops (as before), so we can be sure that the cached Linblad matrix is consistent with those.

@acroy

acroy Jul 22, 2015

Contributor

It is better to keep the Hamiltionian and the collapse ops as well as we will need them for MCWF. The outer constructors should only accept Hamiltonian and a list of collapse ops (as before), so we can be sure that the cached Linblad matrix is consistent with those.

@amitjamadagni

This comment has been minimized.

Show comment
Hide comment
@amitjamadagni

amitjamadagni Jul 22, 2015

Member

@acroy I have made an attempt, a review would be helpful.

Member

amitjamadagni commented Jul 22, 2015

@acroy I have made an attempt, a review would be helpful.

src/quequations.jl
+`hamiltonian` : Hamiltonain of the system
+`collapse_ops` : Collapse operators
+""" ->
+QuLindbladMasterEq{H<:QuBase.AbstractQuMatrix, V<:QuBase.AbstractQuMatrix}(hamiltonian::H, collapse_ops::Vector{V}) = QuLindbladMasterEq{typeof(lindblad_op(hamiltonian, collapse_ops)),H,V}(lindblad_op(hamiltonian, collapse_ops), hamiltonian, collapse_ops)

This comment has been minimized.

@acroy

acroy Jul 22, 2015

Contributor

This is a very expensive way since you have to compute the lindblad_op twice (and this operation might take a substantial amount of time)! Just do it like this

function QuLindbladMasterEq{H<:QuBase.AbstractQuMatrix, V<:QuBase.AbstractQuMatrix}(hamiltonian::H, collapse_ops::Vector{V}) 
    lop = lindblad_op(hamiltonian, collapse_ops)
    return QuLindbladMasterEq{typeof(lop),H,V}(lop, hamiltonian, collapse_ops)
end
@acroy

acroy Jul 22, 2015

Contributor

This is a very expensive way since you have to compute the lindblad_op twice (and this operation might take a substantial amount of time)! Just do it like this

function QuLindbladMasterEq{H<:QuBase.AbstractQuMatrix, V<:QuBase.AbstractQuMatrix}(hamiltonian::H, collapse_ops::Vector{V}) 
    lop = lindblad_op(hamiltonian, collapse_ops)
    return QuLindbladMasterEq{typeof(lop),H,V}(lop, hamiltonian, collapse_ops)
end
src/propmachinery.jl
@@ -16,6 +16,10 @@ QuPropagator{QPM<:QuPropagatorMethod, QM<:QuBase.AbstractQuMatrix}(eq::QuLiouvil
QuPropagator{QPM<:QuPropagatorMethod, QM<:QuBase.AbstractQuMatrix}(param::QuBase.AbstractQuMatrix, init_state::QM, tlist, method::QPM) = QuPropagator{QPM,QM,QuLiouvillevonNeumannEq}(QuLiouvillevonNeumannEq(liouvillian_op(param)),init_state, tlist, method)
+QuPropagator{QPM<:QuPropagatorMethod, QM<:QuBase.AbstractQuMatrix}(eq::QuLindbladMasterEq, init_state::QM, tlist, method::QPM) = QuPropagator{QPM,QM,QuLindbladMasterEq}(eq, init_state, tlist, method)
+
+QuPropagator{QPM<:QuPropagatorMethod, QM<:QuBase.AbstractQuMatrix, COT<:QuBase.AbstractQuMatrix}(param::QuBase.AbstractQuMatrix, collapse_ops::Vector{COT}, init_state::QM, tlist, method::QPM) = QuPropagator{QPM,QM,QuLindbladMasterEq}(QuLindbladMasterEq(param,collapse_ops), init_state, tlist, method)

This comment has been minimized.

@acroy

acroy Jul 22, 2015

Contributor

Probably better to rename param to hamiltonian here and in the constructor above.

@acroy

acroy Jul 22, 2015

Contributor

Probably better to rename param to hamiltonian here and in the constructor above.

@amitjamadagni

This comment has been minimized.

Show comment
Hide comment
@amitjamadagni

amitjamadagni Jul 22, 2015

Member

@acroy a review would be helpful.

Member

amitjamadagni commented Jul 22, 2015

@acroy a review would be helpful.

@acroy

This comment has been minimized.

Show comment
Hide comment
@acroy

acroy Jul 22, 2015

Contributor

I think this looks good. Have you checked that you get the same results as before for the Jaynes-Cummings example? If so go ahead and squash&merge.

Contributor

acroy commented Jul 22, 2015

I think this looks good. Have you checked that you get the same results as before for the Jaynes-Cummings example? If so go ahead and squash&merge.

@amitjamadagni

This comment has been minimized.

Show comment
Hide comment
@amitjamadagni

amitjamadagni Jul 22, 2015

Member

@acroy I have rerun the notebooks and the results seem to remain same.

Here are the notebooks for reference :
JC model using QuDynamics
JC model using QuTiP

Squashing and merging this 👍

Member

amitjamadagni commented Jul 22, 2015

@acroy I have rerun the notebooks and the results seem to remain same.

Here are the notebooks for reference :
JC model using QuDynamics
JC model using QuTiP

Squashing and merging this 👍

amitjamadagni added a commit that referenced this pull request Jul 22, 2015

Merge pull request #18 from amitjamadagni/lindblad
Lindblad Master Equation types and constructs.

@amitjamadagni amitjamadagni merged commit 7f52484 into JuliaQuantum:master Jul 22, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@amitjamadagni amitjamadagni deleted the amitjamadagni:lindblad branch Jul 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment