Question on dump vtk Output: Diameter (Radius) Information Not Written to the VTK File

Hello,

I am using the following LAMMPS version, which includes packages such as VTK, and supports the sphere atom style:

===== information of LAMMPS =====

Large-scale Atomic/Molecular Massively Parallel Simulator - 29 Aug 2024 - Maintenance
Git info (maintenance / stable_29Aug2024_update1-26-g89e442dac1-modified)

OS: Linux "Ubuntu 24.04.1 LTS" 6.8.0-51-generic x86_64

Compiler: GNU C++ 13.3.0 with OpenMP 4.5
C++ standard: C++11
MPI v3.1: Open MPI v5.0.6, package: Open MPI hp-z8@HP-Z8 Distribution, ident: 5.0.6, repo rev: v5.0.6, Nov 15, 2024

Accelerator configuration:

GPU package API: CUDA
GPU package precision: mixed
OPENMP package API: OpenMP
OPENMP package precision: double
OpenMP standard: OpenMP 4.5

Compatible GPU present: yes

Installed packages:

GPU GRANULAR OPENMP VTK 

List of individual style options included in this LAMMPS executable

* Atom styles:

atomic          body            charge          ellipsoid       hybrid          
line            sphere          tri    

===== END of information =====

I attempted to write out the diameter (radius) of spherical atoms, but the values do not appear in the generated VTK file. However, when using dump custom, the diameter is indeed present in the output (e.g., check.txt).

Below is a minimal example script (dumTest.in). In the resulting file (test_0.vtk), there is no diameter or radius information, yet check.txt shows the diameter is stored correctly.

Could you please advise if I am missing any steps or settings to ensure the diameter appears in the VTK output?

Thank you!

===== minimal example script (dumTest.in) =====

atom_style sphere
region box block 0 1 0 1 0 1
create_box 1 box
create_atoms 1 single 0.5 0.5 0.5
set atom 1 diameter 0.001

dump d all vtk 1 test_*.vtk id type radius diameter x y z vx vy vz
dump  check all custom 100 check.txt id type radius diameter x y z vx vy vz
dump_modify check sort id
run 0

===== End of minimal example script (dumTest.in) =====

===== LAMMPS results =====

$ mpirun -np 4 ./lmp_OIGG -in dumTest.in
LAMMPS (29 Aug 2024 - Maintenance - stable_29Aug2024_update1-26-g89e442dac1-modified)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
  using 1 OpenMP thread(s) per MPI task
Created orthogonal box = (0 0 0) to (1 1 1)
  1 by 2 by 2 MPI processor grid
Created 1 atoms
  using lattice units in orthogonal box = (0 0 0) to (1 1 1)
  create_atoms CPU = 0.000 seconds
Setting atom values ...
  1 settings made for diameter
WARNING: No fixes with time integration, atoms won't move (src/verlet.cpp:60)
Setting up Verlet run ...
  Unit style    : lj
  Current step  : 0
  Time step     : 0.005
WARNING: No pairwise cutoff or binsize set. Atom sorting therefore disabled. (src/atom.cpp:2442)
WARNING: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost. (src/comm_brick.cpp:212)
Per MPI rank memory allocation (min/avg/max) = 0.06276 | 0.06276 | 0.06276 Mbytes
   Step          Temp          E_pair         E_mol          TotEng         Press     
         0   0              0              0              0              0            
Loop time of 6.07325e-06 on 4 procs for 0 steps with 1 atoms

111.1% CPU use with 4 MPI tasks x 1 OpenMP threads

MPI task timing breakdown:
Section |  min time  |  avg time  |  max time  |%varavg| %total
---------------------------------------------------------------
Pair    | 0          | 0          | 0          |   0.0 |  0.00
Neigh   | 0          | 0          | 0          |   0.0 |  0.00
Comm    | 0          | 0          | 0          |   0.0 |  0.00
Output  | 0          | 0          | 0          |   0.0 |  0.00
Modify  | 0          | 0          | 0          |   0.0 |  0.00
Other   |            | 6.073e-06  |            |       |100.00

Nlocal:           0.25 ave           1 max           0 min
Histogram: 3 0 0 0 0 0 0 0 0 1
Nghost:           0.75 ave           1 max           0 min
Histogram: 1 0 0 0 0 0 0 0 0 3
Neighs:              0 ave           0 max           0 min
Histogram: 4 0 0 0 0 0 0 0 0 0

Total # of neighbors = 0
Ave neighs/atom = 0
Neighbor list builds = 0
Dangerous builds = 0
Total wall time: 0:00:00

===== End of LAMMPS results =====

===== VTK output file =====

$ cat test_0.vtk
# vtk DataFile Version 5.1
Generated by LAMMPS
ASCII
DATASET POLYDATA
POINTS 1 float
0.5 0.5 0.5 
VERTICES 2 1
OFFSETS vtktypeint64
0 1 
CONNECTIVITY vtktypeint64
0 
POINT_DATA 1
FIELD FieldData 1
v 3 1 double
0 0 0 

===== End of VTK output file =====

===== dump custom output file =====

$ cat check.txt
ITEM: TIMESTEP
0
ITEM: NUMBER OF ATOMS
1
ITEM: BOX BOUNDS pp pp pp
0.0000000000000000e+00 1.0000000000000000e+00
0.0000000000000000e+00 1.0000000000000000e+00
0.0000000000000000e+00 1.0000000000000000e+00
ITEM: ATOMS id type radius diameter x y z vx vy vz
1 1 0.0005 0.001 0.5 0.5 0.5 0 0 0

===== End of dump custom output file =====
1 Like

Thanks for providing a simple reproducer input. This has made checking out the issue very fast and convenient.

It turns out that there is an indexing bug for optional fields in dump vtk that has been present for several years. Not only radius and diameter are missing from the dump output, but also atom id and type. The x, y, and z fields are mandatory for VTK dumps, so the skipping or x due to the bug has no impact. This bug will be fixed in upcoming releases (for both the development and the stable version).

As a workaround you can specify 5 (different) custom properties before using the ones that you are interested in. Those 5 properties will not be printed.

For example using

dump d all vtk 1 test_*.vtk fx fy fz xu yu id type radius diameter x y z vx vy vz

should create a dump that includes atom id, atom type, velocity, radius, and diameter as originally intended.

Thank you akohlmey,
Appreciate.