changed reading hint
[gromacs/adressmacs.git] / include / mdrun.h
blobb48127ff13d7b5f8f139fff331700b416a08959f
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
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
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)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
23 * or e-mail to:
24 * gromacs@chem.rug.nl
26 * And Hey:
27 * Good ROcking Metal Altar for Chronical Sinners
30 #ifndef _mdrun_h
31 #define _mdrun_h
33 static char *SRCID_mdrun_h = "$Id$";
35 #ifdef HAVE_IDENT
36 #ident "@(#) do_md.h 1.12 03 Mar 1996"
37 #endif /* HAVE_IDENT */
38 #include <stdio.h>
39 #include "typedefs.h"
40 #include "network.h"
41 #include "tgroup.h"
42 #include "filenm.h"
43 #include "nsb.h"
44 #include "mshift.h"
45 #include "force.h"
46 #include "time.h"
47 #include "edsam.h"
48 #include "mdebin.h"
50 /* ROUTINES from md.c */
51 extern time_t do_md(FILE *log,t_commrec *cr,int nfile,t_filenm fnm[],
52 bool bVerbose,bool bCompact,bool bDummies,int stepout,
53 t_parm *parm,t_groups *grps,
54 t_topology *top,real ener[],
55 rvec x[],rvec vold[],rvec v[],rvec vt[],rvec f[],
56 rvec buf[],t_mdatoms *mdatoms,
57 t_nsborder *nsb,t_nrnb nrnb[],
58 t_graph *graph,t_edsamyn *edyn,
59 t_forcerec *fr,rvec box_size);
61 /* ROUTINES from nm.c */
62 extern time_t do_nm(FILE *log,t_commrec *cr,int nfile,t_filenm fnm[],
63 bool bVerbose,bool bCompact,int stepout,
64 t_parm *parm,t_groups *grps,
65 t_topology *top,real ener[],
66 rvec x[],rvec vold[],rvec v[],rvec vt[],rvec f[],
67 rvec buf[],t_mdatoms *mdatoms,
68 t_nsborder *nsb,t_nrnb nrnb[],
69 t_graph *graph,t_edsamyn *edyn,
70 t_forcerec *fr,rvec box_size);
72 /* ROUTINES from steep.c */
73 extern real f_norm(int left,int right,int nprocs,
74 int start,int end,rvec grad[]);
75 /* Calculates norm of force */
77 extern real f_max(int left,int right,int nprocs,
78 int start,int end,rvec grad[]);
79 /* Calculates max force */
81 extern time_t do_steep(FILE *log,int nfile,t_filenm fnm[],
82 t_parm *parm,t_topology *top,
83 t_groups *grps,t_nsborder *nsb,
84 rvec x[],rvec grad[],rvec buf[],t_mdatoms *mdatoms,
85 tensor ekin,real ener[],t_nrnb nrnb[],
86 bool bVerbose,bool bDummies,t_commrec *cr,
87 t_graph *graph,t_forcerec *fr,rvec box_size);
88 /* Do steepest descents EM or something like that! */
90 /* ROUTINES from congrad.c */
91 extern time_t do_cg(FILE *log,int nfile,t_filenm fnm[],
92 t_parm *parm,t_topology *top,
93 t_groups *grps,t_nsborder *nsb,
94 rvec x[],rvec grad[],rvec buf[],t_mdatoms *mdatoms,
95 tensor ekin,real ener[],t_nrnb nrnb[],
96 bool bVerbose,bool bDummies,
97 t_commrec *cr,t_graph *graph,t_forcerec *fr,
98 rvec box_size);
99 /* Do conjugate gradients EM! */
101 /* ROUTINES from runner.c */
102 extern bool optRerunMDset (int nfile, t_filenm fnm[]);
104 extern void mdrunner(t_commrec *cr,int nfile,t_filenm fnm[],bool bVerbose,
105 bool bCompact,int nDlb,bool bNM,int nstepout,
106 t_edsamyn *edyn);
108 /* Initialization routines to make maintainance easier */
109 extern void init_md(t_commrec *cr,
110 t_inputrec *ir,real *t,real *t0,real *lambda,real *lam0,
111 real *SAfactor,t_nrnb *mynrnb,bool *bTYZ,t_topology *top,
112 int nfile,t_filenm fnm[],char **traj,char **xtc_traj,
113 int *fp_ene,FILE **fp_dgdl,
114 t_mdebin **mdebin,t_groups *grps,rvec vcm,tensor force_vir,
115 tensor shake_vir,t_mdatoms *mdatoms);
117 extern void do_pbc_first(FILE *log,t_parm *parm,rvec box_size,t_forcerec *fr,
118 t_graph *graph,rvec x[]);
120 extern void get_cmparm(t_inputrec *ir,int step,bool *bStopCM,bool *bStopRot);
121 /* Initiate center of mass removal parameters */
123 void set_pot_bools(t_inputrec *ir,t_topology *top,
124 bool *bLR,bool *bLJLR,bool *bBHAM,bool *b14);
125 /* Initiate some bools for the potential energy calculation */
127 /* ROUTINES from stat.c */
128 extern void global_stat(FILE *log,
129 t_commrec *cr,real ener[],
130 tensor fvir,tensor svir,
131 t_grpopts *opts,t_groups *grps,
132 t_nrnb *mynrnb,t_nrnb nrnb[],
133 rvec vcm,rvec mu_tot,real *terminate);
134 /* Communicate statistics around the ring */
136 extern int write_traj(FILE *log,t_commrec *cr,char *traj,t_nsborder *nsb,
137 int step,real t,real lambda,t_nrnb nr_nb[],
138 int natoms,rvec *xx,rvec *vv,rvec *ff,matrix box);
139 /* Routine to output statusfiles during a run, as specified in
140 * in parm->ir. If any of the pointers xx,vv,ff or ener is not NULL
141 * it is written to the trajectory file.
142 * Also write the energies etc. to the log file.
143 * Returns the file handle (to be closed with close_trn).
146 extern int do_per_step(int step,int nstep);
147 /* Return TRUE if io should be done */
149 extern int do_any_io(int step, t_inputrec *ir);
151 extern void write_xtc_traj(FILE *log,t_commrec *cr,
152 char *xtc_traj,t_nsborder *nsb,t_mdatoms *md,
153 int step,real t,rvec *xx,
154 matrix box,real prec);
156 extern void close_xtc_traj(void);
158 /* ROUTINES from sim_util.c */
159 extern void init_mdatoms(t_mdatoms *md,real lambda,bool bFirst);
160 /* Compute fields from mdatoms struct (invmass etc.) which may change
161 * due to lambda dependent FEP calculations.
162 * If bFirst all values are set, this is necessary once in the
163 * first step.
166 extern void print_time(FILE *out,time_t start,int step,t_inputrec *ir);
168 extern time_t print_date_and_time(FILE *log,int pid,char *title);
170 extern void do_force(FILE *log,t_commrec *cr,
171 t_parm *parm,t_nsborder *nsb,tensor vir_part,
172 int step,t_nrnb *nrnb,t_topology *top,t_groups *grps,
173 rvec x[],rvec v[],rvec f[],rvec buf[],
174 t_mdatoms *mdatoms,real ener[],bool bVerbose,
175 real lambda,t_graph *graph,
176 bool bNS,bool bNBFonly,t_forcerec *fr);
178 extern void nstop_cm(FILE *log,t_commrec *cr,
179 int start,int nr_atoms,real mass[],rvec x[],rvec v[]);
181 /* STUFF from init.c */
182 extern void write_parm(FILE *log,char *title,int pid,t_parm *parm);
183 /* Write parm for debugging */
185 typedef enum
187 LIST_SCALARS =0001,
188 LIST_PARM =0002,
189 LIST_TOP =0004,
190 LIST_X =0010,
191 LIST_V =0020,
192 LIST_F =0040,
193 LIST_LOAD =0100
194 } t_listitem;
196 extern void init_single(FILE *log,
197 t_parm *parm, char *tpbfile, t_topology *top,
198 rvec **x,rvec **v,t_mdatoms **mdatoms,
199 t_nsborder *nsb);
201 * Allocates space for the topology (top), the coordinates x, the
202 * velocities v, masses mass. Reads the parameters, topology,
203 * coordinates and velocities from the file specified in tpbfile
206 extern void distribute_parts(int left,int right,int pid,int nprocs,
207 t_parm *parm,char *tpbfile,int nstDlb);
209 * Reads the parameters, topology, coordinates and velocities for the
210 * multi processor version of the program from the file specified in
211 * parm->files[STATUS_NM]. This file should also contain a so called
212 * split descriptor which describes how to distribute particles over
213 * the system. It then selects for all subsystems the appropriate data
214 * and sends this to the processor using the left and right channels.
215 * At last it sends its own subsystem down the ring where it is buffered.
216 * Its own buffers for reading the data from the file are freed, and it
217 * is now possible to reload this processor from the ring by using the
218 * init_parts() routine.
219 * The routine also creates a renum array which can be used for writing
220 * out the x,v and f for analysis purpose.
223 extern void init_parts(FILE *log,t_commrec *cr,
224 t_parm *parm,t_topology *top,
225 rvec **x,rvec **v,t_mdatoms **mdatoms,
226 t_nsborder *nsb,int list);
228 * Loads the data for a simulation from the ring. Parameters, topology
229 * coordinates, velocities, and masses are initialised equal to using
230 * init_single() in the single processor version. The extra argument
231 * f_add is allocated to use for the update of the forces, the load
232 * array specifies in which part of the x and f array the subsystems
233 * of the other processors are located. Homenr0, homenr1, nparts0 and
234 * nparts1 are necessary to calculate the non bonded interaction using
235 * the symmetry and thus calculating every force only once. List is a facility
236 * for logging (and debugging). One can decide to print none or a set of
237 * selected parameters to the file specified by log. Parameters are
238 * printed by or-ing the corresponding items from t_listitem. A 0 (zero)
239 * specifies that nothing is to be printed on the file. The function
240 * returns the number of shifts over the ring to perform to calculate
241 * all interactions.
244 extern void start_time(void);
245 /* Start timing routines */
247 extern void update_time(void);
248 /* Update the timer.This must be done at least every INT_MAX microseconds,
249 * or 2400 s, in order to give reliable answers.
252 extern double cpu_time(void);
253 /* Return the cpu time so far in seconds. */
255 extern void do_shakefirst(FILE *log,bool bTYZ,real lambda,real ener[],
256 t_parm *parm,t_nsborder *nsb,t_mdatoms *md,
257 rvec x[],rvec vold[],rvec buf[],rvec f[],
258 rvec v[],t_graph *graph,t_commrec *cr,t_nrnb *nrnb,
259 t_groups *grps,t_forcerec *fr,t_topology *top,
260 t_edsamyn *edyn,t_pull *pulldata);
262 extern void get_cmparm(t_inputrec *ir,int step,bool *bStopCM,bool *bStopRot);
263 /* Determine from the input whether or not to stop center of mass motion */
265 #endif /* _mdrun_h */