diff --git a/doc/src/dump.rst b/doc/src/dump.rst index 40eafbb427..6fce1fcaa6 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -363,22 +363,32 @@ attributes is given below. .. versionadded:: 22Dec2022 -For style *grid* the extent of the Nx by Ny by Nz grid that overlays -the simulation domain is output with each snapshot: +For style *grid* the dimension of the simulation domain and size of +the Nx by Ny by Nz grid that overlays the simulation domain are also +output with each snapshot: .. parsed-literal:: - ITEM: GRID EXTENT + ITEM: DIMENSION + dim + ITEM: GRID SIZE nx ny nz -For 2d simulations, nz will be 1. There will also be an "ITEM: GRID -DATA" line which includes column descriptors for the per grid cell -data. Each subsequent line (Nx * Ny * Nz lines) will list the data -for a single grid cell. If grid cell IDs are included in the output -via the :doc:`compute property/grid ` command, -then the IDs will range from 1 to N = Nx*Ny*Nz. The ordering of IDs -is with the x index varying fastest, then the y index, and the z index -varying slowest. +The value dim will be 2 or 3 for 2d or 3d simulations. It is included +so that post-processing tools like `OVITO `, +which can visualize grid-based quantities know how to draw each grid +cell. The grid size will match the input script parameters for +grid(s) created by the computes or fixes which are referenced by the +the dump command. For 2d simulations (and grids), nz will always +be 1. + +There will also be an "ITEM: GRID DATA" line which includes column +descriptors for the per grid cell data. Each subsequent line (Nx * +Ny * Nz lines) will list the data for a single grid cell. If grid +cell IDs are included in the output via the :doc:`compute +property/grid ` command, then the IDs will +range from 1 to N = Nx*Ny*Nz. The ordering of IDs is with the x index +varying fastest, then the y index, and the z index varying slowest. For style *local*, local output generated by :doc:`computes ` and :doc:`fixes ` is used to generate lines of output that is diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index 996c7f1301..2ca4f6c5d4 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -377,6 +377,7 @@ void DumpGrid::header_binary(bigint ndump) fwrite(&boxyhi,sizeof(double),1,fp); fwrite(&boxzlo,sizeof(double),1,fp); fwrite(&boxzhi,sizeof(double),1,fp); + fwrite(&domain->dimension,sizeof(int),1,fp); fwrite(&nxgrid,sizeof(int),1,fp); fwrite(&nygrid,sizeof(int),1,fp); fwrite(&nzgrid,sizeof(int),1,fp); @@ -409,6 +410,7 @@ void DumpGrid::header_binary_triclinic(bigint ndump) fwrite(&boxxy,sizeof(double),1,fp); fwrite(&boxxz,sizeof(double),1,fp); fwrite(&boxyz,sizeof(double),1,fp); + fwrite(&domain->dimension,sizeof(int),1,fp); fwrite(&nxgrid,sizeof(int),1,fp); fwrite(&nygrid,sizeof(int),1,fp); fwrite(&nzgrid,sizeof(int),1,fp); @@ -438,6 +440,7 @@ void DumpGrid::header_item(bigint /*ndump*/) "{:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e}\n", boundstr,boxxlo,boxxhi,boxylo,boxyhi,boxzlo,boxzhi); + fmt::print(fp,"ITEM: DIMENSION\n{}\n",domain->dimension); fmt::print(fp,"ITEM: GRID SIZE nx ny nz\n{} {} {}\n",nxgrid,nygrid,nzgrid); fmt::print(fp,"ITEM: GRID CELLS {}\n",columns); } @@ -458,6 +461,7 @@ void DumpGrid::header_item_triclinic(bigint /*ndump*/) "{:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n", boundstr,boxxlo,boxxhi,boxxy,boxylo,boxyhi,boxxz,boxzlo,boxzhi,boxyz); + fmt::print(fp,"ITEM: DIMENSION\n{}\n",domain->dimension); fmt::print(fp,"ITEM: GRID SIZE nx ny nz\n{} {} {}\n",nxgrid,nygrid,nzgrid); fmt::print(fp,"ITEM: GRID CELLS {}\n",columns); }