-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.py
49 lines (43 loc) · 1.52 KB
/
model.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
# model.py
"""Think of this like the dft function, which always provides the same answer for a given input, and reads from
various molecular files. """
import json
def dftish(core, shell, dielectric, passivization, twodimensional) -> float:
c = str(core)
s = str(shell)
d = str(dielectric)
p = str(passivization)
t = str(twodimensional)
with open('cs.json') as cj:
cs = json.load(cj)
with open('diel.json') as dj:
diel = json.load(dj)
with open('twod.json') as tj:
twod = json.load(tj)
with open('lig.json') as lj:
lig = json.load(lj)
# print(lig)
# print(cs)
return 0.8*0.002*((float(cs[c]) * float(cs[s])) / 2 + (float(cs[c]) * float(cs[s]) * float(twod[t])) / (
float(cs[c] + cs[s]))) * float(lig[p] + 1) / (100.0 - float(diel[d]) * 0.2)
def streamdft(inputarray) -> float:
retlist = []
with open('cs.json') as cj:
cs = json.load(cj)
with open('diel.json') as dj:
diel = json.load(dj)
with open('twod.json') as tj:
twod = json.load(tj)
with open('lig.json') as lj:
lig = json.load(lj)
for i in inputarray:
c = str(i[0])
s = str(i[1])
d = str(i[2])
p = str(i[3])
t = str(i[4])
retlist.append(-2 + 0.002*((float(cs[c]) * float(cs[s])) / 2 + (float(cs[c]) * float(cs[s]) * float(twod[t])) / (float(cs[c] + cs[s]))) * float(lig[p] + 1) / (100.0 - float(diel[d]) * 0.2))
return retlist
if __name__ == "__main__":
# print(dftish(1, 1, 1, 1, 1))
pass