Biomodeling: Introduction
How to install Gromacs using conda
By using conda, one can make his own environment conveniently.
Install miniconda https://docs.conda.io/en/main/miniconda.html
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
~/miniconda3/bin/conda init bash
Install Gromacs package using conda
conda create -n gromacs
conda activate gromacs
conda install -c conda-forge gromacs=2023.1=nompi_cuda_ha81c2ac_2
Conda install command above tries to install Gromacs 2023.1 linked with CUDA library, assuming that you have an NVIDIA GPU.
Depending on the environment, you might need to choose another Gromacs image.
See https://anaconda.org/conda-forge/gromacs/files for available Gromacs images.
After installation, “conda activate gromacs” will bring you to the installed environment.
How to install Gromacs using a conventional way
https://manual.gromacs.org/current/index.html
If you have a Nvidia GPU, install CUDA toolkit before installing Gromacs
https://developer.nvidia.com/cuda-toolkit
cmake ../ \
-DGMX_BUILD_OWN_FFTW=ON \
-DGMX_DEFAULT_SUFFIX=OFF \
-DCMAKE_INSTALL_PREFIX=PATH_TO_GROMACS_INSTALLATION \
-DGMX_X11=OFF \
-DGMX_GPU=CUDA \
-DGMX_OPENMP=on \
-DGMX_PREFER_STATIC_LIBS=ON \
-DGMXAPI=OFF \
-DGMX_HWLOC=off
make
make install
source YOUR_INSTALLATION_DIRECTORY/bin/GMXRC.bash
Test your Gromacs installation
Setup Gromacs environments:
If you installed Gromacs using conda,
conda activate YOUR_GROMACS_ENVIRONMENT
If you compiled Gromacs package, you can set up environments by sourcing GMXRC.bash file
source PATH_TO_GROMACS_INSTALLATION/bin/GMXRC.bash
Confirm Gromacs environments:
Check if environmental variables such as $PATH, $GMXDATA etc are set up.
env
echo $GMXDATA
Where is the Gromacs binary located?
which gmx
See Gromacs manual pages
man gmx
man gmx mdrun
man gmx grompp
You need a text editor such as VIM, VS code, or something else.
Gromacs flow chart taken from the official documentation.
RCSB, Uniprot, AF3 etc.
1. Install Gromacs
- Manual compilation.
- Conda
2. After installation, environmental variables must be properly set.
- All Gromacs-related envrironmental variable starts "GMX"
- env |grep GMX
GMXBIN=/home/jejoong/myusr/gromacs-2023.3/bin
GMXDATA=/home/jejoong/myusr/gromacs-2023.3/share/gromacs
GMXLDLIB=/home/jejoong/myusr/gromacs-2023.3/lib64
GMXMAN=/home/jejoong/myusr/gromacs-2023.3/share/man
- $GMXBIN contains gmx program and config files.
- $GMXDATA/top or $GMXLIB contains force fields.
- $GMXMAN contains manual pages for man command. e.g., "man gmx mdrun" to read manual of mdrun.
3. How to add force fields.
force fields are stored in $GMXDATA/top or $GMXLIB.
Gromacs-format force field directory looks like "*.ff"
You can add a new force field either by
a. copying XXXX.ff folder to your $GMXLIB.
or
b. set multiple force field sources separated by ":" in $GMXLIB
e.g., GMXLIB=/apps/jejoong/gmxlib:/apps/vv137/gmxlib
If you have your own force field repository, reset GMXLIB variable in .bashrc
export GMXLIB=/home/jejoong/gmxlib
Critically testing force fields is important
- amber99sb-ildn.ff: old standard based on AMBER ff99sb.
- charmm36-mar2019.ff: latest CHARMM
- oplsaam.ff: latest OPLS
- amber99sb-ildn-phi-bsc0.ff: modified by Jejoong (CUFIX).
- amber19sb-opc-lm-bsc1.ff: latest AMBER with ff19 for proteins and OPC for water.
- des-amber.ff: DE Shaw's
4. Structure of a force field directory:
- atomtypes.atp: atom type information.
Force field files used by pdb2gmx:
- rtp files (residue topology files)
aminoacids.rtp: contains definitions of all amino acid monomers.
dna.rtp:
tip3p.itp: moleculetype for TIP3P water model.
spc.itp: moleculetype for SPC water model.
ions.itp: moleculetypes for all ions such as Na, Cl, K, etc.
Force field files used by grompp
- forcefield.itp: main file that calls other force field files such as ffbonded.itp or ffnonbonded.itp
- ffbonded.itp: bond parameters for pairs of atomtypes.
bondtypes, angletypes, dihedraltypes ..
- ffnonbonded.itp:
atomstypes: defines mass, LJ parameters (epsilon and sigma) for each atomtype.
5. We start from a protein PDB, init.pdb
- Process init.pdb for Gromacs using gmx pdb2gmx.
gmx pdb2gmx -f init.pdb -ignh
- In many cases, pdb2gmx will return an error saying that some heavy atoms or some residues are missing.
In such cases, we can alternatively use structures from AF server or uniprot.org.
You can add missing heavy atoms using Modeller,
On charmm-gui.org, Input generator => PDB Reader & Manipulator.