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

To add example for time dependent coupling to a bath #17

Open
x94dai opened this issue Nov 10, 2021 · 2 comments
Open

To add example for time dependent coupling to a bath #17

x94dai opened this issue Nov 10, 2021 · 2 comments

Comments

@x94dai
Copy link

x94dai commented Nov 10, 2021

It seems one cannot construct an annealing object with time-dependent coupling to a bach in the same way as constant coupling. The following code block for example gives an error. It will be useful to have an example that desmonstrates using TimeDependentCoupling.

Δ = 0.1
H = DenseHamiltonian([(s)->2*s-1, (s)->1.0], [σz, Δ * σx], unit=:ħ)
η = 0.001
fc = 4 * 2 * π
T = 20
bath = Ohmic(η, fc, T)
coupling = TimeDependentCoupling([(s)->s], [σz], unit=:ħ)
u0 = PauliVec[3][1]
annealing = Annealing(H, u0, coupling=coupling, bath=bath)
MethodError: Cannot `convert` an object of type TimeDependentCoupling to an object of type OpenQuantumBase.AbstractCouplings
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:171

Stacktrace:
 [1] Interaction(::TimeDependentCoupling, ::OhmicBath) at C:\Users\x35dai\.julia\packages\OpenQuantumBase\Pk0vX\src\coupling\interaction.jl:16
 [2] Annealing(::DenseHamiltonian{Complex{Float64}}, ::Array{Complex{Float64},1}; coupling::TimeDependentCoupling, bath::OhmicBath, interactions::Nothing, annealing_parameter::Function) at C:\Users\x35dai\.julia\packages\OpenQuantumBase\Pk0vX\src\annealing\annealing_type.jl:33
 [3] top-level scope at In[11]:8
@neversakura
Copy link
Contributor

You are right, the documentation on this part is a little bit unclear. Currently, there are two objects TimeDepedentCoupling and TimeDependentCouplings. You will need to define each time-dependent coupling operator first and combine them into a TimeDepependentCouplings object.

For your example, the code should be

Δ = 0.1
H = DenseHamiltonian([(s)->2*s-1, (s)->1.0], [σz, Δ * σx], unit=:ħ)
η = 0.001
fc = 4 * 2 * π
T = 20
bath = Ohmic(η, fc, T)
coupling = TimeDependentCoupling([(s)->s], [σz], unit=:ħ)
couplings = TimeDependentCouplings(coupling)
u0 = PauliVec[3][1]
annealing = Annealing(H, u0, coupling=couplings, bath=bath)

I will add some additional tutorials/documentation on this.

@x94dai
Copy link
Author

x94dai commented Nov 10, 2021

That was a really quick reply! Thanks. It seems pretty straightforward.

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