mirror of
https://github.com/ParticulateFlow/LPP.git
synced 2025-12-08 06:37:46 +00:00
convert tabs to spaces, remove extra spaces, fix comments
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python
|
||||
|
||||
# Script: density.py
|
||||
# Purpose: binned atom density by atom type
|
||||
@ -43,19 +43,19 @@ while 1:
|
||||
bin = nbins * [0]
|
||||
for i in xrange(nbins): bin[i] = ntypes * [0]
|
||||
first = 0
|
||||
|
||||
|
||||
box = (d.snaps[-1].xlo,d.snaps[-1].ylo,d.snaps[-1].zlo,
|
||||
d.snaps[-1].xhi,d.snaps[-1].yhi,d.snaps[-1].zhi)
|
||||
vol = (box[3] - box[0]) * (box[4] - box[1]) * (box[5] - box[2])
|
||||
vol = (box[3] - box[0]) * (box[4] - box[1]) * (box[5] - box[2])
|
||||
|
||||
if direction == "x": type,x = d.vecs(time,"type","x")
|
||||
elif direction == "y": type,x = d.vecs(time,"type","y")
|
||||
elif direction == "z": type,x = d.vecs(time,"type","z")
|
||||
|
||||
|
||||
type = map(int,type)
|
||||
natoms = len(type)
|
||||
for i in xrange(natoms): type[i] -= 1
|
||||
|
||||
|
||||
for i in xrange(natoms):
|
||||
ibin = int(nbins*x[i] + 0.5)
|
||||
if (ibin < 0): ibin += nbins
|
||||
@ -63,15 +63,15 @@ while 1:
|
||||
bin[ibin][type[i]] += nbins/vol
|
||||
nsnaps += 1
|
||||
print time,
|
||||
|
||||
|
||||
print
|
||||
print "Printing ", direction, "-directional density distribution in mol/L to",outfile
|
||||
conversion = 1660.53873 # convert from atoms/Angs^3 to mol/L
|
||||
|
||||
|
||||
fp = open(outfile,"w")
|
||||
for i in xrange(nbins):
|
||||
print >>fp, float(i)/float(nbins),
|
||||
print >>fp, float(i)/float(nbins),
|
||||
for j in xrange(ntypes):
|
||||
print >>fp, conversion*bin[i][j]/nsnaps,
|
||||
print >>fp
|
||||
print >>fp
|
||||
fp.close()
|
||||
|
||||
Reference in New Issue
Block a user