-
Notifications
You must be signed in to change notification settings - Fork 1
/
test2.py
62 lines (53 loc) · 1.52 KB
/
test2.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import statevector as sv
import kernels2 as k
import KMC
import sys
import os
import importlib as port
utils=port.import_module('utils.utes')
from astropy.table import Table, Column
M=k.Monomers(400)
x=sv.StateVector(M(),delete_zeros=True)
model=KMC.Model(x,3)
add=k.MonomerAddition(0.1,3)
sub=k.MonomerSubtraction(0.0001,3)
nuc=k.Nucleation(.001,3)
frag=k.Fragmentation(.1,3)
coag=k.Coagulation(1,3)
# print(x)
model.add_propensity(add)
model.add_propensity(sub)
model.add_propensity(nuc)
model.add_propensity(frag)
model.add_propensity(coag)
model.add_mechanisms(sv.SmoluchowskiModel(x,3))
# print(model.mechanisms)
for i in range(int(sys.argv[2])):
looping=True
countr=0
while(looping):
countr+=1
model.calculate_probability()
model.choose()
model.time_step()
model.advance()
# print(x)
#inp=input("0 to quit: ")
# if inp=="0":
# looping=False
# if inp=="1":
# print(model.data)
if countr>300:
looping = False
fn=sys.argv[1]
os.makedirs(utils.wd()+'/results/'+fn,exist_ok=True)
# model.data.save(utils.wd()+'/results/'+fn+'/'+fn+str(i)+'.json',model.data_list)
model.save(utils.wd()+'/results/'+fn+'/'+fn+str(i)+'.json')
x=sv.StateVector([500],delete_zeros=True)
model=KMC.Model(x,3)
model.add_propensity(add)
model.add_propensity(sub)
model.add_propensity(nuc)
model.add_propensity(frag)
model.add_propensity(coag)
model.add_mechanisms(sv.SmoluchowskiModel(x,3))