Added documentation about proper use of pdb2gmx -ter.
[gromacs/rigid-bodies.git] / include / matio.h
blob1a5238a18a3a4a9891992a8357ac787c3db7ba04
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 _matio_h
37 #define _matio_h
39 #include "typedefs.h"
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
45 gmx_bool matelmt_cmp(t_xpmelmt e1, t_xpmelmt e2);
47 t_matelmt searchcmap(int n,t_mapping map[],t_xpmelmt c);
48 /* Seach in the map for code 'c' and return entry number.
49 * return -1 if not found
52 int getcmap(FILE *in,const char *fn,t_mapping **map);
53 /* Read the mapping table from in, return number of entries */
55 int readcmap(const char *fn,t_mapping **map);
56 /* Read the mapping table from fn, return number of entries */
58 void printcmap(FILE *out,int n,t_mapping map[]);
59 /* print mapping table to out */
61 void writecmap(const char *fn,int n,t_mapping map[]);
62 /* print mapping table to fn */
64 int read_xpm_matrix(const char *fnm, t_matrix **matrix);
65 /* Reads a number of matrices from .xpm file fnm and returns this number */
67 real **matrix2real(t_matrix *matrix,real **mat);
68 /* Converts an matrix in a t_matrix struct to a matrix of reals
69 * When mat==NULL memory will be allocated
70 * Returns NULL when something went wrong
73 void write_xpm_m(FILE *out, t_matrix m);
74 /* Writes a t_matrix struct to .xpm file */
76 void write_xpm3(FILE *out,unsigned int flags,
77 const char *title,const char *legend,
78 const char *label_x,const char *label_y,
79 int n_x,int n_y,real axis_x[],real axis_y[],
80 real *matrix[],real lo,real mid,real hi,
81 t_rgb rlo,t_rgb rmid,t_rgb rhi,int *nlevels);
82 /* See write_xpm.
83 * Writes a colormap varying as rlo -> rmid -> rhi.
85 void write_xpm_split(FILE *out,unsigned int flags,
86 const char *title,const char *legend,
87 const char *label_x,const char *label_y,
88 int n_x,int n_y,real axis_x[],real axis_y[],
89 real *matrix[],
90 real lo_top,real hi_top,int *nlevel_top,
91 t_rgb rlo_top,t_rgb rhi_top,
92 real lo_bot,real hi_bot,int *nlevel_bot,
93 gmx_bool bDiscreteColor,
94 t_rgb rlo_bot,t_rgb rhi_bot);
95 /* See write_xpm.
96 * Writes a colormap with separate above and below diagonal colormaps.
97 * If bDiscrete then a colormap with 16 fixed colors is used, first of
98 * which is white.
101 void write_xpm(FILE *out,unsigned int flags,
102 const char *title,const char *legend,
103 const char *label_x,const char *label_y,
104 int n_x,int n_y,real t_x[],real t_y[],
105 real *matrix[],real lo,real hi,
106 t_rgb rlo,t_rgb rhi,int *nlevels);
107 /* out xpm file
108 * flags flags, defined types/matrix.h
109 * MAT_SPATIAL_X
110 * MAT_SPATIAL_Y
111 * Defines if x and y are spatial dimensions,
112 * when not, there are n axis ticks at the middle of the elements,
113 * when set, there are n+1 axis ticks at the edges of the elements.
114 * title matrix title
115 * legend label for the continuous legend
116 * label_x label for the x-axis
117 * label_y label for the y-axis
118 * n_x, n_y size of the matrix
119 * axis_x[] the x-ticklabels (n_x or n_x+1)
120 * axis_y[] the y-ticklables (n_y or n_y+1)
121 * *matrix[] element x,y is matrix[x][y]
122 * lo output lower than lo is set to lo
123 * hi output higher than hi is set to hi
124 * rlo rgb value for level lo
125 * rhi rgb value for level hi
126 * nlevels number of color levels for the output
129 real **mk_matrix(int nx, int ny, gmx_bool b1D);
131 void done_matrix(int nx, real ***m);
133 void clear_matrix(int nx, int ny, real **m);
135 #ifdef __cplusplus
137 #endif
139 #endif /* _matio_h */