Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- D=1 #Diameter if drum
- L=0.5 #length of drum
- Dpart=0.02 #particle diameter
- DENS=2800 #particle density
- z=0.0 #initial z-position
- id=1 #particle id-counter
- type=1 #atom types need to start from 1
- content=""
- #do some math ..
- for i in xrange(0,2*int(L/Dpart)+1):
- for a in xrange(0,360,1):
- rad=a/180.0*math.pi
- x=math.sin(rad)*D/2.
- y=math.cos(rad)*D/2.
- #atom-ID atom-type diameter density x y z
- content+="%d %d %f %f %f %f %f\n" % (id,type,Dpart,DENS,x,y,z)
- id+=1
- z+=Dpart/2.
- N=(id-2)
- header="LIGGGHTS data file made by Richti83 Wall Generator\n\n"
- header+="%d atoms\n\n" % (id-2)#N_particle=ID-2
- header+="2 atom types\n\n"
- header+="%f %f xlo xhi\n" % (-(D+Dpart)/2.,(D+Dpart)/2.)
- header+="%f %f ylo yhi\n" % (-(L+Dpart/2.),(L+Dpart/2.))
- header+="%f %f zlo zhi\n" % (-(D+Dpart)/2,(D+Dpart)/2.)
- header+="\n"
- header+="Atoms\n"
- #print content
- #print string
- fo = open("wall.pour", "wb")
- fo.write(header);
- fo.write(content)
- fo.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement