Enforced rotation: added fit type 'potential'
[alexxy/gromacs.git] / src / gromacs / legacyheaders / types / inputrec.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  * GRoups of Organic Molecules in ACtion for Science
34  */
35 #ifndef _inputrec_h_
36 #define _inputrec_h_
37
38
39 #include "simple.h"
40 #include "../sysstuff.h"
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46
47 typedef struct {
48   int  n;               /* Number of terms                              */
49   real *a;              /* Coeffients (V / nm )                         */
50   real *phi;            /* Phase angles                                 */
51 } t_cosines;
52
53 typedef struct {
54   real E0;              /* Field strength (V/nm)                        */
55   real omega;           /* Frequency (1/ps)                             */
56   real t0;              /* Centre of the Gaussian pulse (ps)            */
57   real sigma;           /* Width of the Gaussian pulse (FWHM) (ps)      */
58 } t_efield;
59
60 #define EGP_EXCL  (1<<0)
61 #define EGP_TABLE (1<<1)
62
63 typedef struct {
64   int     ngtc;                  /* # T-Coupl groups                        */
65   int     nhchainlength;         /* # of nose-hoover chains per group       */
66   int     ngacc;                 /* # Accelerate groups                     */
67   int     ngfrz;                 /* # Freeze groups                         */
68   int     ngener;                /* # Ener groups                           */
69   real    *nrdf;                 /* Nr of degrees of freedom in a group     */
70   real    *ref_t;                /* Coupling temperature        per group   */
71   int     *annealing;            /* No/simple/periodic SA for each group    */
72   int     *anneal_npoints;       /* Number of annealing time points per grp */    
73   real    **anneal_time;         /* For ea. group: Time points              */
74   real    **anneal_temp;         /* For ea. grp: Temperature at these times */
75                                  /* Final temp after all intervals is ref_t */ 
76   real    *tau_t;                /* Tau coupling time                       */
77   rvec    *acc;                  /* Acceleration per group                  */
78   ivec    *nFreeze;              /* Freeze the group in each direction ?    */
79   int     *egp_flags;            /* Exclusions/tables of energy group pairs */
80
81   /* QMMM stuff */
82   int     ngQM;         /* nr of QM groups                              */
83   int     *QMmethod;    /* Level of theory in the QM calculation        */
84   int     *QMbasis;     /* Basisset in the QM calculation               */
85   int     *QMcharge;    /* Total charge in the QM region                */
86   int     *QMmult;      /* Spin multiplicicty in the QM region          */
87   gmx_bool    *bSH;         /* surface hopping (diabatic hop only)          */
88   int     *CASorbitals; /* number of orbiatls in the active space       */
89   int     *CASelectrons;/* number of electrons in the active space      */
90   real    *SAon;        /* at which gap (A.U.) the SA is switched on    */
91   real    *SAoff;
92   int     *SAsteps;     /* in how many steps SA goes from 1-1 to 0.5-0.5*/
93   gmx_bool    *bOPT;
94   gmx_bool    *bTS;
95 } t_grpopts;
96
97 enum { epgrppbcNONE, epgrppbcREFAT, epgrppbcCOS };
98
99 typedef struct {
100   int        nat;      /* Number of atoms in the pull group */
101   atom_id    *ind;     /* The global atoms numbers */
102   int        nat_loc;  /* Number of local pull atoms */
103   int        nalloc_loc; /* Allocation size for ind_loc and weight_loc */ 
104   atom_id    *ind_loc; /* Local pull indices */
105   int        nweight;  /* The number of weights (0 or nat) */
106   real       *weight;  /* Weights (use all 1 when weight==NULL) */
107   real       *weight_loc; /* Weights for the local indices */
108   int        epgrppbc; /* The type of pbc for this pull group, see enum above */
109   atom_id    pbcatom;  /* The reference atom for pbc (global number) */
110   rvec       vec;      /* The pull vector, direction or position */
111   rvec       init;     /* Initial reference displacement */
112   real       rate;     /* Rate of motion (nm/ps) */
113   real       k;        /* force constant */
114   real       kB;       /* force constant for state B */
115   real       wscale;   /* scaling factor for the weights: sum w m/sum w w m */
116   real       invtm;    /* inverse total mass of the group: 1/wscale sum w m */
117   dvec       x;        /* center of mass before update */
118   dvec       xp;       /* center of mass after update before constraining */
119   dvec       dr;       /* The distance from the reference group */
120   double     f_scal;   /* Scalar force for directional pulling */
121   dvec       f;        /* force due to the pulling/constraining */
122 } t_pullgrp; 
123
124 typedef struct {
125   int        ngrp;        /* number of groups */
126   int        eGeom;       /* pull geometry */
127   ivec       dim;         /* used to select components for constraint */
128   real       cyl_r1;      /* radius of cylinder for dynamic COM */
129   real       cyl_r0;      /* radius of cylinder including switch length */
130   real       constr_tol;  /* absolute tolerance for constraints in (nm) */
131   int        nstxout;     /* Output frequency for pull x */
132   int        nstfout;     /* Output frequency for pull f */
133   int        ePBC;        /* the boundary conditions */
134   int        npbcdim;     /* do pbc in dims 0 <= dim < npbcdim */
135   gmx_bool       bRefAt;      /* do we need reference atoms for a group COM ? */
136   int        cosdim;      /* dimension for cosine weighting, -1 if none */
137   gmx_bool       bVirial;     /* do we need to add the pull virial? */
138   t_pullgrp  *grp;        /* groups to pull/restrain/etc/ */
139   t_pullgrp  *dyna;       /* dynamic groups for use with local constraints */
140   rvec       *rbuf;       /* COM calculation buffer */
141   dvec       *dbuf;       /* COM calculation buffer */
142   double     *dbuf_cyl;   /* cylinder ref. groups COM calculation buffer */
143
144   FILE       *out_x;      /* output file for pull data */
145   FILE       *out_f;      /* output file for pull data */
146 } t_pull;
147
148
149 /* Abstract types for enforced rotation only defined in pull_rotation.c       */
150 typedef struct gmx_enfrot *gmx_enfrot_t;
151 typedef struct gmx_enfrotgrp *gmx_enfrotgrp_t;
152
153 typedef struct {
154   int        eType;          /* Rotation type for this group                  */
155   int        bMassW;         /* Use mass-weighed positions?                   */
156   int        nat;            /* Number of atoms in the group                  */
157   atom_id    *ind;           /* The global atoms numbers                      */
158   rvec       *x_ref;         /* The reference positions                       */
159   rvec       vec;            /* The normalized rotation vector                */
160   real       rate;           /* Rate of rotation (degree/ps)                  */
161   real       k;              /* Force constant (kJ/(mol nm^2)                 */
162   rvec       pivot;          /* Pivot point of rotation axis (nm)             */
163   int        eFittype;       /* Type of fit to determine actual group angle   */
164   int        PotAngle_nstep; /* Number of angles around the reference angle
165                                 for which the rotation potential is also
166                                 evaluated (for fit type 'potential' only)     */
167   real       PotAngle_step;  /* Distance between two angles in degrees (for
168                                 fit type 'potential' only)                    */
169   real       slab_dist;      /* Slab distance (nm)                            */
170   real       min_gaussian;   /* Minimum value the gaussian must have so that 
171                                 the force is actually evaluated               */
172   real       eps;            /* Additive constant for radial motion2 and
173                                 flexible2 potentials (nm^2)                   */
174   gmx_enfrotgrp_t enfrotgrp; /* Stores non-inputrec rotation data per group   */
175 } t_rotgrp;
176
177 typedef struct {
178   int        ngrp;           /* Number of rotation groups                     */
179   int        nstrout;        /* Output frequency for main rotation outfile    */
180   int        nstsout;        /* Output frequency for per-slab data            */
181   t_rotgrp   *grp;           /* Groups to rotate                              */
182   gmx_enfrot_t enfrot;       /* Stores non-inputrec enforced rotation data    */
183 } t_rot;
184
185
186 typedef struct {
187   int  eI;              /* Integration method                           */
188   gmx_large_int_t nsteps;       /* number of steps to be taken                  */
189   int  simulation_part; /* Used in checkpointing to separate chunks */
190   gmx_large_int_t init_step;    /* start at a stepcount >0 (used w. tpbconv)    */
191   int  nstcalcenergy;   /* fequency of energy calc. and T/P coupl. upd. */
192   int  ns_type;         /* which ns method should we use?               */
193   int  nstlist;         /* number of steps before pairlist is generated */
194   int  ndelta;          /* number of cells per rlong                    */
195   int  nstcomm;         /* number of steps after which center of mass   */
196                         /* motion is removed                            */
197   int  comm_mode;       /* Center of mass motion removal algorithm      */
198   int nstcheckpoint;    /* checkpointing frequency                      */
199   int nstlog;           /* number of steps after which print to logfile */
200   int nstxout;          /* number of steps after which X is output      */
201   int nstvout;          /* id. for V                                    */
202   int nstfout;          /* id. for F                                    */
203   int nstenergy;        /* number of steps after which energies printed */
204   int nstxtcout;        /* id. for compressed trj (.xtc)                */
205   double init_t;        /* initial time (ps)                            */
206   double delta_t;       /* time step (ps)                               */
207   real xtcprec;         /* precision of xtc file                        */
208   int  nkx,nky,nkz;     /* number of k vectors in each spatial dimension*/
209                         /* for fourier methods for long range electrost.*/
210   int  pme_order;       /* interpolation order for PME                  */
211   real ewald_rtol;      /* Real space tolerance for Ewald, determines   */
212                         /* the real/reciprocal space relative weight    */
213   int  ewald_geometry;  /* normal/3d ewald, or pseudo-2d LR corrections */
214   real epsilon_surface; /* Epsilon for PME dipole correction            */
215   gmx_bool bOptFFT;         /* optimize the fft plan at start               */
216   int  ePBC;            /* Type of periodic boundary conditions         */
217   int  bPeriodicMols;   /* Periodic molecules                           */
218   gmx_bool bContinuation;   /* Continuation run: starting state is correct      */
219   int  etc;             /* temperature coupling                         */
220   int  nsttcouple;      /* interval in steps for temperature coupling   */
221   int  epc;             /* pressure coupling                            */
222   int  epct;            /* pressure coupling type                       */
223   int  nstpcouple;      /* interval in steps for pressure coupling      */
224   real tau_p;           /* pressure coupling time (ps)                  */
225   tensor ref_p;         /* reference pressure (kJ/(mol nm^3))           */
226   tensor compress;      /* compressability ((mol nm^3)/kJ)              */
227   int  refcoord_scaling;/* How to scale absolute reference coordinates  */
228   rvec posres_com;      /* The COM of the posres atoms                  */
229   rvec posres_comB;     /* The B-state COM of the posres atoms          */
230   int  andersen_seed;   /* Random seed for Andersen thermostat.         */
231   real rlist;           /* short range pairlist cut-off (nm)            */
232   real rlistlong;       /* long range pairlist cut-off (nm)             */
233   real rtpi;            /* Radius for test particle insertion           */
234   int  coulombtype;     /* Type of electrostatics treatment             */
235   real rcoulomb_switch; /* Coulomb switch range start (nm)              */
236   real rcoulomb;        /* Coulomb cutoff (nm)                          */
237   real epsilon_r;       /* relative dielectric constant                 */ 
238   real epsilon_rf;      /* relative dielectric constant of the RF       */ 
239   int  implicit_solvent;/* No (=explicit water), or GBSA solvent models */
240   int  gb_algorithm;    /* Algorithm to use for calculation Born radii  */
241   int  nstgbradii;      /* Frequency of updating Generalized Born radii */
242   real rgbradii;        /* Cutoff for GB radii calculation              */
243   real gb_saltconc;     /* Salt concentration (M) for GBSA models       */
244   real gb_epsilon_solvent; /* dielectric coeff. of implicit solvent     */
245   real gb_obc_alpha;    /* 1st scaling factor for Bashford-Case GB      */
246   real gb_obc_beta;     /* 2nd scaling factor for Bashford-Case GB      */
247   real gb_obc_gamma;    /* 3rd scaling factor for Bashford-Case GB      */
248   real gb_dielectric_offset; /* Dielectric offset for Still/HCT/OBC     */
249   int  sa_algorithm;    /* Algorithm for SA part of GBSA                */
250   real sa_surface_tension; /* Energy factor for SA part of GBSA */
251   int  vdwtype;         /* Type of Van der Waals treatment              */
252   real rvdw_switch;     /* Van der Waals switch range start (nm)        */
253   real rvdw;                /* Van der Waals cutoff (nm)                */
254   int  eDispCorr;       /* Perform Long range dispersion corrections    */
255   real tabext;          /* Extension of the table beyond the cut-off,   *
256                          * as well as the table length for 1-4 interac. */
257   real shake_tol;       /* tolerance for shake                          */
258   int  efep;            /* free energy interpolation no/yes             */
259   double init_lambda;   /* initial value for perturbation variable      */
260   double delta_lambda;  /* change of lambda per time step (1/dt)        */
261   int  n_flambda;       /* The number of foreign lambda points          */
262   double *flambda;      /* The foreign lambda values                    */
263   real sc_alpha;        /* free energy soft-core parameter              */
264   int  sc_power;        /* lambda power for soft-core interactions      */
265   real sc_sigma;        /* free energy soft-core sigma when c6 or c12=0 */
266   real sc_sigma_min;    /* minimum FE sc sigma (default: =sg_sigma)     */
267   int  nstdhdl;         /* The frequency for writing to dhdl.xvg        */
268   int  separate_dhdl_file; /* whether to write a separate dhdl.xvg file 
269                               note: NOT a gmx_bool, but an enum */
270   int  dhdl_derivatives;/* whether to calculate+write dhdl derivatives 
271                               note: NOT a gmx_bool, but an enum */
272   int  dh_hist_size;    /* The maximum size for the dH histogram        */
273   double dh_hist_spacing; /* The spacing for the dH histogram           */
274   int  eDisre;          /* Type of distance restraining                 */
275   real dr_fc;               /* force constant for ta_disre                      */
276   int  eDisreWeighting; /* type of weighting of pairs in one restraints */
277   gmx_bool bDisreMixed;     /* Use comb of time averaged and instan. viol's     */
278   int  nstdisreout;     /* frequency of writing pair distances to enx   */ 
279   real dr_tau;              /* time constant for memory function in disres      */
280   real orires_fc;           /* force constant for orientational restraints  */
281   real orires_tau;          /* time constant for memory function in orires      */
282   int  nstorireout;     /* frequency of writing tr(SD) to enx           */ 
283   real dihre_fc;        /* force constant for dihedral restraints       */
284   real em_stepsize;         /* The stepsize for updating                        */
285   real em_tol;              /* The tolerance                            */
286   int  niter;           /* Number of iterations for convergence of      */
287                         /* steepest descent in relax_shells             */
288   real fc_stepsize;     /* Stepsize for directional minimization        */
289                         /* in relax_shells                              */
290   int  nstcgsteep;      /* number of steps after which a steepest       */
291                         /* descents step is done while doing cg         */
292   int  nbfgscorr;       /* Number of corrections to the hessian to keep */
293   int  eConstrAlg;      /* Type of constraint algorithm                 */
294   int  nProjOrder;      /* Order of the LINCS Projection Algorithm      */
295   real LincsWarnAngle;  /* If bond rotates more than %g degrees, warn   */
296   int  nLincsIter;      /* Number of iterations in the final Lincs step */
297   gmx_bool bShakeSOR;       /* Use successive overrelaxation for shake      */
298   real bd_fric;         /* Friction coefficient for BD (amu/ps)         */
299   int  ld_seed;         /* Random seed for SD and BD                    */
300   int  nwall;           /* The number of walls                          */
301   int  wall_type;       /* The type of walls                            */
302   real wall_r_linpot;   /* The potentail is linear for r<=wall_r_linpot */
303   int  wall_atomtype[2];/* The atom type for walls                      */
304   real wall_density[2]; /* Number density for walls                     */
305   real wall_ewald_zfac; /* Scaling factor for the box for Ewald         */
306   int  ePull;           /* Type of pulling: no, umbrella or constraint  */
307   t_pull *pull;         /* The data for center of mass pulling          */
308   gmx_bool bRot;        /* Calculate enforced rotation potential(s)?    */
309   t_rot *rot;           /* The data for enforced rotation potentials    */
310   real cos_accel;       /* Acceleration for viscosity calculation       */
311   tensor deform;        /* Triclinic deformation velocities (nm/ps)     */
312   int  userint1;        /* User determined parameters                   */
313   int  userint2;
314   int  userint3;
315   int  userint4;
316   real userreal1;
317   real userreal2;
318   real userreal3;
319   real userreal4;
320   t_grpopts opts;       /* Group options                                */
321   t_cosines ex[DIM];    /* Electric field stuff (spatial part)          */
322   t_cosines et[DIM];    /* Electric field stuff (time part)             */
323   gmx_bool bQMMM;           /* QM/MM calculation                            */ 
324   int  QMconstraints;   /* constraints on QM bonds                      */
325   int  QMMMscheme;      /* Scheme: ONIOM or normal                      */
326   real scalefactor;     /* factor for scaling the MM charges in QM calc.*/
327 } t_inputrec;
328
329 #define DEFORM(ir) ((ir).deform[XX][XX]!=0 || (ir).deform[YY][YY]!=0 || (ir).deform[ZZ][ZZ]!=0 || (ir).deform[YY][XX]!=0 || (ir).deform[ZZ][XX]!=0 || (ir).deform[ZZ][YY]!=0)
330
331 #define DYNAMIC_BOX(ir) ((ir).epc!=epcNO || (ir).eI==eiTPI || DEFORM(ir))
332
333 #define PRESERVE_SHAPE(ir) ((ir).epc != epcNO && (ir).deform[XX][XX] == 0 && ((ir).epct == epctISOTROPIC || (ir).epct == epctSEMIISOTROPIC))
334
335 #define NEED_MUTOT(ir) (((ir).coulombtype==eelEWALD || EEL_PME((ir).coulombtype)) && ((ir).ewald_geometry==eewg3DC || (ir).epsilon_surface!=0))
336
337 #define IR_TWINRANGE(ir) ((ir).rlist > 0 && ((ir).rlistlong == 0 || (ir).rlistlong > (ir).rlist))
338
339 #define IR_ELEC_FIELD(ir) ((ir).ex[XX].n > 0 || (ir).ex[YY].n > 0 || (ir).ex[ZZ].n > 0)
340
341 #define IR_EXCL_FORCES(ir) (EEL_FULL((ir).coulombtype) || (EEL_RF((ir).coulombtype) && (ir).coulombtype != eelRF_NEC) || (ir).implicit_solvent != eisNO)
342 /* use pointer definitions of ir here, since that's what's usually used in the code */
343 #define IR_NVT_TROTTER(ir) ((((ir)->eI == eiVV) || ((ir)->eI == eiVVAK)) && ((ir)->etc == etcNOSEHOOVER))
344
345 #define IR_NPT_TROTTER(ir) ((((ir)->eI == eiVV) || ((ir)->eI == eiVVAK)) && ((ir)->epc == epcMTTK))
346
347 #ifdef __cplusplus
348 }
349 #endif
350
351
352 #endif