Skip to main content
← OpenMECP Documentation

Module qm_interface

Module qm_interface 

Source
Expand description

Quantum chemistry program interfaces for MECP calculations.

This module provides a unified interface for running calculations with different quantum chemistry programs. It abstracts away the differences between programs (Gaussian, ORCA, Bagel, XTB, custom interfaces) and provides a consistent API for:

  • Writing input files
  • Executing calculations
  • Parsing output files
  • Extracting energies, forces, and geometries

§Supported Programs

  • Gaussian: Full feature support with checkpoint files, TD-DFT, MP2, etc.
  • ORCA: Energy and gradient files with GBW checkpoints
  • Bagel: CASSCF and MRCI calculations with JSON model files
  • XTB: Fast semi-empirical calculations using GFN2-xTB
  • Custom: JSON-configurable interface for any program

§Interface Design

The QMInterface trait defines the contract that all QM programs must implement. Each program has its own implementation that handles:

  • Program-specific input file format
  • Program execution commands and flags
  • Output parsing and data extraction
  • Error handling specific to the program

§Usage Pattern

use omecp::qm_interface::{QMInterface, GaussianInterface};

let gaussian = GaussianInterface::new("g16".to_string(), false);
gaussian.write_input(&geometry, &header, &tail, Path::new("input.gjf"))?;
gaussian.run_calculation(Path::new("input.gjf"))?;
let state = gaussian.read_output(Path::new("output.log"), 0)?;

§Error Handling

All operations return a QMError result that can be:

  • IO: File system errors (missing files, permission issues)
  • Calculation: QM program execution failures
  • Parse: Output parsing errors (malformed or unexpected output)

§State Extraction

Each call to read_output extracts a State containing:

  • Energy (in hartree)
  • Forces/gradients (in hartree/bohr)
  • Final geometry

Structs§

BagelInterface
BAGEL quantum chemistry program interface.
CIS_TOTAL_RE 🔒
CustomInterface
Custom QM interface that reads configuration from JSON
CustomInterfaceConfig
Configuration for custom QM interfaces
EXCITED_RE 🔒
EnergyParser
Configuration for parsing energy from custom QM program output.
FLOAT_RE 🔒
FORCE_RE 🔒
ForcesParser
Configuration for parsing forces from custom QM program output.
GEOM_RE 🔒
GaussianInterface
Gaussian quantum chemistry program interface.
OrcaInterface
ORCA quantum chemistry program interface.
XtbInterface
XTB semi-empirical program interface.

Enums§

QMError
Error type for QM interface operations.

Traits§

QMInterface
Trait that defines the interface for all quantum chemistry programs.

Functions§

atomic_number_to_symbol 🔒
geometry_to_json 🔒
get_output_file_base
Returns the output file extension for the given QM program.

Type Aliases§

Result 🔒
Type alias for QM operation results