From 9169d8809022629991f414ae280260a331869c7b Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Fri, 13 Jan 2023 09:42:11 -0700 Subject: [PATCH 1/2] add ITEM: DIMENSION to dump grid src/doc --- doc/src/dump.rst | 25 ++++++++++++++----------- src/dump_grid.cpp | 4 ++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/doc/src/dump.rst b/doc/src/dump.rst index 40eafbb427..e12cd30b7f 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -363,22 +363,25 @@ 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 and extent of the Nx by Ny by Nz grid +that overlays the simulation domain is 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. +Dim will be 2 or 3 for 2d or 3d simulations. 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. 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); } From 651e95654cb0615a8d96710a2be5d16d27562e40 Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Fri, 13 Jan 2023 12:34:05 -0700 Subject: [PATCH 2/2] more details on dump snapshot header values --- doc/src/dump.rst | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/doc/src/dump.rst b/doc/src/dump.rst index e12cd30b7f..6fce1fcaa6 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -363,8 +363,9 @@ attributes is given below. .. versionadded:: 22Dec2022 -For style *grid* the dimension and extent of the Nx by Ny by Nz grid -that overlays the simulation domain is also 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:: @@ -373,15 +374,21 @@ that overlays the simulation domain is also output with each snapshot: ITEM: GRID SIZE nx ny nz -Dim will be 2 or 3 for 2d or 3d simulations. 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