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 failuresParse: 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§
- Bagel
Interface - BAGEL quantum chemistry program interface.
- CIS_
TOTAL_ 🔒RE - Custom
Interface - Custom QM interface that reads configuration from JSON
- Custom
Interface Config - Configuration for custom QM interfaces
- EXCITED_
RE 🔒 - Energy
Parser - Configuration for parsing energy from custom QM program output.
- FLOAT_
RE 🔒 - FORCE_
RE 🔒 - Forces
Parser - Configuration for parsing forces from custom QM program output.
- GEOM_RE 🔒
- Gaussian
Interface - Gaussian quantum chemistry program interface.
- Orca
Interface - 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