Added selection examples.
[gromacs/qmmm-gamess-us.git] / include / xvgr.h
blob6616273f052197a5f8860ee14d01497241985ec7
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 * Gromacs Runs On Most of All Computer Systems
36 #ifndef _xvgr_h
37 #define _xvgr_h
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
43 #include "sysstuff.h"
44 #include "typedefs.h"
45 #include "viewit.h"
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
51 /***************************************************
52 * XVGR DEFINITIONS
53 ***************************************************/
54 enum {
55 elNone, elSolid, elDotted, elDashed,
56 elLongDashed, elDotDashed, elNR
58 /* xvgr line-styles */
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
66 /* xvgr line-colors */
68 enum {
69 eppNone, eppColor, eppPattern, eppNR
71 /* xvgr pattern type */
73 enum {
74 evView, evWorld, evNR
76 /* view type */
78 /***************************************************
79 * XVGR ROUTINES
80 ***************************************************/
82 /* Strings such as titles, lables and legends can contain escape sequences
83 * for formatting. Currently supported are:
84 * \s : start subscript
85 * \S : start superscript
86 * \N : end sub/superscript
87 * \symbol : where symbol is the full name of a greek letter
88 * (see the xvgrstr function in xvgr.c for the full list)
89 * when starting with a capital, a capital symbol will be printed,
90 * note that symbol does not need to be followed by a space
91 * \8 : (deprecated) start symbol font
92 * \4 : (deprecated) end symbol font
95 extern bool output_env_get_print_xvgr_codes(const output_env_t oenv);
96 /* Returns if we should print xmgrace or xmgr codes */
98 enum {
99 exvggtNONE, exvggtXNY, exvggtXYDY, exvggtXYDYDY, exvggtNR
102 extern FILE *xvgropen_type(const char *fn,const char *title,const char *xaxis,
103 const char *yaxis,int exvg_graph_type,
104 const output_env_t oenv);
105 /* Open a file, and write a title, and axis-labels in Xvgr format
106 * or write nothing when oenv specifies so.
107 * The xvgr graph type enum is defined above.
110 extern FILE *xvgropen(const char *fn,const char *title,const char *xaxis,
111 const char *yaxis,const output_env_t oenv);
112 /* Calls xvgropen_type with graph type xvggtXNY. */
114 /* Close xvgr file, and clean up internal file buffers correctly */
115 extern void xvgrclose(FILE *fp);
117 extern void xvgr_subtitle(FILE *out,const char *subtitle,
118 const output_env_t oenv);
119 /* Set the subtitle in xvgr */
121 extern void xvgr_view(FILE *out,real xmin,real ymin,real xmax,real ymax,
122 const output_env_t oenv);
123 /* Set the view in xvgr */
125 extern void xvgr_world(FILE *out,real xmin,real ymin,real xmax,real ymax,
126 const output_env_t oenv);
127 /* Set the world in xvgr */
129 extern void xvgr_legend(FILE *out,int nsets,char **setnames,
130 const output_env_t oenv);
131 /* Make a legend box, and also modifies the view to make room for the legend */
133 extern void xvgr_line_props(FILE *out,int NrSet,int LineStyle,int LineColor,
134 const output_env_t oenv);
135 /* Set xvgr line styles and colors */
137 extern void xvgr_box(FILE *out,
138 int LocType,
139 real xmin,real ymin,real xmax,real ymax,
140 int LineStyle,int LineWidth,int LineColor,
141 int BoxFill,int BoxColor,int BoxPattern,
142 const output_env_t oenv);
143 /* Make a box */
145 extern int read_xvg_legend(const char *fn,double ***y,int *ny,
146 char **subtitle,char ***legend);
147 /* Read an xvg file for post processing. The number of rows is returned
148 * fn is the filename, y is a pointer to a 2D array (to be allocated by
149 * the routine) ny is the number of columns (including X if appropriate).
150 * If subtitle!=NULL, read the subtitle (when present),
151 * the subtitle string will be NULL when not present.
152 * If legend!=NULL, read the legends for the sets (when present),
153 * 0 is the first y legend, the legend string will be NULL when not present.
156 extern int read_xvg(const char *fn,double ***y,int *ny);
157 /* As read_xvg_legend, but does not read legends. */
159 extern void write_xvg(const char *fn,const char *title,int nx,int ny,real **y,
160 char **leg, const output_env_t oenv);
161 /* Write a two D array (y) of dimensions nx rows times
162 * ny columns to a file. If leg != NULL it will be written too.
166 /* This function reads ascii (xvg) files and extracts the data sets to a
167 * two dimensional array which is returned.
169 extern real **read_xvg_time(const char *fn,
170 bool bHaveT,
171 bool bTB,real tb,
172 bool bTE,real te,
173 int nsets_in,int *nset,int *nval,
174 real *dt,real **t);
175 #ifdef __cplusplus
177 #endif
179 #endif /* _xvgr_h */