git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3860 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2010-03-02 22:52:27 +00:00
parent 4ab2fa5e6b
commit b0ed4d2409
3 changed files with 21 additions and 9 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;
}