-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrial_plot_alleigenvalues.py
152 lines (108 loc) · 4.94 KB
/
trial_plot_alleigenvalues.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import database_preparation as datprep
import jax_derivative as jder
import jax_additional_derivative as jader
import jax_representation as jrep
import plot_derivative as pltder
import jax.numpy as jnp
import sys
from plot_derivative import prepresults
'''with the following variable the derivatives to be included in the final plot are chosen'''
which_d = [0,1,2,3,4] # 0 = dZ, 1 = dR, 2 = ddR, 3 = dZdR, 4 = dZdZ
'''this variable sets the xaxis for plotting. norm of CM matrix or number of atoms in molecule can be chosen'''
xnorm = "norm" #"norm" #"nuc"
'''this variable defines how nonzero values are counted, as absolutes or as percentage'''
yvalues = "perc" #"abs"
#list for correct names
der = ["dZ", "dR", "dRdR", "dZdR", "dZdZ"]
dname = der[which_d[0]]
'''define which representations are considered'''
representations = [0] #0 = CM, 1 = EVCM, 2 = BOB, 3 = OM, 4 = EVOM
#this list is necessary to assign the correct labels
reprolist = ['CM', 'EVCM', 'BOB', 'OM', 'EVOM']
'''below are lists of pickled results files or their partial paths'''
results_file =["/home/linux-miriam/Databases/Pickled/qm7_CM_results.pickle",\
"/home/linux-miriam/Databases/Pickled/qm7_CM_EV_results.pickle",\
"/home/linux-miriam/Databases/Pickled/BoB_numder_res",\
"/home/linux-miriam/Databases/Pickled/OM_numder_res",\
"./Pickled/fourcompounds_EV_results.pickle",\
"./Pickled/trial_numder.pickle"]
#for OM and BoB no full pickled file could be made
completeresults = []
ydatalist = []
xdatalist = []
for i in representations:
repro = reprolist[i]
#print("representation:", repro)
#print("len ydatalist:", len(ydatalist))
filename = results_file[i]
if i < 2:
#repro is pickled in one file
results = datprep.read_compounds(filename)
#get xdata and ydata with labels (ydatalist[i][1] stores labels)
xdata, ydata, newresults = prepresults(results, rep = repro,\
dwhich = which_d, repno = i,\
norm = xnorm, yval = yvalues)
xdatalist.append(xdata)
ydatalist.extend(ydata)
else:
#for BOB, EVOM and OM results were stored in files containing 100 compounds each
j = 0
#collect and append numbers to one array, to later merge to one dataset in yaxis
fullydata = []
fullxdata = []
ydatalabel = ""
for k in [100, 200, 300, 400, 500, 600, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900,\
2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600,\
3700, 3800, 3900]:
if k < 3900:
numbers = "%i-%i" % (k, k+100)
else:
numbers = "%i-3993" %(k)
partialfilename = filename + numbers
print(partialfilename)
results = datprep.read_compounds(partialfilename)
j += 1
xdata, ydata, newresults = prepresults(results, rep = repro,\
dwhich = which_d, repno = i,\
norm = xnorm, yval = yvalues)
#datprep.store_compounds(newresults, partialfilename)
fullxdata.extend(xdata)
print("attention: if there are problems with the xdata list and ydatalist length when plotting\
check whether different lengths of data are included\
for BOB; EVOM and OM the length may vary depending on the range depickted")
for y in ydata:
fullydata.extend(y[0])
ydatalabel = y[1]
#fullydata contains list of [ydata, ylabel] pairs, which need to be merged to one
ydatalist.append([fullydata, ydatalabel])
xdatalist.append(fullxdata)
print("len xdatalist:", len(xdatalist))
print("len ydatalist:", len(ydatalist))
xdatalist = xdatalist*5
#all derivatives dZ of all repros in one panel
if xnorm == "nuc":
xtitle = "Number of Atoms in Molecule"
else: #xnorm = "norm" or something else that is not yet defined
xtitle = "Norm of Coulomb Matrix"
pltder.plot_percentage_zeroEV(xdatalist, ydatalist,\
title = "CM Derivatives on QM7 Dataset",\
savetofile = dname +"_derivatives_CM",\
oneplot = True,\
representations = representations,\
xaxis_title = xtitle)
'''
#all derivatives of one repro in one image
plotname = "./Images/QM7_derivatives/%s_derivatives"%repro
pltder.plot_percentage_zeroEV(xdatalist, ydatalist,\
title = repro + " Derivatives on QM7 Dataset",\
savetofile = plotname + "one",\
oneplot = True,\
representations = 1)
# xaxis_title = "Number of Atoms in Molecule")
pltder.plot_percentage_zeroEV(xdata, ydata,\
title = repro +" Derivatives on QM7 Dataset", \
savetofile = plotname + "panel",\
oneplot = False,\
representations = 1)
# xaxis_title = "Number of Atoms in Molecule")
'''