vibeqc.run_job¶
- vibeqc.run_job(molecule, *, basis, method='auto', functional=None, output='output', optimize=False, write_molden_file=True, fmax=0.05, max_opt_steps=200, memory_override=False, num_threads=None, dispersion=None, record_hostname=True, rhf_options=None, uhf_options=None, rks_options=None, uks_options=None, progress=None, verbose=None, use_logging=False, perf_log=None, structured_log=False, crash_dump=True)[source]¶
Run a vibe-qc SCF job and write the standard output files.
- Parameters:
molecule (vibeqc._vibeqc_core.Molecule) – The
Moleculedescribing the system (bohr coordinates).basis (str) – libint-recognized basis-set name.
method (Literal['rhf', 'rks', 'uhf', 'uks', 'auto']) –
"rhf","uhf","rks","uks", or"auto"(picks restricted vs unrestricted frommolecule.multiplicityand switches between HF/KS based on whetherfunctionalis set).functional (str | None) – XC functional for RKS / UKS (e.g.
"PBE","B3LYP"). Ignored for HF.output (str | PathLike) – Path stem for the generated files.
{output}.outalways; also{output}.moldenunless disabled; and{output}.trajwhenoptimize=True.optimize (bool) – Run a BFGS geometry optimization first (via ASE), then the final SCF on the optimized geometry. The trajectory is written for animation (openable with ASE-aware viewers).
write_molden_file (bool) – Emit
{output}.moldenat the converged geometry. Default True.fmax (float) – Optimizer tolerance (eV/Å) and iteration limit. Ignored unless
optimize=True.max_opt_steps (int) – Optimizer tolerance (eV/Å) and iteration limit. Ignored unless
optimize=True.memory_override (bool) – If
False(default), the driver estimates peak memory and aborts withInsufficientMemoryErrorwhen the estimate exceeds the machine’s available RAM. Set toTrueto proceed anyway — at the risk of swap-thrashing or a system freeze.num_threads (int | None) – If set, pin the OpenMP thread count for the duration of the calculation.
None(default) leaves the current setting in place — which is usually “all cores” unless the environment variableOMP_NUM_THREADSis set orvibeqc.set_num_threads()was called earlier. The actual thread count used is recorded in the output log for reproducibility.dispersion (object | None) –
Post-SCF D3(BJ) dispersion correction. Accepts:
None(default) — no dispersion.Trueor"d3bj"— use D3-BJ params for the current DFT functional.A functional name (
"pbe","b3lyp", …) — use its D3-BJ params (useful formethod="rhf"+"hf"dispersion, or for overriding the SCF functional in the damping lookup).A
D3BJParamsinstance — used directly.
The energy correction is written to the
.outfile, added to the returned object ase_dispersion/energy_total(the raw SCF.energyis preserved untouched), and, whenoptimize=True, added to the forces the optimizer sees. Routes throughvibeqc.compute_d3bj()withbackend="auto"— the referencedftd3backend is used when installed, otherwise the D1a framework stub. Seevibeqc.dispersionfor details.record_hostname (bool) – If
False, the per-job{output}.systemmanifest writeshostname = "<redacted>"instead of the live hostname. TheVIBEQC_NO_HOSTNAME=1environment variable does the same thing globally — engineering’s bundled docs runs use the env var so example outputs indocs/_static/examples/don’t leak machine names. Other manifest fields (CPU model, OS, memory, library versions) are not redacted; the redaction is scoped to the hostname only.uks_options (vibeqc._vibeqc_core.UKSOptions | None) – Optional override for the respective SCF options struct.
progress (bool | ProgressLogger | None) –
Live progress logger for long-running jobs. Default behavior is ON — the job emits a banner, per-stage milestones, and a final summary to stdout (line-flushed) so the canonical
nohup python LiH.py > LiH.log 2>&1 &+tail -f LiH.logworkflow shows progress in real time. The.outfile is also line-buffered sotail -f output-LiH.outworks without any extra setup.Pass
progress=Falseto silence stdout (the.outfile is still written normally — only the live mirror is suppressed). Pass avibeqc.ProgressLoggerinstance for fully custom routing (tee to a persistent file, mute, thread one logger through nested calls).Set
VIBEQC_LIVE_LOGGING=0in the environment to disable live progress globally — useful for batch scripts that don’t want to edit every input file. The env var only takes effect whenprogressis left at its default (None); explicitprogress=True/progress=False/ aProgressLoggerinstance always wins, so a debugging session can re-enable progress for one shell.Per-iteration progress for periodic SCFs (which run in Python) is streamed live through this same logger via the lower-level
run_*_periodic_*entry points; molecular SCFs run in C++ and only emit a pre-SCF banner + post-SCF summary live, with the per-iteration trace landing in the.outwhen the SCF returns.verbose (int | None) –
Integer verbosity level (PySCF convention, 0..9, default 4). Each level is a strict superset of the one below, so bumping
verboseonly adds output:0— silent (nothing live;.outis still written)1— banner + warnings + final SCF summary only2— add per-stage milestones +info()lines3— add per-stage timing on stage exit4— add per-iteration SCF rows (DEFAULT)5— add inline RSS-memory snapshots6+— phase-level wall-clock breakdown live (overlaps the post-mortem.perflog on purpose)
Pass
verbose=None(the default) to read theVIBEQC_VERBOSEenv var; if unset, falls back to 4. Ignored whenprogressis aProgressLoggerinstance — that logger’s own level wins.use_logging (bool) –
If
True, route progress throughlogging.getLogger("vibeqc.run_job")instead of barestdoutwrites. Banner / stage milestones land atINFO; per-iteration SCF rows atDEBUG; warnings atWARNING. Composes naturally with stdlib handlers (RotatingFileHandler, syslog,dictConfig):import logging logging.basicConfig(level=logging.INFO) vq.run_job(..., use_logging=True)
progress=Falsestill wins as a hard kill switch — the verbose-level gate runs before the logging call, so a silent run stays silent regardless of the active logging config. Ignored whenprogressis a pre-builtProgressLoggerinstance.perf_log (str | PathLike | bool | None) – Optional path (or
Trueto use{output}.perf) to write a post-mortem performance / debug breakdown — phase-level wall + CPU times, memory snapshots, parallelism flags. The liveprogress=log shows progress during the run; the perf log shows where the time went afterwards. Off by default. Pass an explicit path,Trueto emit alongside{output}.out, or set theVIBEQC_PERFLOG=pathenv var (which wins whenperf_logis left atNone). Seevibeqc.perffor the full instrumentation surface.structured_log (bool | str | PathLike | None) – Optional NDJSON (one-JSON-record-per-line) log capturing every SCF transition — banner, job_start, memory_estimate, per-iter rows, scf_converged, properties, job_end. Off by default. Pass
Trueto emit{output}.scf.jsonl, a path-like to write there explicitly, or set theVIBEQC_STRUCTURED_LOG=pathenv var (which wins whenstructured_logis left atFalse). The format is stable: events are append-only, fields are never renamed or removed. Seevibeqc.structured_logfor the full event catalog.crash_dump (bool | str | PathLike | None) – Write a snapshot to
{output}.dump(TOML) plus binary attachments (.dump.density.npy,.dump.fock.npy,.dump.mo.npy) when the SCF fails ungracefully — raised exception (NaN, linear dependence, memory error). DefaultTrue: post-mortem reproducibility costs nothing on success and saves a re-run on failure. PassFalse(or setVIBEQC_NO_CRASH_DUMP=1in the environment) to disable. The dump is written alongside{output}.outin the standardoutput.*family — re-attach the.dump+.dump.density.npyto a bug report and the maintainer can reconstruct the failing state viavibeqc.load_dump(). Seevibeqc.crash_dumpfor the dump format. The exception is always re-raised after the dump is written;crash_dump=Truedoes not swallow failures.rhf_options (vibeqc._vibeqc_core.RHFOptions | None)
uhf_options (vibeqc._vibeqc_core.UHFOptions | None)
rks_options (vibeqc._vibeqc_core.RKSOptions | None)
uks_options
- Return type:
The SCF result object (RHFResult / UHFResult / RKSResult / UKSResult).