9c65c27ba0a78d9e2dd3d33b4943c6238bc6ecca
[alexxy/gromacs.git] / include / pull.h
1 /*
2  * $Id$
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 2.0
11  * 
12  * Copyright (c) 1991-1999
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * Please refer to:
17  * GROMACS: A message-passing parallel molecular dynamics implementation
18  * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19  * Comp. Phys. Comm. 91, 43-56 (1995)
20  * 
21  * Also check out our WWW page:
22  * http://md.chem.rug.nl/~gmx
23  * or e-mail to:
24  * gromacs@chem.rug.nl
25  * 
26  * And Hey:
27  * Good ROcking Metal Altar for Chronical Sinners
28  */
29
30
31 #ifndef _pull_h
32 #define _pull_h
33
34 static char *SRCID_pull_h = "$Id$";
35
36 #ifdef HAVE_CONFIG_H
37 #include <config.h>
38 #endif
39
40 #include "vec.h"
41 #include "typedefs.h"
42
43 #define NINT(x) (x<0?((int)((x)-0.5)):((int)((x)+0.5)))
44 #define DEBUG_START fprintf(stderr,"\n\nDEBUG\n");
45 #define DEBUG_END   fprintf(stderr,"\nEND DEBUG\n\n");
46
47 /* print to output file for the various types of runs */
48 extern void print_umbrella(t_pull *pull, int step);
49 extern void print_afm(t_pull *pull, int step);
50 extern void print_constraint(t_pull *pull,rvec *force,int step,matrix box,
51                              int niter);
52 extern void print_start(t_pull *pull, int step);
53
54
55 /* calculate center of mass of index group, making sure it's inside the box.
56    function returns total mass.  
57 */
58 extern real calc_com(rvec x[],       /* coordinates of all atoms in system */ 
59                      int gnx,        /* size of index group */
60                      atom_id *index, /* indices of atoms to be used for com */
61                      t_mdatoms *md,  /* all atoms */
62                      rvec com,       /* calculated center of mass */
63                      matrix box);    
64
65
66 /* calculate center of mass of all atoms x[], index needed to get the right
67    masses from the atom array. function returns total mass.*/
68 extern real calc_com2(rvec x[],       /* coordinates to calc. com from */
69                       int gnx,        /* nr. of atom in group  */
70                       atom_id *index, /* indices of x[] in all atoms */
71                       t_mdatoms *md,  /* all atoms */
72                       rvec com,       /* calculated center of mass */
73                       matrix box); 
74
75
76 /* calculate a running average for center of mass */
77 extern void calc_running_com(t_pull *pull);
78
79
80 /* calculate the center of mass from the true coordinates, without
81    corrections for pbc */
82 extern void correct_t0_pbc(t_pull *pull, 
83                            rvec x[], 
84                            t_mdatoms *md,
85                            matrix box);
86
87
88 /* parse a string for 3 numbers and put them in rvec */
89 extern void string2rvec(char *buf,
90                         rvec x);
91
92 /* read the parameter file .ppa and write out what was read in */
93 extern void read_pullparams(t_pull *pull,
94                             char *infile,
95                             char *outfile); 
96
97 /* find all atoms in group pull->idx[pull->n] that are inside a cylinder
98    with as origin com[i][x],com[i][y] with radius pull->r and possibly
99    a switch function pull->rc. Remember their weight. Now each group i
100    has its own reference group (HOW?) with com defined as 
101    Sum(wi*mi*ri)/(Sum(wi*mi). Basically, build an index structure with
102    the reference groups for the groups i, plus an array with the 
103    weight factors for each of the atoms in those index groups? 
104    */
105 extern void make_refgrps(t_pull *pull,
106                          matrix box,
107                          t_mdatoms *md);
108
109
110 /* write a numbered .gro file in procedure to make starting structures */
111 extern void dump_conf(t_pull *pull,
112                       rvec x[],        /* all coordinates */
113                       matrix box,      /* box */
114                       t_topology *top, /* names and residue info */
115                       int nout,        /* sequence number of this file */
116                       real time);      /* time in simulation */
117
118
119 /* main pull routine that controls all the action */
120 extern void pull(t_pull *pull,    /* all pull data */
121                  rvec *x,         /* coordinates, changed by constraint run */ 
122                  rvec *f,         /* forces, changed by Afm run */
123                  matrix box,               
124                  t_topology *top, /* needed to write out coordinate files */   
125                  real dt,         /* time step */
126                  int step,        /* step number in simulation */
127                  int natoms,      /* total number of atoms on this processor */
128                  t_mdatoms *md);  /* masses and charges of all atoms */
129
130
131 /* get memory and initialize the fields of pull that still need it, and
132    do runtype specific initialization */
133 extern void init_pull(FILE *log,  
134                       int nfile,       
135                       t_filenm fnm[], /* standard filename struct */
136                       t_pull *pull,   /* all pull data */
137                       rvec *x,        /* all coordinates */
138                       t_mdatoms *md,  /* masses and charges of all atoms */
139                       matrix box);
140
141 #endif