Skip to main content

A Python interface to run MadGraph

Project description

MadGraPy

A simple Python interface to run MadGraph

How to use this module

Requirements:

  • Python 3.6+
  • MadGraph 3.6+
  • AND Python 2.7 (for MadDM compatibility)
  • AND MadGraph 2.9 (for MadDM compatibility)
  • ghostscript

sudo apt-get install ghostscript

(Optional) Create a virtual env

python3 -m venv my_virtualenv
source my_virtualenv/bin/activate

Install with pip

pip install madgrapy

Install madgraph from its GitHub

git clone https://github.com/mg5amcnlo/mg5amcnlo.git
cd mg5amcnlo
git switch 3.x

rm -rf bin/*.py

Download MadGraph 2.9.24 (to run MadDM v3.2, to be updated soon)

wget https://github.com/mg5amcnlo/mg5amcnlo/archive/refs/tags/v2.9.24.tar.gz
tar -xvf v2.9.24.tar.gz
cd mg5amcnlo-2.9.24

Run mg5 with

./bin/mg5_aMC

Install MadDM v3.2

In order to install MadDM v3.2

First, run MG5 with and then the following command

./bin/mg5_aMC
install maddm
install pythia

!!! important "Python3 compatibility" Up to now, MadDM doesn't have compatibility with Python3, so you need to have Python2.7 installed.

And run maddm with:

python2.7 bin/maddm.py

After that, you can follow the tutorial to learn MadDM basic features

Run Simplified DM model scan

MadDM> import model eDMsimp_s_spin0
MadDM> define darkmatter xd
MadDM> generate direct
MadDM> output SCAN_example
MadDM> launch SCAN_example

TODO:

  • Update this guide when MadDM v3.3 is released.

[Experimental] Run MadDM beta with Python3 compatibility

Clone the MadDM repository

git clone https://github.com/maddmhep/maddm.git
cd maddm
git switch rc/3.3
cp -R . ../mg5amcnlo-2.9.24/PLUGIN/maddm
cp -R maddm ../mg5amcnlo-2.9.24/bin/maddm.py

Install LHAPDF

wget https://lhapdf.hepforge.org/downloads/?f=LHAPDF-6.X.Y.tar.gz -O LHAPDF-6.X.Y.tar.gz
# ^ or use a web browser to download, which will get the filename correct
tar xf LHAPDF-6.X.Y.tar.gz
cd LHAPDF-6.X.Y
## Changes 
export PYTHON_VERSION=3.10
export PYTHON=/opt/apps/python/3.10/bin/python3.10
./configure  --prefix=/opt/apps/python/3.10
make
make install

Troubleshooting

find /opt/apps/python/3.10 -name "libpython3.10.so.1.0" export LD_LIBRARY_PATH=/opt/apps/python/3.10/lib:$LD_LIBRARY_PATH echo "/opt/apps/python/3.10/lib" | sudo tee /etc/ld.so.conf.d/python310.conf sudo ldconfig

file /opt/modulefiles/lhapdf/6.5.5

#%Module1.0
prepend-path PATH /opt/apps/lhapdf/bin
prepend-path LD_LIBRARY_PATH /opt/apps/lhapdf/lib
prepend-path PYTHONPATH /opt/apps/lhapdf/lib/python3.10/site-packages

MadGraph FAQ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

madgrapy-0.0.2.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

madgrapy-0.0.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file madgrapy-0.0.2.tar.gz.

File metadata

  • Download URL: madgrapy-0.0.2.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for madgrapy-0.0.2.tar.gz
Algorithm Hash digest
SHA256 eb64643210adc9d1a7e57457b5e180b38cec4b671e87a880ff1465b6217d060d
MD5 fb105e8940fade1c3fff89500922835d
BLAKE2b-256 936c71e2ad03f6f2c5be0a41dd11be2cd9e964612e017bae265c0d2d441abde5

See more details on using hashes here.

File details

Details for the file madgrapy-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: madgrapy-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for madgrapy-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3b1cf8330e8913a5602009b3fc10619b08922298a075eb579b9cb05338a9d961
MD5 77c3ccdaebc34f5586036418dd60d276
BLAKE2b-256 1172e5984eda22fcb8813bce71fc5cd66ee5dd89bbaa8a58acfdb1302a74d95a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page