Upped the version to 3.2.0
[gromacs.git] / src / tools / g_rama.c
blobd7884ae840fa0837064d96933863303a31c0cf9c
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 3.2.0
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * For more info, check our website at http://www.gromacs.org
33 * And Hey:
34 * Green Red Orange Magenta Azure Cyan Skyblue
36 #include <math.h>
37 #include "sysstuff.h"
38 #include "string.h"
39 #include "typedefs.h"
40 #include "smalloc.h"
41 #include "macros.h"
42 #include "vec.h"
43 #include "xvgr.h"
44 #include "physics.h"
45 #include "pbc.h"
46 #include "copyrite.h"
47 #include "futil.h"
48 #include "statutil.h"
49 #include "index.h"
50 #include "nrama.h"
52 static void plot_rama(FILE *out,t_xrama *xr)
54 int i;
55 real phi,psi;
57 for(i=0; (i<xr->npp); i++) {
58 phi=xr->dih[xr->pp[i].iphi].ang*RAD2DEG;
59 psi=xr->dih[xr->pp[i].ipsi].ang*RAD2DEG;
60 fprintf(out,"%g %g %s\n",phi,psi,xr->pp[i].label);
64 int gmx_rama(int argc,char *argv[])
66 static char *desc[] = {
67 "g_rama selects the Phi/Psi dihedral combinations from your topology file",
68 "and computes these as a function of time.",
69 "Using simple Unix tools such as [IT]grep[it] you can select out",
70 "specific residues."
73 FILE *out;
74 t_xrama *xr;
75 int j;
76 t_filenm fnm[] = {
77 { efTRX, "-f", NULL, ffREAD },
78 { efTPX, NULL, NULL, ffREAD },
79 { efXVG, NULL, "rama",ffWRITE }
81 #define NFILE asize(fnm)
83 CopyRight(stderr,argv[0]);
84 parse_common_args(&argc,argv,PCA_CAN_VIEW | PCA_CAN_TIME | PCA_BE_NICE,
85 NFILE,fnm,0,NULL,asize(desc),desc,0,NULL);
88 snew(xr,1);
89 init_rama(ftp2fn(efTRX,NFILE,fnm),ftp2fn(efTPX,NFILE,fnm),xr);
91 out=xvgropen(ftp2fn(efXVG,NFILE,fnm),"Ramachandran Plot","Phi","Psi");
92 xvgr_line_props(out,0,elNone,ecFrank);
93 xvgr_view(out,0.2,0.2,0.8,0.8);
94 xvgr_world(out,-180,-180,180,180);
95 fprintf(out,"@ xaxis tick on\n@ xaxis tick major 60\n@ xaxis tick minor 30\n");
96 fprintf(out,"@ yaxis tick on\n@ yaxis tick major 60\n@ yaxis tick minor 30\n");
97 fprintf(out,"@ s0 symbol 2\n@ s0 symbol size 0.4\n@ s0 symbol fill 1\n");
99 j=0;
100 do {
101 plot_rama(out,xr);
102 j++;
103 } while (new_data(xr));
104 fprintf(stderr,"\n");
105 fclose(out);
107 do_view(ftp2fn(efXVG,NFILE,fnm),NULL);
109 thanx(stderr);
111 return 0;