Difference between revisions of "Evolution.m"
(Created page with "Time evolution function. Performs all types of time propagation with automatic trajectory level state space restriction. Syntax: answer=evolution(spin_system,L,coil,...") |
(Update function See also links and function index membership) |
||
| (20 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| − | Time evolution function. | + | {{DISPLAYTITLE:evolution.m}} __NOTOC__ |
| − | + | Time evolution function optimised for ''extended evolution periods with multiple time steps'', such as trajectory calculation and detection stages of time-domain experiments. For brief one-off evolution events (hard pulses, slices of shaped pulses) or time-dependent Liouvillians use [[step.m]] instead. | |
| − | + | This function runs trajectory level state space analysis (https://doi.org/10.1016/j.jmr.2008.08.008), partitions the state space into the smallest possible independently evolving subspaces, and runs exponential time propagation in each subspace: | |
| − | |||
| + | <center><math>{\bf{\rho }}\left( {t + \Delta t} \right) = \exp \left[ { - i{\bf{L}}\Delta t} \right]{\bf{\rho }}\left( t \right)</math></center> | ||
| + | |||
| + | Such analysis is only warranted if the propagation time is long and the Liouvillian matrix is large - this module should not be used for one-off events, such as hard pulses. It should also not be used with small spin systems or time-dependent Hamiltonians because the expensive preliminary analysis would in that case dominate the calculation time. | ||
| + | |||
| + | The default propagation mechanism inside [[evolution.m]] is matrix exponentiation with the propagators obtained by calling [[propagator.m]]. When this function detects that the dimension of the Liouvillian is too big for exponentiation, it calls [[krylov.m]] with the same parameters. If the function detects that the Liouvillian is too small (fewer then five spins) to bother with any sophisticated state space reduction, it simply calls Matlab's expm function. | ||
| + | |||
| + | ==Syntax== | ||
| + | |||
| + | answer=evolution(spin_system,L,coil,rho,timestep,nsteps,output,destination) | ||
| + | |||
| + | ==Parameters== | ||
Arguments for Liouville space calculations: | Arguments for Liouville space calculations: | ||
L - the Liouvillian to be used during evolution | L - the Liouvillian to be used during evolution | ||
| − | + | ||
rho - the initial state vector or a horizontal stack thereof | rho - the initial state vector or a horizontal stack thereof | ||
| − | + | ||
output - a string giving the type of evolution that is required | output - a string giving the type of evolution that is required | ||
| − | + | ||
'final' - returns the final state vector or a horizontal | 'final' - returns the final state vector or a horizontal | ||
stack thereof. | stack thereof. | ||
| − | + | ||
'trajectory' - returns the stack of state vectors giving | 'trajectory' - returns the stack of state vectors giving | ||
the trajectory of the system starting from | the trajectory of the system starting from | ||
rho with the user-specified number of steps | rho with the user-specified number of steps | ||
and step length. | and step length. | ||
| − | + | ||
'total' - returns the integral of the observable trace | 'total' - returns the integral of the observable trace | ||
from the simulation start to infinity. This | from the simulation start to infinity. This | ||
option requires the presence of relaxation. | option requires the presence of relaxation. | ||
| − | + | ||
'refocus' - evolves the first vector for zero steps, | 'refocus' - evolves the first vector for zero steps, | ||
second vector for one step, third vector for | second vector for one step, third vector for | ||
| Line 30: | Line 40: | ||
stage of evolution in the indirect dimension | stage of evolution in the indirect dimension | ||
after a refocusing pulse. | after a refocusing pulse. | ||
| − | + | ||
'observable' - returns the time dynamics of an observable | 'observable' - returns the time dynamics of an observable | ||
as a vector (if starting from a single ini- | as a vector (if starting from a single ini- | ||
tial state) or a matrix (if starting from a | tial state) or a matrix (if starting from a | ||
stack of initial states). | stack of initial states). | ||
| − | + | ||
'multichannel' - returns the time dynamics of several | 'multichannel' - returns the time dynamics of several | ||
observables as rows of a matrix. Note | observables as rows of a matrix. Note | ||
| Line 41: | Line 51: | ||
less efficient when there are multiple | less efficient when there are multiple | ||
destinations to screen against. | destinations to screen against. | ||
| − | + | ||
coil - the detection state, used when 'observable' is specified as | coil - the detection state, used when 'observable' is specified as | ||
the output option. If 'multichannel' is selected, the coil | the output option. If 'multichannel' is selected, the coil | ||
should contain multiple columns corresponding to individual | should contain multiple columns corresponding to individual | ||
observable vectors. | observable vectors. | ||
| − | + | ||
destination - (optional) the state to be used for destination state | destination - (optional) the state to be used for destination state | ||
screening. | screening. | ||
| Line 53: | Line 63: | ||
L - Hamiltonian matrix | L - Hamiltonian matrix | ||
| − | + | ||
coil - observable operator (if any) | coil - observable operator (if any) | ||
| − | + | ||
rho - initial density matrix | rho - initial density matrix | ||
| − | + | ||
timestep - duration of a single time step (seconds) | timestep - duration of a single time step (seconds) | ||
| − | + | ||
nsteps - number of steps to take | nsteps - number of steps to take | ||
| − | + | ||
output - a string giving the type of evolution that is required | output - a string giving the type of evolution that is required | ||
| − | + | ||
'final' - returns the final density matrix. | 'final' - returns the final density matrix. | ||
| − | + | ||
'trajectory' - returns a cell array of density matrices | 'trajectory' - returns a cell array of density matrices | ||
giving the trajectory of the system star- | giving the trajectory of the system star- | ||
ting from rho with the user-specified num- | ting from rho with the user-specified num- | ||
ber of steps and step length. | ber of steps and step length. | ||
| − | + | ||
'refocus' - evolves the first matrix for zero steps, | 'refocus' - evolves the first matrix for zero steps, | ||
second matrix for one step, third matrix for | second matrix for one step, third matrix for | ||
| Line 76: | Line 86: | ||
stage of evolution in the indirect dimension | stage of evolution in the indirect dimension | ||
after a refocusing pulse. | after a refocusing pulse. | ||
| − | + | ||
'observable' - returns the time dynamics of an observable | 'observable' - returns the time dynamics of an observable | ||
as a vector. | as a vector. | ||
| + | |||
| + | destination - this argument is ignored. | ||
| − | + | ==Outputs== | |
| + | |||
| + | answer - a vector, a matrix, or a cell array or matrices, | ||
| + | depending on the options set during the call | ||
| + | |||
| + | ==Notes== | ||
| + | # Calculation of final states and observables in Hilbert space is parallelised (http://dx.doi.org/10.1063/1.3679656) and tested all the way to 128-core (16 nodes, 8 cores each) configuations. Parallelization of the trajectory calculation does not appear to yield any benefits due to large amount of inter-thread communication. | ||
| + | # One-off propagation events (e.g. a hard pulse) should be computed with [[step.m]], which is more efficient in those cases. | ||
| + | # For large Liouvillians that cannot be exponentiated, use [[krylov.m]], which avoids matrix exponentials. | ||
| + | # For shaped pulses, use [[shaped_pulse_af.m]] and [[shaped_pulse_xy.m]] | ||
| + | # GPUs are supported, add 'gpu' to sys.enable array during calculation setup. | ||
| − | + | ==See also== | |
| − | + | [[step.m]], [[krylov.m]], [[reduce.m]], [[propagator.m]], [[shaped_pulse_af.m]], [[shaped_pulse_xy.m]], [[isergen.m]], [[iserstep.m]], [[steady.m]], [[Kernel_functions]] | |
| − | |||
| − | |||
| − | + | ''Version 2.3, authors: [[Ilya Kuprov]], [[Luke Edwards]], [[Ohad Levinkron]]'' | |
Latest revision as of 19:36, 6 June 2026
Time evolution function optimised for extended evolution periods with multiple time steps, such as trajectory calculation and detection stages of time-domain experiments. For brief one-off evolution events (hard pulses, slices of shaped pulses) or time-dependent Liouvillians use step.m instead.
This function runs trajectory level state space analysis (https://doi.org/10.1016/j.jmr.2008.08.008), partitions the state space into the smallest possible independently evolving subspaces, and runs exponential time propagation in each subspace:
Such analysis is only warranted if the propagation time is long and the Liouvillian matrix is large - this module should not be used for one-off events, such as hard pulses. It should also not be used with small spin systems or time-dependent Hamiltonians because the expensive preliminary analysis would in that case dominate the calculation time.
The default propagation mechanism inside evolution.m is matrix exponentiation with the propagators obtained by calling propagator.m. When this function detects that the dimension of the Liouvillian is too big for exponentiation, it calls krylov.m with the same parameters. If the function detects that the Liouvillian is too small (fewer then five spins) to bother with any sophisticated state space reduction, it simply calls Matlab's expm function.
Syntax
answer=evolution(spin_system,L,coil,rho,timestep,nsteps,output,destination)
Parameters
Arguments for Liouville space calculations:
L - the Liouvillian to be used during evolution
rho - the initial state vector or a horizontal stack thereof
output - a string giving the type of evolution that is required
'final' - returns the final state vector or a horizontal
stack thereof.
'trajectory' - returns the stack of state vectors giving
the trajectory of the system starting from
rho with the user-specified number of steps
and step length.
'total' - returns the integral of the observable trace
from the simulation start to infinity. This
option requires the presence of relaxation.
'refocus' - evolves the first vector for zero steps,
second vector for one step, third vector for
two steps, etc., consistent with the second
stage of evolution in the indirect dimension
after a refocusing pulse.
'observable' - returns the time dynamics of an observable
as a vector (if starting from a single ini-
tial state) or a matrix (if starting from a
stack of initial states).
'multichannel' - returns the time dynamics of several
observables as rows of a matrix. Note
that destination state screening may be
less efficient when there are multiple
destinations to screen against.
coil - the detection state, used when 'observable' is specified as
the output option. If 'multichannel' is selected, the coil
should contain multiple columns corresponding to individual
observable vectors.
destination - (optional) the state to be used for destination state
screening.
Arguments for Hilbert space calculations:
L - Hamiltonian matrix
coil - observable operator (if any)
rho - initial density matrix
timestep - duration of a single time step (seconds)
nsteps - number of steps to take
output - a string giving the type of evolution that is required
'final' - returns the final density matrix.
'trajectory' - returns a cell array of density matrices
giving the trajectory of the system star-
ting from rho with the user-specified num-
ber of steps and step length.
'refocus' - evolves the first matrix for zero steps,
second matrix for one step, third matrix for
two steps, etc., consistent with the second
stage of evolution in the indirect dimension
after a refocusing pulse.
'observable' - returns the time dynamics of an observable
as a vector.
destination - this argument is ignored.
Outputs
answer - a vector, a matrix, or a cell array or matrices,
depending on the options set during the call
Notes
- Calculation of final states and observables in Hilbert space is parallelised (http://dx.doi.org/10.1063/1.3679656) and tested all the way to 128-core (16 nodes, 8 cores each) configuations. Parallelization of the trajectory calculation does not appear to yield any benefits due to large amount of inter-thread communication.
- One-off propagation events (e.g. a hard pulse) should be computed with step.m, which is more efficient in those cases.
- For large Liouvillians that cannot be exponentiated, use krylov.m, which avoids matrix exponentials.
- For shaped pulses, use shaped_pulse_af.m and shaped_pulse_xy.m
- GPUs are supported, add 'gpu' to sys.enable array during calculation setup.
See also
step.m, krylov.m, reduce.m, propagator.m, shaped_pulse_af.m, shaped_pulse_xy.m, isergen.m, iserstep.m, steady.m, Kernel_functions
Version 2.3, authors: Ilya Kuprov, Luke Edwards, Ohad Levinkron