Fixing copyright issues and code contributors
[alexxy/gromacs.git] / src / kernel / xmdrun.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, The GROMACS development team,
6  * check out http://www.gromacs.org for more information.
7  * Copyright (c) 2012,2013, by the GROMACS development team, led by
8  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9  * others, as listed in the AUTHORS file in the top-level source
10  * directory and at http://www.gromacs.org.
11  *
12  * GROMACS is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * as published by the Free Software Foundation; either version 2.1
15  * of the License, or (at your option) any later version.
16  *
17  * GROMACS is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with GROMACS; if not, see
24  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
26  *
27  * If you want to redistribute modifications to GROMACS, please
28  * consider that scientific software is very special. Version
29  * control is crucial - bugs must be traceable. We will be happy to
30  * consider code for inclusion in the official distribution, but
31  * derived work must not be called official GROMACS. Details are found
32  * in the README & COPYING files - if they are missing, get the
33  * official version at http://www.gromacs.org.
34  *
35  * To help us fund GROMACS development, we humbly ask that you cite
36  * the research papers on the package. Check out http://www.gromacs.org.
37  */
38
39 #ifndef _xmdrun_h
40 #define _xmdrun_h
41
42 #ifdef HAVE_CONFIG_H
43 #include <config.h>
44 #endif
45
46 #include <stdio.h>
47 #include "typedefs.h"
48 #include "network.h"
49 #include "tgroup.h"
50 #include "filenm.h"
51 #include "mshift.h"
52 #include "force.h"
53 #include <time.h>
54 #include "edsam.h"
55 #include "mdebin.h"
56 #include "vcm.h"
57 #include "vsite.h"
58 #include "gmx_wallcycle.h"
59
60 /* This file contains XMDRUN datatypes and function prototypes, grouped
61  * neatly according to parts of the functionalisty
62  */
63  
64 /* GENERAL COUPLING THEORY (GCT) STUFF */
65 enum { eoPres, eoEpot, eoVir, eoDist, eoMu, eoForce, eoFx, eoFy, eoFz,
66        eoPx, eoPy, eoPz, 
67        eoPolarizability, eoDipole, eoObsNR, 
68        eoMemory=eoObsNR, eoInter, eoUseVirial,  eoCombRule, eoNR };
69 extern const char *eoNames[eoNR];
70
71 typedef struct {
72   int  at_i,at_j;       /* Atom type # for i and j                      */
73   int  eObs;            /* Observable to couple to                      */
74   gmx_bool bPrint;              /* Does this struct have to be printed          */
75   real c6,c12;          /* Actual value of params                       */
76   real xi_6,xi_12;      /* Constants for coupling C6 and C12            */
77 } t_coupl_LJ;
78
79 typedef struct {
80   int  at_i,at_j;       /* Atom type # for i and j                      */
81   int  eObs;            /* Observable to couple to                      */
82   gmx_bool bPrint;              /* Does this struct have to be printed          */
83   real a,b,c;           /* Actual value of params                       */
84   real xi_a,xi_b,xi_c;  /* Constants for coupling A, B and C            */
85 } t_coupl_BU;
86
87 typedef struct {
88   int  at_i;            /* Atom type                                    */
89   int  eObs;            /* Observable to couple to                      */
90   gmx_bool bPrint;              /* Does this struct have to be printed          */
91   real Q;               /* Actual value of charge                       */
92   real xi_Q;            /* Constant for coupling Q                      */
93 } t_coupl_Q;
94
95 typedef struct {
96   int       type;       /* Type number in the iparams struct    */
97   int       eObs;       /* Observable to couple to              */
98   t_iparams xi;         /* Parameters that need to be changed   */
99   t_iparams iprint;
100 } t_coupl_iparams;
101
102 typedef struct {
103   real       act_value[eoObsNR];
104   real       av_value [eoObsNR];
105   real       ref_value[eoObsNR];
106   gmx_bool       bObsUsed[eoObsNR];
107   int        nLJ,nBU,nQ,nIP;
108   t_coupl_LJ *tcLJ;
109   t_coupl_BU *tcBU;
110   t_coupl_Q  *tcQ;
111   t_coupl_iparams *tIP;
112   int        nmemory;
113   gmx_bool       bInter;
114   gmx_bool       bVirial;
115   int        combrule;
116 } t_coupl_rec;
117
118 extern void write_gct(const char *fn,t_coupl_rec *tcr,t_idef *idef);
119
120 extern void read_gct(const char *fn,t_coupl_rec *tcr);
121
122 extern void comm_tcr(FILE *log,t_commrec *cr,t_coupl_rec **tcr);
123
124 extern void copy_ff(t_coupl_rec *tcr,t_forcerec *fr,t_mdatoms *md,
125                     t_idef *idef);
126
127 extern t_coupl_rec *init_coupling(FILE *log,int nfile, const t_filenm fnm[],
128                                   t_commrec *cr,t_forcerec *fr,t_mdatoms *md,
129                                   t_idef *idef);
130                                   
131 extern void calc_force(int natom,rvec f[],rvec fff[]);
132
133 extern void calc_f_dev(int natoms,real charge[],rvec x[],rvec f[],
134                        t_idef *idef,real *xiH,real *xiS);
135
136 extern void do_coupling(FILE *log,const output_env_t oenv,int nfile,
137                         const t_filenm fnm[],
138                         t_coupl_rec *tcr,real t,int step,real ener[],
139                         t_forcerec *fr,t_inputrec *ir,gmx_bool bMaster,
140                         t_mdatoms *md,t_idef *idef,real mu_aver,int nmols,
141                         t_commrec *cr,matrix box,tensor virial,
142                         tensor pres,rvec mu_tot,
143                         rvec x[],rvec f[],gmx_bool bDoIt);
144
145 /* CODE TO ADD SPECIAL 2-DIMENSIONAL LENNARD-JONES CORRECTION TO FORCES AND ENERGY */
146 extern void do_glas(FILE *log,int start,int homenr,rvec x[],rvec f[],
147                     t_forcerec *fr,t_mdatoms *md,int atnr,t_inputrec *ir,
148                     real ener[]);
149
150 extern real mol_dipole(int k0,int k1,rvec x[],real q[]);
151 /* Calculate total dipole for group of atoms */
152
153 extern real calc_mu_aver(t_commrec *cr,rvec x[],real q[],rvec mu,
154                          t_block *mols,t_mdatoms *md,int gnx,atom_id grpindex[]);
155 /* Compute average dipole */
156
157 /********************************************************************/
158 /* Force field scanning stuff */
159 typedef struct {
160   real tol,f_max,npow,epot,fac_epot,fac_pres,fac_msf,pres;
161   int  molsize,nmol;
162   gmx_bool bComb,bVerbose,bLogEps;
163 } t_ffscan;
164
165
166 extern gmx_bool update_forcefield(FILE *fplog,
167                               int nfile,const t_filenm fnm[],t_forcerec *fr,
168                               int natoms,rvec x[],matrix box);
169 /* Modify the parameters. Return TRUE when the scan is finished. */
170
171 extern gmx_bool print_forcefield(FILE *fp,real ener[],int natoms,rvec f[],
172                              rvec fshake[],rvec x[],t_block *mols,real mass[],
173                              tensor pres);
174 /* Print results. Return TRUE when the scan is finished. */
175
176 extern void set_ffvars(t_ffscan *ff);
177 /* Set variables for force scanning */
178
179 #endif  /* _xmdrun_h */