4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
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
27 * Good ROcking Metal Altar for Chronical Sinners
33 static char *SRCID_mdrun_h = "$Id$";
40 #ident "@(#) do_md.h 1.12 03 Mar 1996"
41 #endif /* HAVE_IDENT */
64 /* ROUTINES from md.c */
65 extern time_t do_md(FILE *log,t_commrec *cr,int nfile,t_filenm fnm[],
66 bool bVerbose,bool bCompact,bool bDummies,
67 t_comm_dummies *dummycomm,int stepout,
68 t_parm *parm,t_groups *grps,
69 t_topology *top,real ener[],
70 rvec x[],rvec vold[],rvec v[],rvec vt[],rvec f[],
71 rvec buf[],t_mdatoms *mdatoms,
72 t_nsborder *nsb,t_nrnb nrnb[],
73 t_graph *graph,t_edsamyn *edyn,
74 t_forcerec *fr,rvec box_size,
77 /* ROUTINES from nm.c */
78 extern time_t do_nm(FILE *log,t_commrec *cr,int nfile,t_filenm fnm[],
79 bool bVerbose,bool bCompact,int stepout,
80 t_parm *parm,t_groups *grps,
81 t_topology *top,real ener[],
82 rvec x[],rvec vold[],rvec v[],rvec vt[],rvec f[],
83 rvec buf[],t_mdatoms *mdatoms,
84 t_nsborder *nsb,t_nrnb nrnb[],
85 t_graph *graph,t_edsamyn *edyn,
86 t_forcerec *fr,rvec box_size);
88 /* ROUTINES from steep.c */
89 extern real f_norm(int left,int right,int nprocs,
90 int start,int end,rvec grad[]);
91 /* Calculates norm of force */
93 extern real f_max(int left,int right,int nprocs,
94 int start,int end,rvec grad[]);
95 /* Calculates max force */
97 extern time_t do_steep(FILE *log,int nfile,t_filenm fnm[],
98 t_parm *parm,t_topology *top,
99 t_groups *grps,t_nsborder *nsb,
100 rvec x[],rvec grad[],rvec buf[],t_mdatoms *mdatoms,
101 tensor ekin,real ener[],t_nrnb nrnb[],
102 bool bVerbose,bool bDummies,t_comm_dummies *dummycomm,t_commrec *cr,
103 t_graph *graph,t_forcerec *fr,rvec box_size);
104 /* Do steepest descents EM or something like that! */
106 /* ROUTINES from congrad.c */
107 extern time_t do_cg(FILE *log,int nfile,t_filenm fnm[],
108 t_parm *parm,t_topology *top,
109 t_groups *grps,t_nsborder *nsb,
110 rvec x[],rvec grad[],rvec buf[],t_mdatoms *mdatoms,
111 tensor ekin,real ener[],t_nrnb nrnb[],
112 bool bVerbose,bool bDummies,t_comm_dummies *dummycomm,
113 t_commrec *cr,t_graph *graph,t_forcerec *fr,
115 /* Do conjugate gradients EM! */
117 /* ROUTINES from runner.c */
118 extern bool optRerunMDset (int nfile, t_filenm fnm[]);
120 extern void mdrunner(t_commrec *cr,int nfile,t_filenm fnm[],bool bVerbose,
121 bool bCompact,int nDlb,bool bNM,int nstepout,
122 t_edsamyn *edyn,unsigned long Flags);
124 /* Initialization routines to make maintainance easier */
125 extern void init_md(t_commrec *cr,t_inputrec *ir,tensor box,
126 real *t,real *t0,real *lambda,real *lam0,
127 real *SAfactor,t_nrnb *mynrnb,bool *bTYZ,t_topology *top,
128 int nfile,t_filenm fnm[],char **traj,char **xtc_traj,
129 int *fp_ene,FILE **fp_dgdl,
130 t_mdebin **mdebin,t_groups *grps,
131 tensor force_vir,tensor pme_vir,
132 tensor shake_vir,t_mdatoms *mdatoms,
133 rvec mu_tot,bool *bNEMD,t_vcm **vcm,
136 extern void do_pbc_first(FILE *log,t_parm *parm,rvec box_size,t_forcerec *fr,
137 t_graph *graph,rvec x[]);
139 extern void get_cmparm(t_inputrec *ir,int step,bool *bStopCM,bool *bStopRot);
140 /* Initiate center of mass removal parameters */
142 void set_pot_bools(t_inputrec *ir,t_topology *top,
143 bool *bLR,bool *bLJLR,bool *bBHAM,bool *b14);
144 /* Initiate some bools for the potential energy calculation */
146 /* ROUTINES from stat.c */
147 extern void global_stat(FILE *log,
148 t_commrec *cr,real ener[],
149 tensor fvir,tensor svir,
150 t_grpopts *opts,t_groups *grps,
151 t_nrnb *mynrnb,t_nrnb nrnb[],
152 t_vcm *vcm,real *terminate);
153 /* Communicate statistics around the ring */
155 extern int write_traj(FILE *log,t_commrec *cr,char *traj,t_nsborder *nsb,
156 int step,real t,real lambda,t_nrnb nr_nb[],
157 int natoms,rvec *xx,rvec *vv,rvec *ff,matrix box);
158 /* Routine to output statusfiles during a run, as specified in
159 * in parm->ir. If any of the pointers xx,vv,ff or ener is not NULL
160 * it is written to the trajectory file.
161 * Also write the energies etc. to the log file.
162 * Returns the file handle (to be closed with close_trn).
165 extern int do_per_step(int step,int nstep);
166 /* Return TRUE if io should be done */
168 extern int do_any_io(int step, t_inputrec *ir);
170 extern void write_xtc_traj(FILE *log,t_commrec *cr,
171 char *xtc_traj,t_nsborder *nsb,t_mdatoms *md,
172 int step,real t,rvec *xx,
173 matrix box,real prec);
175 extern void close_xtc_traj(void);
177 /* ROUTINES from sim_util.c */
178 extern void init_mdatoms(t_mdatoms *md,real lambda,bool bFirst);
179 /* Compute fields from mdatoms struct (invmass etc.) which may change
180 * due to lambda dependent FEP calculations.
181 * If bFirst all values are set, this is necessary once in the
185 extern void print_time(FILE *out,time_t start,int step,t_inputrec *ir);
187 extern time_t print_date_and_time(FILE *log,int pid,char *title);
189 extern void do_force(FILE *log,t_commrec *cr,
190 t_parm *parm,t_nsborder *nsb,
191 tensor vir_part,tensor pme_vir,
192 int step,t_nrnb *nrnb,t_topology *top,t_groups *grps,
193 rvec x[],rvec v[],rvec f[],rvec buf[],
194 t_mdatoms *mdatoms,real ener[],bool bVerbose,
195 real lambda,t_graph *graph,
196 bool bNS,bool bNBFonly,t_forcerec *fr, rvec mu_tot,
198 extern void sum_lrforces(rvec f[],t_forcerec *fr,int start,int homenr);
200 extern void calc_virial(FILE *log,int start,int homenr,rvec x[],rvec f[],
201 tensor vir_part,tensor pme_vir,
202 t_commrec *cr,t_graph *graph,matrix box,
203 t_nrnb *nrnb,t_forcerec *fr,bool bTweak);
205 extern void nstop_cm(FILE *log,t_commrec *cr,
206 int start,int nr_atoms,real mass[],rvec x[],rvec v[]);
208 /* STUFF from init.c */
209 extern void write_parm(FILE *log,char *title,int pid,t_parm *parm);
210 /* Write parm for debugging */
223 extern void init_single(FILE *log,
224 t_parm *parm, char *tpbfile, t_topology *top,
225 rvec **x,rvec **v,t_mdatoms **mdatoms,
228 * Allocates space for the topology (top), the coordinates x, the
229 * velocities v, masses mass. Reads the parameters, topology,
230 * coordinates and velocities from the file specified in tpbfile
233 extern void distribute_parts(int left,int right,int pid,int nprocs,
234 t_parm *parm,char *tpbfile,int nstDlb);
236 * Reads the parameters, topology, coordinates and velocities for the
237 * multi processor version of the program from the file specified in
238 * parm->files[STATUS_NM]. This file should also contain a so called
239 * split descriptor which describes how to distribute particles over
240 * the system. It then selects for all subsystems the appropriate data
241 * and sends this to the processor using the left and right channels.
242 * At last it sends its own subsystem down the ring where it is buffered.
243 * Its own buffers for reading the data from the file are freed, and it
244 * is now possible to reload this processor from the ring by using the
245 * init_parts() routine.
246 * The routine also creates a renum array which can be used for writing
247 * out the x,v and f for analysis purpose.
250 extern void init_parts(FILE *log,t_commrec *cr,
251 t_parm *parm,t_topology *top,
252 rvec **x,rvec **v,t_mdatoms **mdatoms,
253 t_nsborder *nsb,int list,
254 bool *bParallelDummies,
255 t_comm_dummies *dummycomm);
257 * Loads the data for a simulation from the ring. Parameters, topology
258 * coordinates, velocities, and masses are initialised equal to using
259 * init_single() in the single processor version. The extra argument
260 * f_add is allocated to use for the update of the forces, the load
261 * array specifies in which part of the x and f array the subsystems
262 * of the other processors are located. Homenr0, homenr1, nparts0 and
263 * nparts1 are necessary to calculate the non bonded interaction using
264 * the symmetry and thus calculating every force only once. List is a facility
265 * for logging (and debugging). One can decide to print none or a set of
266 * selected parameters to the file specified by log. Parameters are
267 * printed by or-ing the corresponding items from t_listitem. A 0 (zero)
268 * specifies that nothing is to be printed on the file. The function
269 * returns the number of shifts over the ring to perform to calculate
273 extern void start_time(void);
274 /* Start timing routines */
276 extern void update_time(void);
277 /* Update the timer.This must be done at least every INT_MAX microseconds,
278 * or 2400 s, in order to give reliable answers.
281 extern double node_time(void);
282 /* Return the node time so far in seconds. */
284 extern void do_shakefirst(FILE *log,bool bTYZ,real lambda,real ener[],
285 t_parm *parm,t_nsborder *nsb,t_mdatoms *md,
286 rvec x[],rvec vold[],rvec buf[],rvec f[],
287 rvec v[],t_graph *graph,t_commrec *cr,t_nrnb *nrnb,
288 t_groups *grps,t_forcerec *fr,t_topology *top,
289 t_edsamyn *edyn,t_pull *pulldata);
291 extern void get_cmparm(t_inputrec *ir,int step,bool *bStopCM,bool *bStopRot);
292 /* Determine from the input whether or not to stop center of mass motion */
294 extern void dynamic_load_balancing(bool bVerbose,t_commrec *cr,real capacity[],
295 int dimension,t_mdatoms *md,t_topology *top,
296 rvec x[],rvec v[],matrix box);
297 /* Perform load balancing, i.e. split the particles over processors
298 * based on their coordinates in the "dimension" direction.
301 #endif /* _mdrun_h */