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

FLiMESolve #2186

Open
wants to merge 90 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
b9a7b25
Version 5.0.0a1
hodgestar Feb 7, 2023
b51c6d0
Set version 5.0.0a1 in changelog.
hodgestar Feb 7, 2023
945bea9
Created flimesolve.py
magnamancer Mar 28, 2023
ee6ac8d
Added QuickSolve
magnamancer May 11, 2023
445cb41
Reconstructed R tensor, Made things more efficient
magnamancer May 13, 2023
d28f431
Fixed Basis Conversion in Rate Tensor Construction
magnamancer May 16, 2023
f86ef3a
Reworked FLiMESolve
magnamancer May 21, 2023
7ce7747
Experimental Stuff to rework FLiMESolv/er
magnamancer May 26, 2023
0152666
mode table in solver.run() generalized
magnamancer May 26, 2023
678bc69
Nyquist Constraint & E_ops
magnamancer Jun 15, 2023
b938432
Merge pull request #1 from magnamancer/Floquet-Beta
magnamancer Jun 15, 2023
8d4a5fb
Working
magnamancer Jun 26, 2023
c057aa0
Merge pull request #2 from magnamancer/Floquet-Beta
magnamancer Jun 26, 2023
31aff66
Added to documentation
magnamancer Jun 26, 2023
d4528bf
Merge branch 'qutip-5.0.X' of https://github.com/magnamancer/qutip in…
magnamancer Jun 26, 2023
e581f2f
Updated internal documentation
magnamancer Jun 26, 2023
bbe99cd
Update floquet.py
magnamancer Jun 26, 2023
6f55e6e
Deleted Working Scripts
magnamancer Jun 26, 2023
a186139
First pass at Fixing Code Issues
magnamancer Jun 27, 2023
e37df3b
Fixed small comment issue
magnamancer Jun 27, 2023
c7dec85
Merge pull request #3 from magnamancer/Fixing-Code-Format
magnamancer Jun 27, 2023
09b40eb
Update qutip/solver/correlation.py
magnamancer Jun 27, 2023
a73b12c
Update doc/guide/dynamics/dynamics-floquet.rst
magnamancer Jun 27, 2023
cf67e6b
Update qutip/solver/correlation.py
magnamancer Jun 27, 2023
e8ca4f3
Update doc/guide/scripts/floquet_ex3.py
magnamancer Jun 27, 2023
ed9b58e
PEP8 style formatting
magnamancer Jun 27, 2023
6401f33
Merge branch 'qutip-5.0.X' of https://github.com/magnamancer/qutip in…
magnamancer Jun 27, 2023
72ff3c9
Merge branch 'qutip-5.0.X'
magnamancer Jun 27, 2023
e3c0ec8
Merge branch 'qutip:master' into master
magnamancer Jun 27, 2023
b9e1f5d
CodeClimate Changes
magnamancer Jun 27, 2023
8cac396
Merge branch 'master' of https://github.com/magnamancer/qutip
magnamancer Jun 27, 2023
49967c1
Changed Towncrier Filename to new PR number
magnamancer Jun 27, 2023
3c7df72
Merge branch 'master' of https://github.com/magnamancer/qutip
magnamancer Jul 6, 2023
31f9564
Fixed Dimensions, Added tests
magnamancer Jul 6, 2023
83db869
Update flimesolve.py
magnamancer Jul 6, 2023
96ba98c
Reverted Some Changes
magnamancer Jul 6, 2023
fc48797
Merge branch 'master' of https://github.com/magnamancer/qutip
magnamancer Jul 6, 2023
ca52eb9
flimesolve small fix
magnamancer Jul 6, 2023
91c0e26
Update doc/guide/scripts/floquet_ex3.py
magnamancer Jul 11, 2023
3174af8
Update qutip/tests/solver/test_flimesolve.py
magnamancer Jul 11, 2023
90f03ec
Reduce Rate Matrix Build Speed
magnamancer Jul 22, 2023
a0dad1e
Rebuilt R(t) for loop - much faster
magnamancer Aug 11, 2023
d0e2a30
Format Update
magnamancer Aug 15, 2023
4082922
Fixed Simon's Comments
magnamancer Aug 28, 2023
5ecdd28
Updated Rate Matrix Build
magnamancer Sep 1, 2023
c256bf3
Fixed Fmodes Anti-Transpose Issue
magnamancer Sep 6, 2023
b84e6bd
Fixed Some Errors
magnamancer Nov 29, 2023
16c9d55
Update flimesolve.py
magnamancer Jan 3, 2024
31c78c5
Moved c_op_rates
magnamancer Jan 4, 2024
dc6906b
Fixed Abs Issue
magnamancer Jan 29, 2024
9f3d3ce
Updated flimesolve
magnamancer Feb 7, 2024
58492df
Update flimesolve.py
magnamancer Feb 22, 2024
d5ae8e3
Fixed FFTshift Issue(?)
magnamancer Feb 24, 2024
62e1d01
Fixed Transformation Issue
magnamancer Feb 28, 2024
00f39ad
Merging Master to Update
magnamancer Apr 1, 2024
d35128a
Fixing Issues
magnamancer Apr 1, 2024
c5c0ca7
c_ops update and options fix
magnamancer Apr 7, 2024
6af1c82
Update flimesolve.py
magnamancer Apr 7, 2024
5e7ebe3
bugfix Qobj typing
magnamancer Apr 7, 2024
c45e5df
Update correlation.py
magnamancer Apr 7, 2024
22cc595
Update test_flimesolve.py
magnamancer Apr 17, 2024
7fa1c16
Update tests.yml
magnamancer Apr 17, 2024
4e5a62c
Fixed Documentation Issue
magnamancer Apr 29, 2024
feda016
Update flimesolve.py
magnamancer Apr 29, 2024
3915cdb
Merge branch 'qutip:master' into master
magnamancer Apr 30, 2024
36ee12b
Update tests.yml
magnamancer Apr 30, 2024
1201c9d
Fixed Eric's Recent Comments
magnamancer Apr 30, 2024
3e8efe2
Merge branch 'master' of https://github.com/magnamancer/qutip
magnamancer Apr 30, 2024
bdf5e6e
Update flimesolve.py
magnamancer Apr 30, 2024
c09e4cd
Update doc/guide/dynamics/dynamics-floquet.rst
magnamancer Apr 30, 2024
de3f937
Update flimesolve.py
magnamancer Apr 30, 2024
6c4ec97
Merge branch 'master' of https://github.com/magnamancer/qutip
magnamancer Apr 30, 2024
7be6df2
Update __init__.py
magnamancer Apr 30, 2024
39aa803
Updated test_flimesolve
magnamancer May 2, 2024
69f64a9
Update flimesolve.py
magnamancer May 3, 2024
0fecc66
Update test_flimesolve.py
magnamancer May 3, 2024
d604e4a
FlimeSolve steady state solver
magnamancer May 4, 2024
d24adff
Updated Floquet Examples 4,5
magnamancer May 4, 2024
9aa533e
Update qutip/tests/solver/test_flimesolve.py
magnamancer May 4, 2024
821c381
Update qutip/tests/solver/test_flimesolve.py
magnamancer May 4, 2024
5fad71d
Update qutip/tests/solver/test_flimesolve.py
magnamancer May 4, 2024
4cf0adf
Update qutip/tests/solver/test_flimesolve.py
magnamancer May 4, 2024
09b67b9
Update qutip/tests/solver/test_flimesolve.py
magnamancer May 4, 2024
1216792
Update qutip/solver/flimesolve.py
magnamancer May 4, 2024
586c585
Update qutip/solver/flimesolve.py
magnamancer May 4, 2024
e84b4d6
Removed steady state solver
magnamancer May 6, 2024
4854091
Update test_flimesolve.py
magnamancer May 7, 2024
9db451b
Update flimesolve.py
magnamancer May 14, 2024
80cd2fa
Adding Back in the FFT
magnamancer May 20, 2024
20f17ab
Update flimesolve.py
magnamancer May 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/2186.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added Floquet-Lindblad Master Equation for sinuisoidally driven time-dependent open system dynamics
51 changes: 51 additions & 0 deletions doc/guide/dynamics/dynamics-floquet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,54 @@ expectation values using:
:context: reset
:include-source: false
:nofigs:

