Dear everybody,
I would love to get a helping hand in testing some new graphics functionality that I just added for use with the dump image command that allows to visualize data computed by a fix. This is complementary to the recently added ability to visualize regions. I have adapted multiple fix styles, e.g. several wall fixes (to display the walls), fix indent (to display the indenter), fix reaxff/bonds (to display bonds as they are computed by pair style reaxff) and fix smd/wall_surface (to display the surface mesh). I also implemented a new fix (called fix graphics) that can be used to add some custom graphics (with movable/adjustable settings). As with any of these kinds of changes, there are likely a bunch of issues because as the person that implemented it, I will only use the features as I intended it, but may overlook other use cases. Also, I am curious to see, if there are suggestions for other additions, be it additional graphics objects for fix graphics or dump image support for additional files.
To make your life easier, I am willing to provide (the usual set of) pre-compiled LAMMPS/LAMMPS-GUI binaries, so you could use it right away. The pull request and some simple examples are here:
develop ← akohlmey:fix-indent-dump-image
opened 06:20AM - 14 Dec 25 UTC
**Summary**
This pull request adds support for passing information of graphic… al objects from fixes to dump image (or dump movie).
Specifically, most wall fixes (except those for regions), fix indent, fix reaxff/bonds, and fix smd/wall_surface are supported with the changes in this pull request.
Also, a new fix, `fix graphics` was added which allows to add individual graphic objects like spheres, cylinders to the image, but also more complex items like arrows or a progress bar. These may change or move during a simulation, since many parameters of the objects can be entered as variable references.
Finally, a so-called 'screen-door transparency' effect was added to the `Image` class that does the low-level rendering for `dump image`. Unlike real transparency, this works by not writing all pixels of an object. This implementation uses a 16x16 pixel threshold matrix for 257 different opacity levels. This can be utilized for atoms, bonds, regions, walls and surface meshes either through dump image arguments or dump_modify commands.
Changing the dump image command in the indent example to:
```
dump 2 all image 1000 image.*.jpg type type &
zoom 1.6 adiam 1.5 fix 4 const 0.0 2.0
dump_modify 2 pad 5 fcolor 4 purple
```
produces the following kind of image with the indenter rendered in purple:

Adding the following lines to the peptide example:
```
variable prog equal step/1000
fix graphics all graphics 25 progbar 1 3 z $(xhi) $(ylo-7.0) $(zlo+0.5*(zhi-zlo)) $(lz) 1.0 v_prog 10
dump 3 peptide movie 25 movie.mkv element type zoom 1.2 fsaa yes &
axes no 0.8 0.02 view 80 -10 bond atom 0.5 fix graphics element 0 0 size 800 800
dump_modify 3 pad 3 element C C O H N C C C O H H S O H acolor 10 silver
```
produces the following animation:

