4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
27 * GRowing Old MAkes el Chrono Sweat
29 static char *SRCID_g_com_c
= "$Id$";
47 int main(int argc
,char *argv
[])
49 static char *desc
[] = {
50 "g_anavel computes temperature profiles in a sample. The sample",
51 "can be analysed radial, i.e. the temperature as a function of",
52 "distance from the center, cylindrical, i.e. as a function of distance",
53 "from the vector (0,0,1) through the center of the box, or otherwise",
54 "(will be specified later)"
57 { efTRN
, "-f", NULL
, ffREAD
},
58 { efTPX
, "-s", NULL
, ffREAD
},
59 { efXPM
, "-o", "xcm", ffWRITE
}
61 #define NFILE asize(fnm)
63 static int mode
= 0, nlevels
= 10;
64 static real tmax
= 300, xmax
= -1;
66 { "-mode", FALSE
, etINT
, {&mode
}, "mode" },
67 { "-nlevels", FALSE
, etINT
, {&nlevels
}, "number of levels" },
68 { "-tmax", FALSE
, etREAL
, {&tmax
}, "max temperature in output" },
69 { "-xmax", FALSE
, etREAL
, {&xmax
}, "max distance from center" }
75 int i
,j
,idum
,step
,nframe
=0,natoms
,index
;
76 real t
,temp
,rdum
,hboxx
,hboxy
,scale
,xnorm
;
78 real
*t_x
=NULL
,*t_y
,hi
=0;
85 t_rgb rgblo
= { 0, 0, 1 },rgbhi
= { 1, 0, 0 };
88 CopyRight(stderr
,argv
[0]);
89 parse_common_args(&argc
,argv
,PCA_CAN_TIME
,TRUE
,NFILE
,fnm
,
90 asize(pa
),pa
,asize(desc
),desc
,0,NULL
);
92 top
= read_top(ftp2fn(efTPX
,NFILE
,fnm
));
94 natoms
= read_first_x_v(&status
,ftp2fn(efTRN
,NFILE
,fnm
),&t
,&x
,&v
,box
);
102 nmax
= (0.5*sqrt(sqr(box
[XX
][XX
])+sqr(box
[YY
][YY
])))*scale
;
106 for(i
=0; (i
<=nmax
); i
++) {
111 srenew(profile
,++nframe
);
112 snew(profile
[nframe
-1],nmax
+1);
114 t_x
[nframe
-1] = t
*1000;
115 hboxx
= box
[XX
][XX
]/2;
116 hboxy
= box
[YY
][YY
]/2;
117 for(i
=0; (i
<natoms
); i
++) {
118 /* determine position dependent on mode */
121 xnorm
= sqrt(sqr(x
[i
][XX
]-hboxx
) + sqr(x
[i
][YY
]-hboxy
));
124 fatal_error(0,"Unknown mode %d",mode
);
128 temp
= top
->atoms
.atom
[i
].m
*iprod(v
[i
],v
[i
])/(2*BOLTZ
);
132 profile
[nframe
-1][index
] += temp
;
135 for(i
=0; (i
<=nmax
); i
++) {
137 profile
[nframe
-1][i
] /= npts
[i
];
140 } while (read_next_x_v(status
,&t
,natoms
,x
,v
,box
));
143 fp
= ftp2FILE(efXPM
,NFILE
,fnm
,"w");
144 write_xpm(fp
,"Temp. profile","T (a.u.)",
146 nframe
,nmax
+1,t_x
,t_y
,profile
,0,tmax
,
147 rgblo
,rgbhi
,&nlevels
);