Installation Instructions 4.5

    Version as of 17:29, 17 Jan 2022

    to this version.

    Return to Version archive.

    View current version

    Full details on how to install GROMACS are provided here. For the impatient, here we give a quick and dirty installation guide as well.


    GROMACS relies on very few external dependencies, namely:

    • An ANSI C compiler, and possibly Fortran. GROMACS can be compiled entirely in C, which means you should be able to get it running on essentially any UNIX-style computer in the world. However prior to version 4.1, we also provide the innermost loops for some platforms in Fortran to improve performance, so we strongly recommend you to use a Fortran compiler if you can - it makes a huge difference! For modern Intel and AMD processors we provide even faster assembly loops though, so for those you can skip Fortran.
    • If you want to run in parallel, you need MPI. If you are running on a supercomputer you probably already have an optimized MPI version installed - consult your documentation or ask your system administrator. See below for information about how to make use of MPI.
    • You need an FFT library to perform Fourier transforms. Its precision (double vs single) needs to match the precision with which you intend to compile GROMACS. Recent versions support FFTW-2.1.x, FFTW-3.x (different interface from FFTW version 2), Intel Math Kernel (MKL) library version 6.0 and later, and we also have a slower built-in version of FFTPACK in case you really don't want to install a good (free) library. We currently recommend that you use FFTW (see since it is the most tested one, and in addition it is also free and faster than the alternatives. The parallel transforms in FFTW haven't been used since GROMACS 3.3, so don't worry about MPI versions of the FFTW libraries.

    Various pre-compiled versions of the FFTW libraries exist (as well as rpms, debs, etc.), but to compile FFTW from source, follow these instructions. You may wish to do this if configure complains about FFT libraries, which are probably of the wrong precision. To compile a single-precision version of the libraries:

    ./configure --enable-threads --enable-float
    make install 

    Add --enable-sse if your computers are i686 or x86-64. This will install FFTW header files in /usr/local/include and the library files in /usr/local/lib. If you do not like that (You must have root permissions to write there), you can place them e.g. in your own home directory by using the option --prefix. If you for instance use --prefix=/home/joe/fftw, the headers will go in /home/joe/fftw/include and the library files in /home/joe/fftw/lib.

    In some cases, it can also be useful to compile and install a double-precision version of the FFTW libraries. This can be accomplished with:

    make distclean
    ./configure --enable-threads
    make install



    After installing FFTW (and, if necessary, MPI - see below), you are ready to install GROMACS. The process is very simple. After unpacking the source code, configure the installation with:


    This will check you system and automatically configure GROMACS with the default options and best optimizations for your type of computer. The script will let you know about any problems. If you don't want GROMACS installed in /usr/local/gromacs (you have to be root to write there), select the path you want with the --prefix option.

    You can get a listing of all options recognized by configure by using the --help option.

    • If you want to compile a parallel version of GROMACS, use the --enable-mpi option.
    • The default is to compile GROMACS in single precision, double precision is selected by the --disable-float option.
    • GROMACS tries to find FFTW and all optional libraries (like Lesstif and FFTW) automatically, but this requires that they are present in the default places where the system searches for include files and libraries. If this is not the case (for instance, your system might not look in /usr/local/include and /usr/local/lib where FFTW is placed) you can tell configure to include these catalogues by using the variables CPPFLAGS and LDFLAGS for includes and libraries, respectively. These variables can be specified separately, in advance of configuration, or on the ./configure command line
    • Especially for use on compute clusters, which may lack X libraries, consider --without-x. Only the built-in visualizer ngmx uses X, and so if you plan not to use that, you don't need to worry about installing and linking X and Motif libraries.

    For instance, assume we have installed FFTW with --prefix=/home/joe/fftw. If your shell is tcsh, you set:

    setenv CPPFLAGS -I/home/joe/fftw/include
    setenv LDFLAGS -L/home/joe/fftw/lib

    If your shell is bash:

    export CPPFLAGS="-I/home/joe/fftw/include"
    export LDFLAGS="-L/home/joe/fftw/lib"

    Alternative forms of the FFTW can be used, if you prefer, by specifying, for example:

    ./configure --with-fft=fftw2

    The currently available FFT choices are fftw3, fftw2, mkl (Intel MKL), and FFTPACK (built-in and slow).

    Other notes:

    • If you don't like the compilers configure detects, just set them with the variables CC and/or F77 (MPICC for the MPI C compiler). You can add extra libraries (-llibrary) in the LIBS variable.
    • The configure script automatically detects not only your architecture, but also the specific CPU version of your computer to optimize as much as possible. Different CPU types will be installed in subdirectories below the architecture directory. If you don't want this, you can select an explicit location for binaries and libraries with --exec-prefix. If you have many similar machines, but with slightly different CPUs, it might be a good idea to compile one full version of GROMACS without CPU-specific optimizations or MPI parallelization (this version will be located in the main architecture directory), and then only compile mdrun for each CPU type. (Linux is a notable exception; we compile both non-assembly, SSE and 3DNow loops and select which one to use at runtime.)
    • GROMACS can use shared libraries on almost any platform, but since there are a few special cases where it doesn't work (MPI builds on aix, and OS X) it is not enabled by default. Static libraries also result in binaries that are more portable (you won't have to install the libraries if you want to make a test run on a computer without GROMACS). On the other hand, shared libraries will decrease the installation size from 100Mb to 10Mb, so you might want to try using it with --enable-shared. The large number of GROMACs utility programs show the greatest benefit from --enable-shared, and in 4.0.x these do not benefit from --enable-mpi. So if you have problems with shared libraries and MPI, then do two installations, one with --enable-shared for the tools and one with --enable-mpi for mdrun_mpi.
    • If you want to start over or change your configuration a later time (once you have started to compile things) you should restore the distribution to its initial clean state by typing:
    make distclean



    Installing GROMACS at this point is trivial. Simply issue:


    If you want a log file of the compilation, type:

    make &> log

    If you have configured with --enable-mpi, then since only mdrun is MPI-aware, you can save time and build only this executable (but you'll need to do another configure and compile without MPI to get the tools):

    make mdrun

    If you are using GNU make (any Linux system) and have more than one CPU you can do a parallel build by adding the option "-j N", where N is the number of build threads. It compiles amazingly fast on a 16-way SMP machine!

    Otherwise - sit back and wait for the package to compile. Once it's done you might want to check the output of the make command, or at least make sure there weren't any fatal errors.


    Final Installation

    If GROMACS compiled OK you're in principle done; this last step is trivial. However:

    If you have an older (pre-3.3-release) Gromacs version installed from source in the same location you should remove it before proceeding! To adhere to modern Linux standards we have changed some subdirectories, and if you just install over the older files you risk ending up with duplicate files and data.

    Install all the binaries, libraries and shared data files with:

    make install

    If you only want to build the mdrun executable (in the case of an MPI build), issue the following:

    make install-mdrun

    If you want to create links in /usr/local/bin to the installed GROMACS executables, issue the command:

    make links


    Using MPI

    You may notice that the above instructions for an MPI installation (so you can run in parallel) recommend only doing make mdrun and make install-mdrun. That's because in GROMACS version 3.x and 4.0.x, only mdrun is MPI-aware. Perhaps in GROMACS 4.1, some of the utility programs may become MPI-aware, but these will only be for compute-intensive utilities (e.g. that diagonalize large matrices, or calculate autocorrelations, etc.). Building and installing the other utilities with configure --enable-mpi is a waste of time, as is attempting to use any resulting MPI-linked-but-unaware utilities with mpirun. You may even run into more issues with shared libraries if you chose that with MPI. Keep things simple!

    Test Set

    A test set is available for testing of a GROMACS installation.


    Getting access to GROMACS after installation

    In a normal Unix/Linux/Cygwin/MacOS environment you will need to know the location where GROMACS is installed, e.g. /usr/local/gromacs.

    In your shell configuration file (e.g. .bashrc for bash, or .cshrc / .tcshrc for tcsh) you should use a command analogous to:

    source /usr/local/gromacs/bin/GMXRC

    near the end of that file.

    GMXRC then magically determines the type of shell you are using and configures your PATH, MANPATH, GMXDATA, etc. environment variables  so that GROMACS works as intended. Note that you will then need to re-source your shell configuration file, or open a new shell in order to have the intended effect. If you prefer, you can interactively invoke the source command as above from your command line, and if you know you might want access to multiple versions of GROMACS in an interchangeable manner, this can be a useful approach.

    At some larger computing facilities, you should consult their documentation and/or staff for instructions on how GROMACS was installed and how you should get access to it and use it.

    Just as with everything else in the UNIX world, you should not do your daily work with GROMACS as root or superuser. It's unnecessary and highly risky. See here for more information.

    Removing a GROMACS installation

     To remove a GROMACS installation, see Removing Installation.

    Having difficulty?

    Edit section

    If you encounter a problem with installing GROMACS, then there are a number of locations where you can find assistance. It is recommended that you follow these steps to find the solution:

    1. read the installation instructions again, taking note that you have followed each and every step correctly.
    2. search the GROMACS website and users emailing list for information on the error.
    3. search this wiki for information.
    4. search the internet using a search engine such as Google.
    5. post to the GROMACS users emailing list for assistance.

    Specialty Instructions

    Edit section
    Page last modified 22:23, 20 Nov 2009 by mabraham