from cresset import flare
用鼠标单击蛋白A链PHE82侧链苯环的六个碳原子,使之处于被选中状态:
atoms = flare.main_window().picked_atoms
for a in atoms:
print(a.pos)
(-1.7269999980926514, 67.61199951171875, 86.1969985961914) (-1.371000051498413, 68.43499755859375, 85.13099670410156) (-1.8480000495910645, 68.12799835205078, 83.86199951171875) (-2.6730000972747803, 67.01300048828125, 83.65299987792969) (-3.0260000228881836, 66.19499969482422, 84.7229995727539) (-2.552000045776367, 66.49400329589844, 86.0009994506836)
求PHE820侧链苯环的几何中心cent1
import numpy as np
cent1 = np.array([0,0,0])
for i in range(0,len(atoms)):
cent1 = cent1 + np.array(atoms[i].pos)
cent1 = cent1/len(atoms)
print(cent1)
[-2.19950004 67.31283315 84.92783229]
用鼠标单击选择配体杂环的六个原子:
atoms = flare.main_window().picked_atoms
求配体六员杂环的几何中心点cent2:
cent2 = np.array([0,0,0])
for i in range(0,len(atoms)):
cent2 = cent2 + np.array(atoms[i].pos)
cent2 = cent2/len(atoms)
print(cent2)
[ 0.41699999 64.70199903 84.9350001 ]
计算两个苯环中心center1与center2之间的距离d
d = np.linalg.norm(cent1 - cent2)
print(d)
3.696292550843733