Skip to main content
← OpenMECP Documentation

clean_keywords

Function clean_keywords 

Source
pub fn clean_keywords(keywords: &str) -> String
Expand description

Cleans keywords by removing comments and extra whitespace (generic version).

This function works for any quantum chemistry program by removing:

  • Lines starting with ‘#’ (full-line comments)
  • Inline comments (text after ‘#’ on the same line as valid keywords)
  • Empty lines
  • Leading and trailing whitespace from each line

The remaining valid keywords are joined with single spaces.

§Arguments

  • keywords - The raw keyword string that may contain comments and extra whitespace

§Returns

Returns a String containing cleaned keywords joined with single spaces.