reading the discussion here: https://github.com/lammps/lammps/issues/2269 I had the impression that dump vtk or dump grid/vtk were introduced to allow users to output binned quantities in a format that was more ‘amenable’ for visualisation and analysis, among other things.
Currently, I am trying to output the density field on my simulation in 2D spatial bins; the commands
compute myBins all chunk/atom bin/2d z lower 2.0 y lower 2.0
fix myDens all ave/chunk 100 10 1000 myBins density/mass file tmp.out
do work. My question is if, and how, it is possible to obtain the same result with dump vtk or dump grid/vtk (with the output file in .vtk file format instead, of course).
I know fix ave/grid also exists, but it seems to me it only output 3D grids (for 3D simulations at leasts), while I am interested in either 2D or radial grid (bin/2d or bin/cylinder respectively). And in any case I haven’t found any example of fix ave/grid+dump grid/vtk either.
No. dump vtk is for per-atom properties (like dump custom) and dump grid/vtk is for grid object data (chunks are not grid objects, even if they are 2d or 3d bins).
VTK support in LAMMPS is a marginal thing for two reasons:
the VTK libraries are a massive and complex dependency and nobody except for die-hard VTK enthusiasts want to deal with it (if you want to only output VTK compatible data, it is often much easier to just pick a specific style and write an output module).
most people don’t use VTK based visualization tools but rather OVITO or VMD or similar for per-atom data and gnuplot, xmgrace, or python+matplotlib for 1d or 2d data.
Bottom line, if you want more and more flexible VTK support in LAMMPS you will have to get busy programming. In some cases, there now exist output styles for YAML format output, which is easy to import into Python.
Thank you @akohlmey
I understand. At the end of the day it’s just a matter of convenience: for analysis purposes, I am more interested in the content than in the format. Having the output in a Paraview-readable format would just allow me to bypass writing a Python script to convert from one format to another, when I want to visualise it.
I was wondering if dump grid/vtk would work with 3D density grid. I tried running with
compute myGrid all property/grid 100 100 1 id ix iy iz
fix myDensFix all ave/grid 100 10 1000 100 100 1 density/mass c_myGrid:grid:data[*]
I also get Fix ave/grid cannot operate on per-atom and per-grid values which I don’t understand since it should indeed not operate on per-atom values, only grid (right?).
Thank you.
Part of the reason I posted my question in the first place was because I wasn’t able to find an answer anywhere in the documentation. I’ll have another look. maybe I’m more lucky this time.
This most often happens when people look for something too specific while they have not read up on the fundamentals. Since LAMMPS is a bit like Lego bricks, i.e. it has many components that can be combined in many different ways, you are not likely find examples for every permutation. This is particularly true for “exotic” features like VTK support. Same as most of the code, also the documentation is written by many different people that usually focus on their specific use case, there are always gaps if you go beyond that.