# brucefan1983/gpumd architecture

> Architecture diagram of the GitHub repository brucefan1983/gpumd, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/brucefan1983/gpumd
- Repository: https://github.com/brucefan1983/gpumd

## Overview

##### Main System Components

a. Core Components:
- GPUMD Engine (Molecular Dynamics Simulator)
- NEP Engine (Neuroevolution Potential Trainer)
- Force Calculation Module
- Integration Module
- Measurement Module

b. Supporting Components:
- Input/Output Handlers
- Tools and Utilities
- Documentation System

- GPUMD       |     |      NEP      |     |    Tools &    |
- Simulator    |<--->|    Trainer    |     |   Utilities   |

- Force     |     | Integration |     | Measurement |
- Modules    |<--->|   Modules   |<--->|   Modules   |

- ^                  ^                  ^

- v                  v                  v

- GPU Acceleration             |

**Force Modules:**
- Classical Potentials (EAM, Tersoff, etc.)
- Machine Learning Potentials (NEP)
- Special Interactions (ZBL, D3 correction)

**Integration Modules:**
- Ensemble Types (NVE, NVT, etc.)
- PIMD/TRPMD
- Monte Carlo Integration

**Measurement Modules:**
- Thermal Properties
- Structural Properties
- Transport Properties

##### Key Design Elements to Highlight

- Blue: Core simulation components
- Green: Machine learning components
- Orange: I/O and utilities
- Gray: GPU acceleration layer

b. Connection Types:
- Double lines: High-bandwidth data transfer

##### Implementation Details

Implementation aspects:

- Implementation   |

- CUDA C++      |
- Multi-GPU     |
- File I/O      |

##### External Interfaces

Connections to:
- Input file formats (XYZ, etc.)
- Output data formats
- Visualization tools
- External analysis tools

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core System"]
        GPUMD["GPUMD Engine"]:::core
        NEP["NEP Engine"]:::ml
        Tools["Tools & Utilities"]:::util
        
        GPUMD <--> NEP
        GPUMD --> Tools
        NEP --> Tools
    end

    subgraph Modules["Core Modules"]
        Force["Force Calculation"]:::compute
        Integration["Integration"]:::compute
        Measure["Measurement"]:::compute
        
        Force <--> Integration
        Integration <--> Measure
    end

    subgraph Implementation["Implementation Layer"]
        Model["Model Management"]:::data
        GPU["GPU Acceleration Layer"]:::gpu
        IO["Input/Output Handlers"]:::io
    end

    subgraph ForceModules["Force Modules"]
        Classical["Classical Potentials"]:::force
        MLPot["ML Potentials"]:::force
        Special["Special Interactions"]:::force
    end

    subgraph IntegrationModules["Integration Modules"]
        Ensemble["Ensemble Types"]:::int
        PIMD["PIMD/TRPMD"]:::int
        Monte["Monte Carlo"]:::int
    end

    subgraph MeasureModules["Measurement Modules"]
        Thermal["Thermal Properties"]:::meas
        Structural["Structural Properties"]:::meas
        Transport["Transport Properties"]:::meas
    end

    GPUMD --> Force
    GPUMD --> Integration
    GPUMD --> Measure
    NEP --> MLPot

    Force --> ForceModules
    Integration --> IntegrationModules
    Measure --> MeasureModules

    Model --> Force
    Model --> Integration
    Model --> Measure
    
    GPU --> Force
    GPU --> Integration
    GPU --> Measure

    IO --> Model
    Tools --> IO

    %% Component Mappings
    click GPUMD "https://github.com/brucefan1983/GPUMD/tree/master/src/main_gpumd/"
    click NEP "https://github.com/brucefan1983/GPUMD/tree/master/src/main_nep/"
    click Force "https://github.com/brucefan1983/GPUMD/tree/master/src/force/"
    click Integration "https://github.com/brucefan1983/GPUMD/tree/master/src/integrate/"
    click Measure "https://github.com/brucefan1983/GPUMD/tree/master/src/measure/"
    click Model "https://github.com/brucefan1983/GPUMD/tree/master/src/model/"
    click Tools "https://github.com/brucefan1983/GPUMD/tree/master/tools/"
    click Classical "https://github.com/brucefan1983/GPUMD/blob/master/src/force/tersoff1989.cu"
    click MLPot "https://github.com/brucefan1983/GPUMD/blob/master/src/force/nep.cu"
    click Ensemble "https://github.com/brucefan1983/GPUMD/blob/master/src/integrate/ensemble.cu"
    click Thermal "https://github.com/brucefan1983/GPUMD/blob/master/src/measure/dos.cu"
    click Structural "https://github.com/brucefan1983/GPUMD/blob/master/src/measure/rdf.cu"
    click Transport "https://github.com/brucefan1983/GPUMD/blob/master/src/measure/msd.cu"

    %% Styling
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef ml fill:#2ecc71,stroke:#27ae60,color:white
    classDef util fill:#e67e22,stroke:#d35400,color:white
    classDef compute fill:#9b59b6,stroke:#8e44ad,color:white
    classDef data fill:#34495e,stroke:#2c3e50,color:white
    classDef gpu fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef io fill:#e74c3c,stroke:#c0392b,color:white
    classDef force fill:#1abc9c,stroke:#16a085,color:white
    classDef int fill:#f1c40f,stroke:#f39c12,color:black
    classDef meas fill:#3498db,stroke:#2980b9,color:white
```
