Files
python-pygmx/install_gromacs_2018.8_bookworm.sh

53 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
#set -x
GMX_VERSION=2018.8
WORKDIR=$PWD
CMAKE_PARAMETERS="-DCMAKE_INSTALL_PREFIX=/usr/local/gromacs-${GMX_VERSION} -DGMX_HWLOC=off"
if [ -f /var/lib/install_gromacs-${GMX_VERSION} ]; then
CMAKE_PARAMTERS_OLD=$(</var/lib/install_gromacs-${GMX_VERSION})
if [ "$CMAKE_PARAMETERS" == "$CMAKE_PARAMTERS_OLD" ]; then
NO_CHANGE=true
echo "No change detected"
else
NO_CHANGE=false
echo "Change detected"
fi
else
NO_CHANGE=false
echo "Change detected, /var/lib/install_gromacs-${GMX_VERSION} not found"
fi
# if the former cmake parameters are the same
if [ -d /usr/local/gromacs-${GMX_VERSION} -a $NO_CHANGE = true ]; then
echo "Assume $GMX_VERSION is installed"
exit 0
else
cd /tmp
curl --fail https://ftp.gromacs.org/gromacs/gromacs-${GMX_VERSION}.tar.gz \
--output gromacs-${GMX_VERSION}.tar.gz \
--silent || echo "Version not found: gromacs-${GMX_VERSION}"
tar xfz gromacs-${GMX_VERSION}.tar.gz
rm gromacs-${GMX_VERSION}.tar.gz
mkdir -p gromacs-${GMX_VERSION}/build
# this patch is need because 2018.8 is *really* old by now
if [ $GMX_VERSION==2018.8 ]; then
pushd gromacs-${GMX_VERSION}
patch --verbose -p1 < $WORKDIR/compile_gromacs_2018.8_bookworm.patch
fi
popd
pushd gromacs-${GMX_VERSION}/build
cmake .. $CMAKE_PARAMETERS
make -j $(nproc)
make install -j $(nproc)
popd
rm -rf gromacs-${GMX_VERSION}
# save parameters of installation
echo $CMAKE_PARAMETERS > /var/lib/install_gromacs-${GMX_VERSION}
fi
echo "Run the following command to set the LD_LIBRARY_PATH in order to compile pygmx:"
echo "source /usr/local/gromacs-${GMX_VERSION}/bin/GMXRC"