# Lindblad Master Equation types and constructs. #18

Merged
merged 1 commit into from Jul 22, 2015

## Conversation

Projects
None yet
2 participants
Member

### amitjamadagni commented Jul 11, 2015

 Attempt at Lindblad Master Equation types and constructs. WIP : Tests Docs

### acroy reviewed Jul 13, 2015

 @@ -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]

#### acroy Jul 13, 2015

Contributor

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

### acroy reviewed Jul 16, 2015

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

#### acroy Jul 16, 2015

Contributor

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

### acroy reviewed Jul 16, 2015

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

#### 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.

Member

### acroy reviewed Jul 21, 2015

 +`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)))

#### 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 reviewed Jul 21, 2015

#### 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?

Member

### amitjamadagni commented Jul 22, 2015

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

### acroy reviewed Jul 22, 2015

#### 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.

Member

### acroy reviewed Jul 22, 2015

#### 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})
end
``````

### acroy reviewed Jul 22, 2015

 @@ -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)

#### acroy Jul 22, 2015

Contributor

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

Member

### amitjamadagni commented Jul 22, 2015

 @acroy a review would be helpful.
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.
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 👍
``` Lindblad Master Equation types and constructs. ```
`Docs, Tests and references.`
``` a96546b ```

### 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.`
``` 7f52484 ```

### amitjamadagni merged commit `7f52484` into JuliaQuantum:master Jul 22, 2015 1 check passed

#### 1 check passed

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