Installing GROMACS with MPI support on a Mac Philip Fowler, 5th December 2014 GROMACS is an optimised molecular dynamics code, primarily used for simulating the behaviour of proteins. To compile GROMACS you need, well, some compilers. I install gcc using MacPorts. Note that this requires you to first install Xcode. Then it is easy to install gcc version 4.9 by sudo port install gcc49 (and yes, I know about Homebrew, but I still find MacPorts has more of the things I want than brew). So, once you’ve done a bit of preparation, compiling vanilla GROMACS from source on a Mac is easy. Once you’ve downloaded the source code tar ball. tar xvf gromacs-5.0.2.tar.gz cd gromacs-5.0.2 mkdir build cmake .. -DGMX_BUILD_OWN_FFTW=ON -DCMAKE_INSTALL_PREFIX='/usr/local/gromacs/5.0.2/‘ make sudo make install Note that this will install it in /usr/local/gromacs/5.0.2 so you can keep multiple versions on the same machine and swap between them in a sane way by sourcing the GMRXC file, for example source /usr/local/gromacs/4.6.7/bin/GMXRC Adding MPI support on a Mac is trickier. This appears mainly to be because the gcc compilers from MacPorts (or clang from Xcode) don’t appear to support OpenMPI. You will know because when you run the cmake command you get a load of failures starting about ten lines down, such as -- Performing Test OpenMP_FLAG_DETECTED - Failure I managed to get a working version using the following approach; it is likely there are better (if you know, please leave a comment), but it has the virtue of working. First we need to install OpenMPI. sudo port install openmpi Now we need a compiler that supports OpenMPI. If you dig around in the MacPorts tree you can find some. sudo port install openmpi-devel-gcc49 Finally, we can follow the steps above (I just mkdir build-mpi subfolder in the above source folder and then cd to it), but now we need a (slightly) complex cmake instruction cmake .. -DGMX_BUILD_OWN_FFTW=ON -DGMX_BUILD_MDRUN_ONLY=on -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs/5.0.2 -DGMX_MPI=ON -DCMAKE_C_COMPILER=mpicc-openmpi-devel-gcc49 -DCMAKE_CXX_COMPILER=mpicxx-openmpi-devel-gcc49 -DGMX_SIMD=SSE4.1 This is only going to build an MPI version of mdrun (which makes sense) and will install mdrun_mpi alongside the regular compiled binaries we did first. We have to tell cmake what all the new fancy compilers are called and, unfortunately, these don’t support AVX SIMD instructions so we have to fall back to SSE4.1. Experience suggests this doesn’t impact performance as much as you might think. Now you can run things like Hamiltonian replica exchange on your workstation! Share this:TwitterBlueskyEmailLinkedInMastodon Related molecular dynamics
antimicrobial resistance New preprint: rapid prediction of AMR by free energy methods 15th January 202015th January 2020 The story behind this preprint goes back to the workshop on free energy methods run… Share this:TwitterBlueskyEmailLinkedInMastodon Read More
New publication: Predicting antibiotic resistance in complex protein targets using alchemical free energy methods 26th August 202224th October 2022 In this paper, Alice Brankin calculates how different mutations in the DNA gyrase affect the… Share this:TwitterBlueskyEmailLinkedInMastodon Read More
computing GROMACS on AWS: compiling against CUDA 27th January 201623rd September 2018 If you want to compile GROMACS to run on a GPU Amazon Web Services EC2… Share this:TwitterBlueskyEmailLinkedInMastodon Read More
Hi Philip! Thanks for your help! I was trying to install GMX on Mac OS X 10.10.5 and found your website by google. However, it worked until cmake, because although I installed gcc49, it did not find cmake. And then I found a shortcut – so I did not invest much time looking into the problem! Actually, MacPorts provides GMX 5.1.2 – and this was exactly the version I wanted to install! Of course, it will not support MPI, but I think it is enough for my purposes on Mac Book Pro 2015 (without extra graphics). Cheers, Bjorn Reply
Hi Philip! Thanks for your help! I was trying to install GMX on Mac OS X 10.10.5 and found your website by google. However, it worked until cmake, because although I installed gcc49, it did not find cmake. And then I found a shortcut – so I did not invest much time looking into the problem! Actually, MacPorts provides GMX 5.1.2 – and this was exactly the version I wanted to install! Of course, it will not support MPI, but I think it is enough for my purposes on Mac Book Pro 2015 (without extra graphics). Cheers, Bjorn Reply
I used for non-mpi: cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DGMX_GPU=off -DCMAKE_PREFIX_PATH=/opt/local -DGMX_SIMD=SSE4.1 reason I forced the gcc and g++ compiler was that on OSX the cmake would find the clang compiler even though gcc and g++ for GNU were set using mac ports. Reply