Fixed a bug in the pdb-writing code.
[gromacs.git] / include / pull.h
blobb0ff4bbedb57fb928c084102ff1ccf796eb28955
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 3.1
11 * Copyright (c) 1991-2001, University of Groningen, The Netherlands
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * If you want to redistribute modifications, please consider that
18 * scientific software is very special. Version control is crucial -
19 * bugs must be traceable. We will be happy to consider code for
20 * inclusion in the official distribution, but derived work must not
21 * be called official GROMACS. Details are found in the README & COPYING
22 * files - if they are missing, get the official version at www.gromacs.org.
24 * To help us fund GROMACS development, we humbly ask that you cite
25 * the papers on the package - you can find them in the top README file.
27 * For more info, check our website at http://www.gromacs.org
29 * And Hey:
30 * Getting the Right Output Means no Artefacts in Calculating Stuff
33 #ifndef _pull_h
34 #define _pull_h
36 static char *SRCID_pull_h = "$Id$";
37 #ifdef HAVE_CONFIG_H
38 #include <config.h>
39 #endif
41 #include "vec.h"
42 #include "typedefs.h"
44 /* This file contains datatypes and function declarations necessary
45 for mdrun to interface with the pull code */
47 typedef enum {eStart, eAfm, eConstraint, eUmbrella, eTest} t_runtype;
48 typedef enum {eCom, eComT0, eDyn, eDynT0} t_reftype;
50 typedef struct {
51 int n; /* number of groups */
52 atom_id **idx; /* indices of pull atoms in full coordinate array */
53 real **weights; /* position depended weight (switch function) */
54 int *ngx; /* pull group sizes */
55 char **grps; /* pull group names */
56 real *tmass; /* total mass of the groups */
57 rvec **x0; /* pull group coordinates at t=0 */
58 rvec **xp; /* pull group coordinates at previous step */
59 rvec *x_ref; /* reference positions */
60 rvec *x_unc; /* center of mass before constraining */
61 rvec *x_con; /* center of mass, obeying constraints */
62 rvec *xprev; /* position of coms in last written structure */
63 rvec *f; /* forces due to the pulling/constraining */
64 rvec *spring; /* coordinates of the springs (eAfm) */
65 rvec *dir; /* direction of constraint */
66 real *d_ref; /* reference distance */
67 rvec *xtarget; /* target coordinates for structure generation */
68 rvec **comhist; /* com over the last nhist steps (for running aver) */
69 } t_pullgrps;
71 typedef struct {
72 t_pullgrps dyna; /* dynamic groups for use with local constraints */
73 t_pullgrps pull; /* groups to pull/restrain/etc/ */
74 t_pullgrps ref; /* reference group, reaction force grps */
75 t_runtype runtype; /* start, afm, constraint, umbrella, test */
76 t_reftype reftype; /* com, com_t0, dynamic, dynamic_t0 */
77 rvec dims; /* used to select components for constraint */
78 rvec coor; /* reaction coordinate */
79 real r; /* radius of cylinder for dynamic COM */
80 real rc; /* radius of cylinder including switch length */
81 real xlt_rate; /* rate of translation, for startstructure run */
82 real xlt_incr; /* write out structure every xlt_incr nm */
83 real tolerance; /* tolerance for reaching desired coordinates (nm) */
84 real constr_tol;/* absolute tolerance for constraints in (nm) */
85 bool bPull; /* true if we're doing any pulling */
86 bool bCyl; /* true if we're using dynamic ref. groups */
87 bool bReverse; /* reverse reference direction */
88 FILE *out; /* output file for pull data */
89 real k; /* force constant for atoms */
90 real rate; /* pull rate, in nm/timestep */
91 int update; /* update frequency for dynamic grps */
92 int reflag; /* running average over reflag steps for com */
93 bool bVerbose; /* be loud and noise */
94 rvec UmbPos[4]; /* center of umbrella potentials */
95 real UmbCons[4];/* force constant of umbrella potential */
96 int nSkip; /* only write output every nSkip steps */
97 bool bCompress; /* compress output */
98 } t_pull;
100 /* main pull routine that controls all the action */
101 extern void pull(t_pull *pull, /* all pull data */
102 rvec *x, /* coordinates, changed by constraint run */
103 rvec *f, /* forces, changed by Afm run */
104 matrix box,
105 t_topology *top, /* needed to write out coordinate files */
106 real dt, /* time step */
107 int step, /* step number in simulation */
108 int natoms, /* total number of atoms on this processor */
109 t_mdatoms *md, /* masses and charges of all atoms */
110 int start, /* number of first atom belonging to this node */
111 int homenr /* number of atoms that belong to this node */
115 /* get memory and initialize the fields of pull that still need it, and
116 do runtype specific initialization */
117 extern void init_pull(FILE *log,
118 int nfile,
119 t_filenm fnm[], /* standard filename struct */
120 t_pull *pull, /* all pull data */
121 rvec *x, /* all coordinates */
122 t_mdatoms *md, /* masses and charges of all atoms */
123 matrix box);
125 #endif