Merge pull request #681 from lammps/dump-modify

remove dependence of dump modify 'at' and 'append'
This commit is contained in:
Steve Plimpton
2017-10-09 08:29:12 -06:00
committed by GitHub
5 changed files with 47 additions and 38 deletions

View File

@ -917,9 +917,9 @@ KOKKOS, o = USER-OMP, t = OPT.
"born/coul/wolf (go)"_pair_born.html,
"brownian (o)"_pair_brownian.html,
"brownian/poly (o)"_pair_brownian.html,
"buck (gkio)"_pair_buck.html,
"buck/coul/cut (gkio)"_pair_buck.html,
"buck/coul/long (gkio)"_pair_buck.html,
"buck (giko)"_pair_buck.html,
"buck/coul/cut (giko)"_pair_buck.html,
"buck/coul/long (giko)"_pair_buck.html,
"buck/coul/long/cs"_pair_buck.html,
"buck/coul/msm (o)"_pair_buck.html,
"buck/long/coul/long (o)"_pair_buck_long.html,
@ -934,12 +934,12 @@ KOKKOS, o = USER-OMP, t = OPT.
"coul/msm"_pair_coul.html,
"coul/streitz"_pair_coul.html,
"coul/wolf (ko)"_pair_coul.html,
"dpd (go)"_pair_dpd.html,
"dpd (gio)"_pair_dpd.html,
"dpd/tstat (go)"_pair_dpd.html,
"dsmc"_pair_dsmc.html,
"eam (gkiot)"_pair_eam.html,
"eam/alloy (gkiot)"_pair_eam.html,
"eam/fs (gkiot)"_pair_eam.html,
"eam (gikot)"_pair_eam.html,
"eam/alloy (gikot)"_pair_eam.html,
"eam/fs (gikot)"_pair_eam.html,
"eim (o)"_pair_eim.html,
"gauss (go)"_pair_gauss.html,
"gayberne (gio)"_pair_gayberne.html,
@ -953,9 +953,9 @@ KOKKOS, o = USER-OMP, t = OPT.
"kim"_pair_kim.html,
"lcbop"_pair_lcbop.html,
"line/lj"_pair_line_lj.html,
"lj/charmm/coul/charmm (kio)"_pair_charmm.html,
"lj/charmm/coul/charmm (iko)"_pair_charmm.html,
"lj/charmm/coul/charmm/implicit (ko)"_pair_charmm.html,
"lj/charmm/coul/long (gkio)"_pair_charmm.html,
"lj/charmm/coul/long (giko)"_pair_charmm.html,
"lj/charmm/coul/msm"_pair_charmm.html,
"lj/charmmfsw/coul/charmmfsh"_pair_charmm.html,
"lj/charmmfsw/coul/long"_pair_charmm.html,
@ -1005,9 +1005,9 @@ KOKKOS, o = USER-OMP, t = OPT.
"resquared (go)"_pair_resquared.html,
"snap"_pair_snap.html,
"soft (go)"_pair_soft.html,
"sw (gkio)"_pair_sw.html,
"sw (giko)"_pair_sw.html,
"table (gko)"_pair_table.html,
"tersoff (gkio)"_pair_tersoff.html,
"tersoff (giko)"_pair_tersoff.html,
"tersoff/mod (gko)"_pair_tersoff_mod.html,
"tersoff/mod/c (o)"_pair_tersoff_mod.html,
"tersoff/zbl (gko)"_pair_tersoff_zbl.html,
@ -1177,7 +1177,7 @@ USER-OMP, t = OPT.
"none"_dihedral_none.html,
"zero"_dihedral_zero.html,
"hybrid"_dihedral_hybrid.html,
"charmm (ko)"_dihedral_charmm.html,
"charmm (iko)"_dihedral_charmm.html,
"charmmfsw"_dihedral_charmm.html,
"class2 (ko)"_dihedral_class2.html,
"harmonic (io)"_dihedral_harmonic.html,
@ -1190,7 +1190,7 @@ used if "LAMMPS is built with the appropriate
package"_Section_start.html#start_3.
"cosine/shift/exp (o)"_dihedral_cosine_shift_exp.html,
"fourier (o)"_dihedral_fourier.html,
"fourier (io)"_dihedral_fourier.html,
"nharmonic (o)"_dihedral_nharmonic.html,
"quadratic (o)"_dihedral_quadratic.html,
"spherical (o)"_dihedral_spherical.html,
@ -1213,7 +1213,7 @@ USER-OMP, t = OPT.
"hybrid"_improper_hybrid.html,
"class2 (ko)"_improper_class2.html,
"cvff (io)"_improper_cvff.html,
"harmonic (ko)"_improper_harmonic.html,
"harmonic (iko)"_improper_harmonic.html,
"umbrella (o)"_improper_umbrella.html :tb(c=4,ea=c)
These are additional improper styles in USER packages, which can be

