-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRMSD.py
More file actions
executable file
·45 lines (37 loc) · 1.17 KB
/
Copy pathRMSD.py
File metadata and controls
executable file
·45 lines (37 loc) · 1.17 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
from math import sqrt
def atomN (list1, list2):
resultN = []
for i in range(0, 3):
N = ((list1[0][i] - list2[0][i]) ** 2)
resultN.append(N)
return resultN
def atomCA (list1, list2):
resultCA = []
for i in range(0, 3):
N = ((list1[1][i] - list2[1][i]) ** 2)
resultCA.append(N)
return resultCA
def atomC (list1, list2):
resultC= []
for i in range(0, 3):
N = ((list1[2][i] - list2[2][i]) ** 2)
resultC.append(N)
return resultC
def atomO (list1, list2):
resultO = []
for i in range(0, 3):
N = ((list1[3][i] - list2[3][i]) ** 2)
resultO.append(N)
return resultO
# x, y, z coordinates of glycine atoms N, CA, C and O, respectively
list1 = [[108.304, 100.827, 67.992],[108.477, 100.389, 69.362],[109.907, 100.555, 69.817],[110.821, 100.799, 69.027]]
list2 = [[107.670, 101.359, 70.074],[108.477, 100.389, 69.362],[109.513, 101.011, 68.450],[110.667, 100.572, 68.425]]
reN = sum(atomN(list1, list2))
reCA = sum(atomCA(list1, list2))
reC = sum(atomC(list1, list2))
reO = sum(atomO(list1, list2))
x = [reN, reCA, reC, reO]
total = sum(x)
quoc = abs(total) / len(list1)
rmsd = sqrt(quoc)
print(f'The RMSD between the x, y, z coordinates of two glycine residues is: {rmsd}')