I’m having trouble visualizing walls (e.g., wall/gran) that are defined via regions or planes in LAMMPS. I came across some example images that mention using VMD for visualization, but I’m unsure how to actually display these walls once I install VMD.
• I’ve seen references stating the walls were created with regions in LAMMPS and then shown in VMD, but I haven’t found a step‐by‐step explanation of how to do this. Does anyone have tips or a sample workflow?
VTK/ParaView Alternative
• I’m more familiar with ParaView and VTK (often used with LIGGGHTS). Is there a recommended way to visualize region‐based walls using VTK output from LAMMPS?
Any guidance, tutorials, or example scripts would be greatly appreciated. I’d love to see how other users handle this.
First off, LAMMPS has no option to output regions in any visualizable form directly, so any visualization has to recreate the region with inside the visualization too of choice.
With VMD you have two options:
you can recreate any regions using Tcl scripting since VMD has the “graphics” command that allows to draw graphics primitives. https://www.ks.uiuc.edu/Research/vmd/vmd-1.9.3/ug/node129.html. These graphics primitives are static and attached to a specific “VMD molecule”. To make them dynamic, you would need to delete and re-create the visualization in a function attached to the timestep progress.
VMD can also read triangle meshes from text mode STL files. LAMMPS has source code for a simple tool, stlbin2txt.cpp, in the tools folder to convert binary STL files to text.
Using Tcl scripting in VMD is very flexible and but requires some practice and familiarity with both VMD and Tcl. Some 20 years ago, I wrote a tutorial that included a section about adding graphics to trajectory using VMD including dynamic changes. Remarkably, it is still available online at: Visualization and Analysis of Quantum Chemical and Molecular Dynamics Data with VMD
@ponpoko Inspired by your question, I have started writing a region2vmd command that can help with the process. At least it can assist in debugging where regions are placed.
region box block -20 20 -20 20 -20 20
create_box 5 box
region c1 cone x 10 0 0 10 0 20
create_atoms 1 single 0.0 10.0 0.0
create_atoms 2 single 19.9 10.0 0.0
region c2 cylinder y 0 0 5 0 20
create_atoms 3 single 0.0 0.0 0.0
create_atoms 4 single 0.0 19.9 0.0
region sph sphere -10 -10 -10 15
create_atoms 5 single -10 -10 -10
mass * 1.0
write_dump all atom regions.lammpstrj
region2vmd regions.vmd command "mol default style VDW" &
command "set oldtop [mol new regions.lammpstrj waitfor all]" &
command "pbc box -center origin -style tubes" &
region c1 region c2 color red region sph &
color yellow material Glass1 region box
should produce two files (with the code from pull request), regions.lammpstrj and regions.vmd. Those files can be loaded into VMD with vmd -e regions.vmd and then adjusted into a visualization like the following (the atoms are placed at critical points of the regions).
Wow, thank you so much for your help! I really appreciate how kind you are to guide a novice like me in using VMD. I’ll try applying your suggestion to my script and will share an update if I succeed. Thanks again!