XIAMParser

XIAMParser reads output files produced by XIAM (eXtended Internal Axis Method), a program for analyzing internal-rotation effects in molecular spectra. XIAM output is whitespace-delimited and is recognized by the -- B <number> block header followed by a column-header line; the parser sniffs this pattern in XIAMParser::canParse() so non-XIAM .out files are rejected. Recognized file extensions are .xo and .out.

The output format depends on the XIAM ints setting and the parser handles both modes that CatalogOverlay needs:

  • ints=2 — a simple frequency/intensity listing, one transition per line, with a single block.

  • ints=3 — frequency, rigid-rotor reference, and per-symmetry-state splittings; the parser unrolls each split into its own transition so downstream consumers can treat every line as an independent record. Quantum numbers from the block start are inherited by the split lines.

XIAM emits intensities with limited decimal precision, which can lose significant digits for weak transitions. The parser reconstructs a higher-precision intensity from the constituent line strength, statistical weight, population factor, and energy factor, returning whichever value is more precise. The molecule name is read from the XIAM file header when present and falls back to the file’s base name.

The output CatalogData carries sourceProgram = "XIAM". The parser is registered with FileParserRegistry during application startup; the user-facing catalog overlay workflow is described in Overlays.

API Reference

class XIAMParser : public CatalogParser

Parser for XIAM (eXtended Internal Axis Method) catalog output.

Public Functions

virtual bool canParse(const QString &filePath, const QVariantMap &hints = QVariantMap()) const override

Recognize a file by its .xo or .out suffix and the XIAM -- B header pattern.

virtual CatalogData parse(const QString &filePath, const QVariantMap &hints = QVariantMap()) const override

Parse a recognized XIAM file into a :cpp:class:CatalogData.

Detects the intensity mode (ints=2 or ints=3) automatically and dispatches to the matching internal parser.

virtual QString formatName() const override

Returns "XIAM".

virtual QString formatDescription() const override

Returns a one-line description of the format.

virtual QStringList fileExtensions() const override

Returns {"*.xo", "*.out"}.

Private Functions

int detectIntensityMode(const QStringList &lines) const

Detect the XIAM intensity mode used in the file.

Returns:

2 for ints=2, 3 for ints=3, 0 if no mode declaration is found.

CatalogData parseInts2Format(const QStringList &lines, int startLine) const

Parse the ints=2 (simple) variant.

CatalogData parseInts3Format(const QStringList &lines, int startLine) const

Parse the ints=3 (with splitting analysis) variant.

int findDataStartLine(const QStringList &lines) const

Find the line index where transition data begins.

Returns:

Zero-based line index, or -1 if no header is found.

QString parseQuantumNumbers(const QString &qnString) const

Normalize a XIAM quantum-number string.

QString extractMoleculeName(const QStringList &lines, const QString &filePath) const

Extract the molecule name from the file header.

Returns:

Header-supplied name when present; otherwise the file’s base name as a fallback.

TransitionData parseInts2Line(const QString &line, const QString &blockNumber = QString()) const

Parse a single transition line in ints=2 mode.

Parameters:

blockNumber – Block label appended to the quantum-number string when the file contains multiple blocks.

TransitionData parseInts3Line(const QString &line, const QString &groupQuantumNumbers = QString()) const

Parse a single transition line in ints=3 mode.

Parameters:

groupQuantumNumbers – Quantum numbers carried over from the block start so split lines inherit the parent assignment.

double calculateOptimalIntensity(double linestr, double total, double statWeight, double population, double hvEnergy) const

Reconstruct a high-precision intensity from XIAM’s constituent fields.

XIAM prints intensities with fixed decimal precision; for weak transitions the printed total can lose significant digits. This helper recomputes the intensity from line strength, statistical weight, population, and energy factors and returns whichever value is more precise.