ob_solve

class maxwellbloch.ob_solve.OBSolve(atom: dict | None = None, t_min: float = 0.0, t_max: float = 1.0, t_steps: int = 100, method: str = 'mesolve', opts: dict | None = None, savefile: str | None = None)[source]

Bases: object

Time-domain master equation solver for a single spatial point.

Wraps qutip.mesolve() to evolve an atomic density matrix described by an OBAtom over a user-defined time grid. Supports Doppler broadening via velocity classes and can save/load results to avoid recomputation.

Parameters:
  • atom – Dict (or empty dict for defaults) describing the atomic system; passed to OBAtom.

  • t_min – Start time of the simulation.

  • t_max – End time of the simulation.

  • t_steps – Number of time steps.

  • method – Solver method — 'mesolve' (Lindblad master equation) is the only supported value.

  • opts – Dict of QuTiP solver options passed to qutip.Options.

  • savefile – Path prefix for caching solved results ('.qu' extension appended automatically). Pass None to disable caching.

build_opts(opts: dict | None = None) dict[source]

Build the options dict to be passed into the QuTiP solver.

Any option available to the QuTiP solver is available here, we provide defaults for solving the optical Bloch equations. See [0] for details of all the available options.

Notes

  • For a stiff problem, it may help to set ‘method’ to

    ‘bdf’ instead of ‘adams’.

  • If the solver times out, try more ‘nsteps’, though

    this will take longer.

  • To speed up the solver, reduce atol and rtol, though this

    will reduce accuracy.

Warning

There is no validation checking here. If you pass in an option which is not known to QuTiP it will throw an exception.

[0]: http://qutip.org/docs/4.2/guide/dynamics/dynamics-options.html

classmethod from_json(file_path: str) OBSolve[source]

Initialise OBSolve from JSON file.

classmethod from_json_str(json_str: str) OBSolve[source]

Initialise OBSolve from JSON string.

get_json_dict() dict[str, Any][source]
obsolve(e_ops: list | None = None, opts: dict | None = None, recalc: bool = True, show_pbar: bool = False, save: bool = True) ndarray[source]
savefile_exists() bool[source]

Returns true if savefile (with appended extension .qu) exists.

set_field_rabi_freq_t_args(field_idx: int, t_args: dict) None[source]
Set the Rabi frequency time function arguments. To be used with

set_field_rabi_freq_t_func

Parameters:
  • field_idx – The field for which to set the Rabi frequency t_args

  • t_args – A dict representing the args to go with the t_func.

set_field_rabi_freq_t_func(field_idx: int, t_func: Any) None[source]
Set the Rabi frequency time function of a field to a new time

function. This is useful when you want to set a custom function, not one available in t_funcs.py

Parameters:
  • field_idx – The field for which to set the Rabi frequency t_func

  • t_func – Rabi frequency as a function of time, f(t, args)

states_t() ndarray[source]
t_step() float[source]
to_json(file_path: str) None[source]
to_json_str() str[source]