meatball1982 发表于 2016-3-11 16:41:14

pymol gromacs 轨迹 自动存储 画图 papa的儿子

#####################################
# outline
# use pymol to auto save a trj pdb into figures
#
# example :
# pymol -c Py_draw.py -- iamref.pdb iamtraj.pdb iamanme 3000 iamfigname
#####################################
import pymol
import cmd
import sys, time, os
#####################################
# inputs
# pdb      : a structure file. .pdb .gro
# trj      : a trajectory file. .pdb(multi frames), .trr
# name   : the name of the trj u import into pymol, it is anything u like
# ray_size : ray number, usually bigger, more clear
# fig_name : the output figure name
pdb = sys.argv
trj = sys.argv
name = sys.argv
ray_size = sys.argv
fig_name = sys.argv
####################################
# load and plot
cmd.load(pdb,name)# load reference structure
cmd.load(trj,name)# load traj file
cmd.show("cartoon",name)#use cartoon to plot pdb
cmd.hide("line",name)# hide the line
cmd.color("red","ss h")# set alpha red
cmd.color("yellow","ss s")# set betayellow
cmd.color("green","ss l+''")# set other green
cmd.set("ray_opaque_background","off")# background transpancy
for x in range(1,12,2) :# plot range for 1 to 12 int 1
        cmd.frame("%d" %x )
        cmd.zoom(name,state=-1)# zoom, show a big pdb in each frame
        cmd.ray(ray_size)# clearer
        cmd.png("fig_name"+str(x-1)+".png")# output fig
cmd.quit()# quit pymol
####################################
# logs
# typed by : meatball1982@163.com
#
有一个轨迹, 有一个ref的pdb,如何自动将轨迹中的每隔2frame的图存出来.


页: [1]
查看完整版本: pymol gromacs 轨迹 自动存储 画图 papa的儿子