Skip to content

Tools for parsing LAMMPS dumps (dump files), 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.

License

Notifications You must be signed in to change notification settings

mitchellirmer/GranularLammpsDump.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GranularLammpsDump.jl

Visit GitHub pages documentation here.

GranularLammpsDump Quick Start

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.

exampleviz1

Installation

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

Reading and Parsing Dumps

  1. 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.

  1. 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)

  1. 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

Visualizing

  1. Open Julia in, or cd() into, the project folder.
  2. Run the setdefaults() function to create a settings.conf menu file in the project folder.

setdefaults()

  1. Use menu() to open the settings menu in nano, or open settings.conf in the working directory in your favorite text editor.

menu()
examplemenu

  1. Use readdump(inputfile) to load a dump file.

dump, boxes, Natoms, times = readdump("inputfile")

  1. 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)

About

Tools for parsing LAMMPS dumps (dump files), 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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages