Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
headerdict["x"] = headerdict.pop("xs")
headerdict["y"] = headerdict.pop("ys")
headerdict["z"] = headerdict.pop("zs")
else:
raise ValueError("only x/xs, y/ys andz/zs keys are allowed for traj file")
else:
raw = line.strip().split()
idd = int(raw[headerdict["id"]])
typ = int(raw[headerdict["type"]])
x = float(raw[headerdict["x"]])
y = float(raw[headerdict["y"]])
z = float(raw[headerdict["z"]])
atom = pca.Atom()
atom.pos = [x, y, z]
atom.id = idd
atom.type = typ
atom.loc = count-8
customdict = {}
#if customkeys need to be read, do it
if customread:
for cc, kk in enumerate(customkeys):
customdict[kk] = raw[headerdict[kk]]
atom.custom = customdict
atoms.append(atom)
#close files
f.close()
if (x < xlow):
x = x + (xhigh - xlow)
elif (x > xhigh):
x = x - (xhigh - xlow)
if (y < ylow):
y = y + (yhigh - ylow)
elif (y > yhigh):
y = y - (yhigh - ylow)
if (z < zlow):
z = z + (zhigh - zlow)
elif (z > zhigh):
z = z - (zhigh - zlow)
count+=1
idd = count
atom = pca.Atom()
atom.pos = [x, y, z]
atom.id = idd
atom.type = typ
atom.loc = i-atom_start
#atom = pc.Atom(pos=, id=idd, type=typ)
atoms.append(atom)
i+=1
else:
species+=1
return atoms, boxdims
atoms = []
xh = nx*lattice_constant*xfact
yh = ny*lattice_constant*yfact
zh = nz*lattice_constant*zfact
boxdims = [[0, xh], [0, yh], [0, zh]]
#create structure
for i in range(1, nx+1):
for j in range(1, ny+1):
for k in range(1, nz+1):
for l in range(1, coord_no+1):
m += 1
posx = (unitcellx[l-1]+(lattice_constant*xfact*(float(i)-1)))
posy = (unitcelly[l-1]+(lattice_constant*yfact*(float(j)-1)))
posz = (unitcellz[l-1]+(lattice_constant*zfact*(float(k)-1)))
atom = pc.Atom()
atom.pos = [posx, posy, posz]
atom.id = co
atom.type = atomtype[l-1]
atom.loc = co-1
atoms.append(atom)
co += 1
return atoms, boxdims