-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbinary.py
More file actions
32 lines (26 loc) · 2.45 KB
/
Copy pathbinary.py
File metadata and controls
32 lines (26 loc) · 2.45 KB
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
import Scripts.MainScripts as ms
import timeit
start_time = timeit.default_timer()
#binary gas
calc = ms.CalcConfig()
calc.method = "trg"
calc.metModification = "default"
calc.model = "binary"
calc.lattice = "square"
calc.metParam = 10
#model params
T = 100.0
coverage_res = []
for mu in ms.np.arange(-40.00, 30.01, 1.0):
m_par = [mu, 10.0, 4.0, 6.0, 0, 0]
obs = ms.thermodynamics(calc, T, m_par, coverage = True, susceptibility = True, entropy = True, heat_capacity = True)
calc_time = timeit.default_timer() - start_time
coverage_res.append(obs["coverage"])
print(mu, obs["coverage"], obs["entropy"], obs["susceptibility"], obs["heat_capacity"], calc_time)
etalon_coverage = [-0.00027477616892923606, 6.762482485100918e-05, 8.050564659356496e-07, -0.0, -0.0008243788225392734, -0.0010304735287292033, 1.3322676295501878e-12, 0.00027478874775610507, -0.0, -0.00027479267883379066, -0.0010819972056097527, -4.440892098500626e-13, -0.0, -0.0043966870575395944, -0.0010304735287292033, 0.004396687056651416, -6.869797353203921e-05, -0.0008243788220951842, -0.0002747929381818892, 4.884981308350689e-12, 1.7763568394002505e-11, -0.00027479261976992575, -0.0010991715670982671, -0.0008243781648431536, -0.0010948759321394164, 7.30260296677443e-09, 2.4298341116946176e-08, 0.0002748738925362204, 2.695195178148424e-07, -0.0008234814909968691, -0.004325001256244576, 7.864488038578088e-05, 0.0010635883032072968, -0.0007141436828561609, 0.0003668278809598746, -0.016298818947380056, 0.021348328527182048, 0.013190626322323595, 0.04137418940652893, 0.11548962362972759, 0.24999980702267166, 0.3845103325539334, 0.4586259302588047, 0.48680943729007, 0.495963649129294, 0.49878077599796455, 0.49983926898589104, 0.49988976556480935, 0.49996688561737557, 0.49999005407208585, 0.4999970146455368, 0.4999991099730039, 0.49999975479675385, 0.5000000000006111, 0.5000002452018038, 0.48243131635317127, 0.5008273641582406, 0.5164975223328483, 0.5000331141813419, 0.5001102337898189, 0.5003668241156944, 0.5012192385818182, 0.5040371199012128, 0.5132184222187419, 0.5422943199384633, 0.6558618064307353, 0.7734282524367586, 0.8652771340358356, 0.9362175552194429, 0.9760528057825013, 0.9921768783289764]
etalon_coverage = ms.np.array(etalon_coverage)
coverage_res = ms.np.array(coverage_res)
difference = sum(ms.np.abs(coverage_res - etalon_coverage))
assert difference < 0.5, "ERROR! Test binary.py is broken now!"
print("Test binary.py is", end = "")
print("\033[92m {}\033[00m" .format("OK"), "!", sep = "")