mb_solve.MBSolve

mb_solve.MBSolve(
    atom=None,
    t_min=0.0,
    t_max=1.0,
    t_steps=100,
    method='mesolve',
    opts=None,
    savefile=None,
    z_min=0.0,
    z_max=1.0,
    z_steps=10,
    z_steps_inner=2,
    num_density_z_func=None,
    num_density_z_args=None,
    interaction_strengths=None,
    velocity_classes=None,
)

Methods

Name Description
build_velocity_classes Build the velocity-class detuning grid and Boltzmann weights.
build_zlist Builds the space grid.
check Validates the MBSolve object.
coherences Gets the sum of coherences (off-diagonals) in a list of coupled
coherences_field Get the sum of coherences (off-diagonals) for the levels coupled by
fields_area Gets the integrated pulse area of each field.
get_json_dict Return the full problem definition as a JSON-serialisable dict.
init_Omegas_zt Inits the Rabi frequency array.
init_states_zt Inits the system density matrices.
load_results Loads the solution from a QuTiP pickle file.
mbsolve Solves the Maxwell-Bloch equations for the system.
mbsolve_ab Solves the Maxwell-Bloch equations using an Adams-Bashforth step.
mbsolve_euler Solves the Maxwell-Bloch equations using a Euler step.
populations Gets the sum of populations in a list of levels.
populations_field Gets the sum of populations for the upper (excited) level coupled by
save_results Saves the solution to a QuTiP pickle file.
z_step Returns the distance from one space point to the next.
z_step_inner Returns the distance from one inner space point to the next.

build_velocity_classes

mb_solve.MBSolve.build_velocity_classes(velocity_classes=None)

Build the velocity-class detuning grid and Boltzmann weights.

Parameters

Name Type Description Default
velocity_classes dict | None dict of velocity-class parameters, or None for the no-Doppler-broadening case (single detuning class at 0). None

Returns

Name Type Description
tuple[np.ndarray, np.ndarray] (thermal_delta_list, thermal_weights)

build_zlist

mb_solve.MBSolve.build_zlist(z_min, z_max, z_steps, z_steps_inner)

Builds the space grid.

Parameters

Name Type Description Default
z_min float The front of the medium, in your chosen length unit. required
z_max float The back of the medium. required
z_steps int The number of even-spaced steps on which to solve and record the solution. required
z_steps_inner int Between each z_step, make this many inner steps of the finite-difference solver (for numerical stability). required

Notes

  • If the problem requires a lot of space steps for stability, but you don’t need to record the solution at such a high-level of resolution, increase z_steps_inner.

check

mb_solve.MBSolve.check()

Validates the MBSolve object.

coherences

mb_solve.MBSolve.coherences(coupled_levels)

Gets the sum of coherences (off-diagonals) in a list of coupled level pairs.

Parameters

Name Type Description Default
coupled_levels list[list[int]] a list of pairs of level indexes required

Returns

Name Type Description
np.ndarray np.array, shape (z_steps+1, t_steps+1), dtype=complex

Note

Unlike OBAtom.get_fields_sum_coherence, which operates on a single-z time series with per-field weighting factors, this method sums over the full (z, t) array with unit weights.

coherences_field

mb_solve.MBSolve.coherences_field(field_idx)

Get the sum of coherences (off-diagonals) for the levels coupled by a field.

Parameters

Name Type Description Default
field_idx int index in the list of fields required

Returns: np.array, shape (z_steps+1, t_steps+1), dtype=complex

fields_area

mb_solve.MBSolve.fields_area()

Gets the integrated pulse area of each field.

Returns

Name Type Description
np.ndarray np.array [num_fields, num_z_steps]: Integrated area of each field
np.ndarray over time

get_json_dict

mb_solve.MBSolve.get_json_dict()

Return the full problem definition as a JSON-serialisable dict.

init_Omegas_zt

mb_solve.MBSolve.init_Omegas_zt()

Inits the Rabi frequency array.

Omegas_zt shape: (num_fields, z_steps+1, t_steps+1) — field-first. states_zt shape: (z_steps+1, t_steps+1, num_states, num_states) — z-first. These are inconsistent; correcting either is a breaking API change, deferred to a future major version.

