Skip to content

Instantly share code, notes, and snippets.

@tueda
Last active March 14, 2023 06:16
Show Gist options
  • Save tueda/11ffd326e6797a0e5fae3aba462764c3 to your computer and use it in GitHub Desktop.
Save tueda/11ffd326e6797a0e5fae3aba462764c3 to your computer and use it in GitHub Desktop.
Run MadGraph5_aMC@NLO.
#!/bin/bash
#
# @file run-mg5_aMC.sh
#
# Runs MadGraph5_aMC@NLO. This script downloads and
# sets up MadGraph5_aMC@NLO if needed.
#
set -eu
set -o pipefail
PYTHON=python3
CURL=curl
MG5_AMC_VERSION=3.4.2
VENV_DIR=.venv
cd "$(dirname "$0")"
if [ ! -d $VENV_DIR ]; then
$PYTHON -m venv $VENV_DIR
$VENV_DIR/bin/pip3 install six ipykernel matplotlib
fi
if [ ! -d "MG5_aMC_v$(echo $MG5_AMC_VERSION | tr . _)" ]; then
$CURL -OL https://launchpad.net/mg5amcnlo/3.0/3.4.x/+download/MG5_aMC_v$MG5_AMC_VERSION.tar.gz
tar -xf MG5_aMC_v$MG5_AMC_VERSION.tar.gz
rm MG5_aMC_v$MG5_AMC_VERSION.tar.gz
fi
PATH=$(pwd)/$VENV_DIR/bin:$PATH
export PATH
$VENV_DIR/bin/python3 "./MG5_aMC_v$(echo $MG5_AMC_VERSION | tr . _)/bin/mg5_aMC" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment