Fix various memory leaks
[gromacs.git] / src / contrib / ehdata.h
blob107ae80b7ba4f1656eb030f4d47d251a87a6433e
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 * Good gRace! Old Maple Actually Chews Slate
36 extern real get_omega(real ekin,int *seed,FILE *fp,char *fn);
38 extern real get_q_inel(real ekin,real omega,int *seed,FILE *fp,char *fn);
40 extern real get_theta_el(real ekin,int *seed,FILE *fp,char *fn);
42 extern real cross_inel(real ekin,real rho,char *fn);
44 extern real cross_el(real ekin,real rho,char *fn);
46 extern real band_ener(int *seed,FILE *fp,char *fn);
48 extern void init_tables(int nfile,t_filenm fnm[], real rho);
49 /* Must be called before any of the table lookup thingies */
51 extern void test_tables(int *seed,char *fn,real rho);
53 /*******************************************************************
55 * Functions to make histograms
57 *******************************************************************/
59 enum { enormNO, enormFAC, enormNP, enormNR };
61 typedef struct {
62 int np;
63 real minx,maxx,dx,dx_1;
64 real *y;
65 int *nh;
66 } t_histo;
68 extern t_histo *init_histo(int np,real minx,real maxx);
70 extern void done_histo(t_histo *h);
72 extern void add_histo(t_histo *h,real x,real y);
74 extern void dump_histo(t_histo *h,char *fn,char *title,char *xaxis,char *yaxis,
75 int enorm,real norm_fac);
78 /*******************************************************************
80 * Functions to analyse and monitor scattering
82 *******************************************************************/
84 typedef struct {
85 int np,maxp;
86 real *time;
87 real *ekin;
88 gmx_bool *bInel;
89 rvec *pos;
90 } t_ana_scat;
92 extern void add_scatter_event(t_ana_scat *scatter,rvec pos,gmx_bool bInel,
93 real t,real ekin);
95 extern void reset_ana_scat(t_ana_scat *scatter);
97 extern void done_scatter(t_ana_scat *scatter);
99 extern void analyse_scatter(t_ana_scat *scatter,t_histo *hmfp);
101 /*******************************************************************
103 * Functions to analyse structural changes
105 *******************************************************************/
107 typedef struct {
108 int nanal,index;
109 real dt;
110 real *t;
111 real *maxdist;
112 rvec *d2_com,*d2_origin;
113 int *nion;
114 int nstruct,nparticle,maxparticle;
115 rvec *q;
116 rvec **x;
117 } t_ana_struct;
119 extern t_ana_struct *init_ana_struct(int nstep,int nsave,real timestep,
120 int maxparticle);
122 extern void done_ana_struct(t_ana_struct *anal);
124 extern void reset_ana_struct(t_ana_struct *anal);
126 extern void add_ana_struct(t_ana_struct *total,t_ana_struct *add);
128 extern void analyse_structure(t_ana_struct *anal,real t,rvec center,
129 rvec x[],int nparticle,real charge[]);
131 extern void dump_ana_struct(char *rmax,char *nion,char *gyr_com,
132 char *gyr_origin,t_ana_struct *anal,int nsim);
134 extern void dump_as_pdb(char *pdb,t_ana_struct *anal);
136 /*******************************************************************
138 * Functions to analyse energies
140 *******************************************************************/
142 enum { eCOUL, eREPULS, ePOT, eHOLE, eELECTRON, eLATTICE, eKIN, eTOT, eNR };
143 extern char *enms[eNR];
145 typedef real evec[eNR];
147 typedef struct {
148 int nx,maxx;
149 evec *e;
150 } t_ana_ener;
152 extern void add_ana_ener(t_ana_ener *ae,int nn,real e[]);
154 extern void dump_ana_ener(t_ana_ener *ae,int nsim,real dt,char *edump,
155 t_ana_struct *total);