The following image shows the pseudo-transparency effect:
<img width="600" height="800" alt="funnel" src="https://github.com/user-attachments/assets/f6fc5ce3-9030-4d03-adb5-8564240c5358" />
**Author(s)**
Axel Kohlmeyer, Temple U
**Licensing**
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
**Artificial Intelligence (AI) Tools Usage**
By submitting this pull request, I confirm that I did NOT use any AI tools to generate
all or parts of the code and modifications in this pull request.
**Backward Compatibility**
The `zcylinder` option was removed from `fix wall/gran` since it is superseded by `fix wall/gran/region'.
**Post Submission Checklist**
- [x] The feature or features in this pull request is complete
- [x] Licensing information is complete
- [x] Corresponding author information is complete
- [x] The source code follows the LAMMPS formatting guidelines
- [x] Suitable new documentation files and/or updates to the existing docs are included
- [x] The added/updated documentation is integrated and tested with the documentation build system
- [x] The feature has been verified to work with the conventional build system
- [x] The feature has been verified to work with the CMake based build system
I am happy to discuss further details in public or in private.
Thanks in advance for any suggestions or other feedback,
Axel.
2 Likes
Is there anybody around that wants to get removed from Santa’s “naughty” list and needs to do a good deed? and is interested in helping me to test some of the new graphics stuff in LAMMPS?
I am now done with the second and third chunk of changes which adds the ability to render body particles and ellipsoids. Also, there is a new “arrow” graphics fix to visualize per-atom or per-chunk vectors.
develop ← akohlmey:visualize-body-faces
opened 11:35PM - 19 Dec 25 UTC
**Summary**
This pull request adds the missing code to enable drawing body pa… rticle faces for body styles `rounded/polyhedron` and `rounded polygon`. The existing code is somewhat refactored to be simpler and more like that for tri/line particles. Also some minor issues from previous `dump image` related pull requests are addressed. In addition, this pull request adds support for rendering ellipsoid particles by approximating the ellipsoid as a mesh of triangles.
Furthermore, also an arrow graphics object (constructed from triangles and a cylinder) was implemented and added to fix graphics.

<img width="600" height="600" alt="myimage-000030000" src="https://github.com/user-attachments/assets/8ce9d093-79dc-47fa-b967-543adfd0ae83" />
<img width="800" height="800" alt="ellipsoid-optimized" src="https://github.com/user-attachments/assets/f26e44c8-f2f0-4ffe-944c-09746ad26c68" />
<img width="800" height="800" alt="arrows-test" src="https://github.com/user-attachments/assets/b603d515-211d-4d9d-8731-b8d985d979f2" />
**Related Issue(s)**
N/A
**Author(s)**
Axel Kohlmeyer, Temple U
**Licensing**
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
**Artificial Intelligence (AI) Tools Usage**
Some of the low-level graphics code was prototyped by Claude Sonnet (through Perplexity.ai) and Google Gemini. It has been significantly refactored, though.
**Backward Compatibility**
N/A
**Implementation Notes**
The body style `image()` function now increments the number of graphics elements it computed.
Some invariant calculations were moved outside the loops.
**Post Submission Checklist**
- [x] The feature or features in this pull request is complete
- [x] Licensing information is complete
- [x] Corresponding author information is complete
- [x] The source code follows the LAMMPS formatting guidelines
- [x] Suitable new documentation files and/or updates to the existing docs are included
- [x] The added/updated documentation is integrated and tested with the documentation build system
- [x] The feature has been verified to work with the conventional build system
- [x] The feature has been verified to work with the CMake based build system
develop ← akohlmey:add-fix-graphics-arrows
opened 03:04AM - 23 Dec 25 UTC
**Summary**
This pull request implements a new `fix graphics/arrows` command … that can display per-atom arrows, e.g. for per-atom forces, velocities, or dipoles.
TODO list:
- [ ] add support for vectors constructed from atom-style variables
- [ ] add an automatic scaling mode, make the computed scale factor available as global scalar.
- [ ] add support for per-chunk vectors
<img width="800" height="800" alt="water-velocity" src="https://github.com/user-attachments/assets/dbe6407b-4d85-4268-8291-15b659ec10cc" />
**Related Issue(s)**
This uses functionality from PR #4817 and thus may be merged only after that pull request has been approved and merged (otherwise merging this pull request with merge both at the same time).
**Author(s)**
Axel Kohlmeyer, Temple U
**Licensing**
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
**Artificial Intelligence (AI) Tools Usage**
By submitting this pull request, I confirm that I did NOT use any AI tools to generate
all or parts of the code and modifications in this pull request.
**Backward Compatibility**
N/A
**Implementation Notes**
This depends on the high-level graphics object class for drawing arrows added in PR #4817
**Post Submission Checklist**
- [ ] The feature or features in this pull request is complete
- [x] Licensing information is complete
- [x] Corresponding author information is complete
- [x] The source code follows the LAMMPS formatting guidelines
- [x] Suitable new documentation files and/or updates to the existing docs are included
- [x] The added/updated documentation is integrated and tested with the documentation build system
- [x] The feature has been verified to work with the conventional build system
- [x] The feature has been verified to work with the CMake based build system
As before, I can produce custom executables for those that feel charitable and don’t want to spend the effort downloading and compiling LAMMPS from source.
Thanks,
Axel.
There are even more changes now and also an expanded Howto with some additional information and examples.
develop ← akohlmey:graphics-howto-and-region-refactor
opened 04:16PM - 24 Dec 25 UTC
**Summary**
This pull request refactors the handling of complex graphics obje… cts in dump image, especially for regions and splits off the image objects classes into a separate namespace and separate files.
Furthermore, a howto document is added with examples and explanations for some more complex visualizations using recently added functionality.
**Related Issue(s)**
This pull request is based on PR #4819 which in turn is based on #4817 which extends #4812.
It thus contains the changes from all of them and thus has to be merged after #4819.
After merging of the earlier pull requests, the list of changes will be reduced and this pull request easier to review.
**Author(s)**
Axel Kohlmeyer, Temple U
**Licensing**
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
**Artificial Intelligence (AI) Tools Usage**
By submitting this pull request, I confirm that I did NOT use any AI tools to generate
all or parts of the code and modifications in this pull request.
**Backward Compatibility**
No known issues.
**Implementation Notes**
N/A
**Post Submission Checklist**
- [x] The feature or features in this pull request is complete
- [x] Licensing information is complete
- [x] Corresponding author information is complete
- [x] The source code follows the LAMMPS formatting guidelines
- [x] Suitable new documentation files and/or updates to the existing docs are included
- [x] The added/updated documentation is integrated and tested with the documentation build system
- [x] The feature has been verified to work with the conventional build system
- [x] The feature has been verified to work with the CMake based build system
lammps-viz-howto.pdf (5.0 MB)
The latest new graphics feature is a fix style to compute and draw isosurfaces.
develop ← akohlmey:add-fix-graphics-surface
opened 06:40AM - 01 Jan 26 UTC
**Summary**
This pull request adds a new `fix graphics/surface` command which… allows to add an isosurface visualization of per-atom data to `dump image`. The isosurface can be created at different grid resolutions and with either a wireframe grid or a triangle mesh.
**Related Issue(s)**
This pull request is based on PR #4820, which in turn is based on PR #4819 which is based on #4817 which extends #4812. It thus contains the changes from all of them and thus has to be merged after #4820. After merging of the earlier pull requests, the list of changes will be reduced and this pull request will become easier to review.
**Author(s)**
Axel Kohlmeyer, Temple U
The marching cubes implementation uses tables available from multiple public domain sources.
**Licensing**
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
**Artificial Intelligence (AI) Tools Usage**
By submitting this pull request, I confirm that I did NOT use any AI tools to generate
all or parts of the code and modifications in this pull request.
**Backward Compatibility**
N/A
**Implementation Notes**
The isosurface computation is parallelized with MPI using the domain decomposition. Each MPI rank computes its own triangulated surface on a grid that slightly extends beyond the subdomains. However, triangles that are outside the subdomain are ignored to avoid bogus surfaces at the subdomain boundaries. Also, ghost atoms can contribute to the property density grid where the contribution is inside the local grid. For that purpose, the per-atom data is copied from the local atoms to local array and then a forward communication is performed.
For high grid resolutions, the distribution of the per-atom data to the grid can take considerable time. This step has been parallelized with OpenMP.
**Post Submission Checklist**
- [ ] The feature or features in this pull request is complete
- [x] Licensing information is complete
- [x] Corresponding author information is complete
- [x] The source code follows the LAMMPS formatting guidelines
- [x] Suitable new documentation files and/or updates to the existing docs are included
- [x] The added/updated documentation is integrated and tested with the documentation build system
- [x] The feature has been verified to work with the conventional build system
- [x] The feature has been verified to work with the CMake based build system
-----------
<img width="600" height="600" alt="image-000000220" src="https://github.com/user-attachments/assets/6fdf5ea7-1e85-4c76-8db2-837dc17abe0b" />
<img width="600" height="600" alt="myimage4-000000400" src="https://github.com/user-attachments/assets/cec7efd3-b84e-4865-b2db-7f1c5a8539af" />
1 Like
… and here is another new fix graphics command:
develop ← akohlmey:add-fix-graphics-periodic
opened 03:17AM - 03 Jan 26 UTC
**Summary**
This pull request adds a new `fix graphcis/periodic` command whic… h allows to add graphics representing the next periodic images in any direction to `dump image` output.
<img width="600" height="600" alt="myimage4-000000040" src="https://github.com/user-attachments/assets/dfbca747-9e7f-4a79-8592-150e2f7c3e38" />
<img width="600" height="600" alt="myimage4-000000060" src="https://github.com/user-attachments/assets/4d1f23c6-1ec5-4b61-bf88-7a4ba1125f58" />
**Related Issue(s)**
This pull request is based on PR #4820, which in turn is based on PR #4819 which is based on #4817 which extends #4812. It thus contains the changes from all of them and thus has to be merged after #4820. After merging of the earlier pull requests, the list of changes will be reduced and this pull request will become easier to review.
**Author(s)**
Axel Kohlmeyer, Temple U
**Licensing**
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
**Artificial Intelligence (AI) Tools Usage**
By submitting this pull request, I confirm that I did NOT use any AI tools to generate
all or parts of the code and modifications in this pull request.
**Backward Compatibility**
N/A
**Implementation Notes**
This currently only works for atoms and bonds.
**Post Submission Checklist**
- [x] The feature or features in this pull request is complete
- [x] Licensing information is complete
- [x] Corresponding author information is complete
- [x] The source code follows the LAMMPS formatting guidelines
- [x] Suitable new documentation files and/or updates to the existing docs are included
- [x] The added/updated documentation is integrated and tested with the documentation build system
- [x] The feature has been verified to work with the conventional build system
- [x] The feature has been verified to work with the CMake based build system