Handling Dump Files

Reading the Dump

GranularLammpsDump.getNatomsMethod
getNatoms("inputfile")

Parses the total number of atoms into an integer.

Looks at the 4th line of the dump file and parses the number of atoms from the readline string into an integer.

source
GranularLammpsDump.readdumpMethod
readdump("inputfile")

Converts the contents of the dumpfile to dictionaries indexed by step number.

RETURNS

dumpstep -> Dictionary where each value is an array of atom attributes for one timestep, sorted by Atom ID.
boxes -> Dictionary where each value is an [xlo, xhi], [ylo, yhi], [zlo, zhi] array.
Natoms -> The Int number of atoms in the simulation.
timedict -> Dictionary where each value is the true timestep from the dump.

Reads the dumpfile into a matrix, shapes the matrix, and removes text lines. The number of atoms is extracted and used internally but not returned. The final dictionary form has timesteps as keys, and matrices sorted by particle ID number as values. In principle, this works for any dumpfile with at least 6 columns of output, but has been tested with 6 output columns and 9 output columns.

Each timestep looks something like this: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | | ID | GROUP | x | y | z | vx | vy | vz | ux | uy | uz |

source
GranularLammpsDump.readdump2Method
readdump2("inputfile")

Converts the contents of the dumpfile to one dictionary with section titles as keys and data dictionaries as values.

Compared to readdump(), this is SLOWER and MORE GENERAL. readdump2() should work with ANY dump file. The outputs are NOT indexed by atom ID. Use readdump() for custom or atom dumps.

source

Using the Dump

GranularLammpsDump.parsestepMethod
parsestep(d,ts)

Stores critical info from a dump step in a mutable struct.

Iterate this in a loop to step through a simulation.

source
GranularLammpsDump.dump2matFunction
dump2mat(dict,exportflag=1)

Converts the readdump dictionary to one giant matrix. Optionally export as .csv file.

Export to .csv is on by default. This will help you collaborate with Matlab users ;) Set exportflag to 0 to turn off.

source