Handling Dump Files
Reading the Dump
GranularLammpsDump.getNatoms
— MethodgetNatoms("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.
GranularLammpsDump.getdumpsections
— Methodgetdumpsections(in)
Reads the first timestep of a dumpfile and returns section headings.
GranularLammpsDump.readdump
— Methodreaddump("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 |
GranularLammpsDump.readdump2
— Methodreaddump2("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.
Using the Dump
GranularLammpsDump.parsestep
— Methodparsestep(d,ts)
Stores critical info from a dump step in a mutable struct.
Iterate this in a loop to step through a simulation.
GranularLammpsDump.dump2mat
— Functiondump2mat(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.