init_states_zt

mb_solve.MBSolve.init_states_zt()

Inits the system density matrices.

load_results

mb_solve.MBSolve.load_results()

Loads the solution from a QuTiP pickle file.

Raises

Name Type Description
ValueError if the savefile was built from a different problem definition (hash mismatch).

Notes

  • The path from which the results will be loaded is taken from self.savefile.
  • Old savefiles without metadata are loaded without integrity checking, with a warning.

mbsolve

mb_solve.MBSolve.mbsolve(
    step='ab',
    rho0=None,
    recalc=True,
    progress=True,
    progress_show_area=False,
    check_counter_prop_depletion=True,
    depletion_warn=0.01,
    depletion_error=0.1,
)

Solves the Maxwell-Bloch equations for the system.

Parameters

Name Type Description Default
step str ‘euler (for Euler method) or ’ab’ (for Adams-Bashforth) 'ab'
rho0 Qobj the initial density matrix state None
recalc bool Recalculate the solution even if a savefile exists? True
progress bool Show a tqdm progress bar with elapsed time, ETA and current max field amplitude. True
progress_show_area bool Extend the progress bar with the pulse area ∫|Ω|dt for each field at the current z-step. Requires progress=True. False
check_counter_prop_depletion bool Run a post-solve depletion check on any counter-propagating fields. Set False to suppress. True
depletion_warn float Depletion fraction that triggers a UserWarning. 0.01
depletion_error float Depletion fraction that raises CounterPropagatingDepletionError. 0.1

Returns

Name Type Description
np.ndarray self.Omegas_zt: The solved field complex Rabi frequency at each point in space z and time t.
np.ndarray self.states_zt: The solved density matrix at each point in space z and time t.

mbsolve_ab

mb_solve.MBSolve.mbsolve_ab(
    rho0=None,
    recalc=True,
    progress=False,
    progress_show_area=False,
)

Solves the Maxwell-Bloch equations using an Adams-Bashforth step.

Parameters

Name Type Description Default
rho0 Qobj the initial density matrix state None
recalc bool Recalculate the solution even if a savefile exists? True
progress bool Show a tqdm progress bar. False
progress_show_area bool Add pulse area ∫|Ω|dt per field to the progress bar. False

Returns

Name Type Description
np.ndarray self.Omegas_zt: The solved field complex Rabi frequency at each point in space z and time t.
np.ndarray self.states_zt: The solved density matrix at each point in space z and time t.

mbsolve_euler

mb_solve.MBSolve.mbsolve_euler(
    rho0=None,
    recalc=True,
    progress=False,
    progress_show_area=False,
)

Solves the Maxwell-Bloch equations using a Euler step.

Parameters

Name Type Description Default
rho0 Qobj the initial density matrix state None
recalc bool Recalculate the solution even if a savefile exists? True
progress bool Show a tqdm progress bar. False
progress_show_area bool Add pulse area ∫|Ω|dt per field to the progress bar. False

Returns

Name Type Description
np.ndarray self.Omegas_zt: The solved field complex Rabi frequency at each point in space z and time t.
np.ndarray self.states_zt: The solved density matrix at each point in space z and time t.

populations

mb_solve.MBSolve.populations(levels)

Gets the sum of populations in a list of levels.

Parameters

Name Type Description Default
levels list[int] a list of level indexes] required

Returns

Name Type Description
np.ndarray np.array, shape (z_steps+1, t_steps+1), dtype=np.real

populations_field

mb_solve.MBSolve.populations_field(field_idx, upper=True)

Gets the sum of populations for the upper (excited) level coupled by a field.

Parameters

Name Type Description Default
field_idx int index in the list of fields required

Returns

Name Type Description
np.ndarray np.array, shape (z_steps+1, t_steps+1), dtype=np.real

Note

  • Casting upper to int so upper is 1, lower is 0.

save_results

mb_solve.MBSolve.save_results()

Saves the solution to a QuTiP pickle file.

Notes

  • The path to which the results will be saved is taken from self.savefile.

z_step

mb_solve.MBSolve.z_step()

Returns the distance from one space point to the next.

z_step_inner

mb_solve.MBSolve.z_step_inner()

Returns the distance from one inner space point to the next.