Properly finalize MPI on mdrun -version. Fixes #1313
[gromacs.git] / include / xvgr.h
blobd5554abce9c00a26bf4338258b849d25ad944ac7
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
39 #ifndef _xvgr_h
40 #define _xvgr_h
42 #include "visibility.h"
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 GMX_LIBGMX_EXPORT
96 gmx_bool output_env_get_print_xvgr_codes(const output_env_t oenv);
97 /* Returns if we should print xmgrace or xmgr codes */
99 enum {
100 exvggtNONE, exvggtXNY, exvggtXYDY, exvggtXYDYDY, exvggtNR
103 GMX_LIBGMX_EXPORT
104 void xvgr_header(FILE *fp, const char *title, const char *xaxis,
105 const char *yaxis, int exvg_graph_type,
106 const output_env_t oenv);
107 /* In most cases you want to use xvgropen_type, which does the same thing
108 * but takes a filename and opens it.
111 GMX_LIBGMX_EXPORT
112 FILE *xvgropen_type(const char *fn, const char *title, const char *xaxis,
113 const char *yaxis, int exvg_graph_type,
114 const output_env_t oenv);
115 /* Open a file, and write a title, and axis-labels in Xvgr format
116 * or write nothing when oenv specifies so.
117 * The xvgr graph type enum is defined above.
120 GMX_LIBGMX_EXPORT
121 FILE *xvgropen(const char *fn, const char *title, const char *xaxis,
122 const char *yaxis, const output_env_t oenv);
123 /* Calls xvgropen_type with graph type xvggtXNY. */
125 /* Close xvgr file, and clean up internal file buffers correctly */
126 GMX_LIBGMX_EXPORT
127 void xvgrclose(FILE *fp);
129 GMX_LIBGMX_EXPORT
130 void xvgr_subtitle(FILE *out, const char *subtitle,
131 const output_env_t oenv);
132 /* Set the subtitle in xvgr */
134 GMX_LIBGMX_EXPORT
135 void xvgr_view(FILE *out, real xmin, real ymin, real xmax, real ymax,
136 const output_env_t oenv);
137 /* Set the view in xvgr */
139 GMX_LIBGMX_EXPORT
140 void xvgr_world(FILE *out, real xmin, real ymin, real xmax, real ymax,
141 const output_env_t oenv);
142 /* Set the world in xvgr */
144 GMX_LIBGMX_EXPORT
145 void xvgr_legend(FILE *out, int nsets, const char** setnames,
146 const output_env_t oenv);
147 /* Make a legend box, and also modifies the view to make room for the legend */
150 GMX_LIBGMX_EXPORT
151 void xvgr_new_dataset(FILE *out,
152 int nr_first, int nsets, const char **setnames,
153 const output_env_t oenv);
154 /* End the previous data set(s) and start new one(s).
155 nr_first = the global set number of the first new set (or 0 if no legend)
156 nsets = the number of sets (or 0 if no legends)
157 setnames = the set names (or NULL if no legends)
160 GMX_LIBGMX_EXPORT
161 void xvgr_line_props(FILE *out, int NrSet, int LineStyle, int LineColor,
162 const output_env_t oenv);
163 /* Set xvgr line styles and colors */
165 void xvgr_box(FILE *out,
166 int LocType,
167 real xmin, real ymin, real xmax, real ymax,
168 int LineStyle, int LineWidth, int LineColor,
169 int BoxFill, int BoxColor, int BoxPattern,
170 const output_env_t oenv);
171 /* Make a box */
173 GMX_LIBGMX_EXPORT
174 int read_xvg_legend(const char *fn, double ***y, int *ny,
175 char **subtitle, char ***legend);
176 /* Read an xvg file for post processing. The number of rows is returned
177 * fn is the filename, y is a pointer to a 2D array (to be allocated by
178 * the routine) ny is the number of columns (including X if appropriate).
179 * If subtitle!=NULL, read the subtitle (when present),
180 * the subtitle string will be NULL when not present.
181 * If legend!=NULL, read the legends for the sets (when present),
182 * 0 is the first y legend, the legend string will be NULL when not present.
185 GMX_LIBGMX_EXPORT
186 int read_xvg(const char *fn, double ***y, int *ny);
187 /* As read_xvg_legend, but does not read legends. */
189 GMX_LIBGMX_EXPORT
190 void write_xvg(const char *fn, const char *title, int nx, int ny, real **y,
191 const char** leg, const output_env_t oenv);
192 /* Write a two D array (y) of dimensions nx rows times
193 * ny columns to a file. If leg != NULL it will be written too.
197 /* This function reads ascii (xvg) files and extracts the data sets to a
198 * two dimensional array which is returned.
200 GMX_LIBGMX_EXPORT
201 real **read_xvg_time(const char *fn,
202 gmx_bool bHaveT,
203 gmx_bool bTB, real tb,
204 gmx_bool bTE, real te,
205 int nsets_in, int *nset, int *nval,
206 real *dt, real **t);
207 #ifdef __cplusplus
209 #endif
211 #endif /* _xvgr_h */