4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Copyright (c) 1991-2001, University of Groningen, The Netherlands
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * If you want to redistribute modifications, please consider that
18 * scientific software is very special. Version control is crucial -
19 * bugs must be traceable. We will be happy to consider code for
20 * inclusion in the official distribution, but derived work must not
21 * be called official GROMACS. Details are found in the README & COPYING
22 * files - if they are missing, get the official version at www.gromacs.org.
24 * To help us fund GROMACS development, we humbly ask that you cite
25 * the papers on the package - you can find them in the top README file.
27 * For more info, check our website at http://www.gromacs.org
30 * Great Red Owns Many ACres of Sand
54 static char *nm[5] = { "OW", "HW1", "HW2", "DW", "SW" };
56 static void list_trn(char *fn)
58 static real mass[5] = { 15.9994, 1.008, 1.008, 0.0, 0.0 };
59 int i,j=0,m,fpread,fpwrite,nframe;
60 rvec *x,*v,*f,fmol[2],xcm[2],torque[j],dx;
66 printf("Going to open %s\n",fn);
67 fpread = open_trn(fn,"r");
68 fpwrite = open_tpx(NULL,"w");
69 fio_setdebug(fpwrite,TRUE);
71 mmm=mass[0]+2*mass[1];
76 while (fread_trnheader(fpread,&trn,&bOK)) {
80 if (fread_htrn(fpread,&trn,
81 trn.box_size ? box : NULL,
82 trn.x_size ? x : NULL,
83 trn.v_size ? v : NULL,
84 trn.f_size ? f : NULL)) {
86 if (trn.x_size && trn.f_size) {
87 printf("There are %d atoms\n",trn.natoms);
88 for(j=0; (j<2); j++) {
91 clear_rvec(torque[j]);
92 for(i=5*j; (i<5*j+5); i++) {
93 rvec_inc(fmol[j],f[i]);
94 for(m=0; (m<DIM); m++)
95 xcm[j][m] += mass[i%5]*x[i][m];
97 for(i=5*j; (i<5*j+5); i++) {
98 rvec_dec(x[i],xcm[j]);
100 rvec_inc(torque[j],dx);
101 rvec_inc(x[i],xcm[j]);
104 pr_rvecs(stdout,0,"FMOL ",fmol,2);
105 pr_rvecs(stdout,0,"TORQUE",torque,2);
106 printf("Distance matrix Water1-Water2\n%5s","");
108 printf(" %10s",nm[j]);
110 for(j=0; (j<5); j++) {
112 for(i=5; (i<10); i++) {
113 rvec_sub(x[i],x[j],dx);
114 len = sqrt(iprod(dx,dx));
115 printf(" %10.7f",len);
127 fprintf(stderr,"\nWARNING: Incomplete frame header: nr %d, t=%g\n",
133 int main(int argc,char *argv[])
135 static char *desc[] = {
136 "gmxdump reads a run input file ([TT].tpa[tt]/[TT].tpr[tt]/[TT].tpb[tt]),",
137 "a trajectory ([TT].trj[tt]/[TT].trr[tt]/[TT].xtc[tt]) or an energy",
138 "file ([TT].ene[tt]/[TT].edr[tt]) and prints that to standard",
139 "output in a readable format. This program is essential for",
140 "checking your run input file in case of problems.[PAR]"
143 { efTRN, "-f", NULL, ffOPTRD }
145 #define NFILE asize(fnm)
148 /* Command line options */
150 CopyRight(stdout,argv[0]);
151 parse_common_args(&argc,argv,0,NFILE,fnm,0,NULL,
152 asize(desc),desc,0,NULL);
154 if (ftp2bSet(efTRN,NFILE,fnm)) {
155 fn = ftp2fn(efTRN,NFILE,fnm);
156 printf("Going to open %s\n",fn);