# svenherbers/xiam-2nq architecture

> Architecture diagram of the GitHub repository svenherbers/xiam-2nq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/svenherbers/xiam-2nq
- Repository: https://github.com/svenherbers/xiam-2nq

## Overview

XIAM-2NQ is a Fortran spectral-fitting program for molecules with up to two quadrupolar nuclei, four internal rotors, and one double-well tunneling motion. The documented product workflow is to fit molecular spectra using a model assembled from semi-rigid-rotor, internal-rotor, and rotation-distortion parameters. The README names the source files but does not describe their runtime calls; the component-to-file assignments below are therefore cautious, and unverified runtime links are dashed. No source excerpts were available to confirm internal control flow.

Main entry points: [`iamfit.f`](https://github.com/svenherbers/xiam-2nq/blob/main/iamfit.f) (Spectral fitting), [`iam.f`](https://github.com/svenherbers/xiam-2nq/blob/main/iam.f) (XIAM-2NQ program), [`iamv.f`](https://github.com/svenherbers/xiam-2nq/blob/main/iamv.f) (Semi-rigid rotor), [`iamint.f`](https://github.com/svenherbers/xiam-2nq/blob/main/iamint.f) (Internal rotors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Program and fitting"]
  node_program["XIAM-2NQ program<br/>[iam.f]"]
  node_fitting["Spectral fitting<br/>[iamfit.f]"]
end

subgraph group_physics["Molecular model"]
  node_semi_rigid["Semi-rigid rotor<br/>[iamv.f]"]
  node_internal_rotors["Internal rotors<br/>[iamint.f]"]
  node_quadrupole_tunnel["Quadrupole and tunneling<br/>[iamv2.f]"]
  node_distortion["Rotor distortion<br/>[iamadj.f]"]
end

subgraph group_io["Input and output"]
  node_spectral_io["Spectral data I/O<br/>[iamio.f]"]
  node_results["Fit results<br/>[iamio.f]"]
end

node_user(("Spectroscopy user"))

node_user -->|"uses"| node_program
node_program -.->|"fits spectra"| node_fitting
node_fitting -.->|"models rotor"| node_semi_rigid
node_fitting -.->|"models internal rotation"| node_internal_rotors
node_fitting -.->|"models couplings"| node_quadrupole_tunnel
node_fitting -.->|"models distortion"| node_distortion
node_program -.->|"reads and writes"| node_spectral_io
node_program -.->|"produces"| node_results

click node_program "https://github.com/svenherbers/xiam-2nq/blob/main/iam.f"
click node_fitting "https://github.com/svenherbers/xiam-2nq/blob/main/iamfit.f"
click node_semi_rigid "https://github.com/svenherbers/xiam-2nq/blob/main/iamv.f"
click node_internal_rotors "https://github.com/svenherbers/xiam-2nq/blob/main/iamint.f"
click node_quadrupole_tunnel "https://github.com/svenherbers/xiam-2nq/blob/main/iamv2.f"
click node_distortion "https://github.com/svenherbers/xiam-2nq/blob/main/iamadj.f"
click node_spectral_io "https://github.com/svenherbers/xiam-2nq/blob/main/iamio.f"
click node_results "https://github.com/svenherbers/xiam-2nq/blob/main/iamio.f"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_program,node_fitting,node_user toneBlue
class node_semi_rigid,node_internal_rotors,node_quadrupole_tunnel,node_distortion toneAmber
class node_spectral_io,node_results toneMint
```

## Components

### Program and fitting

- [XIAM-2NQ program](https://github.com/svenherbers/xiam-2nq/blob/main/iam.f): `iam.f`
- [Spectral fitting](https://github.com/svenherbers/xiam-2nq/blob/main/iamfit.f): `iamfit.f`

### Molecular model

- [Semi-rigid rotor](https://github.com/svenherbers/xiam-2nq/blob/main/iamv.f): `iamv.f`
- [Internal rotors](https://github.com/svenherbers/xiam-2nq/blob/main/iamint.f): `iamint.f`
- [Quadrupole and tunneling](https://github.com/svenherbers/xiam-2nq/blob/main/iamv2.f): `iamv2.f`
- [Rotor distortion](https://github.com/svenherbers/xiam-2nq/blob/main/iamadj.f): `iamadj.f`

### Input and output

- [Spectral data I/O](https://github.com/svenherbers/xiam-2nq/blob/main/iamio.f): `iamio.f`
- [Fit results](https://github.com/svenherbers/xiam-2nq/blob/main/iamio.f): `iamio.f`

### Other components

- **Spectroscopy user**

## Connections

- Spectroscopy user → XIAM-2NQ program: uses (evidence: `README.md`)
- XIAM-2NQ program → Spectral fitting: fits spectra
- Spectral fitting → Semi-rigid rotor: models rotor
- Spectral fitting → Internal rotors: models internal rotation
- Spectral fitting → Quadrupole and tunneling: models couplings
- Spectral fitting → Rotor distortion: models distortion
- XIAM-2NQ program → Spectral data I/O: reads and writes
- XIAM-2NQ program → Fit results: produces
