Code beautification with uncrustify
[alexxy/gromacs.git] / src / programs / mdrun / xmdrun.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  * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
34  */
35
36 #ifndef _xmdrun_h
37 #define _xmdrun_h
38
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
42
43 #include <stdio.h>
44 #include "typedefs.h"
45 #include "network.h"
46 #include "tgroup.h"
47 #include "filenm.h"
48 #include "mshift.h"
49 #include "force.h"
50 #include <time.h>
51 #include "edsam.h"
52 #include "mdebin.h"
53 #include "vcm.h"
54 #include "vsite.h"
55 #include "gmx_wallcycle.h"
56
57 /* This file contains XMDRUN datatypes and function prototypes, grouped
58  * neatly according to parts of the functionalisty
59  */
60
61 /* GENERAL COUPLING THEORY (GCT) STUFF */
62 enum {
63     eoPres, eoEpot, eoVir, eoDist, eoMu, eoForce, eoFx, eoFy, eoFz,
64     eoPx, eoPy, eoPz,
65     eoPolarizability, eoDipole, eoObsNR,
66     eoMemory = eoObsNR, eoInter, eoUseVirial,  eoCombRule, eoNR
67 };
68 extern const char *eoNames[eoNR];
69
70 typedef struct {
71     int      at_i, at_j;  /* Atom type # for i and j                    */
72     int      eObs;        /* Observable to couple to                */
73     gmx_bool bPrint;      /* Does this struct have to be printed                */
74     real     c6, c12;     /* Actual value of params                     */
75     real     xi_6, xi_12; /* Constants for coupling C6 and C12      */
76 } t_coupl_LJ;
77
78 typedef struct {
79     int      at_i, at_j;       /* Atom type # for i and j                       */
80     int      eObs;             /* Observable to couple to               */
81     gmx_bool bPrint;           /* Does this struct have to be printed           */
82     real     a, b, c;          /* Actual value of params                        */
83     real     xi_a, xi_b, xi_c; /* Constants for coupling A, B and C         */
84 } t_coupl_BU;
85
86 typedef struct {
87     int      at_i;   /* Atom type                                       */
88     int      eObs;   /* Observable to couple to                 */
89     gmx_bool bPrint; /* Does this struct have to be printed             */
90     real     Q;      /* Actual value of charge                  */
91     real     xi_Q;   /* Constant for coupling Q                 */
92 } t_coupl_Q;
93
94 typedef struct {
95     int       type; /* Type number in the iparams struct        */
96     int       eObs; /* Observable to couple to              */
97     t_iparams xi;   /* Parameters that need to be changed       */
98     t_iparams iprint;
99 } t_coupl_iparams;
100
101 typedef struct {
102     real             act_value[eoObsNR];
103     real             av_value [eoObsNR];
104     real             ref_value[eoObsNR];
105     gmx_bool         bObsUsed[eoObsNR];
106     int              nLJ, nBU, nQ, nIP;
107     t_coupl_LJ      *tcLJ;
108     t_coupl_BU      *tcBU;
109     t_coupl_Q       *tcQ;
110     t_coupl_iparams *tIP;
111     int              nmemory;
112     gmx_bool         bInter;
113     gmx_bool         bVirial;
114     int              combrule;
115 } t_coupl_rec;
116
117 extern void write_gct(const char *fn, t_coupl_rec *tcr, t_idef *idef);
118
119 extern void read_gct(const char *fn, t_coupl_rec *tcr);
120
121 extern void comm_tcr(FILE *log, t_commrec *cr, t_coupl_rec **tcr);
122
123 extern void copy_ff(t_coupl_rec *tcr, t_forcerec *fr, t_mdatoms *md,
124                     t_idef *idef);
125
126 extern t_coupl_rec *init_coupling(FILE *log, int nfile, const t_filenm fnm[],
127                                   t_commrec *cr, t_forcerec *fr, t_mdatoms *md,
128                                   t_idef *idef);
129
130 extern void calc_force(int natom, rvec f[], rvec fff[]);
131
132 extern void calc_f_dev(int natoms, real charge[], rvec x[], rvec f[],
133                        t_idef *idef, real *xiH, real *xiS);
134
135 extern void do_coupling(FILE *log, const output_env_t oenv, int nfile,
136                         const t_filenm fnm[],
137                         t_coupl_rec *tcr, real t, int step, real ener[],
138                         t_forcerec *fr, t_inputrec *ir, gmx_bool bMaster,
139                         t_mdatoms *md, t_idef *idef, real mu_aver, int nmols,
140                         t_commrec *cr, matrix box, tensor virial,
141                         tensor pres, rvec mu_tot,
142                         rvec x[], rvec f[], gmx_bool bDoIt);
143
144 /* CODE TO ADD SPECIAL 2-DIMENSIONAL LENNARD-JONES CORRECTION TO FORCES AND ENERGY */
145 extern void do_glas(FILE *log, int start, int homenr, rvec x[], rvec f[],
146                     t_forcerec *fr, t_mdatoms *md, int atnr, t_inputrec *ir,
147                     real ener[]);
148
149 extern real mol_dipole(int k0, int k1, rvec x[], real q[]);
150 /* Calculate total dipole for group of atoms */
151
152 extern real calc_mu_aver(t_commrec *cr, rvec x[], real q[], rvec mu,
153                          t_block *mols, t_mdatoms *md, int gnx, atom_id grpindex[]);
154 /* Compute average dipole */
155
156 /********************************************************************/
157 /* Force field scanning stuff */
158 typedef struct {
159     real     tol, f_max, npow, epot, fac_epot, fac_pres, fac_msf, pres;
160     int      molsize, nmol;
161     gmx_bool bComb, bVerbose, bLogEps;
162 } t_ffscan;
163
164
165 extern gmx_bool update_forcefield(FILE *fplog,
166                                   int nfile, const t_filenm fnm[], t_forcerec *fr,
167                                   int natoms, rvec x[], matrix box);
168 /* Modify the parameters. Return TRUE when the scan is finished. */
169
170 extern gmx_bool print_forcefield(FILE *fp, real ener[], int natoms, rvec f[],
171                                  rvec fshake[], rvec x[], t_block *mols, real mass[],
172                                  tensor pres);
173 /* Print results. Return TRUE when the scan is finished. */
174
175 extern void set_ffvars(t_ffscan *ff);
176 /* Set variables for force scanning */
177
178 #endif  /* _xmdrun_h */