DeMonNanoPy API Reference

Project

Field Value
Distribution DeMonNanoPy
Import name deMonPy
Version 0.1.1
License MIT
Python >= 3.10
Runtime dependencies numpy >= 2.4, ase >= 3.20
Development dependencies pytest >= 9.0, ruff

Python wrapper around the deMonNano quantum-chemistry codes: builds input files from dictionaries, launches calculations, parses results, and drives workflows with ASE support.

Architecture

DeMonNanoPy wraps the external deMon.x binary in a high-level Python API: a calculation is defined as nested dictionaries that quasi-mirror the deMonNano input file (basis, DFTB, OPTIMIZATION, …), where active keys automatically become lower-case flags driving the input writer and output parser. One calculate(symbols, positions) call on a deMonNano instance writes deMon.inp, executes the binary in a working directory (optionally through a launcher such as mpirun), and parses deMon.out / deMon.mol into a plain, JSON-serializable results dictionary. The Module_DeMonNano class adds pluggable workflow drivers — opt (geometry optimization), ptmc (parallel tempering Monte Carlo) and md (molecular dynamics) — and an ASE-compatible calculator with the same properties exposes (energy, forces, Mulliken charges in eV) so structures can be driven directly through ASE.

Modules

Module Description
deMonPy Package entry point: global configuration and workflow-module registry.
deMonPy.basic Core calculation lifecycle: working-directory management, execution, state snapshots, error bookkeeping.
deMonPy.deMonNano Main deMonNano calculator and the workflow-capable Module_DeMonNano wrapper.
deMonPy.deMon Calculator for the non-Nano deMon code, same interface as deMonNano.
deMonPy.ase_calculator ASE-compatible calculator interface (units eV, eV/angstrom).
deMonPy.module Base class for workflow modules.
deMonPy.modules.dyn Molecular dynamics workflow (registry key "md").
deMonPy.modules.ptmc Parallel Tempering Monte Carlo workflow (registry key "ptmc").
deMonPy.modules.quench Geometry optimization workflow (registry key "opt").
deMonPy.profile Process management: build the command line, environment and execute the binary.
deMonPy.ioread Line/block-based parser base class and tolerance decorator.
deMonPy.demonnano.input deMonNano input-file writer: turns the parameter dictionaries into a deMon.inp.
deMonPy.demonnano.output deMonNano output parser: deMon.out and deMon.mol into a results dictionary.
deMonPy.demon.input deMon (non-Nano) input-file writer.
deMonPy.demon.output deMon (non-Nano) output parser.
deMonPy.molden XYZ trajectory I/O helpers (used for MD trajectories).
deMonPy.encoder JSON encoder for NumPy and ASE objects.
deMonPy.exceptions Exception hierarchy; catch the whole family with except DeMonError.

Workflow registry

Key Module
opt _relax_geometry (geometry optimization)
ptmc _ptmc (parallel tempering Monte Carlo)
md _dyn (molecular dynamics)

Exceptions

Exception Description
DeMonError Base class for every deMonPy-specific error.
ConfigError Invalid or missing configuration (executable, basis, launcher).
InputError The generated input file is invalid.
ExecuteFailed The deMon binary exited with an error.
OutputParseError The output could not be parsed (missing file or unparseable block).

Assets

  • deMonPy/asset/parameters-deMonNano.json — Skeleton deMonNano parameter template (DEMON_EXECUTABLE, WORKDIR, BASIS, DEMON_PARAMETERS ACTIVE/DISABLE).

Examples

  • example/example_argon.py
  • example/example_ase.py
  • example/example_bs.py
  • example/example_ci.py
  • example/example_dftb.py
  • example/example_dispersion.py
  • example/example_md.py
  • example/example_opt.py
  • example/example_periodic.py
  • example/example_qmmm.py
  • example/example_rttddftb.py
  • example/global_research.py

Tests

36 integration (require a runnable deMon.x + global.json with DEMON_EXECUTABLE / DEMON_BASIS)

  • test_ase_calculator.py (ASE interface, force/charge behaviour)
  • test_module.py (workflow modules)
  • test_parse_errors.py (error bookkeeping)
  • test_deMon_opt.py / test_deMon_ptmc.py / test_deMon_mdyn.py / test_deMon_ptmd.py (workflows)
  • test_periodic.py, test_basis_length.py, test_launcher.py (PBC, basis, mpirun)

Sections: Quickstart | Tutorial | Examples