# valdes-tresanco-ms/gmx_mmpbsa architecture

> Architecture diagram of the GitHub repository valdes-tresanco-ms/gmx_mmpbsa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/valdes-tresanco-ms/gmx_mmpbsa
- Repository: https://github.com/valdes-tresanco-ms/gmx_mmpbsa

## Overview

##### Project type and purpose
- This is an open-source Python tool (gmx_MMPBSA) that wraps AMBER’s MMPBSA.py workflows to work with GROMACS files.
- It provides both a command-line interface (CLI) and a GUI “analyzer” for post-processing and plotting.

##### File structure
- Top level:
- GMXMMPBSA/ – core Python package
- examples/ & docs/ – use-case examples & documentation
- setup.py, mkdocs.yml, workflows – packaging, publishing, CI/CD
- Inside GMXMMPBSA/:
- main.py, app.py, API.py, commandlineparser.py – CLI entry points & API façade
- calculation.py, createinput.py, make_top.py, make_trajs.py, parm_setup.py – core “engine” modules
- input_parser.py, output_file.py, infofile.py, analyzer/utils.py, exceptions.py, utils.py – I/O, error handling, helpers
- analyzer/ – PyQt (or Qt) GUI components: gui.py, dialogs.py, customitem.py, plots.py, style/
- data/ – bundled parameter files & test data for GROMACS/AMBER
- External dependencies called at runtime:
- GROMACS binaries
- AmberTools (MMPBSA.py)
- Python libraries (NumPy, Matplotlib, ParmEd, PyQt5, etc.)

##### README for insights
- Confirms it’s a drop-in tool to perform end-state free energy calculations.
- Points to “API” and “analyzer” documentation, and requires GROMACS & AmberTools.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Points
    subgraph "Entry Points"
        CLI["commandlineparser.py"]:::internal
        Main["main.py"]:::internal
        App["app.py"]:::internal
        Shell["GMXMMPBSA.sh"]:::internal
        Version["_version.py"]:::internal
        Init["__init__.py"]:::internal
    end

    %% API Layer
    subgraph "API Layer"
        API["API.py"]:::internal
    end

    %% Core Engine
    subgraph "Core Engine"
        InputParser["input_parser.py"]:::internal
        Calculation["calculation.py"]:::internal
        CreateInput["createinput.py"]:::internal
        MakeTop["make_top.py"]:::internal
        MakeTrajs["make_trajs.py"]:::internal
        ParmSetup["parm_setup.py"]:::internal
    end

    %% I/O & Data
    subgraph "I/O & Data"
        InfoFile["infofile.py"]:::internal
        OutputFile["output_file.py"]:::internal
        DataDir["data/"]:::data
    end

    %% Exceptions & Utilities
    subgraph "Exceptions & Utilities"
        Exceptions["exceptions.py"]:::internal
        Utils["utils.py"]:::internal
        Timer["timer.py"]:::internal
        FakeMPI["fake_mpi.py"]:::internal
    end

    %% Analyzer GUI
    subgraph "Analyzer GUI"
        GUI["gui.py"]:::internal
        Dialogs["dialogs.py"]:::internal
        CustomItem["customitem.py"]:::internal
        Plots["plots.py"]:::internal
        AnUtils["utils.py"]:::internal
        subgraph "Style"
            StyleDir["style/"]:::data
        end
        subgraph "Parameter Tree"
            PTree["ParameterTree.py"]:::internal
            Param["Parameter.py"]:::internal
            ParamItem["ParameterItem.py"]:::internal
            ParamTypes["parameterTypes.py"]:::internal
        end
    end

    %% External Tools
    subgraph "External Tools"
        GROMACS["GROMACS Binaries"]:::external
        Amber["AmberTools (MMPBSA.py)"]:::external
    end

    %% Third-party Libraries
    subgraph "Third-party Libraries"
        ParmEd["ParmEd"]:::external
        NumPy["NumPy"]:::external
        Matplotlib["Matplotlib"]:::external
        PyQt5["PyQt5"]:::external
    end

    %% Relationships
    CLI -->|parses args| Main
    Main -->|routes| App
    App -->|calls| API
    App -->|calls| InputParser
    API -->|invokes| InputParser

    %% Core Engine flow
    InputParser -->|reads inputs| Calculation
    Calculation -->|generates| CreateInput
    CreateInput -->|prepares| ParmSetup
    Calculation -->|prepares| MakeTop
    Calculation -->|prepares| MakeTrajs
    CreateInput --> ParmSetup

    %% External calls
    MakeTop -->|subprocess| GROMACS
    MakeTrajs -->|subprocess| GROMACS
    ParmSetup -->|calls| Amber

    %% I/O & Data flow
    Calculation -->|outputs| OutputFile
    OutputFile -->|writes| InfoFile
    InfoFile -->|uses| DataDir

    %% Analyzer flow
    OutputFile -->|loads| GUI
    GUI -->|uses| AnUtils
    GUI -->|opens| Dialogs
    GUI -->|renders| Plots
    GUI -->|builds| PTree
    PTree --> Param
    PTree --> ParamItem
    PTree --> ParamTypes
    GUI -->|applies| StyleDir

    %% Exceptions & Utilities usage
    Calculation --> Exceptions
    App --> Utils
    Calculation --> Timer
    Calculation --> FakeMPI

    %% Third-party library dependencies
    ParmSetup --> ParmEd
    Plots --> Matplotlib
    GUI --> PyQt5
    Calculation --> NumPy

    %% Click Events
    click CLI "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/commandlineparser.py"
    click Main "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/main.py"
    click App "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/app.py"
    click Shell "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/GMXMMPBSA.sh"
    click Version "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/_version.py"
    click Init "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/__init__.py"
    click API "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/API.py"
    click InputParser "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/input_parser.py"
    click Calculation "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/calculation.py"
    click CreateInput "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/createinput.py"
    click MakeTop "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/make_top.py"
    click MakeTrajs "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/make_trajs.py"
    click ParmSetup "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/parm_setup.py"
    click InfoFile "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/infofile.py"
    click OutputFile "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/output_file.py"
    click DataDir "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/tree/master/GMXMMPBSA/data/"
    click Exceptions "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/exceptions.py"
    click Utils "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/utils.py"
    click Timer "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/timer.py"
    click FakeMPI "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/fake_mpi.py"
    click GUI "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/analyzer/gui.py"
    click Dialogs "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/analyzer/dialogs.py"
    click CustomItem "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/analyzer/customitem.py"
    click Plots "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/analyzer/plots.py"
    click AnUtils "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/analyzer/utils.py"
    click StyleDir "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/tree/master/GMXMMPBSA/analyzer/style/"
    click PTree "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/analyzer/parametertree/ParameterTree.py"
    click Param "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/analyzer/parametertree/Parameter.py"
    click ParamItem "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/analyzer/parametertree/ParameterItem.py"
    click ParamTypes "https://github.com/valdes-tresanco-ms/gmx_mmpbsa/blob/master/GMXMMPBSA/analyzer/parametertree/parameterTypes.py"

    %% Styles
    classDef internal fill:#b7e4c7,stroke:#2d6a4f,color:#1b4332
    classDef external fill:#d0e2ff,stroke:#386fa4,color:#1c7ed6
    classDef data fill:#fff3bf,stroke:#d97706,color:#92400e
```