The Floquet-Lindblad master equation in QuTiP
---------------------------------------------
magnamancer marked this conversation as resolved.
Show resolved Hide resolved
The QuTiP function :func:`qutip.floquet.flimesolve` implements the
Floquet-Lindblad master equation. It calculates the dynamics of a system given
its initial state, a time-dependent Hamiltonian, and a list of operators
through which the system couples to its environment.

The following example extends the example studied above, and uses
:func:`qutip.floquet.flimesolve` to introduce dissipation into the calculation.


.. plot:: guide/scripts/floquet_ex4.py
:width: 4.0in
:include-source:

Importantly, the default solution method used by FLiMESolve will change, depending
on the physical parameters of the system and the user inputs. A system
with no time dependence can be solved in the full secular approximation,
whereas a system with complicated time-dependence will need a more relaxed
secular approximation. To adress this, FLiMESolve does have one additional input,
relative to MESolve. This property is called "time_sense," for time sensitivity,
which allows for the secular approximation used in the Lindblad equation to
be relaxed. This is in contrast to FMMESolve, which uses the most restrictive
form of the secular approximation. The value of time sensitivity goes as

.. math::
time sensitivity = (\omega_{1}-\omega_{2})/(S_{1}\S_{2})

where :math:'\omega_{n},S_{n}' are the rotation frequency and rate of the
:math:'n^th' index of the Fourier-decomposed system operators in the Lindblad
equation. Essentially, this value compares the rotation rate of a term in the
master equation to how quickly that component affects the system. Large values
mean that the component rotates quickly, relative to its contribution to the
system motion, so that overall the movement averages out on larger timescales.
Smaller values have the converse meaning, such that overall the quotient can be
understood to be a sort of "negligibility factor," with higher values being
more negligible. The value of "time_sense" sets the value above which terms
will be ignored. The default value of this input is zero, but if it can be
to arbitrary limits to more accurately recover the behavior of MESolve.

