Model

class Model(name=None)

Represent a coupled spin system.

This class provides a high-level abstraction for simulating quantum systems consisting of multiple coupled spins. It supports adding spins, interactions, static and driving magnetic fields. The model allows calculation of energy levels and eigenstates. In addition, it provides methods for computing parameters required to define control pulses (e.g. splittings, Rabi-frequencies, …). It enables the simulation of the system’s time evolution under the influence of driving fields and additional noise. It is especially suitable for modeling systems like nitrogen-vacancy centers.

The model owns the lifecycle of attached components. Spins, interactions, static fields, and driving fields should be attached using the corresponding add_spin(), add_interaction(), add_static_field(), and add_driving_field() methods, and removed using the matching remove_...() methods. After a component is attached, updating one of its physically relevant attributes automatically affects future accesses to derived model quantities such as the static Hamiltonian, eigensystem, or driving operators.

Rotating-frame frequencies, virtual phases, and pulse lists remain directly editable runtime settings unless a model-level rotating-frame setter is attached.

Initialize a model.

Parameters:

name (str) – Name of the model.

Hint

For example, to initialize a model for a nitrogen-vacancy center including the intrinsic nitrogen nuclear spin, one can use:

model = simphony.default_nv_model(nitrogen_isotope=14)

Overview

name

Name of the model.

n_spins

Number of the spins.

dimension

Total dimension of the spin model.

subdimensions

Dimensions of the spins.

spin_names

Names of the spins.

driving_field_names

Names of the driving fields.

Components

spins

Spins attached to the model.

spin(name)

Return the instance of the spin specified by name.

add_spin(spin)

Add a spin to the model.

remove_spin(spin[, include_interactions])

Remove a spin from the model.

interactions

Interactions attached to the model.

add_interaction(interaction)

Add a spin-spin interaction to the model.

remove_interaction(interaction)

Remove an interaction from the model.

static_fields

Static fields attached to the model.

add_static_field(static_field[, target_spins])

Add a static field to the model.

remove_static_field(static_field)

Remove a static field from the model.

driving_fields

Driving fields attached to the model.

driving_field(name)

Return the instance of the driving field specified by name.

add_driving_field(driving_field[, target_spins])

Add a driving field to the model.

remove_driving_field(driving_field)

Remove a driving field from the model.

Bases and Eigensystem

basis

Product-basis labels of the full Hilbert space.

basis_qubit_subspace

Product-basis labels restricted to the qubit subspace of each spin.

state(quantum_nums[, basis, coeffs_basis])

Return the state of the model corresponding to the given quantum numbers.

productstate(quantum_nums)

Return the product-basis state for the given per-spin quantum numbers.

eigenstate(quantum_nums)

Return the static-Hamiltonian eigenstate assigned to the local-\(S_z\) product-basis state.

eigenenergy(quantum_nums)

Return the eigenenergy of a labeled eigenstate.

eigenbasis

Eigenstates of static_hamiltonian expressed in the product basis.

eigenenergies

Eigenenergies of static_hamiltonian labeled by basis.

Hamiltonians, Operators and Frames

static_hamiltonian

Static part of the Hamiltonian in the model's full Hilbert space.

driving_operators

Time-independent operator parts of the driving Hamiltonian.

local_quasistatic_noise_operators

Time-independent operators of the local quasistatic-noise Hamiltonian.

rotating_frame

Optional rotating-frame setter that owns per-spin frame frequencies.

rotating_frame_frequencies

Per-spin rotating-frame frequencies used by 'local_qubit_z'.

rotating_frame_hamiltonian

Hamiltonian used to construct the rotating-frame operator.

rotating_frame_operator(t[, only_diag, ...])

Return the rotating-frame operator defined by rotating_frame_hamiltonian.

virtual_phases

Per-spin virtual z-phases.

virtual_phases_operator([only_diag, ...])

Return the operator corresponding to the virtual z-phases:

operator_from_string(string[, in_qubit_subspace])

Return tensor product operator from an extended operator string.

Transitions and Control

splitting(spin_name, quantum_nums[, ...])

Return the energy splitting between the two eigenstates of the model.

splitting_qubit(spin_name[, rest_quantum_nums])

Return the energy splitting between the two eigenstates of the model.

rabi_amplitude(driving_field_name, ...)

Return the driving-field amplitude for a single Rabi cycle.

rabi_amplitude_qubit(driving_field_name, ...)

Return the driving-field amplitude for a single Rabi cycle.

rabi_period(driving_field_name, amplitude, ...)

Return the period time of a Rabi cycle.

rabi_period_qubit(driving_field_name, ...[, ...])

Return the period time of a Rabi cycle.

matrix_element(driving_field_name, state1, ...)

Return the matrix element of the effective driving operator between two states.

Simulation

simulate_time_evolution([n_shots, start, ...])

Simulate the model's time evolution under its driving fields and noise.

initial_state

Initial state used when state_only=True simulations are requested.

pulses

Concatenated pulse list from all driving fields.

last_pulse_end

Latest pulse end time across all driving fields.

remove_all_pulses()

Remove all pulses from every driving field and reset virtual z-phases.

Visualization

plot_driving_fields([name, function, start, end])

Plot the pulses of the driving fields.

plot_levels([zoom_electron_state, height, ...])

Plot the energy spectrum with optionally zoomed electron subpanels.

Utils

project_to_qubit_subspace(unitary[, ...])

Project an operator or batch of operators into the qubit subspace.

test_labeling([output, return_type, ...])

Inspect eigenstate labeling quality in the local-\(S_z\) product basis.