3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
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
33 * Gromacs Runs On Most of All Computer Systems
39 #include "visibility.h"
48 /***************************************************
50 ***************************************************/
52 elNone, elSolid, elDotted, elDashed,
53 elLongDashed, elDotDashed, elNR
55 /* xvgr line-styles */
58 ecWhite, ecFrank, ecBlack=ecFrank,
59 ecRed, ecGreen, ecBlue, ecYellow, ecBrown, ecGray,
60 ecPurple, ecLightBlue, ecViolet, ecHolland, ecLila, ecDarkGray,
61 ecAquamarine, ecOlive, ecNR
63 /* xvgr line-colors */
66 eppNone, eppColor, eppPattern, eppNR
68 /* xvgr pattern type */
75 /***************************************************
77 ***************************************************/
79 /* Strings such as titles, lables and legends can contain escape sequences
80 * for formatting. Currently supported are:
81 * \s : start subscript
82 * \S : start superscript
83 * \N : end sub/superscript
84 * \symbol : where symbol is the full name of a greek letter
85 * (see the xvgrstr function in xvgr.c for the full list)
86 * when starting with a capital, a capital symbol will be printed,
87 * note that symbol does not need to be followed by a space
88 * \8 : (deprecated) start symbol font
89 * \4 : (deprecated) end symbol font
93 gmx_bool output_env_get_print_xvgr_codes(const output_env_t oenv);
94 /* Returns if we should print xmgrace or xmgr codes */
97 exvggtNONE, exvggtXNY, exvggtXYDY, exvggtXYDYDY, exvggtNR
101 void xvgr_header(FILE *fp,const char *title,const char *xaxis,
102 const char *yaxis,int exvg_graph_type,
103 const output_env_t oenv);
104 /* In most cases you want to use xvgropen_type, which does the same thing
105 * but takes a filename and opens it.
109 FILE *xvgropen_type(const char *fn,const char *title,const char *xaxis,
110 const char *yaxis,int exvg_graph_type,
111 const output_env_t oenv);
112 /* Open a file, and write a title, and axis-labels in Xvgr format
113 * or write nothing when oenv specifies so.
114 * The xvgr graph type enum is defined above.
118 FILE *xvgropen(const char *fn,const char *title,const char *xaxis,
119 const char *yaxis,const output_env_t oenv);
120 /* Calls xvgropen_type with graph type xvggtXNY. */
122 /* Close xvgr file, and clean up internal file buffers correctly */
124 void xvgrclose(FILE *fp);
127 void xvgr_subtitle(FILE *out,const char *subtitle,
128 const output_env_t oenv);
129 /* Set the subtitle in xvgr */
132 void xvgr_view(FILE *out,real xmin,real ymin,real xmax,real ymax,
133 const output_env_t oenv);
134 /* Set the view in xvgr */
137 void xvgr_world(FILE *out,real xmin,real ymin,real xmax,real ymax,
138 const output_env_t oenv);
139 /* Set the world in xvgr */
142 void xvgr_legend(FILE *out,int nsets,const char** setnames,
143 const output_env_t oenv);
144 /* Make a legend box, and also modifies the view to make room for the legend */
148 void xvgr_new_dataset(FILE *out,
149 int nr_first, int nsets, const char **setnames,
150 const output_env_t oenv);
151 /* End the previous data set(s) and start new one(s).
152 nr_first = the global set number of the first new set (or 0 if no legend)
153 nsets = the number of sets (or 0 if no legends)
154 setnames = the set names (or NULL if no legends)
158 void xvgr_line_props(FILE *out,int NrSet,int LineStyle,int LineColor,
159 const output_env_t oenv);
160 /* Set xvgr line styles and colors */
162 void xvgr_box(FILE *out,
164 real xmin,real ymin,real xmax,real ymax,
165 int LineStyle,int LineWidth,int LineColor,
166 int BoxFill,int BoxColor,int BoxPattern,
167 const output_env_t oenv);
171 int read_xvg_legend(const char *fn,double ***y,int *ny,
172 char **subtitle,char ***legend);
173 /* Read an xvg file for post processing. The number of rows is returned
174 * fn is the filename, y is a pointer to a 2D array (to be allocated by
175 * the routine) ny is the number of columns (including X if appropriate).
176 * If subtitle!=NULL, read the subtitle (when present),
177 * the subtitle string will be NULL when not present.
178 * If legend!=NULL, read the legends for the sets (when present),
179 * 0 is the first y legend, the legend string will be NULL when not present.
183 int read_xvg(const char *fn,double ***y,int *ny);
184 /* As read_xvg_legend, but does not read legends. */
187 void write_xvg(const char *fn,const char *title,int nx,int ny,real **y,
188 const char** leg, const output_env_t oenv);
189 /* Write a two D array (y) of dimensions nx rows times
190 * ny columns to a file. If leg != NULL it will be written too.
194 /* This function reads ascii (xvg) files and extracts the data sets to a
195 * two dimensional array which is returned.
198 real **read_xvg_time(const char *fn,
200 gmx_bool bTB,real tb,
201 gmx_bool bTE,real te,
202 int nsets_in,int *nset,int *nval,