get rid of (evil) tabs and trailing whitespace in bundled Pizza.py components
This commit is contained in:
@ -11,7 +11,7 @@
|
|||||||
oneline = "Convert LAMMPS snapshots to AtomEye CFG format"
|
oneline = "Convert LAMMPS snapshots to AtomEye CFG format"
|
||||||
|
|
||||||
docstr = """
|
docstr = """
|
||||||
c = cfg(d) d = object containing atom coords (dump, data)
|
c = cfg(d) d = object containing atom coords (dump, data)
|
||||||
|
|
||||||
c.one() write all snapshots to tmp.cfg
|
c.one() write all snapshots to tmp.cfg
|
||||||
c.one("new") write all snapshots to new.cfg
|
c.one("new") write all snapshots to new.cfg
|
||||||
|
|||||||
@ -12,15 +12,15 @@ oneline = "Read, write, manipulate dump files and particle attributes"
|
|||||||
|
|
||||||
docstr = """
|
docstr = """
|
||||||
d = dump("dump.one") read in one or more dump files
|
d = dump("dump.one") read in one or more dump files
|
||||||
d = dump("dump.1 dump.2.gz") can be gzipped
|
d = dump("dump.1 dump.2.gz") can be gzipped
|
||||||
d = dump("dump.*") wildcard expands to multiple files
|
d = dump("dump.*") wildcard expands to multiple files
|
||||||
d = dump("dump.*",0) two args = store filenames, but don't read
|
d = dump("dump.*",0) two args = store filenames, but don't read
|
||||||
|
|
||||||
incomplete and duplicate snapshots are deleted
|
incomplete and duplicate snapshots are deleted
|
||||||
atoms will be unscaled if stored in files as scaled
|
atoms will be unscaled if stored in files as scaled
|
||||||
self-describing column names assigned
|
self-describing column names assigned
|
||||||
|
|
||||||
time = d.next() read next snapshot from dump files
|
time = d.next() read next snapshot from dump files
|
||||||
|
|
||||||
used with 2-argument constructor to allow reading snapshots one-at-a-time
|
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
|
snapshot will be skipped only if another snapshot has same time stamp
|
||||||
@ -32,20 +32,20 @@ d.map(1,"id",3,"x") assign names to columns (1-N)
|
|||||||
|
|
||||||
not needed if dump file is self-describing
|
not needed if dump file is self-describing
|
||||||
|
|
||||||
d.tselect.all() select all timesteps
|
d.tselect.all() select all timesteps
|
||||||
d.tselect.one(N) select only timestep N
|
d.tselect.one(N) select only timestep N
|
||||||
d.tselect.none() deselect all timesteps
|
d.tselect.none() deselect all timesteps
|
||||||
d.tselect.skip(M) select every Mth step
|
d.tselect.skip(M) select every Mth step
|
||||||
d.tselect.test("$t >= 100 and $t < 10000") select matching timesteps
|
d.tselect.test("$t >= 100 and $t < 10000") select matching timesteps
|
||||||
d.delete() delete non-selected timesteps
|
d.delete() delete non-selected timesteps
|
||||||
|
|
||||||
selecting a timestep also selects all atoms in the timestep
|
selecting a timestep also selects all atoms in the timestep
|
||||||
skip() and test() only select from currently selected timesteps
|
skip() and test() only select from currently selected timesteps
|
||||||
test() uses a Python Boolean expression with $t for timestep value
|
test() uses a Python Boolean expression with $t for timestep value
|
||||||
Python comparison syntax: == != < > <= >= and or
|
Python comparison syntax: == != < > <= >= and or
|
||||||
|
|
||||||
d.aselect.all() select all atoms in all steps
|
d.aselect.all() select all atoms in all steps
|
||||||
d.aselect.all(N) select all atoms in one step
|
d.aselect.all(N) select all atoms in one step
|
||||||
d.aselect.test("$id > 100 and $type == 2") select match atoms in all steps
|
d.aselect.test("$id > 100 and $type == 2") select match atoms in all steps
|
||||||
d.aselect.test("$id > 100 and $type == 2",N) select matching atoms in one step
|
d.aselect.test("$id > 100 and $type == 2",N) select matching atoms in one step
|
||||||
|
|
||||||
@ -56,24 +56,24 @@ d.aselect.test("$id > 100 and $type == 2",N) select matching atoms in one step
|
|||||||
Python comparison syntax: == != < > <= >= and or
|
Python comparison syntax: == != < > <= >= and or
|
||||||
$name must end with a space
|
$name must end with a space
|
||||||
|
|
||||||
d.write("file") write selected steps/atoms to dump file
|
d.write("file") write selected steps/atoms to dump file
|
||||||
d.write("file",head,app) write selected steps/atoms to dump file
|
d.write("file",head,app) write selected steps/atoms to dump file
|
||||||
d.scatter("tmp") write selected steps/atoms to multiple files
|
d.scatter("tmp") write selected steps/atoms to multiple files
|
||||||
|
|
||||||
write() can be specified with 2 additional flags
|
write() can be specified with 2 additional flags
|
||||||
head = 0/1 for no/yes snapshot header, app = 0/1 for write vs append
|
head = 0/1 for no/yes snapshot header, app = 0/1 for write vs append
|
||||||
scatter() files are given timestep suffix: e.g. tmp.0, tmp.100, etc
|
scatter() files are given timestep suffix: e.g. tmp.0, tmp.100, etc
|
||||||
|
|
||||||
d.scale() scale x,y,z to 0-1 for all timesteps
|
d.scale() scale x,y,z to 0-1 for all timesteps
|
||||||
d.scale(100) scale atom coords for timestep N
|
d.scale(100) scale atom coords for timestep N
|
||||||
d.unscale() unscale x,y,z to box size to all timesteps
|
d.unscale() unscale x,y,z to box size to all timesteps
|
||||||
d.unscale(1000) unscale atom coords for timestep N
|
d.unscale(1000) unscale atom coords for timestep N
|
||||||
d.wrap() wrap x,y,z into periodic box via ix,iy,iz
|
d.wrap() wrap x,y,z into periodic box via ix,iy,iz
|
||||||
d.unwrap() unwrap x,y,z out of box via ix,iy,iz
|
d.unwrap() unwrap x,y,z out of box via ix,iy,iz
|
||||||
d.owrap("other") wrap x,y,z to same image as another atom
|
d.owrap("other") wrap x,y,z to same image as another atom
|
||||||
d.sort() sort atoms by atom ID in all selected steps
|
d.sort() sort atoms by atom ID in all selected steps
|
||||||
d.sort("x") sort atoms by column value in all steps
|
d.sort("x") sort atoms by column value in all steps
|
||||||
d.sort(1000) sort atoms in timestep N
|
d.sort(1000) sort atoms in timestep N
|
||||||
|
|
||||||
scale(), unscale(), wrap(), unwrap(), owrap() operate on all steps and atoms
|
scale(), unscale(), wrap(), unwrap(), owrap() operate on all steps and atoms
|
||||||
wrap(), unwrap(), owrap() require ix,iy,iz be defined
|
wrap(), unwrap(), owrap() require ix,iy,iz be defined
|
||||||
@ -85,8 +85,8 @@ d.sort(1000) sort atoms in timestep N
|
|||||||
m1,m2 = d.minmax("type") find min/max values for a column
|
m1,m2 = d.minmax("type") find min/max values for a column
|
||||||
d.set("$ke = $vx * $vx + $vy * $vy") set a column to a computed value
|
d.set("$ke = $vx * $vx + $vy * $vy") set a column to a computed value
|
||||||
d.setv("type",vector) set a column to a vector of values
|
d.setv("type",vector) set a column to a vector of values
|
||||||
d.spread("ke",N,"color") 2nd col = N ints spread over 1st col
|
d.spread("ke",N,"color") 2nd col = N ints spread over 1st col
|
||||||
d.clone(1000,"color") clone timestep N values to other steps
|
d.clone(1000,"color") clone timestep N values to other steps
|
||||||
|
|
||||||
minmax() operates on selected timesteps and atoms
|
minmax() operates on selected timesteps and atoms
|
||||||
set() operates on selected timesteps and atoms
|
set() operates on selected timesteps and atoms
|
||||||
@ -107,17 +107,17 @@ d.clone(1000,"color") clone timestep N values to other steps
|
|||||||
values at every timestep are set to value at timestep N for that atom ID
|
values at every timestep are set to value at timestep N for that atom ID
|
||||||
useful for propagating a color map
|
useful for propagating a color map
|
||||||
|
|
||||||
t = d.time() return vector of selected timestep values
|
t = d.time() return vector of selected timestep values
|
||||||
fx,fy,... = d.atom(100,"fx","fy",...) return vector(s) for atom ID N
|
fx,fy,... = d.atom(100,"fx","fy",...) return vector(s) for atom ID N
|
||||||
fx,fy,... = d.vecs(1000,"fx","fy",...) return vector(s) for timestep N
|
fx,fy,... = d.vecs(1000,"fx","fy",...) return vector(s) for timestep N
|
||||||
|
|
||||||
atom() returns vectors with one value for each selected timestep
|
atom() returns vectors with one value for each selected timestep
|
||||||
vecs() returns vectors with one value for each selected atom in the timestep
|
vecs() returns vectors with one value for each selected atom in the timestep
|
||||||
|
|
||||||
index,time,flag = d.iterator(0/1) loop over dump snapshots
|
index,time,flag = d.iterator(0/1) loop over dump snapshots
|
||||||
time,box,atoms,bonds,tris,lines = d.viz(index) return list of viz objects
|
time,box,atoms,bonds,tris,lines = d.viz(index) return list of viz objects
|
||||||
d.atype = "color" set column returned as "type" by viz
|
d.atype = "color" set column returned as "type" by viz
|
||||||
d.extra(obj) extract bond/tri/line info from obj
|
d.extra(obj) extract bond/tri/line info from obj
|
||||||
|
|
||||||
iterator() loops over selected timesteps
|
iterator() loops over selected timesteps
|
||||||
iterator() called with arg = 0 first time, with arg = 1 on subsequent calls
|
iterator() called with arg = 0 first time, with arg = 1 on subsequent calls
|
||||||
@ -304,15 +304,15 @@ class dump:
|
|||||||
snap = self.read_snapshot(f)
|
snap = self.read_snapshot(f)
|
||||||
if not snap:
|
if not snap:
|
||||||
self.nextfile += 1
|
self.nextfile += 1
|
||||||
if self.nextfile == len(self.flist): return -1
|
if self.nextfile == len(self.flist): return -1
|
||||||
f.close()
|
f.close()
|
||||||
self.eof = 0
|
self.eof = 0
|
||||||
continue
|
continue
|
||||||
self.eof = f.tell()
|
self.eof = f.tell()
|
||||||
f.close()
|
f.close()
|
||||||
try:
|
try:
|
||||||
self.findtime(snap.time)
|
self.findtime(snap.time)
|
||||||
continue
|
continue
|
||||||
except: break
|
except: break
|
||||||
|
|
||||||
# select the new snapshot with all its atoms
|
# select the new snapshot with all its atoms
|
||||||
|
|||||||
@ -11,12 +11,12 @@
|
|||||||
oneline = "Create plots via GnuPlot plotting program"
|
oneline = "Create plots via GnuPlot plotting program"
|
||||||
|
|
||||||
docstr = """
|
docstr = """
|
||||||
g = gnu() start up GnuPlot
|
g = gnu() start up GnuPlot
|
||||||
g.stop() shut down GnuPlot process
|
g.stop() shut down GnuPlot process
|
||||||
|
|
||||||
g.plot(a) plot vector A against linear index
|
g.plot(a) plot vector A against linear index
|
||||||
g.plot(a,b) plot B against A
|
g.plot(a,b) plot B against A
|
||||||
g.plot(a,b,c,d,...) plot B against A, D against C, etc
|
g.plot(a,b,c,d,...) plot B against A, D against C, etc
|
||||||
g.mplot(M,N,S,"file",a,b,...) multiple plots saved to file0000.eps, etc
|
g.mplot(M,N,S,"file",a,b,...) multiple plots saved to file0000.eps, etc
|
||||||
|
|
||||||
each plot argument can be a tuple, list, or Numeric/NumPy vector
|
each plot argument can be a tuple, list, or Numeric/NumPy vector
|
||||||
@ -29,21 +29,21 @@ g.mplot(M,N,S,"file",a,b,...) multiple plots saved to file0000.eps, etc
|
|||||||
|
|
||||||
g("plot 'file.dat' using 2:3 with lines") execute string in GnuPlot
|
g("plot 'file.dat' using 2:3 with lines") execute string in GnuPlot
|
||||||
|
|
||||||
g.enter() enter GnuPlot shell
|
g.enter() enter GnuPlot shell
|
||||||
gnuplot> plot sin(x) with lines type commands directly to GnuPlot
|
gnuplot> plot sin(x) with lines type commands directly to GnuPlot
|
||||||
gnuplot> exit, quit exit GnuPlot shell
|
gnuplot> exit, quit exit GnuPlot shell
|
||||||
|
|
||||||
g.export("data",range(100),a,...) create file with columns of numbers
|
g.export("data",range(100),a,...) create file with columns of numbers
|
||||||
|
|
||||||
all vectors must be of equal length
|
all vectors must be of equal length
|
||||||
could plot from file with GnuPlot command: plot 'data' using 1:2 with lines
|
could plot from file with GnuPlot command: plot 'data' using 1:2 with lines
|
||||||
|
|
||||||
g.select(N) figure N becomes the current plot
|
g.select(N) figure N becomes the current plot
|
||||||
|
|
||||||
subsequent commands apply to this plot
|
subsequent commands apply to this plot
|
||||||
|
|
||||||
g.hide(N) delete window for figure N
|
g.hide(N) delete window for figure N
|
||||||
g.save("file") save current plot as file.eps
|
g.save("file") save current plot as file.eps
|
||||||
|
|
||||||
Set attributes for current plot:
|
Set attributes for current plot:
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ nvec = l.nvec # of vectors of thermo info
|
|||||||
nlen = l.nlen length of each vectors
|
nlen = l.nlen length of each vectors
|
||||||
names = l.names list of vector names
|
names = l.names list of vector names
|
||||||
t,pe,... = l.get("Time","KE",...) return one or more vectors of values
|
t,pe,... = l.get("Time","KE",...) return one or more vectors of values
|
||||||
l.write("file.txt") write all vectors to a file
|
l.write("file.txt") write all vectors to a file
|
||||||
l.write("file.txt","Time","PE",...) write listed vectors to a file
|
l.write("file.txt","Time","PE",...) write listed vectors to a file
|
||||||
|
|
||||||
get and write allow abbreviated (uniquely) vector names
|
get and write allow abbreviated (uniquely) vector names
|
||||||
@ -133,9 +133,9 @@ class log:
|
|||||||
else:
|
else:
|
||||||
count = 0
|
count = 0
|
||||||
for i in range(self.nvec):
|
for i in range(self.nvec):
|
||||||
if self.names[i].find(key) == 0:
|
if self.names[i].find(key) == 0:
|
||||||
count += 1
|
count += 1
|
||||||
index = i
|
index = i
|
||||||
if count == 1:
|
if count == 1:
|
||||||
map.append(index)
|
map.append(index)
|
||||||
else:
|
else:
|
||||||
@ -161,9 +161,9 @@ class log:
|
|||||||
else:
|
else:
|
||||||
count = 0
|
count = 0
|
||||||
for i in range(self.nvec):
|
for i in range(self.nvec):
|
||||||
if self.names[i].find(key) == 0:
|
if self.names[i].find(key) == 0:
|
||||||
count += 1
|
count += 1
|
||||||
index = i
|
index = i
|
||||||
if count == 1:
|
if count == 1:
|
||||||
map.append(index)
|
map.append(index)
|
||||||
else:
|
else:
|
||||||
@ -226,7 +226,7 @@ class log:
|
|||||||
keywords.insert(0,"Step")
|
keywords.insert(0,"Step")
|
||||||
i = 0
|
i = 0
|
||||||
for keyword in keywords:
|
for keyword in keywords:
|
||||||
self.names.append(keyword)
|
self.names.append(keyword)
|
||||||
self.ptr[keyword] = i
|
self.ptr[keyword] = i
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ class log:
|
|||||||
line = txt[s1:s2]
|
line = txt[s1:s2]
|
||||||
words = line.split()
|
words = line.split()
|
||||||
for i in range(len(words)):
|
for i in range(len(words)):
|
||||||
self.names.append(words[i])
|
self.names.append(words[i])
|
||||||
self.ptr[words[i]] = i
|
self.ptr[words[i]] = i
|
||||||
|
|
||||||
self.nvec = len(self.names)
|
self.nvec = len(self.names)
|
||||||
@ -275,36 +275,36 @@ class log:
|
|||||||
|
|
||||||
if s1 >= 0 and s2 >= 0 and s1 < s2: # found s1,s2 with s1 before s2
|
if s1 >= 0 and s2 >= 0 and s1 < s2: # found s1,s2 with s1 before s2
|
||||||
if self.style == 2:
|
if self.style == 2:
|
||||||
s1 = txt.find("\n",s1) + 1
|
s1 = txt.find("\n",s1) + 1
|
||||||
elif s1 >= 0 and s2 >= 0 and s2 < s1: # found s1,s2 with s2 before s1
|
elif s1 >= 0 and s2 >= 0 and s2 < s1: # found s1,s2 with s2 before s1
|
||||||
s1 = 0
|
s1 = 0
|
||||||
elif s1 == -1 and s2 >= 0: # found s2, but no s1
|
elif s1 == -1 and s2 >= 0: # found s2, but no s1
|
||||||
last = 1
|
last = 1
|
||||||
s1 = 0
|
s1 = 0
|
||||||
elif s1 >= 0 and s2 == -1: # found s1, but no s2
|
elif s1 >= 0 and s2 == -1: # found s1, but no s2
|
||||||
last = 1
|
last = 1
|
||||||
if self.style == 1:
|
if self.style == 1:
|
||||||
s2 = txt.rfind("\n--",s1) + 1
|
s2 = txt.rfind("\n--",s1) + 1
|
||||||
else:
|
else:
|
||||||
s1 = txt.find("\n",s1) + 1
|
s1 = txt.find("\n",s1) + 1
|
||||||
s2 = txt.rfind("\n",s1) + 1
|
s2 = txt.rfind("\n",s1) + 1
|
||||||
eof -= len(txt) - s2
|
eof -= len(txt) - s2
|
||||||
elif s1 == -1 and s2 == -1: # found neither
|
elif s1 == -1 and s2 == -1: # found neither
|
||||||
# could be end-of-file section
|
# could be end-of-file section
|
||||||
# or entire read was one chunk
|
# or entire read was one chunk
|
||||||
|
|
||||||
if txt.find("Loop time of",start) == start: # end of file, so exit
|
if txt.find("Loop time of",start) == start: # end of file, so exit
|
||||||
eof -= len(txt) - start # reset eof to "Loop"
|
eof -= len(txt) - start # reset eof to "Loop"
|
||||||
break
|
break
|
||||||
|
|
||||||
last = 1 # entire read is a chunk
|
last = 1 # entire read is a chunk
|
||||||
s1 = 0
|
s1 = 0
|
||||||
if self.style == 1:
|
if self.style == 1:
|
||||||
s2 = txt.rfind("\n--",s1) + 1
|
s2 = txt.rfind("\n--",s1) + 1
|
||||||
else:
|
else:
|
||||||
s2 = txt.rfind("\n",s1) + 1
|
s2 = txt.rfind("\n",s1) + 1
|
||||||
eof -= len(txt) - s2
|
eof -= len(txt) - s2
|
||||||
if s1 == s2: break
|
if s1 == s2: break
|
||||||
|
|
||||||
chunk = txt[s1:s2-1]
|
chunk = txt[s1:s2-1]
|
||||||
start = s2
|
start = s2
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
oneline = "Convert LAMMPS snapshots to XYZ format"
|
oneline = "Convert LAMMPS snapshots to XYZ format"
|
||||||
|
|
||||||
docstr = """
|
docstr = """
|
||||||
x = xyz(d) d = object containing atom coords (dump, data)
|
x = xyz(d) d = object containing atom coords (dump, data)
|
||||||
|
|
||||||
x.one() write all snapshots to tmp.xyz
|
x.one() write all snapshots to tmp.xyz
|
||||||
x.one("new") write all snapshots to new.xyz
|
x.one("new") write all snapshots to new.xyz
|
||||||
|
|||||||
Reference in New Issue
Block a user