# takayuki-miyagi/nuhamil-public architecture

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

- Interactive diagram: https://gitdiagram.com/takayuki-miyagi/nuhamil-public
- Repository: https://github.com/takayuki-miyagi/nuhamil-public

## Overview

NuHamil is a nuclear-interaction matrix-element generator with companion few-body calculations and analysis tools. The main user workflow is to configure a run, supply a nucleon–nucleon interaction, and invoke the Fortran executable to generate matrix elements; example scripts also request deuteron, helium-4, and triton/helium-3 properties. Separate documented capabilities include two-body currents and phase-shift analysis. The README and excerpts establish these entry points and broad purposes, but do not expose the Fortran call graph, so internal runtime links are omitted.

Main entry points: [`src/NuHamilMain.F90`](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/src/NuHamilMain.F90) (NuHamil executable), [`input_nn_files`](https://github.com/takayuki-miyagi/nuhamil-public/tree/main/input_nn_files) (NN interactions), [`exe/NuHamil_2BME.py`](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/NuHamil_2BME.py) (Two-body ME driver), [`exe/NuHamil_3BME.py`](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/NuHamil_3BME.py) (Three-body ME driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_drivers["Run drivers"]
  node_two_body_driver["Two-body ME driver<br/>[NuHamil_2BME.py]"]
  node_three_body_driver["Three-body ME driver<br/>[NuHamil_3BME.py]"]
  node_multipole_driver["Multipole driver<br/>[Multipoles.py]"]
  node_gt_driver["Gamow-Teller driver<br/>[GT2BC.py]"]
end

subgraph group_runtime["Fortran runtime"]
  node_runtime_main["NuHamil executable<br/>[NuHamilMain.F90]"]
  node_runtime_input["Input handling<br/>[NuHamilInput.F90]"]
  node_two_body["Two-body operators"]
  node_three_body["Three-body operators"]
  node_one_body["One-body operators"]
  node_abody["A-body operators"]
  node_renorm["Renormalization"]
end

subgraph group_fewbody["Few-body calculations"]
  node_deuteron["Deuteron example<br/>[deuteron.py]"]
  node_helium4["Helium-4 example<br/>[helium4.py]"]
  node_triton["Triton/helium-3 example<br/>[triton_helium3.py]"]
end

subgraph group_analysis["Interaction analysis"]
  node_phase_calc["Phase-shift calculation"]
  node_phase_plots["Phase-shift plots"]
  node_local_projection["Local projection"]
end

node_user(("Researcher"))
node_nn_inputs["NN interactions"]
node_output["Generated results"]

node_user -->|"configures"| node_two_body_driver
node_user -->|"configures"| node_three_body_driver
node_user -->|"runs example"| node_deuteron
node_user -->|"runs example"| node_helium4
node_user -->|"runs example"| node_triton
node_user -->|"requests operator"| node_multipole_driver
node_two_body_driver -->|"selects input"| node_nn_inputs
node_three_body_driver -->|"selects input"| node_nn_inputs
node_deuteron -->|"selects input"| node_nn_inputs
node_two_body_driver -->|"invokes executable"| node_runtime_main
node_three_body_driver -->|"invokes executable"| node_runtime_main
node_multipole_driver -->|"invokes executable"| node_runtime_main
node_gt_driver -->|"invokes executable"| node_runtime_main
node_deuteron -->|"invokes executable"| node_runtime_main
node_helium4 -->|"invokes executable"| node_runtime_main
node_triton -->|"invokes executable"| node_runtime_main
node_runtime_main -->|"generates matrix elements"| node_output
node_runtime_main -->|"computes few-body results"| node_output
node_user -->|"requests analysis"| node_phase_calc
node_phase_calc -->|"invokes executable"| node_runtime_main
node_phase_calc -.->|"writes phase-shift data"| node_phase_plots
node_phase_plots -->|"plots results"| node_output
node_local_projection -->|"reads interaction"| node_nn_inputs
node_local_projection -->|"plots projection"| node_output

click node_nn_inputs "https://github.com/takayuki-miyagi/nuhamil-public/tree/main/input_nn_files"
click node_two_body_driver "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/NuHamil_2BME.py"
click node_three_body_driver "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/NuHamil_3BME.py"
click node_multipole_driver "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/Multipoles.py"
click node_gt_driver "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/GT2BC.py"
click node_runtime_main "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/src/NuHamilMain.F90"
click node_runtime_input "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/src/NuHamilInput.F90"
click node_two_body "https://github.com/takayuki-miyagi/nuhamil-public/tree/main/src/TwoBody"
click node_three_body "https://github.com/takayuki-miyagi/nuhamil-public/tree/main/src/ThreeBody"
click node_one_body "https://github.com/takayuki-miyagi/nuhamil-public/tree/main/src/OneBody"
click node_abody "https://github.com/takayuki-miyagi/nuhamil-public/tree/main/src/ABody"
click node_renorm "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/src/Renormalization.F90"
click node_deuteron "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/few-body/deuteron.py"
click node_helium4 "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/few-body/helium4.py"
click node_triton "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/few-body/triton_helium3.py"
click node_phase_calc "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/phase-shift-analysis/calc_phase_shift.py"
click node_phase_plots "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/phase-shift-analysis/plot_phase_shift_coupled.py"
click node_local_projection "https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/phase-shift-analysis/plot_local_projection.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_two_body_driver,node_three_body_driver,node_multipole_driver,node_gt_driver toneBlue
class node_runtime_main,node_runtime_input,node_two_body,node_three_body,node_one_body,node_abody,node_renorm toneAmber
class node_deuteron,node_helium4,node_triton toneMint
class node_phase_calc,node_phase_plots,node_local_projection toneRose
class node_user,node_output toneIndigo
class node_nn_inputs toneTeal
```

## Components

### Run drivers

- [Two-body ME driver](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/NuHamil_2BME.py): `exe/NuHamil_2BME.py`
- [Three-body ME driver](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/NuHamil_3BME.py): `exe/NuHamil_3BME.py`
- [Multipole driver](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/Multipoles.py): `exe/Multipoles.py`
- [Gamow-Teller driver](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/GT2BC.py): `exe/GT2BC.py`

### Fortran runtime

- [NuHamil executable](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/src/NuHamilMain.F90): `src/NuHamilMain.F90`
- [Input handling](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/src/NuHamilInput.F90): `src/NuHamilInput.F90`
- [Two-body operators](https://github.com/takayuki-miyagi/nuhamil-public/tree/main/src/TwoBody): `src/TwoBody`
- [Three-body operators](https://github.com/takayuki-miyagi/nuhamil-public/tree/main/src/ThreeBody): `src/ThreeBody`
- [One-body operators](https://github.com/takayuki-miyagi/nuhamil-public/tree/main/src/OneBody): `src/OneBody`
- [A-body operators](https://github.com/takayuki-miyagi/nuhamil-public/tree/main/src/ABody): `src/ABody`
- [Renormalization](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/src/Renormalization.F90): `src/Renormalization.F90`

### Few-body calculations

- [Deuteron example](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/few-body/deuteron.py): `exe/few-body/deuteron.py`
- [Helium-4 example](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/few-body/helium4.py): `exe/few-body/helium4.py`
- [Triton/helium-3 example](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/few-body/triton_helium3.py): `exe/few-body/triton_helium3.py`

### Interaction analysis

- [Phase-shift calculation](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/phase-shift-analysis/calc_phase_shift.py): `exe/phase-shift-analysis/calc_phase_shift.py`
- [Phase-shift plots](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/phase-shift-analysis/plot_phase_shift_coupled.py): `exe/phase-shift-analysis/plot_phase_shift_coupled.py`
- [Local projection](https://github.com/takayuki-miyagi/nuhamil-public/blob/main/exe/phase-shift-analysis/plot_local_projection.py): `exe/phase-shift-analysis/plot_local_projection.py`

### Other components

- **Researcher**
- [NN interactions](https://github.com/takayuki-miyagi/nuhamil-public/tree/main/input_nn_files): `input_nn_files`
- **Generated results**

## Connections

- Researcher → Two-body ME driver: configures (evidence: `README.md`)
- Researcher → Three-body ME driver: configures (evidence: `README.md`)
- Researcher → Deuteron example: runs example (evidence: `README.md`)
- Researcher → Helium-4 example: runs example (evidence: `README.md`)
- Researcher → Triton/helium-3 example: runs example (evidence: `README.md`)
- Researcher → Multipole driver: requests operator (evidence: `README.md`)
- Two-body ME driver → NN interactions: selects input (evidence: `exe/NuHamil_2BME.py`)
- Three-body ME driver → NN interactions: selects input (evidence: `exe/NuHamil_3BME.py`)
- Deuteron example → NN interactions: selects input (evidence: `exe/few-body/deuteron.py`)
- Two-body ME driver → NuHamil executable: invokes executable (evidence: `exe/NuHamil_2BME.py`)
- Three-body ME driver → NuHamil executable: invokes executable (evidence: `exe/NuHamil_3BME.py`)
- Multipole driver → NuHamil executable: invokes executable (evidence: `exe/Multipoles.py`)
- Gamow-Teller driver → NuHamil executable: invokes executable (evidence: `exe/GT2BC.py`)
- Deuteron example → NuHamil executable: invokes executable (evidence: `exe/few-body/deuteron.py`)
- Helium-4 example → NuHamil executable: invokes executable (evidence: `exe/few-body/helium4.py`)
- Triton/helium-3 example → NuHamil executable: invokes executable (evidence: `exe/few-body/triton_helium3.py`)
- NuHamil executable → Generated results: generates matrix elements (evidence: `README.md`)
- NuHamil executable → Generated results: computes few-body results (evidence: `README.md`)
- Researcher → Phase-shift calculation: requests analysis (evidence: `README.md`)
- Phase-shift calculation → NuHamil executable: invokes executable (evidence: `exe/phase-shift-analysis/calc_phase_shift.py`)
- Phase-shift calculation → Phase-shift plots: writes phase-shift data
- Phase-shift plots → Generated results: plots results (evidence: `exe/phase-shift-analysis/plot_phase_shift_coupled.py`)
- Local projection → NN interactions: reads interaction (evidence: `input_nn_files/plot_local_projection.py`)
- Local projection → Generated results: plots projection
