I have a GROMACS trajectory of MD simulation. I want to make a contour plot of density as a function of two coordinates, namely X and Z. Is it possible to get this using
gmx density? If not, is there any other way?
gmx density can help in finding partial densities either along a particular axis (generally z axis) or with respect to the center of the box. It does not make a contour plot. However, gmx densmap can be used for computing 2D density maps. Both the commands need trajectory file as input files.
You can use gmx-densmap and set the average along the y-axis to get the contour plot showing the density as a function of the x and z-axis and the average over the y-axis.
Use the command as :
gmx densmap -f trj.trr -s trj.tpr -o densmap.xpm -aver y -n index.ndx -bin 0.01
Use index.ndx to calculate the density of a selected atom or molecule.