Expand description
Input file parsing for OpenMECP configuration.
This module provides parsing functionality for OpenMECP input files, which use a custom section-based format. The parser handles:
- Geometries: Main geometry and LST interpolation geometries
- Configuration: All calculation parameters (method, program, etc.)
- Constraints: Bond lengths, angles, and fixed atoms
- Tail sections: Additional keywords for each state
§Input File Format
OpenMECP input files use a section-based syntax marked with *SECTION markers
and terminated with *. The format is designed to be human-readable and
flexible for different types of calculations.
§Required Sections
§*GEOM Section
Contains the initial molecular geometry in Cartesian coordinates:
*GEOM
C 0.0 0.0 0.0
H 1.0 0.0 0.0
H 0.0 1.0 0.0
*Can also reference external files:
*GEOM
@geometry.xyz
*§Key-Value Parameters
After sections, specify calculation parameters:
program = gaussian
method = B3LYP/6-31G*
nprocs = 4
mem = 4GB
charge = 0
mult_state_a = 1 # or mult_a = 1
mult_state_b = 3 # or mult_b = 3§Optional Sections
*TAIL_a/*TAIL_b: Additional keywords for each electronic state*CONSTR: Geometric constraints (bonds, angles, scans)*LST_a/*LST_b: Geometries for linear synchronous transit interpolation
§Examples
use omecp::parser::{parse_input, InputData};
use std::path::Path;
// Parse an input file
let input_path = Path::new("input.inp");
let input_data: InputData = parse_input(input_path)?;
// Access parsed data
let config = input_data.config;
let geometry = input_data.geometry;
let constraints = input_data.constraints;Structs§
- Input
Data - Complete parsed input data from an OpenMECP input file.
Enums§
- Parse
Error - Error type for parsing operations.
Functions§
- constraints_
are_ 🔒equivalent - Checks if two constraints are equivalent (define the same geometric parameter).
- create_
user_ 🔒friendly_ tail_ error - Creates a user-friendly error message for tail section validation failures.
- filter_
tail_ content - Filters comments and cleans tail section content.
- get_
tail_ 🔒section_ suggestions - Provides suggestions for fixing common tail section formatting issues.
- is_
comment_ line - Checks if a line is a comment line.
- log_
empty_ 🔒tail_ section_ info - Logs informational message about empty tail sections after filtering.
- parse_
angle_ 🔒target - Parses an angle target value (in degrees) with validation.
- parse_
atom_ 🔒index - Parses an atom index from a string with detailed error reporting.
- parse_
bool 🔒 - Parses a boolean value from a string, supporting multiple formats.
- parse_
constraint 🔒 - Parses a single constraint line from the *CONSTR section.
- parse_
distance_ 🔒target - Parses a distance target value with validation.
- parse_
input - Parse an OpenMECP input file.
- parse_
parameter - Parses configuration from a string content. All thresholds and coordinates use Angstrom-based units internally.
- parse_
scan 🔒 - read_
external_ 🔒geometry - read_
geom_ 🔒from_ gjf - read_
geom_ 🔒from_ log - read_
geom_ 🔒from_ xyz - validate_
constraints_ 🔒against_ geometry - Validates parsed constraints against the molecular geometry.
- validate_
gaussian_ keywords - Validates Gaussian keyword syntax.
- validate_
gaussian_ syntax - Validates basic Gaussian syntax patterns.
- validate_
tail_ section - Validates tail section content for Gaussian compatibility.
- validate_
tail_ section_ with_ context - Validates tail section content with enhanced context and error reporting.
- validate_
tail_ section_ with_ filtering_ context - Validates tail section content with filtering context awareness.
Type Aliases§
- Result 🔒
- Type alias for parse operation results