[gmx-users] analysis tool of 407 to 46x

Chandan Choudhury iitdckc at gmail.com
Mon Aug 5 15:29:28 CEST 2013


Dear gmx users,

I have calculated the bonded distibutions of a polymer melt by writing an
analysis tool (template.c). The tool was written in gmx 4.0.7 version.

code snippet
****************************************************************************************
 * do {

    /* coordinates are available in the vector fr.x
     * you can find this and all other structures in
     * the types directory under the gromacs include dir.
     * Note how flags determines wheter to read x/v/f!
     */

        for(i = 0; i < top.atoms.nr;) {
                dist = distance(fr.x[i][XX], fr.x[i + 1][XX],\
                                fr.x[i][YY], fr.x[i + 1][YY],\
                                fr.x[i][ZZ], fr.x[i + 1][ZZ]);

                histogram(dist, &hist_AB[0]);
               i = i + 9;
        }
    } while(read_next_frame(status,&fr));


    for(i = 1; i < maxbin; i++)
            fprintf(fdistAB,"%f %f\n", (i-1)*delr, hist_AB[i]);

float distance(float xi, float xj, float yi, float yj, float zi, float zj)
    {
        float dist = 0.0;

        dist =  sqrt(pow((xi - xj), 2) + pow((yi - yj), 2) + pow((zi - zj),
2));

        return (dist);

    }

int histogram(float dist, float *hist)
    {
        int bin = 0;

        bin = (int)(dist/delr) + 1;

        if(bin < maxbin)
            {
                hist[bin] = hist[bin] + 1;
            }
        return 0;
    }
*
**************************************************************************************************



Now, I want to import the code to the latest version (4.6.x). I find that
the structure of template is different. Can anyone guide me ?

Also, I want to implement the following lines in the template. How can this
be done?

 *for(i = 0; i < top.atoms.nr; i++){
            fprintf(fw,"ATOM  %5d %-4s  OW  %4d    %8.3f%8.3f%8.3f\n",\
            i,*(top.atoms.atomname[i]),top.atoms.atom[i].resnr,
fr.x[i][XX]*10,
            fr.x[i][YY]*10, fr.x[i][ZZ]*10);
        }
*

Any suggestions would b every helpful.

Chandan

--
Chandan kumar Choudhury
NCL, Pune
INDIA



More information about the gromacs.org_gmx-users mailing list