<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://spindynamics.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Device.m</id>
	<title>Device.m - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://spindynamics.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Device.m"/>
	<link rel="alternate" type="text/html" href="https://spindynamics.org/wiki/index.php?title=Device.m&amp;action=history"/>
	<updated>2026-12-06T16:52:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.15</generator>
	<entry>
		<id>https://spindynamics.org/wiki/index.php?title=Device.m&amp;diff=9870&amp;oldid=prev</id>
		<title>Kuprov: Document new Spinach 2.12 spin-boson functionality (PR 195)</title>
		<link rel="alternate" type="text/html" href="https://spindynamics.org/wiki/index.php?title=Device.m&amp;diff=9870&amp;oldid=prev"/>
		<updated>2026-08-06T04:37:56Z</updated>

		<summary type="html">&lt;p&gt;Document new Spinach 2.12 spin-boson functionality (PR 195)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{DISPLAYTITLE:device.m}} __NOTOC__&lt;br /&gt;
Spin-boson device interface to pulse sequences. This [[Kernel contexts|context]] generates the evolution generators for a device containing spins and bosonic modes at a fixed orientation of the spin subsystem, and passes them to the pulse sequence function, which should be supplied as a handle. Where [[liquid.m]], [[crystal.m]], and [[powder.m]] describe molecules in magnets, this context describes devices: electromagnetic cavities, phonon modes, and transmons declared in the [[Spin system specification#Bosonic modes|inter.modes]] block, whose Hamiltonian terms carry no orientation dependence. The spin subsystem is rotated into the requested orientation; the bosonic terms are not, because rotations of a cavity mode are not defined.&lt;br /&gt;
&lt;br /&gt;
The function builds the Hamiltonian and adds the relaxation and kinetics superoperators, applies transmitter offsets to the spin channels and detuning offsets to the bosonic modes, wipes the decoupled species from the generators and from the initial state, and optionally supplies the thermal equilibrium state with Bose-Einstein populations of the modes. Drives applied to bosonic modes are not a context matter: the pulse sequence builds them from the [[operator.m|creation and annihilation operators]] of the mode it drives.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&lt;br /&gt;
     answer=device(spin_system,pulse_sequence,parameters,assumptions)&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&lt;br /&gt;
     pulse_sequence         - pulse sequence function handle. See the&lt;br /&gt;
                              experiments directory for the list of&lt;br /&gt;
                              pulse sequences that ship with Spinach.&lt;br /&gt;
 &lt;br /&gt;
     parameters.spins       - a cell array giving the spin species that&lt;br /&gt;
                              the pulse sequence works on, in the order&lt;br /&gt;
                              of channels, e.g. {&amp;#039;E&amp;#039;}; may be omitted&lt;br /&gt;
                              when no spin channels are needed&lt;br /&gt;
 &lt;br /&gt;
     parameters.offset      - transmitter offsets in Hz on each of the&lt;br /&gt;
                              spin species listed in parameters.spins&lt;br /&gt;
 &lt;br /&gt;
     parameters.mode_offset - detuning offsets in Hz, one for each&lt;br /&gt;
                              bosonic mode in the order of declaration;&lt;br /&gt;
                              the transmitter sign convention of para-&lt;br /&gt;
                              meters.offset applies: each offset enters&lt;br /&gt;
                              the Hamiltonian as minus the offset times&lt;br /&gt;
                              the number operator of its mode, so that a&lt;br /&gt;
                              positive offset lowers the mode frequency&lt;br /&gt;
 &lt;br /&gt;
     parameters.decouple    - a cell array of spin species to be wiped&lt;br /&gt;
                              from the evolution generators and from the&lt;br /&gt;
                              initial state, e.g. {&amp;#039;1H&amp;#039;}; the default is&lt;br /&gt;
                              an empty cell array, meaning no decoupling&lt;br /&gt;
 &lt;br /&gt;
     parameters.orientation - Euler angles (ZYZ active convention, ra-&lt;br /&gt;
                              dians) giving the orientation of the spin&lt;br /&gt;
                              subsystem; bosonic terms are not affected;&lt;br /&gt;
                              the default is [0 0 0]&lt;br /&gt;
 &lt;br /&gt;
     parameters.rframes     - numerical rotating frame specification for&lt;br /&gt;
                              spin species, e.g. &amp;lt;nowiki&amp;gt;{{&amp;#039;E&amp;#039;,2}}&amp;lt;/nowiki&amp;gt;, as described&lt;br /&gt;
                              in the header of rotframe.m&lt;br /&gt;
 &lt;br /&gt;
     parameters.needs       - a cell array of strings specifying additional&lt;br /&gt;
                              information required by the sequence:&lt;br /&gt;
 &lt;br /&gt;
                              &amp;#039;rho_eq&amp;#039; - thermal equilibrium state at the&lt;br /&gt;
                              system temperature, with the Bose-Einstein&lt;br /&gt;
                              populations of the bosonic modes included;&lt;br /&gt;
                              this is placed into parameters.rho0&lt;br /&gt;
 &lt;br /&gt;
     parameters.*           - additional subfields may be required by&lt;br /&gt;
                              the pulse sequence - check its docs&lt;br /&gt;
 &lt;br /&gt;
     assumptions            - &amp;#039;labframe&amp;#039;, &amp;#039;cavity&amp;#039;, or &amp;#039;spin-phonon&amp;#039;;&lt;br /&gt;
                              see the header of assume.m for details&lt;br /&gt;
&lt;br /&gt;
==Outputs==&lt;br /&gt;
&lt;br /&gt;
     answer - whatever it is that the pulse sequence returns.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
A spin coupled longitudinally to a phonon mode, with a trajectory taken through the spin-phonon assumption set:&lt;br /&gt;
&lt;br /&gt;
     % Particle specification&lt;br /&gt;
     sys.isotopes={&amp;#039;E&amp;#039;,&amp;#039;V7&amp;#039;};&lt;br /&gt;
 &lt;br /&gt;
     % Phonon mode with a longitudinal coupling&lt;br /&gt;
     inter.modes.frqs={[] 20e6};&lt;br /&gt;
     inter.modes.longitudinal=cell(2,2);&lt;br /&gt;
     inter.modes.longitudinal{1,2}=4e6*sqrt(2);&lt;br /&gt;
 &lt;br /&gt;
     % Sequence parameters&lt;br /&gt;
     parameters.sweep=5e8; parameters.npoints=501;&lt;br /&gt;
     parameters.rho0=state(spin_system,{&amp;#039;Lx&amp;#039;,&amp;#039;BL1&amp;#039;},{1,2});&lt;br /&gt;
 &lt;br /&gt;
     % Trajectory through the device context&lt;br /&gt;
     traj=device(spin_system,@traject,parameters,&amp;#039;spin-phonon&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
# The system must contain at least one bosonic mode; pure spin systems belong with [[liquid.m]], [[crystal.m]], and [[powder.m]] contexts.&lt;br /&gt;
# Dissipative bosonic modes require a Liouville space formalism; coherent simulations may also use zeeman-hilb.&lt;br /&gt;
# The equilibrium state requested by &amp;#039;rho_eq&amp;#039; is built from the laboratory frame Hamiltonian at the declared orientation, so it is correct for oriented spin subsystems.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[create.m]], [[assume.m]], [[hamiltonian.m]], [[relaxation.m]], [[rlx_modes.m]], [[coherent.m]], [[equilibrium.m]], [[liquid.m]], [[crystal.m]], [[powder.m]], [[Spin system specification]], [[Kernel contexts]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Version 2.12, authors: [[Ilya Kuprov]]&amp;#039;&amp;#039;&lt;/div&gt;</summary>
		<author><name>Kuprov</name></author>
		
	</entry>
</feed>