0
# Time Evolution Solvers
1
2
Comprehensive suite of solvers for quantum system dynamics including unitary evolution, open system dynamics, stochastic methods, and specialized solvers.
3
4
## Capabilities
5
6
### Schrödinger Equation Solver
7
8
Unitary time evolution for closed quantum systems.
9
10
```python { .api }
11
def sesolve(H, psi0, tlist, e_ops=None, args=None, options=None) -> Result:
12
"""
13
Solve time-dependent Schrödinger equation.
14
15
Parameters:
16
- H: Hamiltonian (Qobj or list for time-dependent)
17
- psi0: Initial state vector (Qobj)
18
- tlist: Array of time points
19
- e_ops: List of operators for expectation values
20
- args: Dictionary of parameters for time-dependent H
21
- options: Solver options (SolverOptions object)
22
23
Returns:
24
- Result: Object containing times, states, and expectation values
25
"""
26
27
class SESolver:
28
"""
29
Schrödinger equation solver class for repeated calculations.
30
"""
31
def __init__(self, H, e_ops=None, options=None):
32
"""
33
Initialize Schrödinger solver.
34
35
Parameters:
36
- H: Hamiltonian
37
- e_ops: Expectation value operators
38
- options: Solver options
39
"""
40
41
def solve(self, psi0, tlist, args=None) -> Result:
42
"""
43
Solve for given initial state and times.
44
45
Parameters:
46
- psi0: Initial state
47
- tlist: Time points
48
- args: Time-dependent parameters
49
50
Returns:
51
- Result: Solution object
52
"""
53
```
54
55
### Master Equation Solver
56
57
Open system dynamics with Lindblad master equation.
58
59
```python { .api }
60
def mesolve(H, rho0, tlist, c_ops=None, e_ops=None, args=None, options=None) -> Result:
61
"""
62
Solve Lindblad master equation for open quantum systems.
63
64
Parameters:
65
- H: Hamiltonian (Qobj or list for time-dependent)
66
- rho0: Initial density matrix (Qobj)
67
- tlist: Array of time points
68
- c_ops: List of collapse operators
69
- e_ops: List of operators for expectation values
70
- args: Dictionary of parameters for time-dependent terms
71
- options: Solver options (SolverOptions object)
72
73
Returns:
74
- Result: Object containing times, states, and expectation values
75
"""
76
77
class MESolver:
78
"""
79
Master equation solver class for repeated calculations.
80
"""
81
def __init__(self, H, c_ops=None, e_ops=None, options=None):
82
"""
83
Initialize master equation solver.
84
85
Parameters:
86
- H: Hamiltonian
87
- c_ops: Collapse operators
88
- e_ops: Expectation value operators
89
- options: Solver options
90
"""
91
92
def solve(self, rho0, tlist, args=None) -> Result:
93
"""
94
Solve for given initial state and times.
95
96
Parameters:
97
- rho0: Initial density matrix
98
- tlist: Time points
99
- args: Time-dependent parameters
100
101
Returns:
102
- Result: Solution object
103
"""
104
```
105
106
### Monte Carlo Solver
107
108
Quantum trajectory method for open systems.
109
110
```python { .api }
111
def mcsolve(H, psi0, tlist, c_ops=None, e_ops=None, ntraj=500, args=None, options=None) -> McResult:
112
"""
113
Solve stochastic Schrödinger equation using Monte Carlo method.
114
115
Parameters:
116
- H: Hamiltonian (Qobj or list for time-dependent)
117
- psi0: Initial state vector (Qobj)
118
- tlist: Array of time points
119
- c_ops: List of collapse operators
120
- e_ops: List of operators for expectation values
121
- ntraj: Number of Monte Carlo trajectories
122
- args: Dictionary of parameters for time-dependent terms
123
- options: Solver options (SolverOptions object)
124
125
Returns:
126
- McResult: Object with trajectory data and averaged results
127
"""
128
129
class MCSolver:
130
"""
131
Monte Carlo solver class for repeated calculations.
132
"""
133
def __init__(self, H, c_ops=None, e_ops=None, options=None):
134
"""
135
Initialize Monte Carlo solver.
136
137
Parameters:
138
- H: Hamiltonian
139
- c_ops: Collapse operators
140
- e_ops: Expectation value operators
141
- options: Solver options
142
"""
143
144
def solve(self, psi0, tlist, ntraj=500, args=None) -> McResult:
145
"""
146
Solve for given initial state and times.
147
148
Parameters:
149
- psi0: Initial state
150
- tlist: Time points
151
- ntraj: Number of trajectories
152
- args: Time-dependent parameters
153
154
Returns:
155
- McResult: Monte Carlo results
156
"""
157
```
158
159
### Steady State Solvers
160
161
Finding equilibrium states of open quantum systems.
162
163
```python { .api }
164
def steadystate(A, c_ops=None, method='direct', sparse=True, use_wbm=False,
165
weight=None, **kwargs) -> Qobj:
166
"""
167
Calculate steady state of open quantum system.
168
169
Parameters:
170
- A: Hamiltonian or Liouvillian superoperator
171
- c_ops: List of collapse operators (if A is Hamiltonian)
172
- method: 'direct', 'eigen', 'iterative-gmres', 'iterative-lgmres', 'iterative-bicgstab'
173
- sparse: Use sparse matrices
174
- use_wbm: Use weighted bipartite matching
175
- weight: Weighting factor for balancing
176
177
Returns:
178
- Qobj: Steady state density matrix
179
"""
180
181
def steadystate_floquet(H_S, c_ops, A, w, H_0=None, max_iter=10000, tol=1e-6) -> Qobj:
182
"""
183
Calculate steady state for periodically driven system using Floquet formalism.
184
185
Parameters:
186
- H_S: System Hamiltonian
187
- c_ops: List of collapse operators
188
- A: Floquet driving amplitude
189
- w: Driving frequency
190
- H_0: Additional constant Hamiltonian
191
- max_iter: Maximum iterations
192
- tol: Convergence tolerance
193
194
Returns:
195
- Qobj: Floquet steady state
196
"""
197
```
198
199
### Propagator
200
201
Time evolution operators and propagators.
202
203
```python { .api }
204
def propagator(H, t, c_ops=None, args=None, options=None, unitary_mode='batch', parallel=False) -> Qobj:
205
"""
206
Calculate time evolution propagator.
207
208
Parameters:
209
- H: Hamiltonian
210
- t: Time or list of times
211
- c_ops: Collapse operators (for Liouvillian propagator)
212
- args: Time-dependent parameters
213
- options: Solver options
214
- unitary_mode: 'batch' or 'single' calculation mode
215
- parallel: Use parallel computation
216
217
Returns:
218
- Qobj: Evolution operator U(t) or superoperator
219
"""
220
221
class Propagator:
222
"""
223
Propagator class for efficient repeated calculations.
224
"""
225
def __init__(self, H, c_ops=None, options=None):
226
"""
227
Initialize propagator.
228
229
Parameters:
230
- H: Hamiltonian
231
- c_ops: Collapse operators
232
- options: Solver options
233
"""
234
235
def propagate(self, t, args=None) -> Qobj:
236
"""
237
Calculate propagator for given time.
238
239
Parameters:
240
- t: Evolution time
241
- args: Time-dependent parameters
242
243
Returns:
244
- Qobj: Propagator
245
"""
246
```
247
248
### Stochastic Solvers
249
250
Stochastic differential equations for open quantum systems.
251
252
```python { .api }
253
def smesolve(H, rho0, tlist, c_ops=None, sc_ops=None, e_ops=None,
254
_safe_mode=True, **kwargs) -> Result:
255
"""
256
Solve stochastic master equation.
257
258
Parameters:
259
- H: Hamiltonian
260
- rho0: Initial density matrix
261
- tlist: Time points
262
- c_ops: Collapse operators
263
- sc_ops: Stochastic collapse operators
264
- e_ops: Expectation value operators
265
- _safe_mode: Use safe integration mode
266
267
Returns:
268
- Result: Stochastic evolution results
269
"""
270
271
def ssesolve(H, psi0, tlist, c_ops=None, sc_ops=None, e_ops=None,
272
_safe_mode=True, **kwargs) -> Result:
273
"""
274
Solve stochastic Schrödinger equation.
275
276
Parameters:
277
- H: Hamiltonian
278
- psi0: Initial state vector
279
- tlist: Time points
280
- c_ops: Collapse operators
281
- sc_ops: Stochastic collapse operators
282
- e_ops: Expectation value operators
283
- _safe_mode: Use safe integration mode
284
285
Returns:
286
- Result: Stochastic evolution results
287
"""
288
```
289
290
### Floquet Theory Solvers
291
292
Periodically driven quantum systems.
293
294
```python { .api }
295
def floquet_modes(H, T, args=None, sort=True, U=None) -> tuple:
296
"""
297
Calculate Floquet modes and quasi-energies.
298
299
Parameters:
300
- H: Time-dependent Hamiltonian (list format)
301
- T: Period of driving
302
- args: Parameters for time-dependent H
303
- sort: Sort by quasi-energy
304
- U: Pre-calculated evolution operator
305
306
Returns:
307
- tuple: (quasi_energies, floquet_modes)
308
"""
309
310
def floquet_states(H, T, args=None, sort=True, U=None) -> tuple:
311
"""
312
Calculate Floquet states at t=0.
313
314
Parameters:
315
- H: Time-dependent Hamiltonian
316
- T: Period of driving
317
- args: Parameters for time-dependent H
318
- sort: Sort by quasi-energy
319
- U: Pre-calculated evolution operator
320
321
Returns:
322
- tuple: (quasi_energies, floquet_states)
323
"""
324
325
def fsesolve(H, psi0, tlist, e_ops=None, T=None, args=None, options=None) -> Result:
326
"""
327
Solve Schrödinger equation using Floquet formalism.
328
329
Parameters:
330
- H: Time-dependent Hamiltonian
331
- psi0: Initial state
332
- tlist: Time points
333
- e_ops: Expectation value operators
334
- T: Driving period
335
- args: Time-dependent parameters
336
- options: Solver options
337
338
Returns:
339
- Result: Floquet evolution results
340
"""
341
342
def fmmesolve(H, rho0, tlist, c_ops=None, e_ops=None, T=None, args=None, options=None) -> Result:
343
"""
344
Solve master equation using Floquet-Markov formalism.
345
346
Parameters:
347
- H: Time-dependent Hamiltonian
348
- rho0: Initial density matrix
349
- tlist: Time points
350
- c_ops: Collapse operators
351
- e_ops: Expectation value operators
352
- T: Driving period
353
- args: Time-dependent parameters
354
- options: Solver options
355
356
Returns:
357
- Result: Floquet-Markov evolution results
358
"""
359
```
360
361
### Bloch-Redfield Solver
362
363
Non-Markovian open system dynamics.
364
365
```python { .api }
366
def brmesolve(H, rho0, tlist, a_ops, e_ops=None, c_ops=None, args=None,
367
use_secular=True, options=None) -> Result:
368
"""
369
Solve Bloch-Redfield master equation.
370
371
Parameters:
372
- H: System Hamiltonian
373
- rho0: Initial density matrix
374
- tlist: Time points
375
- a_ops: List of system operators coupled to bath
376
- e_ops: Expectation value operators
377
- c_ops: Additional Lindblad operators
378
- args: Time-dependent parameters
379
- use_secular: Use secular approximation
380
- options: Solver options
381
382
Returns:
383
- Result: Bloch-Redfield evolution results
384
"""
385
386
class BRSolver:
387
"""
388
Bloch-Redfield solver class.
389
"""
390
def __init__(self, H, a_ops, e_ops=None, c_ops=None, options=None):
391
"""
392
Initialize Bloch-Redfield solver.
393
394
Parameters:
395
- H: System Hamiltonian
396
- a_ops: System-bath coupling operators
397
- e_ops: Expectation value operators
398
- c_ops: Additional collapse operators
399
- options: Solver options
400
"""
401
402
def solve(self, rho0, tlist, args=None) -> Result:
403
"""
404
Solve Bloch-Redfield equation.
405
406
Parameters:
407
- rho0: Initial density matrix
408
- tlist: Time points
409
- args: Time-dependent parameters
410
411
Returns:
412
- Result: Evolution results
413
"""
414
```
415
416
### Solver Options
417
418
Configuration options for all solvers.
419
420
```python { .api }
421
class SolverOptions:
422
"""
423
Options for ODE solvers.
424
425
Attributes:
426
atol: Absolute tolerance (default: 1e-8)
427
rtol: Relative tolerance (default: 1e-6)
428
method: Integration method ('adams', 'bdf', etc.)
429
order: Integration order
430
nsteps: Maximum number of steps
431
first_step: Initial step size
432
min_step: Minimum step size
433
max_step: Maximum step size
434
tidy: Clean up small matrix elements
435
num_cpus: Number of CPUs for parallel execution
436
"""
437
def __init__(self, atol=1e-8, rtol=1e-6, method='adams', order=12,
438
nsteps=1000, first_step=0, min_step=0, max_step=0,
439
tidy=True, num_cpus=0):
440
"""Initialize solver options."""
441
```
442
443
### Usage Examples
444
445
```python
446
import qutip as qt
447
import numpy as np
448
449
# Define system
450
N = 10
451
a = qt.destroy(N)
452
H = a.dag() * a # Number operator Hamiltonian
453
psi0 = qt.coherent(N, 2.0) # Initial coherent state
454
times = np.linspace(0, 10, 100)
455
456
# Closed system evolution (Schrödinger equation)
457
result_se = qt.sesolve(H, psi0, times, e_ops=[a.dag()*a])
458
populations = result_se.expect[0]
459
460
# Open system with damping (Master equation)
461
gamma = 0.1
462
c_ops = [np.sqrt(gamma) * a] # Damping
463
rho0 = psi0 * psi0.dag()
464
result_me = qt.mesolve(H, rho0, times, c_ops, e_ops=[a.dag()*a])
465
466
# Monte Carlo trajectories
467
result_mc = qt.mcsolve(H, psi0, times, c_ops, e_ops=[a.dag()*a], ntraj=100)
468
print(f"Collapse events: {result_mc.col_times}")
469
470
# Steady state calculation
471
L = qt.liouvillian(H, c_ops) # Liouvillian superoperator
472
rho_ss = qt.steadystate(H, c_ops) # Direct method
473
print(f"Steady state population: {qt.expect(a.dag()*a, rho_ss)}")
474
475
# Time-dependent Hamiltonian
476
def H_coeff(t, args):
477
return np.cos(args['w'] * t)
478
479
H_td = [H, [a.dag() + a, H_coeff]] # H(t) = H + cos(wt)(a† + a)
480
args = {'w': 1.0}
481
result_td = qt.sesolve(H_td, psi0, times, args=args)
482
483
# Floquet system (periodic driving)
484
T = 2*np.pi # Driving period
485
quasi_energies, floquet_modes = qt.floquet_modes(H_td, T, args=args)
486
print(f"Quasi-energies: {quasi_energies}")
487
488
# Stochastic evolution
489
sc_ops = [a] # Stochastic collapse operators
490
result_sme = qt.smesolve(H, rho0, times, c_ops, sc_ops)
491
492
# Propagator calculation
493
t_prop = 1.0
494
U = qt.propagator(H, t_prop) # Evolution operator U(t)
495
psi_evolved = U * psi0 # Evolved state
496
497
# Solver with custom options
498
options = qt.SolverOptions(atol=1e-10, rtol=1e-8, nsteps=2000)
499
result_precise = qt.mesolve(H, rho0, times, c_ops, options=options)
500
501
# Bloch-Redfield solver for structured environment
502
a_ops = [[a.dag(), lambda w: 0.1 * w / (1 + w**2)]] # System-bath coupling
503
result_br = qt.brmesolve(H, rho0, times, a_ops)
504
```
505
506
## Types
507
508
```python { .api }
509
class Result:
510
"""
511
Result object containing solver output.
512
513
Attributes:
514
solver: String identifier of solver used
515
times: Array of time points
516
states: List of quantum states at each time
517
expect: List of expectation value arrays
518
num_expect: Number of expectation operators
519
num_collapse: Number of collapse operators
520
"""
521
522
class McResult(Result):
523
"""
524
Monte Carlo result with trajectory information.
525
526
Additional Attributes:
527
ntraj: Number of trajectories
528
col_times: List of collapse times for each trajectory
529
col_which: List of which collapse operator triggered each event
530
photocurrent: Photocurrent measurement record (if applicable)
531
"""
532
533
class SolverOptions:
534
"""
535
Configuration options for numerical integration.
536
537
Main Attributes:
538
atol: Absolute tolerance
539
rtol: Relative tolerance
540
method: Integration method
541
nsteps: Maximum integration steps
542
"""
543
```