How to use a collapse operator when using a Hamiltonian function

51 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Parallax

ungelesen,
06.02.2018, 03:33:1906.02.18
an QuTiP: Quantum Toolbox in Python
Hello,

I have a question about how to use a collapse operator when using the Hamiltonian function.
See the following program as an example.

--------------------------------------------------
wq = 1.0 * 2 * np.pi
W = 1.0 * 2 * np.pi
gamma = 1

sm, sx, sy, sz = q.sigmam(), q.sigmax(), q.sigmay(), q.sigmaz()

H0 = 0.5 * wq * sz
H1x, H1y = W * sx, W * sy

args = {"H0": H0, "H1x": H1x, "H1y": H1y, "wq": wq}

def Ht(t, args):
    return args["H0"] + np.cos(args["wq"] * t) * args["H1x"] + np.sin(args["wq"] * t) * args["H1y"]

tlist = np.linspace(0, (1/gamma)*5, 500+1)
psi0 = q.basis(2,0)

# c_ops = []
# c_ops = [0 * sm]
c_ops = [np.sqrt(gamma) * sm]

e_ops = [sm.dag() * sm]

result = q.mesolve(Ht, psi0, tlist, c_ops, e_ops, args=args, progress_bar=True)

fig, ax = plt.subplots(figsize=(12,5))
ax.plot(tlist, result.expect[0])
plt.show()
plt.close()
--------------------------------------------------

In this example, it seems to work correctly when the collapse operator exists (c_ops = [np.sqrt(gamma) * sm]).
However, when the collapse operator does not exist (c_ops = []), this outputs an error.
On the other hand, if gamma is zero (i.e. c_ops = [0 * sm]), this works.

This behavior seems strange.
Where is wrong with this program?
How should I use this?

The version_table() is as following:
QuTiP  4.2.0
Numpy  1.13.3
SciPy  0.19.1
matplotlib  2.1.0
Cython  0.26.1
IPython  6.1.0
Python  3.6.3
OS  nt [win32]

Thanks

Alex Pitchford

ungelesen,
06.02.2018, 04:07:4606.02.18
an qu...@googlegroups.com
See:

try formatting your time-dependent Hamiltonian like:
H = [H0, [H1x, 'cos(wq*t)'], [H1x, 'sin(wq*t)']]





--
You received this message because you are subscribed to the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Parallax

ungelesen,
06.02.2018, 04:30:4806.02.18
an QuTiP: Quantum Toolbox in Python
Dear Alex,

I know a function based format.
This example is simple, so we can use it.
But the time dependent Hamiltonian I actually think is more complicated, so I want to use the Hamiltonian function format.

Thanks

2018年2月6日火曜日 18時07分46秒 UTC+9 Alex Pitchford:
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+un...@googlegroups.com.

Alex Pitchford

ungelesen,
06.02.2018, 05:31:3306.02.18
an qu...@googlegroups.com
If you really want to do a Python function based approach then you can separate into:

H = [H0, [H1x, h1xcoeff], [H1y, h1ycoeff]]

where h1xcoeff and h1ycoeff are td py function funcs like:

def h1xcoeff(t, args):

that must return a real scalar

Otherwise, if you really want to do a single function, then I think it must return a Liouvillian when using mesolve, and you have to add the c_ops yourself.
See:

But unless your H is much more complicated than the example you gave, then my first suggestion is almost certainly the best.


To unsubscribe from this group and stop receiving emails from it, send an email to qutip+unsubscribe@googlegroups.com.

Parallax

ungelesen,
08.02.2018, 03:55:2808.02.18
an QuTiP: Quantum Toolbox in Python
Dear Alex,

I understood that the Hamiltonian function format is difficult.

Eventually I decomposed my Hamiltonian, divided it into a number of terms, and extracted the time dependent coefficients.
In this way, I could solve by using a function based format you recommended.

Thanks!

2018年2月6日火曜日 19時31分33秒 UTC+9 Alex Pitchford:
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten