diff -Naur lammps-5Sep09/doc/dump_modify.html lammps-6Sep09/doc/dump_modify.html --- lammps-5Sep09/doc/dump_modify.html 2009-09-02 14:56:46.000000000 -0600 +++ lammps-6Sep09/doc/dump_modify.html 2009-09-04 13:40:03.000000000 -0600 @@ -19,9 +19,10 @@
  • one or more keyword/value pairs may be appended -
  • keyword = every or flush or format or image or precision or region or scale or sort or thresh or unwrap +
  • keyword = append or every or flush or format or image or precision or region or scale or sort or thresh or unwrap -
      element args = E1 E2 ... EN, where N = # of atom types
    +
      append arg = yes or no
    +  element args = E1 E2 ... EN, where N = # of atom types
         E1,...,EN = element name, e.g. C or Fe or Ga
       every arg = N
         N = dump every this many timesteps
    @@ -53,6 +54,17 @@
     

    Modify the parameters of a previously defined dump command. Not all parameters are relevant to all dump styles.

    +

    The append keyword applies to all dump styles except cfg and xtc +and dcd. It also applies only to text output files, not to binary +or gzipped files. If specified as yes, then dump snapshots are +appended to the end of an existing dump file. If specified as no, +then a new dump file will be created which will overwrite an existing +file with the same name. This keyword can only take effect if the +dump_modify command is used after the dump command, but +before the first command that causes dump snapshots to be output, +e.g. a run or minimize command. Once the +dump file has been opened, this keyword has no further effect. +

    The element keyword applies only to the the dump cfg style. It associates element names (e.g. H, C, Fe) with LAMMPS atom types, so that the AtomEye @@ -146,7 +158,8 @@

    The option defaults are

    -
    • element = "C" for every atom type +
      • append = no +
      • element = "C" for every atom type
      • every = whatever it was set to via the dump command
      • flush = yes (except for the dump xtc style)
      • format = %d and %g for each integer or floating point value diff -Naur lammps-5Sep09/doc/dump_modify.txt lammps-6Sep09/doc/dump_modify.txt --- lammps-5Sep09/doc/dump_modify.txt 2009-09-02 14:56:46.000000000 -0600 +++ lammps-6Sep09/doc/dump_modify.txt 2009-09-04 13:40:03.000000000 -0600 @@ -14,7 +14,8 @@ dump-ID = ID of dump to modify :ulb,l one or more keyword/value pairs may be appended :l -keyword = {every} or {flush} or {format} or {image} or {precision} or {region} or {scale} or {sort} or {thresh} or {unwrap} :l +keyword = {append} or {every} or {flush} or {format} or {image} or {precision} or {region} or {scale} or {sort} or {thresh} or {unwrap} :l + {append} arg = {yes} or {no} {element} args = E1 E2 ... EN, where N = # of atom types E1,...,EN = element name, e.g. C or Fe or Ga {every} arg = N @@ -46,6 +47,17 @@ Modify the parameters of a previously defined dump command. Not all parameters are relevant to all dump styles. +The {append} keyword applies to all dump styles except {cfg} and {xtc} +and {dcd}. It also applies only to text output files, not to binary +or gzipped files. If specified as {yes}, then dump snapshots are +appended to the end of an existing dump file. If specified as {no}, +then a new dump file will be created which will overwrite an existing +file with the same name. This keyword can only take effect if the +dump_modify command is used after the "dump"_dump.html command, but +before the first command that causes dump snapshots to be output, +e.g. a "run"_run.html or "minimize"_minimize.html command. Once the +dump file has been opened, this keyword has no further effect. + The {element} keyword applies only to the the dump {cfg} style. It associates element names (e.g. H, C, Fe) with LAMMPS atom types, so that the "AtomEye"_http://mt.seas.upenn.edu/Archive/Graphics/A @@ -139,6 +151,7 @@ The option defaults are +append = no element = "C" for every atom type every = whatever it was set to via the "dump"_dump.html command flush = yes (except for the dump {xtc} style) diff -Naur lammps-5Sep09/src/MOLECULE/dump_bond.cpp lammps-6Sep09/src/MOLECULE/dump_bond.cpp --- lammps-5Sep09/src/MOLECULE/dump_bond.cpp 2008-04-08 07:58:15.000000000 -0600 +++ lammps-6Sep09/src/MOLECULE/dump_bond.cpp 2009-09-04 13:39:53.000000000 -0600 @@ -34,10 +34,6 @@ int n = strlen(str) + 1; format_default = new char[n]; strcpy(format_default,str); - - // one-time file open - - if (multifile == 0) openfile(); } /* ---------------------------------------------------------------------- */ @@ -53,6 +49,10 @@ format = new char[n]; strcpy(format,str); strcat(format,"\n"); + + // open single file, one time only + + if (multifile == 0) openfile(); } /* ---------------------------------------------------------------------- */ diff -Naur lammps-5Sep09/src/dump.cpp lammps-6Sep09/src/dump.cpp --- lammps-5Sep09/src/dump.cpp 2009-09-02 10:24:00.000000000 -0600 +++ lammps-6Sep09/src/dump.cpp 2009-09-04 13:39:53.000000000 -0600 @@ -53,6 +53,7 @@ format_user = NULL; sort_flag = 0; + append_flag = 0; maxbuf = 0; buf = NULL; @@ -65,6 +66,7 @@ // else if ends in .gz = gzipped text file // else ASCII text file + singlefile_opened = 0; compressed = 0; binary = 0; multifile = 0; @@ -233,7 +235,22 @@ int iarg = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"format") == 0) { + if (strcmp(arg[iarg],"append") == 0) { + if (iarg+2 > narg) error->all("Illegal dump_modify command"); + if (strcmp(arg[iarg+1],"yes") == 0) append_flag = 1; + else if (strcmp(arg[iarg+1],"no") == 0) append_flag = 0; + else error->all("Illegal dump_modify command"); + iarg += 2; + } else if (strcmp(arg[iarg],"every") == 0) { + if (iarg+2 > narg) error->all("Illegal dump_modify command"); + int n = atoi(arg[iarg+1]); + if (n <= 0) error->all("Illegal dump_modify command"); + int idump; + for (idump = 0; idump < output->ndump; idump++) + if (strcmp(id,output->dump[idump]->id) == 0) break; + output->dump_every[idump] = n; + iarg += 2; + } else if (strcmp(arg[iarg],"format") == 0) { if (iarg+2 > narg) error->all("Illegal dump_modify command"); delete [] format_user; format_user = NULL; @@ -249,15 +266,6 @@ 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],"every") == 0) { - if (iarg+2 > narg) error->all("Illegal dump_modify command"); - int n = atoi(arg[iarg+1]); - if (n <= 0) error->all("Illegal dump_modify command"); - int idump; - for (idump = 0; idump < output->ndump; idump++) - if (strcmp(id,output->dump[idump]->id) == 0) break; - output->dump_every[idump] = n; - 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; @@ -290,6 +298,11 @@ void Dump::openfile() { + // single file, already opened, so just return + + if (singlefile_opened) return; + if (multifile == 0) singlefile_opened = 1; + // if one file per timestep, replace '*' with current timestep char *filecurrent; @@ -315,6 +328,8 @@ #endif } else if (binary) { fp = fopen(filecurrent,"wb"); + } else if (append_flag) { + fp = fopen(filecurrent,"a"); } else { fp = fopen(filecurrent,"w"); } diff -Naur lammps-5Sep09/src/dump.h lammps-6Sep09/src/dump.h --- lammps-5Sep09/src/dump.h 2009-09-02 10:24:00.000000000 -0600 +++ lammps-6Sep09/src/dump.h 2009-09-04 13:39:53.000000000 -0600 @@ -35,6 +35,8 @@ int header_flag; // 0 = item, 2 = xyz 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 + int singlefile_opened; // 1 = one big file, already opened, else 0 char *format_default; // default format string char *format_user; // format string set by user diff -Naur lammps-5Sep09/src/dump_atom.cpp lammps-6Sep09/src/dump_atom.cpp --- lammps-5Sep09/src/dump_atom.cpp 2009-07-22 10:34:52.000000000 -0600 +++ lammps-6Sep09/src/dump_atom.cpp 2009-09-04 13:39:53.000000000 -0600 @@ -30,10 +30,6 @@ scale_flag = 1; image_flag = 0; format_default = NULL; - - // one-time file open - - if (multifile == 0) openfile(); } /* ---------------------------------------------------------------------- */ @@ -99,6 +95,10 @@ if (binary) write_choice = &DumpAtom::write_binary; else if (image_flag == 0) write_choice = &DumpAtom::write_noimage; else if (image_flag == 1) write_choice = &DumpAtom::write_image; + + // open single file, one time only + + if (multifile == 0) openfile(); } /* ---------------------------------------------------------------------- */ diff -Naur lammps-5Sep09/src/dump_custom.cpp lammps-6Sep09/src/dump_custom.cpp --- lammps-5Sep09/src/dump_custom.cpp 2009-09-02 10:24:00.000000000 -0600 +++ lammps-6Sep09/src/dump_custom.cpp 2009-09-04 13:39:53.000000000 -0600 @@ -112,10 +112,6 @@ strcat(columns,arg[iarg]); strcat(columns," "); } - - // one-time file open - - if (multifile == 0) openfile(); } /* ---------------------------------------------------------------------- */ @@ -219,6 +215,10 @@ if (ivariable < 0) error->all("Could not find dump custom variable name"); variable[i] = ivariable; } + + // open single file, one time only + + if (multifile == 0) openfile(); } /* ---------------------------------------------------------------------- */ diff -Naur lammps-5Sep09/src/dump_xyz.cpp lammps-6Sep09/src/dump_xyz.cpp --- lammps-5Sep09/src/dump_xyz.cpp 2008-04-08 07:58:15.000000000 -0600 +++ lammps-6Sep09/src/dump_xyz.cpp 2009-09-04 13:39:53.000000000 -0600 @@ -45,9 +45,6 @@ coords = (float *) memory->smalloc(3*natoms*sizeof(float),"dump:coords"); } - // one-time file open - - if (multifile == 0) openfile(); ntotal = 0; } @@ -74,6 +71,10 @@ format = new char[n]; strcpy(format,str); strcat(format,"\n"); + + // open single file, one time only + + if (multifile == 0) openfile(); } /* ----------------------------------------------------------------------