.. plot:: guide/scripts/floquet_ex5.py
:width: 4.0in
:include-source:

Finally, for the sake of clarity, :func:`qutip.solver.floquet.fmmesolve`,
similar to :func:`qutip.solver.floquet.flimesolve`, always expects the
``e_ops`` to be specified in the laboratory basis:

output = flimesolve(H, psi0, tlist, [[sigmax() * gamma1**0.5 ]], e_ops=[num(2)], T=T, args=args)
p_ex = output.expect[0]
57 changes: 57 additions & 0 deletions doc/guide/scripts/floquet_ex4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import numpy as np
from matplotlib import pyplot
import qutip

delta = 0.0 * 2 * np.pi
eps0 = 1.0 * 2 * np.pi
A = 0.25 * 2 * np.pi
omega = 1.0 * 2 * np.pi
T = 2 * np.pi / omega

tlist = np.linspace(0.0, 20 * T, 301)
psi0 = qutip.basis(2, 0)

H0 = -delta / 2.0 * qutip.sigmax() - eps0 / 2.0 * qutip.sigmaz()
H1 = A / 2.0 * qutip.sigmax()
args = {"w": omega}
H = [H0, [H1, lambda t, w: np.sin(w * t)]]
gamma1 = 0.1


# solve the floquet-lindblad master equation
output = qutip.flimesolve(
H,
psi0,
tlist,
T,
c_ops=[np.sqrt(gamma1) * qutip.sigmax()],
args=args,
options={"store_floquet_states": True},
)


