Difference between revisions of "Human2opspec.m"

From Spinach Documentation Wiki
Jump to: navigation, search
 
Line 1: Line 1:
−
Converts user-friendly descriptions of spin states and operators into the  
+
{{DISPLAYTITLE:function.m}}
−
formal description (opspec) used by Spinach kernel. The function supports
+
Converts user-friendly descriptions of spin states and operators into the formal operator and state description used by ''Spinach'' kernel.
−
two types of calls:
 
  
−
1. If both inputs are strings, e.g.
+
==Syntax==
 +
The function supports three types of syntax:
 +
 
 +
1. If both inputs are strings, ''e.g.''
  
 
       [opspecs,coeffs]=human2opspec(spin_system,'Lz','13C')
 
       [opspecs,coeffs]=human2opspec(spin_system,'Lz','13C')
  
−
the function returns a list of single-spin opspecs for all spins with the
+
the function returns a list of single-spin opspecs for all spins with the specified name. In the example above, the list of Lz operator specifications for all 13C nuclei in the system would be returned.
−
specified name. In the example above, the list of Lz operator specificati-
+
 
−
ons for all 13C nuclei in the system would be returned.
+
Valid labels for operators in this type of call are 'E', 'Lz', 'L+', 'L-' and 'Tl,m'. In the latter case, l and m are integers. Valid labels for the spins are standard isotope names as well as 'electrons', 'nuclei', 'all'.
 +
 
 +
2. If one input is a string and the other is a vector, ''e.g.''
  
−
Valid labels for operators in this type of call are 'E', 'Lz', 'L+', 'L-'
+
      [opspecs,coeffs]=human2opspec(spin_system,'Lz',[1 2 4])
−
and 'Tl,m'. In the latter case, l and m are integers. Valid labels for the
 
−
spins are standard isotope names as well as 'electrons', 'nuclei', 'all'.
 
  
−
2. If the two inputs are a cell array of strings and a cell array of num-
+
−
bers respectively, a product operator specification is produced, e.g.
+
the function returns a list of single-spin opspecs for all spins with the specified number. In the example above, the list of Lz operator specifications for all 13C nuclei in the system would be returned.
 +
 
 +
Valid labels for operators in this type of call are 'E', 'Lz', 'L+', 'L-' and 'Tl,m'. In the latter case, l and m are integers.
 +
 
 +
3. If the two inputs are a cell array of strings and a cell array of numbers respectively, a product operator specification is produced, ''e.g.''
 
   
 
   
 
       [opspecs,coeffs]=human2opspec(spin_system,{'Lz','L+'},{1,2})
 
       [opspecs,coeffs]=human2opspec(spin_system,{'Lz','L+'},{1,2})
  
−
would return the LzL+ operator specification with Lz on spin 1 and L+ on
+
would return the Lz(x)L+ product operator specification with Lz on spin 1 and L+ on spin 2. Valid labels for operators in the cell array are 'E', 'Lz', 'L+', 'L-' and 'Tl,m'. In the latter case, l and m are integers.
−
spin 2. Valid labels for operators in the cell array are 'E', 'Lz', 'L+',
+
 
−
'L-' and 'Tl,m'. In the latter case, l and m are integers.
+
==Outputs==
 +
 
 +
    opspecs    - ''Spinach'' operator specification: a cell array of
 +
                row vectors specifying which operator enters the
 +
                Kronecker product for which spin.
 +
 +
    coeffs    - coefficient with which each of the Kronecker pro-
 +
                ducts enters the overall sum.
 +
 
 +
==Notes==
 +
Direct calls to this function should not be necessary, use [[operator.m]] and [[state.m]] functions instead.
 +
 
 +
==See also==
 +
[[operator.m]], [[state.m]], [[equilibrium.m]], [[coherence.m]], [[correlation.m]], [[singlet.m]]
 +
 
 +
 
 +
''Version 2.2, authors: [[Luke Edwards]], [[Ilya Kuprov]]''

Revision as of 14:25, 17 August 2018

Converts user-friendly descriptions of spin states and operators into the formal operator and state description used by Spinach kernel.

Syntax

The function supports three types of syntax:

1. If both inputs are strings, e.g.

      [opspecs,coeffs]=human2opspec(spin_system,'Lz','13C')

the function returns a list of single-spin opspecs for all spins with the specified name. In the example above, the list of Lz operator specifications for all 13C nuclei in the system would be returned.

Valid labels for operators in this type of call are 'E', 'Lz', 'L+', 'L-' and 'Tl,m'. In the latter case, l and m are integers. Valid labels for the spins are standard isotope names as well as 'electrons', 'nuclei', 'all'.

2. If one input is a string and the other is a vector, e.g.

      [opspecs,coeffs]=human2opspec(spin_system,'Lz',[1 2 4])


the function returns a list of single-spin opspecs for all spins with the specified number. In the example above, the list of Lz operator specifications for all 13C nuclei in the system would be returned.

Valid labels for operators in this type of call are 'E', 'Lz', 'L+', 'L-' and 'Tl,m'. In the latter case, l and m are integers.

3. If the two inputs are a cell array of strings and a cell array of numbers respectively, a product operator specification is produced, e.g.

      [opspecs,coeffs]=human2opspec(spin_system,{'Lz','L+'},{1,2})

would return the Lz(x)L+ product operator specification with Lz on spin 1 and L+ on spin 2. Valid labels for operators in the cell array are 'E', 'Lz', 'L+', 'L-' and 'Tl,m'. In the latter case, l and m are integers.

Outputs

   opspecs    - Spinach operator specification: a cell array of
                row vectors specifying which operator enters the
                Kronecker product for which spin.

   coeffs     - coefficient with which each of the Kronecker pro-
                ducts enters the overall sum.

Notes

Direct calls to this function should not be necessary, use operator.m and state.m functions instead.

See also

operator.m, state.m, equilibrium.m, coherence.m, correlation.m, singlet.m


Version 2.2, authors: Luke Edwards, Ilya Kuprov