#!/bin/sh

# Wrapper to set RELION_MPIRUN variable before running RELION GUI
#
# ('relion' is normally just a copy of 'relion_maingui' anyway, so this script
# changes the mpirun command used by RELION and otherwise starts the GUI as
# normal.)

if [ -n "$LD_LIBRARY_PATH" ]; then
  echo "Warning: LD_LIBRARY_PATH is set. This could cause library version conflicts."
  echo "If RELION fails to start, unset LD_LIBRARY_PATH and try again."
elif [ -n "$DYLD_LIBRARY_PATH" ]; then
  echo "Warning: DYLD_LIBRARY_PATH is set. This could cause library version conflicts."
  echo "If RELION fails to start, unset DYLD_LIBRARY_PATH and try again."
fi

export RELION_MPIRUN=ccpem-mpirun

exec relion_maingui "$@"
