Difference between revisions of "Operator.m"
(→See also) |
(Sync syntax/arguments/outputs with current Spinach source) |
||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE:operator.m}} __NOTOC__ | {{DISPLAYTITLE:operator.m}} __NOTOC__ | ||
| + | |||
Generates Hilbert space operators and Liouville space superoperators from their human-readable descriptions. | Generates Hilbert space operators and Liouville space superoperators from their human-readable descriptions. | ||
==Syntax== | ==Syntax== | ||
| − | + | A=operator(spin_system,operators,spins,operator_type,format) | |
==Arguments== | ==Arguments== | ||
| + | |||
This function supports three types of calls: | This function supports three types of calls: | ||
| Line 47: | Line 49: | ||
==Outputs== | ==Outputs== | ||
| − | + | A - a CSC sparse (default) or a [rows, cols, vals] repre- | |
sentation of a spin operator or superoperator. | sentation of a spin operator or superoperator. | ||
| + | |||
| + | Notes: WARNING - a product of two commutation superoperators is NOT a com- | ||
| + | mutation superoperator of a product. In Liouville space, you cannot | ||
| + | generate single-spin superoperators and multiply them up. | ||
| + | |||
| + | Note: operator caching is supported, add 'op_cache' to sys.enable array | ||
| + | to enable; make sure your scratch storage is fast. | ||
| + | |||
| + | ledwards@cbs.mpg.de | ||
| + | ilya.kuprov@weizmann.ac.il | ||
==Examples== | ==Examples== | ||
| + | |||
'''1. L+ on spin 3''' | '''1. L+ on spin 3''' | ||
| Line 66: | Line 79: | ||
==Notes== | ==Notes== | ||
| + | |||
'''WARNING''': do not try to obtain product commutation superoperators by multiplying up single-spin commutation superoperators. It is easy to see that | '''WARNING''': do not try to obtain product commutation superoperators by multiplying up single-spin commutation superoperators. It is easy to see that | ||
| Line 75: | Line 89: | ||
==See also== | ==See also== | ||
| + | |||
[[unit_state.m]], [[unit_oper.m]], [[mprealloc.m]], [[singlet.m]], | [[unit_state.m]], [[unit_oper.m]], [[mprealloc.m]], [[singlet.m]], | ||
[[equilibrium.m]], [[state.m]], [[human2opspec.m]] | [[equilibrium.m]], [[state.m]], [[human2opspec.m]] | ||
Revision as of 14:06, 5 April 2026
Generates Hilbert space operators and Liouville space superoperators from their human-readable descriptions.
Syntax
A=operator(spin_system,operators,spins,operator_type,format)
Arguments
This function supports three types of calls:
1. If operators is a string and spins is a string
operators='Lz'; spins='13C';
the function returns the sum of the corresponding single-spin operators (Hilbert space) or superoperators (Liouville space) on all spins of that type. Valid labels for operators in this type of call are 'E' (identity), 'Lz', 'Lx', 'Ly', 'L+', 'L-', and 'Tl,m' (irreducible spherical tensor, l and m are integers). Valid labels for spins are standard isotope names as well as 'electrons', 'nuclei' and 'all'.
2. If operators is a string and spins is a vector
operators='Lz'; spins=[1 2 4];
the function returns the sum of all single-spin operators (Hilbert space) or superoperators (Liouville space) for all spins with the specified numbers. Valid labels for operators are the same as in Item 1 above.
3. If operators is a cell array of strings and spins is a cell array of numbers
operators={'Lz','L+'}; spins={1,2};
then a product operator (Hilbert space) or its superoperator (Liouville space) is produced. In the case above, Spinach will generate LzS+ in Hilbert space or its specified superoperator in Liouville space. Valid labels for operators are the same as in Item 1 above.
In Liouville space calculations, operator_type can be set to:
'left' - produces left side product superoperator
'right' - produces right side product superoperator
'comm' - produces commutation superoperator (default)
'acomm' - produces anticommutation superoperator
In Hilbert space calculations operator_type parameter is ignored, and the operator itself is always returned.
The format parameter refers to the format of the output:
'csc' - returns a Matlab sparse matrix
'xyz' - returns a [rows, cols, vals] array
Outputs
A - a CSC sparse (default) or a [rows, cols, vals] repre-
sentation of a spin operator or superoperator.
Notes: WARNING - a product of two commutation superoperators is NOT a com-
mutation superoperator of a product. In Liouville space, you cannot
generate single-spin superoperators and multiply them up.
Note: operator caching is supported, add 'op_cache' to sys.enable array
to enable; make sure your scratch storage is fast.
ledwards@cbs.mpg.de ilya.kuprov@weizmann.ac.il
Examples
1. L+ on spin 3
Lp=operator(spin_system,{'L+'},{3});
2. A sum of Lx on all 15N spins in the system
Lx=operator(spin_system,'Lx','15N');
3. AxBx between spin 2 and spin 5
AxBx=operator(spin_system,{'Lx','Lx'},{2,5});
Operators will be generated in Hilbert space and superoperators in Liouville space.
Notes
WARNING: do not try to obtain product commutation superoperators by multiplying up single-spin commutation superoperators. It is easy to see that
\({{\hat{\hat{O}}}^{2}}=\left[ \hat{O},\left[ \hat{O},\_ \right] \right]\ne \left[ {{{\hat{O}}}^{2}},\_ \right]\)
If you require a commutation superoperator corresponding to a multi-spin operator, use the syntax given in Section 3 above.
See also
unit_state.m, unit_oper.m, mprealloc.m, singlet.m, equilibrium.m, state.m, human2opspec.m
Version 2.8, authors: Ilya Kuprov, Luke Edwards, Dmitry Savostyanov