- fetch 1crn
- run mv2origin.py; mv2origin 1crn
- run axes.py; axes
第2步:把分子放到原點
第3步:畫出XYZ的座標軸,驗證分子真的被放到原點上
以下是mv2origin.py的程式碼:
from pymol import cmd
from pymol.cgo import *
def mv2origin(selection):
"""
Move the molecule to the origin
"""
## assumes equal weights
model = cmd.get_model(selection+' and name ca')
x,y,z = 0,0,0
for a in model.atom:
x+= a.coord[0]
y+= a.coord[1]
z+= a.coord[2]
x = x/len(model.atom)
y = y/len(model.atom)
z = z/len(model.atom)
cmd.translate([-1*x, -1*y, -1*z], selection, camera=0)
cmd.orient("visible",animate=-1)
cmd.extend('mv2origin', mv2origin)
_EOF_
沒有留言:
張貼留言