Saturday, October 1, 2016

Installation of Gromacs-5.1.x parallel version with MPI support



     Myself Anji Babu Kapakayala, research student at IIT Kanpur, India. Here I tried to give explained installation procedure  of gromacs package. a point to note here is  , I have  written this procedure by keeping dummies/beginners in mind.

There are many sites which contained information on this topic ,but I would like to give brief procedure of installation of gromacs-5.1.2 with few commands in linux environment, you can install in your linux pc or linux based remote servers.

At firstly, I would suggest you to look at the official documentation page of gromacs. (click here)

Before installing gromacs make sure that ,you have installed  latest versions of C, C++ compilers and mpi for the better performance as well as smooth installation. These are the prerequisites to install gromacs ,along with these there are other few prerequisites are there which we have to look at before going to install.

Lets have look at few important prerequisites,

CMake:

 
CMake is an open source which is used to build, test and  control the compilation process .Gromacs uses the Cmake build system, and requires version 2.8.8 or higher( lower versions will not work ).You can download the CMake latest version from website (click here to download ).

Installation of CMake :

Installation of any package will be done by three major steps. Those are Configuration, Compilation and final is Installation. After successful completion downloading of  CMake package (cmake-3.6.2.tar.gz )you can easily install yourself by  following  the below steps.

  • Extract the downloaded tar file by using following command
                                >>  tar -xvf cmake-3.x.x 
  •  It will produce directory named as cmake-3.x.x , change directory cmake-3.x.x by using cd command.  
                               >>  cd cmake-3.x.x
  •  now we are in cmake-3.x.x directory,next step is to make configuration.we can create binary files (/bin) by specifying path as -- prefix tag.
                               >> ./configure  --prefix=/path_to_install
  • After successful configuration run gmake command .
                              >>gmake
  • The next step is Installation, we can install cmake by using following command.
                              >> make install
  •  The next step is to verify ,whether cmake has installed successfully or not. go to above given path , and then go to /bin directory. There following executable files should generate.
                          ccmake     cmake     cpack     ctest 
  • If you could see all the above executable files in /bin directory ,indicates successful installation of cmake. 
The next prerequisite is FFTW libraries : (Fast Fourier Transfer Library)

Fast Fourier Transfer Library (FFTW) :
Many simulations in gromacs make extensive use of fast fourier transform and a software library to perform these.

So, we should install fftw version3.0 or higher versions to get successfull installation of gromacs.

Let us see how to install fftw-3.3.x version.

Installing FFTW-3.3.x:

download the fftw-3.3.x.tar.gz file from website and follow the below steps to install.

1.extract the downloaded file

>>        tar  -xvf  fftw-3.3.x.tar.gz

2.open the extraxted directory

>>       cd  fftw-3.3.x/

3.do the configuration by using following command

>>  ./configure   --prefix = /path to install/

4.Once configuration has done successfully, we have to compile and make these files to ready for installation
//
>>   make -j  N        !N= no of processors

5.final step is install ,use below command

>>  make install

installation is successful, but still we need to check whether it has installed properly or not.

check the main files required for installation of gromacs are

*   /path to install/include
*   /path to install/lib/libfftw3f.so

if these  two paths/files are exists then congrats your installation of fftw-3.3.3.x is successful.

Installation of Gromacs-5.1.x :

Now this is the time to install gromacs5.1.x . first download the gromacs package (tar file) from the website (click here ).I would strongly recommand again to look at the official page of gromacs (click here) to have better idea.

Follow the steps below to install gromacs package.

1.First step to unpack the tar file

>>       tar -xvf gromacs-5.1.x.tar.gz

2.next step is to go into the extracted directory .

>>       cd gromacs-5.1.x/

3. make a directory called build to building gromacs by using cmake

>>       mkdir build
>>       cd build/

4.  now we are in build directory, we need to configure the files by using cmake builder. you can use cmake with all necessary options but wise idea or trick is to use ccmake to build gromacs .(ccmake GUI interface ).

So first make Cmake files by using cmake then you can use ccmake GUI to edit the options.

build>>   cmake ../ 

Then after doing this step, it will create makefile and CMakeCache.txt files etc. but our configuration may incomplete so, here we need to change the settings by using ccmake GUI.

use the following command to do this

build>>       ccmake ../

Now, it will open the ccmake GUI ,so here change the corresponding settings

the ccmake GUI looks like this .



many of the  settings are default so we need to change few important settings, those are


* (you need to use up and down arrows and ENTER to make changes in  GUI)

1. change the gromacs executable path

CMAKE_INSTALL_PREFIX   :  /path-to-install/

2. change the  fftw library     :   fftpack

3. GMX_MPI                       :  ON (for parallel instalation)
                                                 :OFF ( serial installation)

Now press C to configure.

Once configure is done successfully, it will generate the Cache file with all these settings.

Sometimes, it may create errors while installing or making files due to undetection of fftw pack, if this is the case we need to add the fftwpack path manually in CMakeCache.txt .

build >>    vi CMakeCache.txt

Now search for the FFTW to add the path

command    :   /FFTWF

then you may look like this . change the fftw paths with appropriate executable paths of fftwpack.


In the above picture , it has taken by default , in this not required to change . If could not find these deafault paths then u should add these paths.

The same applicable for open MPI  also. we need to add those paths if not found here.

Now do the configure with cmake after adding these library paths to CMakeCache.txt file.

build>>      cmake  ../

now it will print on the screen  tellibg that,
 done the configuration
genarate all required files....

Now next step is to compile all files by using make command

build>>      make   -j   N          ! N = no of processors


After successful compilation , istall the gromacs by using following command

build>>     make install


After successful installation we need to check whether it was imstalled properly or not. to do that , go to the executable path which you have given while ccmake GUI  and check the /bin directory for following executable files.

>>  cd  /path-to-install/bin

then you may have to see the files like
 
>>        demux.pl                          gmx_mpi         GMXRC.csh
gmx-completion.bash                   GMXRC           GMXRC.zsh
gmx-completion-gmx_mpi.bash    GMXRC.bash  xplor2gmx.pl


If you could see all these files , yes congrats your gromacs has installed successfully.

gmx_mpi / gmx is your executable.

Inorder to use this executable you have to add below lines in .bashrc file

it may look like this.

--------------------------------------------------------------------------------------
  #GROMACS EXECUTABLE PATH
export PATH=$PATH: /path-to-install/bin

-------------------------------------------------------------------------------------


Congratulations !



Cheers !!!!!!!!!!!

ANJI BABU KAPAKAYALA
dept. of chemistry
IIT Kanpur.








keep updating.................!!!!!!!!!!!!!

No comments:

Post a Comment