# calculate expectation values in the computational basis
p_ex = np.zeros(tlist.shape, dtype=np.complex128)
for idx, t in enumerate(tlist):
f_coeff_t = output.floquet_states[idx]
psi_t = output.floquet_basis.from_floquet_basis(f_coeff_t, t)
# Alternatively
psi_t = output.states[idx]
p_ex[idx] = qutip.expect(qutip.num(2), psi_t)
Ericgig marked this conversation as resolved.
Show resolved Hide resolved

# For reference: calculate the same thing with mesolve
output = qutip.mesolve(
H, psi0, tlist, [np.sqrt(gamma1) * qutip.sigmax()], [qutip.num(2)], args
)
p_ex_ref = output.expect[0]


# plot the results
pyplot.plot(tlist, np.real(p_ex), "r--", tlist, 1 - np.real(p_ex), "b--")
pyplot.plot(tlist, np.real(p_ex_ref), "r", tlist, 1 - np.real(p_ex_ref), "b")
pyplot.xlabel("Time")
pyplot.ylabel("Occupation probability")
pyplot.legend(
("Floquet $P_1$", "Floquet $P_0$", "Lindblad $P_1$", "Lindblad $P_0$")
)
pyplot.show()
67 changes: 67 additions & 0 deletions doc/guide/scripts/floquet_ex5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 29 11:52:21 2024

@author: frc00
"""

import numpy as np
from matplotlib import pyplot
import qutip

delta = 0.0 * 2 * np.pi
eps0 = 1.0 * 2 * np.pi
A = 0.25 * 2 * np.pi
omega = 1.0 * 2 * np.pi
T = 2 * np.pi / omega

tlist = np.linspace(0.0, 20 * T, 301)
psi0 = qutip.basis(2, 0)

H0 = -delta / 2.0 * qutip.sigmax() - eps0 / 2.0 * qutip.sigmaz()
H1 = A / 2.0 * qutip.sigmax()
args = {"w": omega}
H = [H0, [H1, lambda t, w: np.sin(w * t)]]
gamma1 = 0.1

# setting the value of the time_sense argument arbitrarily high
t_sensitivity = 1e10

# solve the floquet-lindblad master equation
output = qutip.flimesolve(
H,
psi0,
tlist,
T,
c_ops=[np.sqrt(gamma1) * qutip.sigmax()],
args=args,
options={"store_floquet_states": True},
time_sense=t_sensitivity,
)


# calculate expectation values in the computational basis
p_ex = np.zeros(tlist.shape, dtype=np.complex128)
for idx, t in enumerate(tlist):
f_coeff_t = output.floquet_states[idx]
psi_t = output.floquet_basis.from_floquet_basis(f_coeff_t, t)
# Alternatively
psi_t = output.states[idx]
p_ex[idx] = qutip.expect(qutip.num(2), psi_t)

# For reference: calculate the same thing with mesolve
output = qutip.mesolve(
H, psi0, tlist, [np.sqrt(gamma1) * qutip.sigmax()], [qutip.num(2)], args
)
p_ex_ref = output.expect[0]


# plot the results
pyplot.plot(tlist, np.real(p_ex), "r--", tlist, 1 - np.real(p_ex), "b--")
pyplot.plot(tlist, np.real(p_ex_ref), "r", tlist, 1 - np.real(p_ex_ref), "b")
pyplot.xlabel("Time")
pyplot.ylabel("Occupation probability")
pyplot.legend(
("Floquet $P_1$", "Floquet $P_0$", "Lindblad $P_1$", "Lindblad $P_0$")
)
pyplot.show()
1 change: 1 addition & 0 deletions qutip/solver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .correlation import *
from .spectrum import *
from .floquet import *
from .flimesolve import *
from .floquet_bwcomp import *
from .steadystate import *
from .countstat import *
Expand Down