This repository was archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplayG.py
More file actions
214 lines (197 loc) · 4.36 KB
/
playG.py
File metadata and controls
214 lines (197 loc) · 4.36 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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
cfg = 'ffinal_allH_rn_spc_xfx_NoTweakZIneulers'
M = np.load("mu2ave_"+cfg+".npy")
G = np.loadtxt("../Gmats/trimer/"+cfg+".gmat")
sqrt2o = 1/np.sqrt(2)
sqrt4o = 1/np.sqrt(4)
#########Just shared Protons
# k = np.zeros((2,2))
# np.fill_diagonal(k,1/np.sqrt(2))
# # print(k)
# k[0,1] = sqrt2o
# k[1,0] = -sqrt2o
# print(k)
# Mred = np.copy(M)[np.ix_([3,6],[3,6])]
# print(Mred)
# res = np.matmul(k,np.matmul(Mred,kT))
#########/Just shared protons
#########Including r,theta,phi of shared protons
# k = np.zeros((9,9))
# np.fill_diagonal(k,1/np.sqrt(2))
# k[0,0]=1.0 #rH8
# k[1,1]=1.0 #thH8
# k[2,2]=1.0 #phiH8
# pairs = [(3,6),(4,7),(5,8)]
# pairsrevd = pairs[::-1]
# for pair in pairs:
# k[pair[0],pair[1]]=sqrt2o
# k[pair[1],pair[0]]=-1.0*sqrt2o
# Mred = np.copy(M)[:9,:9]
# Gred = np.copy(G)[:9,:9]
# res = np.matmul(k,np.matmul(Mred,k.T))
# resG = np.matmul(k,np.matmul(Gred,k.T))
# print(res)
# plt.matshow(res)
# plt.colorbar()
# plt.show()
#########Including r,theta,phi of shared protons
###Everything except eulers##########
"""
0, rOH8
1, thH8
2, phiH8
3, rOH9
4, thH9
5, phiH9
6, rOH10
7, thH10
8, phiH10
9, R14
10, R15
11, th145
12, R26
13, R27
14, th267
15, Roo1
16, Roo2
17, thOOO
"""
# k = np.zeros((18,18))
# np.fill_diagonal(k,sqrt2o)
# for i in range(10,14):
# k[i,i] = 1.0
#
# k[0,0]=1.0 #rH8
# k[1,1]=1.0 #thH8
# k[2,2]=1.0 #phiH8
# k[11,11]=sqrt2o
# k[14,14]=sqrt2o
# pairs = [(3,6),(4,7),(5,8),(11,14),(15,16)]
# pairsrevd = pairs[::-1]
# for pair in pairs:
# k[pair[0],pair[1]]=sqrt2o
# k[pair[1],pair[0]]=-1.0*sqrt2o
#
# pairsF = [9,10,12,13]
# rowz = np.array([
# [1,1,1,1],
# [1,1,-1,-1],
# [1,-1,1,-1],
# [1,-1,-1,1]])*sqrt4o
# z=0
# for i in pairsF:
# k[i,pairsF]=rowz[z]
# z+=1
#
# Mtest = np.copy(M)
# Mtest2 = np.delete(Mtest, [9,10,11,12,13,14], axis=1)
# Mtest2 = np.delete(Mtest2, [9,10,11,12,13,14], axis=0)
# Mred = np.copy(Mtest2)
# res = np.matmul(k,np.matmul(Mred,k.T))
# print(res)
# plt.matshow(res)
# plt.colorbar()
# plt.show()
#add on eulers
k = np.zeros((24,24))
np.fill_diagonal(k,sqrt2o)
for i in range(10,14):
k[i,i] = 1.0
k[0,0]=1.0 #rH8
k[1,1]=1.0 #thH8
k[2,2]=1.0 #phiH8
k[11,11]=sqrt2o
k[14,14]=sqrt2o
"""
0, rOH8
1, thH8
2, phiH8
3, rOH9
4, thH9
5, phiH9
6, rOH10
7, thH10
8, phiH10
9, R14
10, R15
11, th145
12, R26
13, R27
14, th267
15, Roo1
16, Roo2
17, thOOO
18 theta1
19 Phi1
20 Chi1
21 theta2
22 Phi2
23 Chi2
"""
pairs = [(3,6),(4,7),(5,8),(11,14),(15,16),(18,21),(19,22),(20,23)]
pairsrevd = pairs[::-1]
for pair in pairs:
k[pair[0],pair[1]]=sqrt2o
k[pair[1],pair[0]]=-1.0*sqrt2o
pairsF = [9,10,12,13]
rowz = np.array([
[1,1,1,1],
[1,1,-1,-1],
[1,-1,1,-1],
[1,-1,-1,1]])*sqrt4o
z=0
for i in pairsF:
k[i,pairsF]=rowz[z]
z+=1
Mtest = np.copy(M)
Mtest2 = np.copy(M)
#A[idx,:][:,idx]
idx = np.concatenate((np.arange(9),np.arange(15,24),np.arange(9,15)))
Mred = Mtest2[idx,:][:,idx]
Gred = G[idx,:][:,idx]
# Mtest[[9,10,11,12,13,14]] = Mtest2[[18,19,20,21,22,23]]
# Mtest[[18,19,20,21,22,23]] = M[[9,10,11,12,13,14]]
# Mtest[:,[9,10,11,12,13,14]] = Mtest2[:,[18,19,20,21,22,23]]
# Mtest[:,[18,19,20,21,22,23]] = M[:,[9,10,11,12,13,14]]
# Mtest2 = np.delete(Mtest, [9,10,11,12,13,14], axis=1)
# Mtest2 = np.delete(Mtest2, [9,10,11,12,13,14], axis=0)
# Mred = np.copy(Mtest2)
# res = Mred
# resG = Gred
res = np.matmul(k,np.matmul(Mred,k.T))
resG = np.matmul(k,np.matmul(Gred,k.T))
print(res)
plt.matshow(res,cmap='hot')
plt.title("Transformed M")
plt.colorbar()
plt.matshow(np.abs(res),cmap='hot')
plt.title("Absolute Value of Transformed M")
plt.colorbar()
plt.savefig("AbsM"+cfg,dpi=400)
plt.matshow(resG,cmap='hot')
plt.title("Transformed G")
plt.colorbar()
plt.matshow(np.abs(resG),cmap='hot')
plt.title("Absolute Value of Transformed G")
plt.colorbar()
# plt.show()
plt.savefig("AbsG"+cfg,dpi=400)
resP = res - np.diag(np.diag(res))
resGP = resG - np.diag(np.diag(resG))
plt.matshow(resP,cmap='hot')
plt.title("Transformed M")
plt.colorbar()
plt.matshow(np.abs(resP),cmap='hot')
plt.title("Absolute Value of Transformed M")
plt.colorbar()
plt.savefig("RAbsM"+cfg,dpi=400)
plt.matshow(resGP,cmap='hot')
plt.title("Transformed G")
plt.colorbar()
plt.matshow(np.abs(resGP),cmap='hot')
plt.title("Absolute Value of Transformed G")
plt.colorbar()
# plt.show()
plt.savefig("RAbsG"+cfg,dpi=400)