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(), andadd_driving_field()methods, and removed using the matchingremove_...()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 of the model.
Number of the spins.
Total dimension of the spin model.
Dimensions of the spins.
Names of the spins.
Names of the driving fields.
Components
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 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 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 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
Product-basis labels of the full Hilbert space.
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.
Eigenstates of
static_hamiltonianexpressed in the product basis.Eigenenergies of
static_hamiltonianlabeled bybasis.Hamiltonians, Operators and Frames
Static part of the Hamiltonian in the model's full Hilbert space.
Time-independent operator parts of the driving Hamiltonian.
Time-independent operators of the local quasistatic-noise Hamiltonian.
Optional rotating-frame setter that owns per-spin frame frequencies.
Per-spin rotating-frame frequencies used by
'local_qubit_z'.Hamiltonian used to construct the rotating-frame operator.
rotating_frame_operator(t[, only_diag, ...])Return the rotating-frame operator defined by
rotating_frame_hamiltonian.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 used when
state_only=Truesimulations are requested.Concatenated pulse list from all driving fields.
Latest pulse end time across all driving fields.
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.