# GROMACS Radial Distribution Function Calculation Tutorial ### What is radial distribution function?

The radial distribution function usually refers to the distribution probability of other particles in space (how far away from the given particle) given the coordinates of a certain particle. Therefore, the radial distribution function can be used not only to study the order of matter, but also to describe the correlation of electrons.

### Tutorial

It is relatively simple to use GROMACS to calculate the radial distribution function and coordination number, as long as you understand the use of the gmx rdf program. But even for simple tasks, sometimes we need to think deeply about how to do it faster and better, how can we minimize the time required for repeated operations. Only in this way can we continue to improve work efficiency. You can calculate RDF according to the following steps:

After running the kinetics, calculate the RDF of each atom in the dimer and the oxygen atom OW and hydrogen atom HW in the solvent water to determine the thickness of the first solvation layer of each atom.

To calculate RDF, first make an index file, put each atom of the dimer, OW, HW into different groups. Simple. Execute

gmx make_ndx -f conf.gro

Then use the following command

a OW: Select the oxygen atom in the water

a HW: Select the hydrogen atom in the water

splitat 1: Split group 1 into one group for each atom. Group 1 is other, which is a dimer.

q: Save the index file and exit the program.

This way we get the index file, which can be used to specify the RDF to be calculated.

[System ][ Other ][ ROH ][ 4GB ][ 0GB ][ Water ][ SOL ][ non-Water ][ OW ][ HW ][ Other_HO1_1 ][ Other_O1_2 ][ Other_C1_3 ]...[ Other_H2_43 ][ Other_O2_44] [Other_H2O_45]

Open the index file obtained, the order of each group is as follows

The RDF calculated using this index file is inconvenient, because the atom number of the dimer and the index group number are inconsistent, we adjust them to the same (note that the index group number starts from 0), after adjustment, the order of the index file is as follows:

[System ][ Other_HO1_1 ][ Other_O1_2 ][ Other_C1_3 ]...[ Other_H2_43 ][ Other_O2_44 ][ Other_H2O_45 ][ OW ][ HW ][ Other ][ ROH ][ 4GB ][ 0GB ][ Water ][ SOL ][ non -Water]

There is also a simple way, which is to use a bash script

for((i=1;i<=45;i++));doecho-e\$i'\n46'|gmxrdf-f-ndone

Of course, if your bash version supports it, you can also use:

foriin{1..45};doecho-e\$i'n46'|gmxrdf-f-ndone

If you still know parallel, that's even better, you can perform RDF calculations in parallel, which will save time greatly

paralleecho-e{}'\n46'|gmxrdf-f-n:::{1..45}

* For Research Use Only.
Inquiry