# partha-debug/brownian_dynamics architecture

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

- Interactive diagram: https://gitdiagram.com/partha-debug/brownian_dynamics
- Repository: https://github.com/partha-debug/brownian_dynamics

## Overview

This is a Brownian-dynamics simulator for particles in a 2D harmonic trap, with optional WCA interactions and underdamped or overdamped integration. The main workflow runs the simulation, saves position and velocity trajectories, calculates MSD and (when WCA is enabled) RDF, then produces plots and an animation. The README also describes these outputs. Edges reflect calls and data transfers visible in the sampled source; unsampled behavior is not inferred.

Main entry points: [`main.py`](https://github.com/partha-debug/brownian_dynamics/blob/main/main.py) (Simulation runner), [`dynamics.py`](https://github.com/partha-debug/brownian_dynamics/blob/main/dynamics.py) (Force calculation), [`analyzer.py`](https://github.com/partha-debug/brownian_dynamics/blob/main/analyzer.py) (MSD and RDF), [`visualizer.py`](https://github.com/partha-debug/brownian_dynamics/blob/main/visualizer.py) (Plots and animation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation"]
  node_config["Simulation config<br/>[config.py]"]
  node_runner["Simulation runner<br/>[main.py]"]
  node_forces["Force calculation<br/>[dynamics.py]"]
  node_integrators["Integrators<br/>[dynamics.py]"]
  node_trajectory["Trajectories"]
end

subgraph group_analysis["Analysis"]
  node_analyzer["MSD and RDF<br/>[analyzer.py]"]
  node_csv["Analysis CSV"]
end

subgraph group_presentation["Visualization"]
  node_visualizer["Plots and animation<br/>[visualizer.py]"]
  node_figures["Figures and GIF"]
end

node_user(("User"))

node_user -->|"runs"| node_runner
node_runner -->|"reads settings"| node_config
node_runner -->|"computes forces"| node_forces
node_forces -.-> node_integrators
node_runner -->|"advances particles"| node_integrators
node_runner -->|"saves"| node_trajectory
node_runner -->|"passes trajectory"| node_analyzer
node_analyzer -->|"writes results"| node_csv
node_runner -->|"requests plots"| node_visualizer
node_runner -->|"passes to visualizer"| node_trajectory
node_visualizer -->|"writes"| node_figures

click node_config "https://github.com/partha-debug/brownian_dynamics/blob/main/config.py"
click node_runner "https://github.com/partha-debug/brownian_dynamics/blob/main/main.py"
click node_forces "https://github.com/partha-debug/brownian_dynamics/blob/main/dynamics.py"
click node_integrators "https://github.com/partha-debug/brownian_dynamics/blob/main/dynamics.py"
click node_analyzer "https://github.com/partha-debug/brownian_dynamics/blob/main/analyzer.py"
click node_visualizer "https://github.com/partha-debug/brownian_dynamics/blob/main/visualizer.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_config,node_runner,node_forces,node_integrators,node_trajectory,node_user toneBlue
class node_analyzer,node_csv toneAmber
class node_visualizer,node_figures toneMint
```

## Components

### Simulation

- [Simulation config](https://github.com/partha-debug/brownian_dynamics/blob/main/config.py): `config.py`
- [Simulation runner](https://github.com/partha-debug/brownian_dynamics/blob/main/main.py): `main.py`
- [Force calculation](https://github.com/partha-debug/brownian_dynamics/blob/main/dynamics.py): `dynamics.py`
- [Integrators](https://github.com/partha-debug/brownian_dynamics/blob/main/dynamics.py): `dynamics.py`
- **Trajectories**

### Analysis

- [MSD and RDF](https://github.com/partha-debug/brownian_dynamics/blob/main/analyzer.py): `analyzer.py`
- **Analysis CSV**

### Visualization

- [Plots and animation](https://github.com/partha-debug/brownian_dynamics/blob/main/visualizer.py): `visualizer.py`
- **Figures and GIF**

### Other components

- **User**

## Connections

- User → Simulation runner: runs
- Simulation runner → Simulation config: reads settings
- Simulation runner → Force calculation: computes forces
- Force calculation → Integrators
- Simulation runner → Integrators: advances particles
- Simulation runner → Trajectories: saves
- Simulation runner → MSD and RDF: passes trajectory
- MSD and RDF → Analysis CSV: writes results
- Simulation runner → Plots and animation: requests plots
- Simulation runner → Trajectories: passes to visualizer
- Plots and animation → Figures and GIF: writes
