Skip to main content
← OpenMECP Documentation

build_program_header

Function build_program_header 

Source
pub fn build_program_header(
    config: &Config,
    charge: i32,
    mult: usize,
    td_or_tail: &str,
    state: usize,
) -> String
Expand description

Builds a program-specific input file header string.

This function dispatches to the appropriate header building function based on the quantum chemistry program specified in the configuration. It now uses dynamic method modification to ensure run mode compatibility.

Note: For ORCA programs, this function will panic if no input basename is provided. Use build_program_header_with_basename() instead for ORCA calculations.

§Arguments

  • config - The global configuration for the MECP calculation
  • charge - Molecular charge for the current state
  • mult - Spin multiplicity for the current state
  • td_or_tail - TD-DFT keywords (Gaussian) or tail section content (other programs)
  • state - Electronic state index (used for BAGEL)

§Returns

Returns a String containing the formatted input header for the specified program.

§Panics

Panics if config.program is QMProgram::Orca since ORCA requires an input basename.

§Examples

use omecp::config::{Config, QMProgram, RunMode};
use omecp::io;

let mut config = Config::default();
config.program = QMProgram::Gaussian; // Works for Gaussian
config.method = "B3LYP/6-31G*".to_string();
config.run_mode = RunMode::Normal;

let header = io::build_program_header(&config, 0, 1, "", 0);
println!("{}", header);