[gmx-users] changing the code just a little bit (g_density)

Marcelo A. Carignano cari at purdue.edu
Fri Nov 18 19:27:06 CET 2005


Dear Gromacs users,


I need to modify g_density so I can calculate the density profile in
my system, but shifting the z coordenate so that one particular atom
stays fix. Let's call "A" to this atom, then I need to do (z-zA) 
before calculating to which slice the current atom belongs to.

I am working with version 3.2.1

I will appreciate if anyone of you could help me to do this right.

1) First, I copied gmx_density.c to gmx_density2.c, and this will be 
the file to modify.

2) emacs gmx_density2.c

3) In line 170, the code goes like this:

-------
	  /* determine which slice atom is in */
	  slice = (z / (*slWidth)); 
	  sought.nr_el = 0;
	  sought.atomname = strdup(*(top->atoms.atomname[index[n][i]]));
-------

So it must be here. I need to change the line: 	  

	slice = (z / (*slWidth)); 

by something like

	slice = ( (z-zA) / (*slWidth)); 

where zA is my reference atom. 

4) Let's say that the reference atom is the oxygen atom of an SPC water
molecule. Let's assume that this water molecule is residue number 33,
then the Oxigen is atom number 97 (=32*3+1, because Oxygen is first in
the spc.itp).

5) How should I write this line  

	slice = ( (z-zA) / (*slWidth));

so that the program will do what I want?




Many thanks, grazie mille, muito obrigado, muchas gracias, ....

	Marcelo Carignano




More information about the gromacs.org_gmx-users mailing list