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
47 /***************************************************
49 ***************************************************/
51 elNone, elSolid, elDotted, elDashed,
52 elLongDashed, elDotDashed, elNR
54 /* xvgr line-styles */
57 ecWhite, ecFrank, ecBlack=ecFrank,
58 ecRed, ecGreen, ecBlue, ecYellow, ecBrown, ecGray,
59 ecPurple, ecLightBlue, ecViolet, ecHolland, ecLila, ecDarkGray,
60 ecAquamarine, ecOlive, ecNR
62 /* xvgr line-colors */
65 eppNone, eppColor, eppPattern, eppNR
67 /* xvgr pattern type */
74 /***************************************************
76 ***************************************************/
78 /* Strings such as titles, lables and legends can contain escape sequences
79 * for formatting. Currently supported are:
80 * \s : start subscript
81 * \S : start superscript
82 * \N : end sub/superscript
83 * \symbol : where symbol is the full name of a greek letter
84 * (see the xvgrstr function in xvgr.c for the full list)
85 * when starting with a capital, a capital symbol will be printed,
86 * note that symbol does not need to be followed by a space
87 * \8 : (deprecated) start symbol font
88 * \4 : (deprecated) end symbol font
91 bool output_env_get_print_xvgr_codes(const output_env_t oenv);
92 /* Returns if we should print xmgrace or xmgr codes */
95 exvggtNONE, exvggtXNY, exvggtXYDY, exvggtXYDYDY, exvggtNR
98 void xvgr_header(FILE *fp,const char *title,const char *xaxis,
99 const char *yaxis,int exvg_graph_type,
100 const output_env_t oenv);
101 /* In most cases you want to use xvgropen_type, which does the same thing
102 * but takes a filename and opens it.
105 FILE *xvgropen_type(const char *fn,const char *title,const char *xaxis,
106 const char *yaxis,int exvg_graph_type,
107 const output_env_t oenv);
108 /* Open a file, and write a title, and axis-labels in Xvgr format
109 * or write nothing when oenv specifies so.
110 * The xvgr graph type enum is defined above.
113 FILE *xvgropen(const char *fn,const char *title,const char *xaxis,
114 const char *yaxis,const output_env_t oenv);
115 /* Calls xvgropen_type with graph type xvggtXNY. */
117 /* Close xvgr file, and clean up internal file buffers correctly */
118 void xvgrclose(FILE *fp);
120 void xvgr_subtitle(FILE *out,const char *subtitle,
121 const output_env_t oenv);
122 /* Set the subtitle in xvgr */
124 void xvgr_view(FILE *out,real xmin,real ymin,real xmax,real ymax,
125 const output_env_t oenv);
126 /* Set the view in xvgr */
128 void xvgr_world(FILE *out,real xmin,real ymin,real xmax,real ymax,
129 const output_env_t oenv);
130 /* Set the world in xvgr */
132 void xvgr_legend(FILE *out,int nsets,const char** setnames,
133 const output_env_t oenv);
134 /* Make a legend box, and also modifies the view to make room for the legend */
137 void xvgr_new_dataset(FILE *out, const output_env_t oenv);
138 /* End the previous data set(s) and start new one(s). */
140 void xvgr_line_props(FILE *out,int NrSet,int LineStyle,int LineColor,
141 const output_env_t oenv);
142 /* Set xvgr line styles and colors */
144 void xvgr_box(FILE *out,
146 real xmin,real ymin,real xmax,real ymax,
147 int LineStyle,int LineWidth,int LineColor,
148 int BoxFill,int BoxColor,int BoxPattern,
149 const output_env_t oenv);
152 int read_xvg_legend(const char *fn,double ***y,int *ny,
153 char **subtitle,char ***legend);
154 /* Read an xvg file for post processing. The number of rows is returned
155 * fn is the filename, y is a pointer to a 2D array (to be allocated by
156 * the routine) ny is the number of columns (including X if appropriate).
157 * If subtitle!=NULL, read the subtitle (when present),
158 * the subtitle string will be NULL when not present.
159 * If legend!=NULL, read the legends for the sets (when present),
160 * 0 is the first y legend, the legend string will be NULL when not present.
163 int read_xvg(const char *fn,double ***y,int *ny);
164 /* As read_xvg_legend, but does not read legends. */
166 void write_xvg(const char *fn,const char *title,int nx,int ny,real **y,
167 const char** leg, const output_env_t oenv);
168 /* Write a two D array (y) of dimensions nx rows times
169 * ny columns to a file. If leg != NULL it will be written too.
173 /* This function reads ascii (xvg) files and extracts the data sets to a
174 * two dimensional array which is returned.
176 real **read_xvg_time(const char *fn,
180 int nsets_in,int *nset,int *nval,