From b0ed4d24096f9b4acdb6ca64e67893c7928fb006 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 2 Mar 2010 22:52:27 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3860 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/dump.cpp | 20 +++++++++++++------- src/dump.h | 1 + src/output.cpp | 9 +++++++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/dump.cpp b/src/dump.cpp index f61097967d..8723627ec5 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -48,10 +48,10 @@ Dump::Dump(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) filename = new char[n]; strcpy(filename,arg[4]); + first_flag = 0; flush_flag = 1; format = NULL; format_user = NULL; - clearstep = 0; sort_flag = 0; append_flag = 0; @@ -252,6 +252,18 @@ void Dump::modify_params(int narg, char **arg) if (strcmp(id,output->dump[idump]->id) == 0) break; output->dump_every[idump] = n; iarg += 2; + } else if (strcmp(arg[iarg],"first") == 0) { + if (iarg+2 > narg) error->all("Illegal dump_modify command"); + if (strcmp(arg[iarg+1],"yes") == 0) first_flag = 1; + else if (strcmp(arg[iarg+1],"no") == 0) first_flag = 0; + else error->all("Illegal dump_modify command"); + iarg += 2; + } else if (strcmp(arg[iarg],"flush") == 0) { + if (iarg+2 > narg) error->all("Illegal dump_modify command"); + if (strcmp(arg[iarg+1],"yes") == 0) flush_flag = 1; + else if (strcmp(arg[iarg+1],"no") == 0) flush_flag = 0; + else error->all("Illegal dump_modify command"); + iarg += 2; } else if (strcmp(arg[iarg],"format") == 0) { if (iarg+2 > narg) error->all("Illegal dump_modify command"); delete [] format_user; @@ -262,12 +274,6 @@ void Dump::modify_params(int narg, char **arg) strcpy(format_user,arg[iarg+1]); } iarg += 2; - } else if (strcmp(arg[iarg],"flush") == 0) { - if (iarg+2 > narg) error->all("Illegal dump_modify command"); - if (strcmp(arg[iarg+1],"yes") == 0) flush_flag = 1; - else if (strcmp(arg[iarg+1],"no") == 0) flush_flag = 0; - else error->all("Illegal dump_modify command"); - iarg += 2; } else if (strcmp(arg[iarg],"sort") == 0) { if (iarg+2 > narg) error->all("Illegal dump_modify command"); if (strcmp(arg[iarg+1],"yes") == 0) sort_flag = 1; diff --git a/src/dump.h b/src/dump.h index fec33b4d00..b6029518bd 100644 --- a/src/dump.h +++ b/src/dump.h @@ -33,6 +33,7 @@ class Dump : protected Pointers { int multiproc; // 0 = proc 0 writes for all, 1 = one file/proc int header_flag; // 0 = item, 2 = xyz + int first_flag; // 0 if no initial dump, 1 if yes initial dump int flush_flag; // 0 if no flush, 1 if flush every dump int sort_flag; // 1 if write in sorted order, 0 if not int append_flag; // 1 if open file in append mode, 0 if not diff --git a/src/output.cpp b/src/output.cpp index 6ed58fa032..c71caba8d5 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -132,11 +132,16 @@ void Output::setup(int flag) // if no dumps, set next_dump_any to last+1 so will not influence next // wrap dumps that invoke computes with clear/add + int writeflag; + if (ndump && update->restrict_output == 0) { for (int idump = 0; idump < ndump; idump++) { if (dump[idump]->clearstep) modify->clearstep_compute(); - if ((ntimestep % dump_every[idump] == 0 && - last_dump[idump] != ntimestep) || last_dump[idump] < 0) { + writeflag = 0; + if (ntimestep % dump_every[idump] == 0 && last_dump[idump] != ntimestep) + writeflag = 1; + if (last_dump[idump] < 0 && dump[idump]->first_flag == 1) writeflag = 1; + if (writeflag) { dump[idump]->write(); last_dump[idump] = ntimestep; }