06c5df10b6a905981360ee0d4a31dca227d1bc74
[alexxy/gromacs.git] / include / xvgr.h
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 2.0
11  * 
12  * Copyright (c) 1991-1999
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * Please refer to:
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)
20  * 
21  * Also check out our WWW page:
22  * http://md.chem.rug.nl/~gmx
23  * or e-mail to:
24  * gromacs@chem.rug.nl
25  * 
26  * And Hey:
27  * Green Red Orange Magenta Azure Cyan Skyblue
28  */
29
30 #ifndef _xvgr_h
31 #define _xvgr_h
32
33 static char *SRCID_xvgr_h = "$Id$";
34
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
38
39 #ifdef HAVE_IDENT
40 #ident  "@(#) xvgr.h 1.8 7/28/97"
41 #endif /* HAVE_IDENT */
42
43 #ifdef CPLUSPLUS
44 extern "C" {
45 #endif
46
47 #include "sysstuff.h"
48 #include "typedefs.h"
49 #include "viewit.h"
50
51 /***************************************************
52  *            XVGR   DEFINITIONS
53  ***************************************************/
54 enum {
55   elNone, elSolid, elDotted, elDashed, 
56   elLongDashed, elDotDashed, elNR
57 };
58 /* xvgr line-styles */
59
60 enum {  
61   ecWhite, ecFrank, ecBlack=ecFrank,
62   ecRed, ecGreen, ecBlue, ecYellow, ecBrown, ecGray, 
63   ecPurple, ecLightBlue, ecViolet, ecHolland, ecLila, ecDarkGray, 
64   ecAquamarine, ecOlive, ecNR
65 };
66 /* xvgr line-colors */
67
68 enum {
69   eppNone, eppColor, eppPattern, eppNR
70 };
71 /* xvgr pattern type */
72
73 enum {
74   evView, evWorld, evNR
75 };
76 /* view type */
77
78 /***************************************************
79  *            XVGR   ROUTINES
80  ***************************************************/
81
82 extern FILE *xvgropen(char *fn,char *title,char *xaxis,char *yaxis);
83 /* Open a file, and write a title, and axis-labels in Xvgr format */
84
85   /*extern void xvgr_file(char *fn,char *opts);*/
86 /* ! - - - DEPRECATED - - - !
87  * use do_view now instead!
88  * optional support for xmgrace now via env. GMX_VIEW_XVG
89  * see viewit.c/.h (gmxlib)
90  * Starts xvgr with a file fn in the background,
91  * opts (options to xvgr) may be NULL
92  */
93
94 extern void xvgr_view(FILE *out,real xmin,real ymin,real xmax,real ymax);
95 /* Set the view in xvgr */
96
97 extern void xvgr_world(FILE *out,real xmin,real ymin,real xmax,real ymax);
98 /* Set the world in xvgr */
99
100 extern void xvgr_legend(FILE *out,int nsets,char *setname[]);
101 /* Make a legend box, and also modifies the view to make room for the legend */
102
103 extern void xvgr_line_props(FILE *out,int NrSet,int LineStyle,int LineColor);
104 /* Set xvgr line styles and colors */
105
106 extern void xvgr_box(FILE *out,
107                      int LocType,
108                      real xmin,real ymin,real xmax,real ymax,
109                      int LineStyle,int LineWidth,int LineColor,
110                      int BoxFill,int BoxColor,int BoxPattern);
111 /* Make a box */
112
113 extern int read_xvg(char *fn,real ***y,int *ny);
114 /* Read an xvg file for post processing. The number of rows is returned
115  * fn is the filename, y is a pointer to a 2D array (to be allocated by
116  * the routine) ny is the number of columns (including X if appropriate)
117  */
118  
119 extern void write_xvg(char *fn,char *title,int nx,int ny,real **y,char **leg);
120 /* Write a two D array (y) of dimensions nx rows times
121  * ny columns to a file. If leg != NULL it will be written too.
122  */
123
124 /****************************************************
125  *           Some statistics utilities 
126  ****************************************************/
127 extern void lsq_y_ax(int n, real x[], real y[], real *a);
128 /* Fit a straight line y=ax thru the n data points x,y. */
129
130 extern real lsq_y_ax_b(int n, real x[], real y[], real *a, real *b);
131 /* Fit a straight line y=ax+b thru the n data points x,y.
132  * Returns the "fit quality" sigma = sqrt(chi^2/(n-2)).
133  */
134
135 #ifdef CPLUSPLUS
136 }
137 #endif
138
139 #endif  /* _xvgr_h */