3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
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.
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.
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.
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.
30 * For more info, check our website at http://www.gromacs.org
33 * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
44 #include "gmx_wallcycle.h"
49 do_trajectory_writing(FILE *fplog,
54 gmx_large_int_t step_rel,
58 t_state *state_global,
59 gmx_mtop_t *top_global,
64 gmx_ekindata_t *ekind,
67 gmx_wallcycle_t wcycle,
82 if (do_per_step(step, ir->nstxout))
86 if (do_per_step(step, ir->nstvout))
90 if (do_per_step(step, ir->nstfout))
94 if (do_per_step(step, ir->nstxtcout))
96 mdof_flags |= MDOF_XTC;
100 mdof_flags |= MDOF_CPT;
104 #if defined(GMX_FAHCORE) || defined(GMX_WRITELASTSTEP)
107 /* Enforce writing positions and velocities at end of run */
108 mdof_flags |= (MDOF_X | MDOF_V);
114 fcReportProgress( ir->nsteps, step );
117 /* sync bCPT and fc record-keeping */
118 if (bCPT && MASTER(cr))
120 fcRequestCheckPoint();
126 wallcycle_start(wcycle, ewcTRAJ);
129 if (state->flags & (1<<estLD_RNG))
131 get_stochd_state(upd, state);
133 if (state->flags & (1<<estMC_RNG))
135 get_mc_state(mcrng, state);
141 state_global->ekinstate.bUpToDate = FALSE;
145 update_ekinstate(&state_global->ekinstate, ekind);
146 state_global->ekinstate.bUpToDate = TRUE;
148 update_energyhistory(&state_global->enerhist, mdebin);
151 write_traj(fplog, cr, outf, mdof_flags, top_global,
152 step, t, state, state_global, f, f_global, &n_xtc, &x_xtc);
159 if (bLastStep && step_rel == ir->nsteps &&
160 bDoConfOut && MASTER(cr) &&
163 /* x and v have been collected in write_traj,
164 * because a checkpoint file will always be written
167 fprintf(stderr, "\nWriting final coordinates.\n");
170 /* Make molecules whole only for confout writing */
171 do_pbc_mtop(fplog, ir->ePBC, state->box, top_global, state_global->x);
173 write_sto_conf_mtop(ftp2fn(efSTO, nfile, fnm),
174 *top_global->name, top_global,
175 state_global->x, state_global->v,
176 ir->ePBC, state->box);
179 wallcycle_stop(wcycle, ewcTRAJ);