MaxwellLink core workflow
Enforce invariants
- •Create new runnable inputs only under
projects/YYYY-MM-DD-NAME/. - •Keep runs reproducible by storing parameters in a
config.json(or similar) and avoiding hard-coded absolute paths. - •Never pass both
hub=...anddriver=...tomaxwelllink.Molecule; provide exactly one.
Choose coupling mode
- •Use embedded mode when the driver can run in the same Python process:
- •Construct molecules with
Molecule(driver="<id>", driver_kwargs={...}).
- •Construct molecules with
- •Use socket mode when drivers must run as separate processes or nodes:
- •Construct a
SocketHub(...), passhub=hubinto eachMolecule(...), and launch onemxl_driver --model <id> ...per molecule.
- •Construct a
- •If local socket runs fail with MPI/network permission errors, prefer embedded mode (
Molecule(driver="...", ...)) on local machines and reserve socket mode for SLURM/HPC. - •For local socket mode, you can disable MPI auto-init with
MPI4PY_RC_INITIALIZE=0and ensure loopback NIC usage (use127.0.0.1; set site-specific NIC selection env vars if MPI/OFI tries a non-loopback interface).
Handle units/time
- •For Meep: set
time_units_fsonMeepSimulation(...)and keep it consistent when interpreting driver times. - •For SingleMode/LaserDriven: work directly in atomic units and set
dt_auexplicitly.
Handle MPI and multi-process execution
- •Launch socket drivers only once (rank 0) under MPI; rely on MaxwellLink broadcasts for other ranks.
- •Set generous
timeoutfor HPC and tunelatencyto match driver cost. - •If attaching many molecules, consider
store_additional_data=Falsefor most molecules to limit memory usage; keep itTrueonly for the molecules you intend to export/plot.
Validate before running
- •Use
skills/mxl-project-scaffold/scripts/mxl_validate_project.pyto sanity-checkconfig.jsonand required files. - •When debugging behavior, compare to patterns in
tests/anddocs/source/usage.rst.
References
- •Solver choice:
skills/mxl-core/references/solver_quickref.md - •Driver choice:
skills/mxl-core/references/driver_quickref.md