-
Notifications
You must be signed in to change notification settings - Fork 1
/
particleInitialize.py
44 lines (37 loc) · 1.96 KB
/
particleInitialize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from pylab import *
def particleInitialize(p,initialization,L):
vel=1.0
dist = L/10.
if initialization == 'one':
p.addParticle(0,dist,0,0,0,0,1)
elif initialization == 'two':
p.addParticle(-dist,0.,0.,vel,0.,0.,1.)
p.addParticle(dist,0.,0,-vel,0.,0.,1.)
elif initialization == 'three':
p.addParticle(0.,dist*sqrt(3)/2,0.,0.,-vel,0.,1.)
p.addParticle(-dist,0.,0.,vel,0.,0.,1.0)
p.addParticle(dist,0.,0,-vel,0.,0.,1.)
elif initialization == 'four':
p.addParticle(-dist,0.,0.,vel,0.,0.,1.)
p.addParticle(dist,0.,0,-vel,0.,0.,1.)
p.addParticle(0.,dist,0,0.,-vel,0.,1.)
p.addParticle(0.,-dist,0,0.,vel,0.,1.)
elif initialization == 'six':
p.addParticle(0.,dist,0.,0.,-vel,0.,1.)
p.addParticle(0.,-dist,0.,0.,vel,0.,1.)
p.addParticle(dist/sqrt(2),dist/sqrt(2),0,-vel/sqrt(2),-vel/sqrt(2),0.,1.)
p.addParticle(-dist/sqrt(2),dist/sqrt(2),0,vel/sqrt(2),-vel/sqrt(2),0.,1.)
p.addParticle(-dist/sqrt(2),-dist/sqrt(2),0,vel/sqrt(2),vel/sqrt(2),0.,1.)
p.addParticle(dist/sqrt(2),-dist/sqrt(2),0,-vel/sqrt(2),vel/sqrt(2),0.,1.)
elif initialization == 'eight':
p.addParticle(-dist,0.,0.,vel,0.,0.,1.)
p.addParticle(dist,0.,0,-vel,0.,0.,1.)
p.addParticle(0.,dist,0,0.,-vel,0.,1.)
p.addParticle(0.,-dist,0,0.,vel,0.,1.)
p.addParticle(dist/sqrt(2),dist/sqrt(2),0,-vel/sqrt(2),-vel/sqrt(2),0.,1.)
p.addParticle(-dist/sqrt(2),dist/sqrt(2),0,vel/sqrt(2),-vel/sqrt(2),0.,1.)
p.addParticle(-dist/sqrt(2),-dist/sqrt(2),0,vel/sqrt(2),vel/sqrt(2),0.,1.)
p.addParticle(dist/sqrt(2),-dist/sqrt(2),0,-vel/sqrt(2),vel/sqrt(2),0.,1.)
else:
p.addParticle(-dist,0.,0.,vel,0.,0.,1.)
p.addParticle(dist,0.,0,-vel,0.,0.,1.)