RotatingFrameSetter

class RotatingFrameSetter(rest_electron_spin_state='1', rest_nuclear_spin_state='avg')

Set the rotating-frame frequency of each spin from the corresponding qubit splitting.

When attached to a model, this helper recomputes those frequencies automatically as the Hamiltonian changes. For each target spin, it evaluates model.splitting_qubit(...) under the configured conditioning states and writes the result back to spin.rotating_frame_frequency.

Parameters:
  • rest_electron_spin_state (str | Dict[str, str]) – How the other electron spins are fixed when computing the qubit splitting of a target spin. Use '0' or '1' to fix them to a qubit state, or 'avg' to average over them. A single label is broadcast to all electron spins; a dictionary assigns values by spin name.

  • rest_nuclear_spin_state (str | Dict[str, str]) – How the other nuclear spins are fixed when computing the qubit splitting of a target spin. Use '0' or '1' to fix them to a qubit state, or 'avg' to average over them. A single label is broadcast to all nuclear spins; a dictionary assigns values by spin name.

Hint

The conditioning states apply only to the other spins while the qubit splitting of a target spin is computed.

Consider a model with one electron spin 'e' and two nuclear spins 'N' and 'C'.

  1. With the default setting,

RotatingFrameSetter(rest_electron_spin_state='1', rest_nuclear_spin_state='avg')

the rotating-frame frequencies are computed as follows:

  • for 'e': use the qubit splitting of 'e' averaged over 'N' and 'C';

  • for 'N': use the qubit splitting of 'N' conditioned on 'e' being in the \(|1\rangle\) qubit state and averaged over 'C';

  • for 'C': use the qubit splitting of 'C' conditioned on 'e' being in the \(|1\rangle\) qubit state and averaged over 'N'.

  1. With

RotatingFrameSetter(rest_electron_spin_state='0', rest_nuclear_spin_state='1')

the rotating-frame frequencies are computed as follows:

  • for 'e': use the qubit splitting of 'e' conditioned on both 'N' and 'C' being in the \(|1\rangle\) qubit state;

  • for 'N': use the qubit splitting of 'N' conditioned on 'e' being in the \(|0\rangle\) qubit state and 'C' being in the \(|1\rangle\) qubit state;

  • for 'C': use the qubit splitting of 'C' conditioned on 'e' being in the \(|0\rangle\) qubit state and 'N' being in the \(|1\rangle\) qubit state.

  1. With spin-specific nuclear settings,

RotatingFrameSetter(rest_electron_spin_state='1', rest_nuclear_spin_state={'N': '0', 'C': 'avg'})

the rotating-frame frequencies are computed as follows:

  • for 'e': use the qubit splitting of 'e' conditioned on 'N' being in the \(|0\rangle\) qubit state and averaged over 'C';

  • for 'N': use the qubit splitting of 'N' conditioned on 'e' being in the \(|1\rangle\) qubit state and averaged over 'C';

  • for 'C': use the qubit splitting of 'C' conditioned on 'e' being in the \(|1\rangle\) qubit state and 'N' being in the \(|0\rangle\) qubit state.

Methods

apply(model)

Recompute and assign per-spin rotating-frame frequencies.

Attributes

rest_electron_spin_state

Conditioning state specification used for electron spins other than the target spin.

rest_nuclear_spin_state

Conditioning state specification used for nuclear spins other than the target spin.