Visit GitHub pages documentation here.
Tools for parsing LAMMPS dumps (dump files output with "atom" or "custom" arguments), exporting the parsed dumps, and visualizing the simulation as a .mp4 movie. Developed during research for a master's thesis in sheared, vibrated granular flows at the Naval Postgraduate School, Monterey CA.
This library isn't in the official registry (yet?). Add with:
julia> ]
pkg> add https://github.com/mitchellirmer/GranularLammpsDump.jl.git
julia> using GranularLammpsDump
Update with
julia> ]
pkg> update
- Read an entire dump file into a dictionary with readdump(inputfile). In principle, this works with any "atom" or "custom" mode LAMMPS dump, but is tested to work for this case in particular:
|----------------------------------|
| ITEM: TIMESTEP |
| ITEM: NUMBER OF ATOMS |
| ITEM: BOX BOUNDS pp pp ss |
| ITEM: ATOMS id type x y z vx ... |
|----------------------------------|
dump, boxes, Natoms, times = readdump("inputfile")
Optionally, use readdump2(inputfile) for other dump file setups. This version is slower by at least a factor of 2 (and the atoms are not indexed by ID in the output), but this /should/ work for any dump. The output is a dictionary of section titles as keys and dictionaries of each section as values.
- Parse one step at a time into a mutable struct with parsestep -- iterate to analyze multiple steps. By default, it is set up for x, y, z positions, and vx, vy, vz velocities. The mutable struct could be modified for any custom outputs.
step = parsestep(dump, stepnumber)
- Export an entire reshaped dump as Julia matrix and optionally as a CSV file to be read into MATLAB (c). It can export the dump, boxes, and times dictionaries.
matrix = dump2mat(dictionary,exportflag) # // 0 for no CSV, 1 to export a CSV
- Open Julia in, or cd() into, the project folder.
- Run the setdefaults() function to create a settings.conf menu file in the project folder.
setdefaults()
- Use menu() to open the settings menu in nano, or open settings.conf in the working directory in your favorite text editor.
- Use readdump(inputfile) to load a dump file.
dump, boxes, Natoms, times = readdump("inputfile")
- Run one of the makemovie functions to make a movie. The "skips" variable takes every Nth timestep from the dump dictionary. E.g., use 1 for every timestep or 10 to take every 10th step. makemovi() takes one x slice, top to bottom, and color codes the particles based on "granular temperature" in the current step. The "allgrains" variant visualizes all grains with colorcoding by initial x position.
makemovie(dump, boxes, Tref, skips, moviename)
makemovie_allgrains(dump, boxes, skips, moviename)