mirror of
https://github.com/ParticulateFlow/LPP.git
synced 2025-12-08 06:37:46 +00:00
103 lines
3.7 KiB
Plaintext
103 lines
3.7 KiB
Plaintext
"Pizza.py WWW Site"_pws - "Pizza.py Documentation"_pd - "Pizza.py Tools"_pc :c
|
|
|
|
:link(pws,http://www.cs.sandia.gov/~sjplimp/pizza.html)
|
|
:link(pd,Manual.html)
|
|
:link(pc,Section_tools.html)
|
|
|
|
:line
|
|
|
|
data tool :h3
|
|
|
|
[Purpose:]
|
|
|
|
Read, write, manipulate LAMMPS data files.
|
|
|
|
[Description:]
|
|
|
|
The data tool reads and writes LAMMPS data files. It also allows
|
|
their content to be accessed or modified.
|
|
|
|
The data constructor reads in the specified LAMMPS data file. With no
|
|
argument, an empty data object is created which can have fields added
|
|
to it later, and then be written out.
|
|
|
|
The map() method assigns names to different atom attributes by their
|
|
column number (1-N). The get() method extracts columns of information
|
|
from the specified section of the data file.
|
|
|
|
The title, headers, and sections variables can be set directly. The
|
|
header values correspond to one-line definition that appear at the top
|
|
of the data file. The box size values should be set to a Python
|
|
tuple, e.g.
|
|
|
|
d.headers\["xlo xhi"\] = (-30, 30) :pre
|
|
|
|
The section value should be a list of text lines, each of which
|
|
includes a newline at the end.
|
|
|
|
The delete() method deletes a header or entire section of the data
|
|
file. The replace() method allows one column of a section to be
|
|
replaced with a vector of new values. The newxyz() methods replaces
|
|
the xyz coords of the "Atoms" section of the data file with xyz values
|
|
from the Nth snapshot of a dump object containing snapshots.
|
|
|
|
The iterator() and viz() methods are called by Pizza.py tools that
|
|
visualize snapshots of atoms (e.g. raster, svg tools). A data file
|
|
can be visualzed similarly to snapshots from a dump file. In the case
|
|
of a data file, there is only a single snapshot with index 0.
|
|
|
|
The write() method outputs a LAMMPS data file.
|
|
|
|
[Usage:]
|
|
|
|
d = data("data.poly") read a LAMMPS data file, can be gzipped
|
|
d = data() create an empty data file :pre
|
|
|
|
d.map(1,"id",3,"x") assign names to atom columns (1-N) :pre
|
|
|
|
coeffs = d.get("Pair Coeffs") extract info from data file section
|
|
q = d.get("Atoms",4) :pre
|
|
|
|
1 arg = all columns returned as 2d array of floats
|
|
2 args = Nth column returned as vector of floats :pre
|
|
|
|
d.reorder("Atoms",1,3,2,4,5) reorder columns (1-N) in a data file section :pre
|
|
|
|
1,3,2,4,5 = new order of previous columns, can delete columns this way :pre
|
|
|
|
d.title = "My LAMMPS data file" set title of the data file
|
|
d.headers\["atoms"\] = 1500 set a header value
|
|
d.sections\["Bonds"\] = lines set a section to list of lines (with newlines)
|
|
d.delete("bonds") delete a keyword or section of data file
|
|
d.delete("Bonds")
|
|
d.replace("Atoms",5,vec) replace Nth column of section with vector
|
|
d.newxyz(dmp,1000) replace xyz in Atoms with xyz of snapshot N :pre
|
|
|
|
newxyz assumes id,x,y,z are defined in both data and dump files
|
|
also replaces ix,iy,iz if they are defined :pre
|
|
|
|
index,time,flag = d.iterator(0/1) loop over single data file snapshot
|
|
time,box,atoms,bonds,tris,lines = d.viz(index) return list of viz objects :pre
|
|
|
|
iterator() and viz() are compatible with equivalent dump calls
|
|
iterator() called with arg = 0 first time, with arg = 1 on subsequent calls
|
|
index = timestep index within dump object (only 0 for data file)
|
|
time = timestep value (only 0 for data file)
|
|
flag = -1 when iteration is done, 1 otherwise
|
|
viz() returns info for specified timestep index (must be 0)
|
|
time = 0
|
|
box = \[xlo,ylo,zlo,xhi,yhi,zhi\]
|
|
atoms = id,type,x,y,z for each atom as 2d array
|
|
bonds = id,type,x1,y1,z1,x2,y2,z2,t1,t2 for each bond as 2d array
|
|
NULL if bonds do not exist
|
|
tris = NULL
|
|
lines = NULL :pre
|
|
|
|
d.write("data.new") write a LAMMPS data file :pre
|
|
|
|
[Related tools:]
|
|
|
|
"gl"_gl.html, "raster"_raster.html, "svg"_svg.html
|
|
|
|
[Prerequisites:] none
|