tapir

A tool for Feynman diagram and topology identification, analysis, minimization, partial fraction decomposition with direct FORM export.

Moderate Pure Nim score 52/100 · last commit 2026-05-07 · 11 stars · tests present · no docs generated

Summary

Latest Version Unknown
License Unknown
CI Status Failing
Stars 11
Forks 1
Open Issues 0
Last Commit 2026-05-07
Downloads 0
Last Indexed 2026-08-11 05:07

Installation

nimble install tapir
choosenim install tapir
git clone https://gitlab.com/tapir-devs/tapir

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
tapir - - - - - - -

Source

Repository https://gitlab.com/tapir-devs/tapir
Homepage https://gitlab.com/tapir-devs/tapir
Registry Source gitlab

README

![The logo](../images/tapir-logo-doxy.png "The logo")


TAPIR or tapir = Topologies, Amplitudes, Partial fractioning and Input for Reductions

Introduction

To fulfill the needs of multi-loop computations in modern QFT calculations, extensive software tools are indispensable. One of many toolchains combining some of them is classical for many years: qgraf, q2e and exp. Basically, qgraf generates Feynman graphs, q2e translates them into FORM code and exp maps topologies and asymptotically expands them. Since these programs were written a long time ago and not many people were interested in caring about their codebase, they are broadly used nowadays as black boxes. This leads to difficulties for q2e and exp which where written in old C++, especially regarding compilation using modern compilers. Also, because of the old (and completely uncommented!) codebase of q2e bugfixes and extensions are tedious.

To tackle these problems we launched tapir as a full replacement of q2e in a modern programming language (python 3.6+) while being extendible (due to a modular structure), flexible (being able to reproduce the same output as q2e as well as other features), tested (widely using unit- and integration tests) and documented.

Requirements

python3 (>=3.6), gcc

To run tapir on a GNU/Linux machine, python3 is required in a version above 3.6. gcc is used to compile the ancillary C++ backend.

Installation

There are two possibilities for installation: Either installing all needed python packages in a virtual environment or using your own python binary.

Option 1: Installation using virtual environment (Recommended)

To install (i.e. create a virtual environment and install the necessary packages), go to the main folder and run

$ make install

To create the virtual environment, the standard python3 command from your $PATH shell variable is used (via which). To force the usage of a specific python3 executable, just change the variable PYTHON_CMD in Makefile.

Note: The authors cannot recommend using pypy to run tapir. With the default CPython, the program is about 15% faster in most applications.

Option 2: Use your own python binary

To use your own python3 binary, set its path simply in the tapir executable bash script:

LOCAL_PYTHON_CMD=/path/to/your/python3

Note that the package requirements in requirements.txt must be fulfilled. This is easily done with

$ /path/to/your/python3 -m pip install -r requirements.txt

Optional requirements

Additionally, certain tasks require an installation of doxygen, lualatex and pdflatex. The former can be used to generate a technical (and very verbose) documentation of the tapir internals (relevant only for those who want to know more about the program structure). To generate this documentation, simply run

$ make doc

lualatex on the other hand is used to compile the generated Feynman diagram and topology drawings. It is needed to use TikZ-Feynman properly.

Test

You can use

$ make test

to run the unit- smoke and consistency-tests to see if tapir behaves properly.

Usage

Information about the structure of the files involved around the program can be found in the comprehensive user manual and a technical developer manual.

tapir can be executed with the shell script called "tapir" in the project folder. Type

$ ./tapir --help

to see the basic usage. The CLI options are specified here

Examples

Guides

Recipes

Run tapir in legacy mode (produce the same output as q2e):

$ tapir -q2e -q [qlist input file] -c [config file] -do [dia output file] -eo [edia output file] 

Generate topsel file from all diagrams of the qlist input file:

$ tapir -q [qlist input file] -c [config file] -t [topsel output file] 

Read topsel file and generate topology files for every topsel entry:

$ ./tapir -i [topsel input file] -c [config file] -f [output folder for topology files] 

Do the same as above but apply partial fraction decomposition on top of it:

$ ./tapir -i [topsel input file] -c [config file] -f [output folder for topology files] -pf

Generate a tikz-Feynman drawing for every diagram of a qlist file

$ ./tapir -q [qlist input file] -c [config file] -da [tex output file]

Minimize diagrams before generating topology files from qlist input and apply partial fraction decomposition, where the topologies after partial fractioning are minimized as well:

$ ./tapir -m -q [qlist input file] -c [config file] -t [topsel output file] -f [output folder for topology files] -pm

Read topsel file topselA, add a second known topsel file topselB. Minimize them using Pak's algorithm, where the topologies of topselA are either mapped on the ones from topselB or added. Write the new (not in topselB residing) topsel entries to topselC. Create new topology files with partial fraction decomposition.

$ ./tapir -i topselA -c [config file] -M topselB -t topselC -f [output folder for topology files] -pf

Copyright 2021 Marvin Gerlach, Florian Herren, Martin Lang