Difference between revisions of "Operator.m"
(→Generating the AxBx operator in a two-spin system) |
(→Generating the AxBx operator in a two-spin system) |
||
| Line 48: | Line 48: | ||
==Examples== | ==Examples== | ||
| − | ===Generating the AxBx operator in a two-spin system=== | + | ===1. Generating the AxBx operator in a two-spin system=== |
Both components are Cartesian and must therefore be translated into the convention above: | Both components are Cartesian and must therefore be translated into the convention above: | ||
Revision as of 11:58, 8 January 2017
Generates Hilbert space operators and Liouville space superoperators from their human-readable descriptions. Syntax:
A=operator(spin_system,operators,spins,operator_type)
The function supports two types of calls:
1. If an operator is given as a single string and spins are named by passing a single string, e.g.
sum_Lz=operator(spin_system,'Lz','13C');
then the function returns the sum of the corresponding single-spin operators (in Hilbert space) or superoperators (in Liouville space) on all spins with that name. Valid labels for operators in this type of call are
'E', 'Lz', 'L+', 'L-', 'Tl,m'
where l and m are integers. In the latter case a spherical tensor operator or superoperator is returned. Valid labels for spins are standard isotope names as well as
'electrons', 'nuclei', 'all'
2. If the operators are supplied as a cell array of strings and spins as a cell array of numbers, a product operator (in Hilbert space) or superoperator (in Liouville space) is produced, e.g.
LzSp=operator(spin_system,{'Lz','L+'},{1,2});
will return LzL+ operator in Hilbert space and [LzL+,_] commutation superoperator in Liouville space, with Lz on spin 1 and L+ on spin 2. Valid labels for operators in the cell array are
'E', 'Lz', 'L+', 'L-', 'Tl,m'
where l and m are integers. In the latter case a spherical tensor operator or superoperator is included into the product.
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 not permitted.
WARNING: do not try to obtain product commutation superoperators by multiplying them up! 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 the Section 2 above.
Examples
1. Generating the AxBx operator in a two-spin system
Both components are Cartesian and must therefore be translated into the convention above:
The Spinach code would therefore be:
AxBx=(operator(spin_system,{'L+','L+'},{1,2})+...
operator(spin_system,{'L+','L-'},{1,2})+...
operator(spin_system,{'L-','L+'},{1,2})+...
operator(spin_system,{'L-','L-'},{1,2}))/4;
Revision 3142, authors: Ilya Kuprov, Luke Edwards