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

cari at purdue.edu cari at purdue.edu
Sun Nov 20 17:36:10 CET 2005


Hi all,

I found a (non elegant) solution to my problem by writting the
coordinates to an asci file using g_traj, and then doing the
density calculation with 20 lines of fortran code.

Thanks,
        Marcelo Carignano 

Quoting "Marcelo A. Carignano" <cari at purdue.edu>:

> 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
> 
> _______________________________________________
> gmx-users mailing list
> gmx-users at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-users
> Please don't post (un)subscribe requests to the list. Use the 
> www interface or send it to gmx-users-request at gromacs.org.
> 






More information about the gromacs.org_gmx-users mailing list