View File

@ -19,7 +19,6 @@ keyword = {append} or {at} or {buffer} or {element} or {every} or {fileper} or {
{append} arg = {yes} or {no}
{at} arg = N
N = index of frame written upon first dump
only available after "append yes"
{buffer} 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
@ -143,13 +142,18 @@ and {dcd}. It also applies only to text output files, not to binary
or gzipped or image/movie 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. If the {at} option is present
({netcdf} only), then the frame to append to can be specified. Negative values
are counted from the end of the file. 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.
overwrite an existing file with the same name.
:line
The {at} keyword only applies to the {netcdf} dump style. It can only
be used if the {append yes} keyword is also used. The {N} argument is
the index of which frame to append to. A negative value can be
specified for {N}, which means a frame counted from the end of the
file. The {at} keyword can only be used if the dump_modify command is
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.
:line

View File

@ -330,8 +330,7 @@ void DumpNetCDF::openfile()
// Type mangling
if (vtype[perat[i].field[0]] == INT) {
xtype = NC_INT;
}
else {
} else {
if (double_precision)
xtype = NC_DOUBLE;
else
@ -355,10 +354,13 @@ void DumpNetCDF::openfile()
NCERR( nc_inq_dimlen(ncid, frame_dim, &nframes) );
// framei == -1 means append to file, == -2 means override last frame
// Note that in the input file this translates to 'yes', '-1', etc.
if (framei < 0 || (append_flag && framei == 0)) framei = nframes+framei+1;
if (framei <= 0) framei = nframes+framei+1;
if (framei < 1) framei = 1;
}
else {
} else {
if (framei != 0)
error->all(FLERR,"at keyword requires use of 'append yes'");
int dims[NC_MAX_VAR_DIMS];
size_t index[NC_MAX_VAR_DIMS], count[NC_MAX_VAR_DIMS];
double d[1];
@ -924,11 +926,12 @@ int DumpNetCDF::modify_param(int narg, char **arg)
return 2;
}
else if (strcmp(arg[iarg],"at") == 0) {
if (!append_flag)
error->all(FLERR,"expected 'append yes' before 'at' keyword");
iarg++;
if (iarg >= narg)
error->all(FLERR,"expected additional arg after 'at' keyword.");
framei = force->inumeric(FLERR,arg[iarg]);
if (framei < 0) framei--;
if (framei == 0) error->all(FLERR,"frame 0 not allowed for 'at' keyword.");
else if (framei < 0) framei--;
iarg++;
return 2;
}

View File

@ -351,10 +351,12 @@ void DumpNetCDFMPIIO::openfile()
NCERR( ncmpi_inq_dimlen(ncid, frame_dim, &nframes) );
// framei == -1 means append to file, == -2 means override last frame
// Note that in the input file this translates to 'yes', '-1', etc.
if (framei < 0 || (append_flag && framei == 0)) framei = nframes+framei+1;
if (framei <= 0) framei = nframes+framei+1;
if (framei < 1) framei = 1;
}
else {
} else {
if (framei != 0)
error->all(FLERR,"at keyword requires use of 'append yes'");
int dims[NC_MAX_VAR_DIMS];
MPI_Offset index[NC_MAX_VAR_DIMS], count[NC_MAX_VAR_DIMS];
double d[1];
@ -920,11 +922,12 @@ int DumpNetCDFMPIIO::modify_param(int narg, char **arg)
return 2;
}
else if (strcmp(arg[iarg],"at") == 0) {
if (!append_flag)
error->all(FLERR,"expected 'append yes' before 'at' keyword");
iarg++;
if (iarg >= narg)
error->all(FLERR,"expected additional arg after 'at' keyword.");
framei = force->inumeric(FLERR,arg[iarg]);
if (framei < 0) framei--;
if (framei == 0) error->all(FLERR,"frame 0 not allowed for 'at' keyword.");
else if (framei < 0) framei--;
iarg++;
return 2;
}

View File

@ -949,8 +949,7 @@ void Modify::delete_fix(const char *id)
void Modify::delete_fix(int ifix)
{
if(fix[ifix])
delete fix[ifix];
if (fix[ifix]) delete fix[ifix];
atom->update_callback(ifix);
// move other Fixes and fmask down in list one slot