-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgyration_nation.py
148 lines (140 loc) · 7.12 KB
/
gyration_nation.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
#Get data from XVG file
import matplotlib.pyplot as plt
import numpy as np
dataset = """ 0 1.41093 1.20714 1.03354 1.20667
10 1.4192 1.21968 1.04179 1.20636
20 1.4273 1.22192 1.0439 1.2213
30 1.42217 1.2183 1.04668 1.21052
40 1.42889 1.23018 1.05274 1.20906
50 1.42067 1.2154 1.05581 1.20193
60 1.42144 1.21212 1.06716 1.19705
70 1.43057 1.22883 1.06561 1.20314
80 1.42924 1.2229 1.06538 1.2062
90 1.43067 1.22752 1.06414 1.20601
100 1.43844 1.22478 1.07032 1.2217
110 1.43718 1.22494 1.06865 1.22003
120 1.43413 1.22219 1.07041 1.21407
130 1.43192 1.21103 1.0776 1.21365
140 1.44138 1.20379 1.09935 1.22372
150 1.44022 1.19583 1.10823 1.22077
160 1.43561 1.19206 1.10906 1.21283
170 1.44308 1.19943 1.10644 1.22561
180 1.44064 1.18656 1.11034 1.22888
190 1.43829 1.17938 1.10366 1.23626
200 1.43341 1.18199 1.09555 1.22963
210 1.43412 1.20115 1.07193 1.23353
220 1.44152 1.19779 1.08403 1.24344
230 1.43081 1.1879 1.07453 1.23641
240 1.42881 1.18515 1.07339 1.2354
250 1.43577 1.21279 1.06677 1.23045
260 1.43211 1.20179 1.07187 1.22829
270 1.43313 1.18834 1.09038 1.22745
280 1.43556 1.20501 1.0773 1.22843
290 1.43253 1.20446 1.06522 1.23242
300 1.43217 1.19589 1.06888 1.23676
310 1.42919 1.20013 1.06197 1.23169
320 1.43267 1.18793 1.0817 1.23444
330 1.43494 1.19289 1.07414 1.24152
340 1.42708 1.17865 1.07929 1.2325
350 1.43902 1.19792 1.08629 1.23553
360 1.42188 1.1839 1.06997 1.22354
370 1.43618 1.20464 1.06861 1.23779
380 1.43917 1.19805 1.08146 1.23999
390 1.43156 1.20665 1.06175 1.23102
400 1.42831 1.19377 1.06591 1.23242
410 1.43395 1.19216 1.07788 1.23667
420 1.43293 1.19876 1.0776 1.22815
430 1.43365 1.1916 1.07843 1.23604
440 1.42883 1.18621 1.08867 1.221
450 1.43034 1.19537 1.08713 1.21696
460 1.42873 1.18998 1.08921 1.21659
470 1.42601 1.18867 1.08372 1.21639
480 1.42871 1.21049 1.06906 1.2142
490 1.42285 1.20934 1.04845 1.21954
500 1.42702 1.21284 1.04964 1.22477
510 1.42518 1.21014 1.04794 1.22462
520 1.43547 1.21825 1.04746 1.24089
530 1.43698 1.23224 1.03934 1.2374
540 1.43363 1.21932 1.05261 1.2312
550 1.43405 1.22054 1.05029 1.23294
560 1.43445 1.23353 1.03271 1.2358
570 1.44299 1.24367 1.02335 1.2532
580 1.44351 1.24697 1.01674 1.25647
590 1.43631 1.23959 1.00467 1.257
600 1.43578 1.24429 1.00886 1.24776
610 1.42433 1.23391 1.00905 1.23156
620 1.43604 1.24079 1.01597 1.24606
630 1.43513 1.24479 1.01687 1.23922
640 1.43284 1.24533 1.0029 1.24476
650 1.43139 1.2372 1.00786 1.24553
660 1.42739 1.23611 1.00178 1.24232
670 1.43389 1.23843 1.01346 1.24551
680 1.43936 1.23145 1.02259 1.25751
690 1.4362 1.23313 1.01826 1.25214
700 1.42358 1.21485 1.01922 1.24036
710 1.4228 1.2136 1.01942 1.23962
720 1.42624 1.21421 1.02688 1.2408
730 1.4262 1.20745 1.03214 1.2429
740 1.43249 1.21095 1.03814 1.24896
750 1.43137 1.19873 1.04884 1.24925
760 1.42762 1.206 1.02892 1.25023
770 1.42749 1.19588 1.04297 1.248
780 1.42689 1.21588 1.01457 1.25073
790 1.42836 1.21828 1.01312 1.25291
800 1.42325 1.21861 1.00853 1.24465
810 1.42179 1.21241 1.01596 1.24132
820 1.42203 1.21563 1.01385 1.24044
830 1.41958 1.21837 1.00032 1.24312
840 1.42151 1.21339 1.01366 1.24159
850 1.42789 1.22254 1.00919 1.25086
860 1.42665 1.219 1.00871 1.25187
870 1.43325 1.22284 1.01118 1.26119
880 1.42642 1.21677 1.0143 1.24901
890 1.43202 1.23184 1.00199 1.25697
900 1.43333 1.22626 1.01539 1.25465
910 1.43228 1.23278 1.00644 1.25307
920 1.43943 1.23569 1.01105 1.26284
930 1.44031 1.24331 1.00172 1.2648
940 1.43384 1.23337 1.01056 1.25274
950 1.42992 1.2299 1.0116 1.24633
960 1.43089 1.23116 1.00752 1.25061
970 1.42219 1.21861 1.00799 1.24266
980 1.42459 1.21466 1.01905 1.24301
990 1.43831 1.24059 1.00817 1.25779
1000 1.43591 1.24163 1.00429 1.25435"""
overall_gyration = []
x_gyration = []
y_gyration = []
z_gyration = []
str_num = 0
for char in dataset:
if dataset[str_num:str_num + 2] == "0 ":
overall_gyration.append(float(dataset[str_num + 2: str_num + 14]))
x_gyration.append(float(dataset[str_num + 14: str_num + 25]))
y_gyration.append(float(dataset[str_num + 25: str_num + 38]))
z_gyration.append(float(dataset[str_num + 38: str_num + 51]))
str_num += 1
else:
str_num += 1
overall_mean = np.mean(overall_gyration)
overall_variance = []
for point in overall_gyration:
overall_variance.append(point - overall_mean)
x_mean = np.mean(x_gyration)
x_variance = []
for point in x_gyration:
x_variance.append(point - x_mean)
y_mean = np.mean(y_gyration)
y_variance = []
for point in y_gyration:
y_variance.append(point - y_mean)
z_mean = np.mean(z_gyration)
z_variance = []
for point in z_gyration:
z_variance.append(point - z_mean)
plt.plot(np.linspace(0, 1000, 101), overall_variance)
plt.plot(np.linspace(0, 1000, 101), x_variance)
plt.plot(np.linspace(0, 1000, 101), y_variance)
plt.plot(np.linspace(0, 1000, 101), z_variance)
plt.legend(["overall_variance", "x_variance", "y_variance", "z_variance"])
plt.show()