107ae80b7ba4f1656eb030f4d47d251a87a6433e
[alexxy/gromacs.git] / src / contrib / ehdata.h
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.
14
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.
19  * 
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.
26  * 
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.
29  * 
30  * For more info, check our website at http://www.gromacs.org
31  * 
32  * And Hey:
33  * Good gRace! Old Maple Actually Chews Slate
34  */
35         
36 extern real get_omega(real ekin,int *seed,FILE *fp,char *fn);
37
38 extern real get_q_inel(real ekin,real omega,int *seed,FILE *fp,char *fn);
39
40 extern real get_theta_el(real ekin,int *seed,FILE *fp,char *fn);
41
42 extern real cross_inel(real ekin,real rho,char *fn);
43
44 extern real cross_el(real ekin,real rho,char *fn);
45
46 extern real band_ener(int *seed,FILE *fp,char *fn);
47
48 extern void init_tables(int nfile,t_filenm fnm[], real rho);
49 /* Must be called before any of the table lookup thingies */
50
51 extern void test_tables(int *seed,char *fn,real rho);
52
53 /*******************************************************************
54  *
55  * Functions to make histograms
56  *
57  *******************************************************************/   
58         
59 enum { enormNO, enormFAC, enormNP, enormNR };
60
61 typedef struct {
62   int np;
63   real minx,maxx,dx,dx_1;
64   real *y;
65   int  *nh;
66 } t_histo;
67
68 extern t_histo *init_histo(int np,real minx,real maxx);
69
70 extern void done_histo(t_histo *h);
71
72 extern void add_histo(t_histo *h,real x,real y);
73
74 extern void dump_histo(t_histo *h,char *fn,char *title,char *xaxis,char *yaxis,
75                        int enorm,real norm_fac);
76
77
78 /*******************************************************************
79  *
80  * Functions to analyse and monitor scattering
81  *
82  *******************************************************************/   
83         
84 typedef struct {
85   int  np,maxp;
86   real *time;
87   real *ekin;
88   gmx_bool *bInel;
89   rvec *pos;
90 } t_ana_scat;
91
92 extern void add_scatter_event(t_ana_scat *scatter,rvec pos,gmx_bool bInel,
93                               real t,real ekin);
94                               
95 extern void reset_ana_scat(t_ana_scat *scatter);
96
97 extern void done_scatter(t_ana_scat *scatter);
98
99 extern void analyse_scatter(t_ana_scat *scatter,t_histo *hmfp);
100
101 /*******************************************************************
102  *
103  * Functions to analyse structural changes
104  *
105  *******************************************************************/   
106
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;
118
119 extern t_ana_struct *init_ana_struct(int nstep,int nsave,real timestep,
120                                      int maxparticle);
121
122 extern void done_ana_struct(t_ana_struct *anal);
123
124 extern void reset_ana_struct(t_ana_struct *anal);
125
126 extern void add_ana_struct(t_ana_struct *total,t_ana_struct *add);
127
128 extern void analyse_structure(t_ana_struct *anal,real t,rvec center,
129                               rvec x[],int nparticle,real charge[]);
130
131 extern void dump_ana_struct(char *rmax,char *nion,char *gyr_com,
132                             char *gyr_origin,t_ana_struct *anal,int nsim);
133
134 extern void dump_as_pdb(char *pdb,t_ana_struct *anal);
135
136 /*******************************************************************
137  *
138  * Functions to analyse energies
139  *
140  *******************************************************************/   
141                             
142 enum { eCOUL, eREPULS, ePOT, eHOLE, eELECTRON, eLATTICE, eKIN, eTOT, eNR };
143 extern char *enms[eNR];
144
145 typedef real evec[eNR];
146
147 typedef struct {
148   int  nx,maxx;
149   evec *e;
150 } t_ana_ener;
151
152 extern void add_ana_ener(t_ana_ener *ae,int nn,real e[]);
153
154 extern void dump_ana_ener(t_ana_ener *ae,int nsim,real dt,char *edump,
155                           t_ana_struct *total);
156