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