Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different behavior of schroedinger() and master() for sum basis. #377

Closed
kimkyngt opened this issue Dec 21, 2023 · 3 comments
Closed

Different behavior of schroedinger() and master() for sum basis. #377

kimkyngt opened this issue Dec 21, 2023 · 3 comments

Comments

@kimkyngt
Copy link

I was trying some simple rabi oscillation with sum basis and found different behavior for schroedinger() and master().
If I understand what I am doing, the following script shows two identical plots (as printed value is true), but it does not.

using QuantumOptics
using Plots

spins = [1//2, 1//2]

bases = [SpinBasis(spin) for spin in spins]

rho0 = directsum(
    diagonaloperator(SpinBasis(spins[1]), ComplexF64[1.0, 0.0]),
    diagonaloperator(SpinBasis(spins[2]), ComplexF64[0.0, 0.0]),
)

psi0 = directsum(
    Ket(SpinBasis(spins[1]), ComplexF64[1.0, 0.0]),
    Ket(SpinBasis(spins[2])),
)

println(psi0dagger(psi0) == rho0)


H = (spinup(bases[1])  Ket(bases[2]))  dagger(Ket(bases[1])  spindown(bases[2]))
H = 2π*(H + H')/2

tspan = range(0.0, 3.0, step=1e-2)

t_master, rho_master = timeevolution.master(tspan, rho0, H, [])
t_sch, rho_sch = timeevolution.schroedinger(tspan, rho0, H)

fig1 = plot()
fig2 = plot()
id_ops = [one(bases[ii]) for ii in eachindex(spins)]
for indx in eachindex(spins)
    id_vec = zeros(length(spins))
    id_vec[1] = 1
    id_vec = circshift(id_vec, indx - 1)

    plot!(fig1, tspan, real.(expect(directsum([id_vec[ii] * id_ops[ii] for ii in eachindex(spins)]...), rho_master)), label="Tr(ρ$indx) master",)
    plot!(fig2, tspan, real.(expect(directsum([id_vec[ii] * id_ops[ii] for ii in eachindex(spins)]...), rho_sch)), label="Tr(ρ$indx) schroedinger",)

end
plot!(fig1, tspan, real.(expect(directsum([id_ops[ii] for ii in eachindex(spins)]...), rho_master)), label="Tr(ρ) master",)
plot!(fig2, tspan, real.(expect(directsum([id_ops[ii] for ii in eachindex(spins)]...), rho_sch)), label="Tr(ρ) schroedinger",)

fig = plot(fig1, fig2, layout=(2, 1))
display(fig)
image
@amilsted
Copy link
Collaborator

amilsted commented Dec 21, 2023

When you supply a density matrix to schroedinger you are computing the action of the propagator exp(-itH) * rho, whereas master performs exp(-itH) * rho * exp(itH).

You should see the same results if you apply schroedinger to psi0 to get pure state outputs.

@kimkyngt
Copy link
Author

When you supply a density matrix to schroedinger you are computing the action of the propagator exp(-itH) * rho, whereas master performs exp(-itH) * rho * exp(itH).

You should see the same results if you apply schroedinger to psi0 to get pure state outputs.

Thank you. I guess it is not a sum basis thing then.
If I am interested in a coherent evolution of a mixed state , I should use master without the jump operators.

@amilsted
Copy link
Collaborator

Yes, that's right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants