Files
LPP/examples/test_data.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

33 lines
686 B
Python

# simple test of data tool
# requires files/data.micelle and dump.micelle
# creates tmp.data
from __future__ import absolute_import
d = data("files/data.micelle")
d.map(1,"id",3,"type",4,"x",5,"y",6,"z")
coeffs = d.get("Masses")
print("Masses",coeffs)
x = d.get("Atoms",4)
print("X of 1st atom",x[0])
d.title = "New LAMMPS data file"
natoms = d.headers["atoms"]
vec = list(range(1,natoms+1))
vec.reverse()
d.replace("Atoms",1,vec)
dm = dump("files/dump.micelle")
d.newxyz(dm,1000)
flag = 0
while 1:
index,time,flag = d.iterator(flag)
if flag == -1: break
time,box,atoms,bonds,tris,lines= d.viz(index)
d.write("tmp.data")
print("all done ... type CTRL-D to exit Pizza.py")