- This project is a simple Feynman diagram generator written in C++ using the Boost Graph Library.
- At the moment, only undirected diagrams corresponding to the one-electron self-energy with electron-phonon interactions can be output.
- Diagrams are enumerated up to isomorphism and, by default, restricted to the proper (one-particle-irreducible) ones. They are drawn by a built-in SVG renderer (electron line as a horizontal backbone, phonon lines as wavy arcs), so Graphviz is optional.
The order is the number of phonon (wavy) lines, i.e. the order of perturbation theory. In every diagram:
- the straight line with arrows is the electron propagator, drawn along a horizontal backbone (red = incoming/initial vertex, blue = outgoing/final vertex);
- the wavy lines are phonon propagators;
- the number inside a vertex is how many phonon lines attach to it.
Ensure you have the following installed on your system:
- CMake (version 3.13 or higher)
- A C++ compiler (e.g., g++, clang)
- Boost library
- Graphviz (optional; only needed to rasterize the
.dotfiles to PNG — SVG output works without it)
sudo apt update
sudo apt install cmake g++ libboost-all-dev graphvizsudo pacman -S cmake boost graphvizbrew install cmake boost graphviz- Clone the repository:
git clone git@github.com:cohsh/feynman-diagram-generator.git
cd feynman-diagram-generator- Create a build directory and run CMake:
cmake -S . -B build- Build the project:
make- Run the executable (
$n=1,2,3,4$ is the order of diagrams;$n=4$ takes ~2 min):
./generate_graph.sh nThis generates:
svg/graph_*.svg— diagrams drawn directly by a built-in renderer (electron lines as a horizontal backbone, phonon lines as wavy arcs), so Graphviz is not required for vector output;dot/graph_*.dot— Graphviz source;png/graph_*.png— rasterized from the dot files, only if Graphvizdotis installed.
By default only proper (one-particle-irreducible) self-energy diagrams are
produced. To also include the improper (reducible) ones, pass improper:
./generate_graph.sh n improper


