# tuhh-tvt/opencosmo-rs_py architecture

> Architecture diagram of the GitHub repository tuhh-tvt/opencosmo-rs_py, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tuhh-tvt/opencosmo-rs_py
- Repository: https://github.com/tuhh-tvt/opencosmo-rs_py

## Overview

openCOSMO-RS(py) is a Python implementation of COSMO-RS for predicting mixture thermodynamic properties from quantum-chemistry surface data. The principal workflow parses a COSMO file, builds molecule and segment representations, then calculates mixture properties using parameterized segment interactions and combinatorial terms. The package also provides sigma-profile and molecular visualizations. The connections shown follow excerpts and SOURCE INDEX references; visualization’s wider inputs and unsampled calculation details are not inferred.

Main entry points: [`src/opencosmorspy/cosmors.py`](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/cosmors.py) (Mixture calculation), [`src/opencosmorspy/molecules.py`](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/molecules.py) (Molecule structures), [`src/opencosmorspy/input_parsers.py`](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/input_parsers.py) (COSMO parser), [`src/opencosmorspy/segtp_collection.py`](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/segtp_collection.py) (Segment types)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input processing"]
  node_parser["COSMO parser<br/>[input_parsers.py]"]
end

subgraph group_prep["Molecular preparation"]
  node_molecule["Molecule structures<br/>[molecules.py]"]
  node_helpers["Geometry helpers"]
  node_segments["Segment types"]
end

subgraph group_model["COSMO-RS model"]
  node_parameters["Model parameters"]
  node_calculation["Mixture calculation<br/>[cosmors.py]"]
  node_combinatorial["Combinatorial term<br/>[cosmors.py]"]
  node_enthalpic["Enthalpic term<br/>[cosmors.py]"]
end

subgraph group_viz["Visualization"]
  node_visualization["Profiles and 3D"]
end

node_user(("Package user"))

node_user -.->|"provides COSMO data"| node_parser
node_molecule -->|"parses structures"| node_parser
node_molecule -->|"uses geometry"| node_helpers
node_molecule -->|"selects settings"| node_parameters
node_molecule -->|"assigns segment types"| node_segments
node_calculation -->|"uses molecules"| node_molecule
node_calculation -->|"configures model"| node_parameters
node_calculation -->|"uses segment types"| node_segments
node_calculation -->|"calculates submodel"| node_combinatorial
node_calculation -->|"calculates submodel"| node_enthalpic
node_visualization -->|"reads sigma profiles"| node_parser
node_user -.->|"requests prediction"| node_calculation

click node_parser "https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/input_parsers.py"
click node_molecule "https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/molecules.py"
click node_helpers "https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/helper_functions.py"
click node_parameters "https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/parameterization.py"
click node_segments "https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/segtp_collection.py"
click node_calculation "https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/cosmors.py"
click node_combinatorial "https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/cosmors.py"
click node_enthalpic "https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/cosmors.py"
click node_visualization "https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/cosmo_visualizations.py"

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_parser,node_user toneBlue
class node_molecule,node_helpers,node_segments toneAmber
class node_parameters,node_calculation,node_combinatorial,node_enthalpic toneMint
class node_visualization toneRose
```

## Components

### Input processing

- [COSMO parser](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/input_parsers.py): `src/opencosmorspy/input_parsers.py`

### Molecular preparation

- [Molecule structures](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/molecules.py): `src/opencosmorspy/molecules.py`
- [Geometry helpers](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/helper_functions.py): `src/opencosmorspy/helper_functions.py`
- [Segment types](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/segtp_collection.py): `src/opencosmorspy/segtp_collection.py`

### COSMO-RS model

- [Model parameters](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/parameterization.py): `src/opencosmorspy/parameterization.py`
- [Mixture calculation](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/cosmors.py): `src/opencosmorspy/cosmors.py`
- [Combinatorial term](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/cosmors.py): `src/opencosmorspy/cosmors.py`
- [Enthalpic term](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/cosmors.py): `src/opencosmorspy/cosmors.py`

### Visualization

- [Profiles and 3D](https://github.com/tuhh-tvt/opencosmo-rs_py/blob/master/src/opencosmorspy/cosmo_visualizations.py): `src/opencosmorspy/cosmo_visualizations.py`

### Other components

- **Package user**

## Connections

- Package user → COSMO parser: provides COSMO data
- Molecule structures → COSMO parser: parses structures (evidence: `src/opencosmorspy/molecules.py`)
- Molecule structures → Geometry helpers: uses geometry (evidence: `src/opencosmorspy/molecules.py`)
- Molecule structures → Model parameters: selects settings (evidence: `src/opencosmorspy/molecules.py`)
- Molecule structures → Segment types: assigns segment types (evidence: `src/opencosmorspy/molecules.py`)
- Mixture calculation → Molecule structures: uses molecules (evidence: `src/opencosmorspy/cosmors.py`)
- Mixture calculation → Model parameters: configures model (evidence: `src/opencosmorspy/cosmors.py`)
- Mixture calculation → Segment types: uses segment types (evidence: `src/opencosmorspy/cosmors.py`)
- Mixture calculation → Combinatorial term: calculates submodel (evidence: `src/opencosmorspy/cosmors.py`)
- Mixture calculation → Enthalpic term: calculates submodel (evidence: `src/opencosmorspy/cosmors.py`)
- Profiles and 3D → COSMO parser: reads sigma profiles (evidence: `src/opencosmorspy/cosmo_visualizations.py`)
- Package user → Mixture calculation: requests prediction
