7c854de1c6c05acf612edb2076c4cd227a913ec7
[alexxy/gromacs.git] / src / contrib / ehdata.h
1 /*
2  * $Id: ehdata.h,v 1.8 2003/11/17 21:50:46 spoel Exp $
3  * 
4  *                This source code is part of
5  * 
6  *                 G   R   O   M   A   C   S
7  * 
8  *          GROningen MAchine for Chemical Simulations
9  * 
10  *                        VERSION 3.2.0
11  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13  * Copyright (c) 2001-2004, The GROMACS development team,
14  * check out http://www.gromacs.org for more information.
15
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  * 
21  * If you want to redistribute modifications, please consider that
22  * scientific software is very special. Version control is crucial -
23  * bugs must be traceable. We will be happy to consider code for
24  * inclusion in the official distribution, but derived work must not
25  * be called official GROMACS. Details are found in the README & COPYING
26  * files - if they are missing, get the official version at www.gromacs.org.
27  * 
28  * To help us fund GROMACS development, we humbly ask that you cite
29  * the papers on the package - you can find them in the top README file.
30  * 
31  * For more info, check our website at http://www.gromacs.org
32  * 
33  * And Hey:
34  * Good gRace! Old Maple Actually Chews Slate
35  */
36         
37 extern real get_omega(real ekin,int *seed,FILE *fp,char *fn);
38
39 extern real get_q_inel(real ekin,real omega,int *seed,FILE *fp,char *fn);
40
41 extern real get_theta_el(real ekin,int *seed,FILE *fp,char *fn);
42
43 extern real cross_inel(real ekin,real rho,char *fn);
44
45 extern real cross_el(real ekin,real rho,char *fn);
46
47 extern real band_ener(int *seed,FILE *fp,char *fn);
48
49 extern void init_tables(int nfile,t_filenm fnm[], real rho);
50 /* Must be called before any of the table lookup thingies */
51
52 extern void test_tables(int *seed,char *fn,real rho);
53
54 /*******************************************************************
55  *
56  * Functions to make histograms
57  *
58  *******************************************************************/   
59         
60 enum { enormNO, enormFAC, enormNP, enormNR };
61
62 typedef struct {
63   int np;
64   real minx,maxx,dx,dx_1;
65   real *y;
66   int  *nh;
67 } t_histo;
68
69 extern t_histo *init_histo(int np,real minx,real maxx);
70
71 extern void done_histo(t_histo *h);
72
73 extern void add_histo(t_histo *h,real x,real y);
74
75 extern void dump_histo(t_histo *h,char *fn,char *title,char *xaxis,char *yaxis,
76                        int enorm,real norm_fac);
77
78
79 /*******************************************************************
80  *
81  * Functions to analyse and monitor scattering
82  *
83  *******************************************************************/   
84         
85 typedef struct {
86   int  np,maxp;
87   real *time;
88   real *ekin;
89   bool *bInel;
90   rvec *pos;
91 } t_ana_scat;
92
93 extern void add_scatter_event(t_ana_scat *scatter,rvec pos,bool bInel,
94                               real t,real ekin);
95                               
96 extern void reset_ana_scat(t_ana_scat *scatter);
97
98 extern void done_scatter(t_ana_scat *scatter);
99
100 extern void analyse_scatter(t_ana_scat *scatter,t_histo *hmfp);
101
102 /*******************************************************************
103  *
104  * Functions to analyse structural changes
105  *
106  *******************************************************************/   
107
108 typedef struct {
109   int  nanal,index;
110   real dt;
111   real *t;
112   real *maxdist;
113   rvec *d2_com,*d2_origin;
114   int  *nion;
115   int  nstruct,nparticle,maxparticle;
116   rvec *q;
117   rvec **x;
118 } t_ana_struct;
119
120 extern t_ana_struct *init_ana_struct(int nstep,int nsave,real timestep,
121                                      int maxparticle);
122
123 extern void done_ana_struct(t_ana_struct *anal);
124
125 extern void reset_ana_struct(t_ana_struct *anal);
126
127 extern void add_ana_struct(t_ana_struct *total,t_ana_struct *add);
128
129 extern void analyse_structure(t_ana_struct *anal,real t,rvec center,
130                               rvec x[],int nparticle,real charge[]);
131
132 extern void dump_ana_struct(char *rmax,char *nion,char *gyr_com,
133                             char *gyr_origin,t_ana_struct *anal,int nsim);
134
135 extern void dump_as_pdb(char *pdb,t_ana_struct *anal);
136
137 /*******************************************************************
138  *
139  * Functions to analyse energies
140  *
141  *******************************************************************/   
142                             
143 enum { eCOUL, eREPULS, ePOT, eHOLE, eELECTRON, eLATTICE, eKIN, eTOT, eNR };
144 extern char *enms[eNR];
145
146 typedef real evec[eNR];
147
148 typedef struct {
149   int  nx,maxx;
150   evec *e;
151 } t_ana_ener;
152
153 extern void add_ana_ener(t_ana_ener *ae,int nn,real e[]);
154
155 extern void dump_ana_ener(t_ana_ener *ae,int nsim,real dt,char *edump,
156                           t_ana_struct *total);
157