Skip to main content
← OpenMECP Documentation

Module parser

Module parser 

Source
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§

InputData
Complete parsed input data from an OpenMECP input file.

Enums§

ParseError
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