Read dump files with bond info.
The bdump tool reads one or more LAMMPS dump files, and stores their contents as a series of snapshots with 2d arrays of atom attributes. It is assumed that each entry contains info for a bond in a LAMMPS simulation as is typically written by the dump local command in LAMMPS. Other tools use bdump objects to extract bond info for visualization, like the dump tool via its extra() method.
The constructor method is passed a string containing one or more dump filenames. They can be listed in any order since snapshots are sorted by timestep after they are read and duplicate snapshots (with the same time stamp) are deleted. If a 2nd argument is specified, the files are not immediately read, but snapshots can be read one-at-a-time by the next() method.
The map() method assigns names to columns of attributes. The id,type,atom1,atom2 names must be assigned in order for bond info to be extracted.
The viz() method is called by Pizza.py tools that visualize snapshots of atoms (e.g. gl, raster, svg tools).
Normally, LAMMPS creates the dump files read in by this tool. If you want to create them yourself, the format of LAMMPS dump local files is simple. Each snapshot is formatted as follows:
ITEM: TIMESTEP 100 ITEM: NUMBER OF ENTRIES 32 ITEM: ENTRIES 1 1 5 10 2 1 11 45 3 2 6 8 ... N -3 23 456
There are N lines following "ITEM: ENTRIES" where N is the number of entries. Entries do not have to be listed in any particular order. There can be a different number of entries in each snapshot. Each line must contain the bond ID, type, and the 2 atom IDs of the atoms in the bond, as specified by the map() command.
b = bdump("dump.one") read in one or more dump files b = bdump("dump.1 dump.2.gz") can be gzipped b = bdump("dump.*") wildcard expands to multiple files b = bdump("dump.*",0) two args = store filenames, but don't read
incomplete and duplicate snapshots are deleted no column name assignment is performed
time = b.next() read next snapshot from dump files
used with 2-argument constructor to allow reading snapshots one-at-a-time snapshot will be skipped only if another snapshot has same time stamp return time stamp of snapshot read return -1 if no snapshots left or last snapshot is incomplete no column name assignment is performed
b.map(1,"id",3,"x") assign names to atom columns (1-N)
must assign id,type,atom1,atom2
time,box,atoms,bonds,tris,lines = b.viz(index) return list of viz objects
viz() returns line info for specified timestep index can also call as viz(time,1) and will find index of preceding snapshot time = timestep value box = NULL atoms = NULL bonds = id,type,atom1,atom2 for each line as 2d array tris = NULL lines = NULL
dump, gl, raster, svg
Numeric or NumPy Python packages. Gunzip command (if you want to read gzipped files).