maxwelllink.mxl_drivers.python.mxl_driver module

maxwelllink.mxl_drivers.python.mxl_driver.launch_driver(command='--model tls --port 31415 --param "omega=0.242, mu12=187, orientation=2, pe_initial=1e-4" --verbose', sleep_time=0.5)[source]

Launch the driver as a background subprocess for local testing.

Parameters:
  • command (str, default: '--model tls --port 31415 --param "omega=0.242, mu12=187, orientation=2, pe_initial=1e-4" --verbose') – Command-line arguments passed to mxl_driver.py.

  • sleep_time (float, default: 0.5) – Time to sleep (seconds) after launch to allow initialization.

Returns:

The process handle on the master rank, otherwise None.

Return type:

subprocess.Popen or None

maxwelllink.mxl_drivers.python.mxl_driver.mxl_driver_main()[source]

Parse CLI arguments and start the MaxwellLink socket driver.

Notes

Constructs the selected model via __drivers__ using the --model and --param options, then calls run_driver(...).

maxwelllink.mxl_drivers.python.mxl_driver.run_driver(unix=False, address='localhost', port=31415, timeout=600.0, driver=DummyModel(), sockets_prefix='/tmp/socketmxl_')[source]

Run the socket driver loop to communicate with MaxwellLink.

Parameters:
  • unix (bool, default: False) – Use a UNIX domain socket if True; otherwise use TCP/IP.

  • address (str, default: "localhost") – Hostname (TCP/IP) or UNIX socket name (when unix=True).

  • port (int, default: 31415) – TCP/IP port (ignored for UNIX sockets).

  • timeout (float, default: 600.0) – Socket timeout in seconds.

  • driver (DummyModel, default: DummyModel()) – Quantum dynamics model implementing the driver interface.

  • sockets_prefix (str, default: "/tmp/socketmxl_") – Prefix for UNIX domain socket paths (ignored for TCP/IP).

Notes

Implements a simple message protocol with headers such as STATUS, INIT, POSDATA/FIELDDATA, GETFORCE/GETSOURCE, and STOP.

maxwelllink.mxl_drivers.python.mxl_driver.terminate_driver(proc, timeout=2.0)[source]

Terminate a driver process launched by launch_driver.

Parameters:
  • proc (subprocess.Popen or None) – Process handle to terminate.

  • timeout (float, default: 2.0) – Seconds to wait for graceful shutdown before escalating.