Install Gromacs on window with WSL
Step 1: Install WSL
For window 10 or lower: Search "Turn Windows Features on or off" in your windows Check "Windows Subsystem for linux". >> go to window store and search "Ubuntu" and download it
For window 11: win+R and type-in "cmd" >> type-in "wsl --install" >> restart the computer.
Step 2: Pre-setup
Install the Microsoft Visual Studio first if your computer doesn't have.
Open Ubuntu, and execute the codes below (one line by one line)
sudo apt update sudo apt-get upgrade sudo apt-get install gcc sudo apt-get install cmake sudo apt-get install build-essential sudo apt-get install libfftw3-dev |
Note: they should always show "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." After execution
!!! sudo apt-get install gromacs (if want to install old-version, but the memory will go wrong. and something don't work)
Step 3: Download the latest version ( For instance: gromacs-2022.3.tar.gz) and save it on the desktop
Install latest version: https://manual.gromacs.org/current/install-guide/index.html
Latest version download: https://manual.gromacs.org/current/download.html
Step 4-1: Find the directory for desktop
ex: cd /mnt/c/Users/"your window user's name"/Desktop/
Step 4-2: Install the gromacs
tar xfz gromacs-2022.3.tar.gz cd gromacs-2022.3 mkdir build cd build cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_MPI=on make make check sudo make install source /usr/local/gromacs/bin/GMXRC |
Notes: if the last line is failed, check the directory (open a folder and check \\wsl$\Ubuntu)
From Experience: "source /usr/local /bin/GMXRC" for windows 10 , "source /usr/local/gromacs/bin/GMXRC" for windows 11
Step 5: Done
Type in ""gmx", you can check the version information for your Gormacs.
Delete Gromacs
sudo apt-get purge gromacs
Add MPI to Gromacs
sudo apt install gromacs-mpi
sudo apt install gromacs-openmpi