Install Gromacs Molecular Dynamics Simulation software on Windows 10 by using build in Linux Subsystem WSL
GROMACS on WINDOWS
WSL under Windows10
- First enable WSL under Windows10 WSL
- Normally you now have WSL 1 installed, which is completely OK for Gromacs, however to use for instance xmgrace you need a GUI (graphical user interface), therefore WSL 2 is necessary.
- WSL 2 can additionally be installed under Windows10. (WSL 1 & 2)
- After you have succesfully enabled WSL you can compile a Gromacs version and run it from the command line as it would work under Linux.
Linux under Windows10
- From the “Microsoft Store” you can install any Linux distribution.
- However, I prefer Ubuntu, therefore I use Ubuntu 20
- Install and create a user account, this user doesn’t have anything to do with your Windows user account… I prefer to choose a simple name and relative simple password, because you have to type it quite often…
Compiling Gromacs
- Download any Gromacs version you would like to run from the Gromacs website. (GROMACS)
- Unpack the gromacs version, either with a Windows program such as 7zip or navigate to your “Download” folder or the folder you have downloaded Gromacs.
- Use the Ubuntu command line -> type the command
tar -xvf gromacs-20xx.x.tar.gz
(change the xx to the version number of Gromacs!)
Command line
- Now you have to switch to the command line
- Navigate to the “gromacs-20xx.x” folder which appeared by using the command
cd gromacs-20xx.x
- Follow the Installation guideline from the Gromacs website (Installation)
- First we create a “build” folder with the command
mkdir build
- Than we have to install some additional programs to compile Gromacs.
- Run this commands to install necessary programs:
First update and upgrade all packages…
sudo apt-get update && sudo apt-get upgrade
Install necessary packages…
sudo apt-get install build-essential cmake libuv1-dev libssl-dev libhwloc-dev
Finally update and upgrade also the installed packages…
sudo apt-get update && sudo apt-get upgrade
- Go to the “build” folder and type:
cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON
Optional:
-DCMAKE_INSTALL_PREFIX=/home/xxx/gromacs -DBUILD_SHARED_LIBS=OFF -DGMX_GPU=ON -DGMX_USE_OPENCL=ON -DGMX_MPI=ON
- Install_prefix — changes the location to install gromacs (add your home folder for instance; default is /usr/local/gromacs)
- Build_shared_libs — to turn off shared libraries (makes it more portable)
- GPU — if your system has an GPU (graphics card)
- OpenCL — for AMD GPUs OpenCl is needed for parallel computing, for Nvidia cards Cuda will automatically be used.
- MPI — Message passing interface for multicore and multiplatform calculation, only needed if you have more than one workstation (computer cluster)
- After
cmake
compile the program with:
make
- To check if everything went fine you can type:
make check
(maybe not necessary on a local machine)
- To finally install gromacs and to make the programs executable type:
sudo make install
(sudo, only if you install it in the default location)
- Now gromacs is installed on your machine, however to call it from the command-line we have to source the directory of Gromacs.
- Go to your home directory by typing
cd
and open the file ".bashrc" - This file starts with an dot “.”, therefore it is hidden and only visible if you type
ls -a
- For WSL 1 you can type
nano .bashrc
orvim .bashrc
(for command-line editor) - For WSL 2 you can type
gedit .bashrc
(for GUI editor) - Add the path you have installed gromacs into this file at the beginning or the end, that does not matter.
source /usr/local/gromacs/bin/GMXRC
orsource /home/xxx/gromacs/bin/GMXRC
- With this you should be fine and you can run Gromacs from the command-line with
gmx