Files
LPP/examples/test_mdump.py
danielque 539fd060c2 python 3 compatibility for examples/*.py files
add from __future__ import
print statement -> print() function
xrange -> range
map() -> list(map())
range() -> list(range())
StandardError -> Exception
2023-08-10 13:25:36 +02:00

36 lines
670 B
Python

# simple test of mdump tool
# requires files/mesh.grain
# creates tmp.* files
m = mdump("files/mesh.grain")
m.tselect.none()
m.tselect.one(200)
m.tselect.all()
m.tselect.skip(2)
m.tselect.all()
m.tselect.test("$t >= 100 and $t <= 200")
m.delete()
print("Time",m.time())
m.map(2,"spin")
m.etype = "spin"
flag = 0
while 1:
index,time,flag = m.iterator(flag)
if flag == -1: break
time,box,atoms,bonds,tris,lines = m.viz(index)
colors = [tri[1] for tri in tris]
print(time,colors)
m = dump("files/mesh.grain",0)
while 1:
time = m.next()
if time < 0: break
print("Incrementally read snaps =",m.nsnaps)
print("all done ... type CTRL-D to exit Pizza.py")