Merge pull request #3597 from lammps/dump-grid-dimension

Add ITEM: DIMENSION to dump grid output
This commit is contained in:
Axel Kohlmeyer
2023-01-13 17:42:35 -05:00
committed by GitHub
2 changed files with 25 additions and 11 deletions

View File

@ -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 <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 <https://www.ovito.org>`,
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 <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 <compute>`
and :doc:`fixes <fix>` is used to generate lines of output that is

View File

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