deMonPy.basic

Back to DeMonNanoPy API Reference

Description

Core calculation lifecycle: working-directory management, execution, state snapshots, error bookkeeping.

Source file: deMonPy/basic.py

Classes

BasicCalculation

Thin wrapper around deMonPy.profile.Process handling workdir creation, execution and state snapshots.

Methods

Method Signature Description
__init__ __init__(executable, workdir, prefix, omp_threads=1, launcher=None, nprocs=1) Create the process manager and calculation bookkeeping.
execute execute(ignore_fails=False) Run the deMon binary (and capture output).
set_workdir set_workdir() Create/enter the working directory for calculation files.
set_state set_state(index=1, **props) Record a state snapshot (iteration index + properties).
get_state get_state(index=1) Retrieve a recorded state snapshot.
to_dict to_dict() Return a JSON-serializable snapshot of the calculation state.

Common (BasicCalculation)

Shared base for the deMon and deMonNano calculators: input/output lifecycle, parameters, flags and error bookkeeping.

Methods

Method Signature Description
__init__ __init__(execut=None, workdir=".", omp_threads=1, prefix="DEMON", title="CALCULATION DEMON", properties=None, basis=None, ase_obj=True, clean_repository=True, ignore_parse_errors=True, **parameters) Initialise the calculator; execut/basis fall back to the deMonPy globals; **parameters is the full nested deMon configuration (DEMON_PARAMETERS, DEMON_MODULE, ...).
clean_workdir clean_workdir() Remove previous calculation files from the workdir.
reset reset() Reset calculator state between workflow steps.
calculate calculate(*, symbols, positions, cell=None, pbc=False, kpts=None, index=0, read_charges=False, extract_debug=False, **kwargs) One full step: write input, execute the binary, parse output, store results.
update update(properties=None, basis=None, **parameters) Update properties/basis/parameters for a next iteration (flags are recomputed).
write_input write_input() Abstract: write deMon.inp (implemented by deMon / deMonNano subclasses).
parse_output parse_output() Abstract: parse deMon.out / deMon.mol (implemented by deMon / deMonNano subclasses).
print_results print_results(files=sys.stdout) Pretty-print the results dictionary.
has_errors has_errors() True if any error (execution or parse) was recorded.
raise_on_errors raise_on_errors() Raise the first recorded error as the matching exception type.