autodataming的个人博客分享 http://blog.sciencenet.cn/u/autodataming

博文

Pymol函数cmd.load_cgo中的第3个参数的说明

已有 2246 次阅读 2014-11-8 18:41 |个人分类:DrugDesign|系统分类:科研笔记

http://www.liv.ac.uk/~afcalder/apt3.html


############

cmd.load_cgo(obj,'segment',   1)

Additional states can be appended quite simply like this. Note how thewireframe 'box' is recalled without having to restate the same vertexcoordinates and that the object name 'atoms' is reused and overwrittenwith fresh sphere positions and loaded into a new PyMOL 'state' (2).Note the comment line '# FRAME    2' which is optionaland is solely there to assist any debugging and perhaps should be morecorrectly 'STATE   2' or anything you desire instead.


# FRAME     2
atoms = [
  COLOR,    0.100,    1.000,    0.000,
  SPHERE,   30.334,   30.497,   30.681,0.30,
  COLOR,    1.000,    0.000,    0.000,
  SPHERE,   30.250,   30.250,   30.250,0.20,
   ]

obj = box + atoms

cmd.load_cgo(obj,'segment',   2)

###############################################

第一个参数obj,数组,对要创建的物体的形状的详细描述

第二个参数segname,是对这个物体的命名

第三个参数,数字,代表frame,state

##################################################



CGO Reference

A CGO is simply a Python list of floating point numbers, which are compiled by PyMOL into a CGO object and associated with a given state.

Lowercase names below are should be replaced with floating-point numbers. Generally, the TRIANGLE primitive should only be used only as a last restore since it is much less effective to render than using a series of vertices with a BEGIN/END group.

BEGIN, { POINTS | LINES | LINE_LOOP | LINE_STRIP | TRIANGLES | TRIANGLE_STRIP | TRIANGLE_FAN }, VERTEX, x, y, z, COLOR, red, green, blue, NORMAL, normal-x, normal-y, normal-z, END, LINEWIDTH, line-width, WIDTHSCALE, width-scale, # for ray-tracing SPHERE, x, y, z, radius # uses the current color CYLINDER, x1, y1, z1, x2, y2, z2, radius, red1, green1, blue1, red2, green2, blue2, TRIANGLE, x1, y1, z1, x2, y2, z2, x3, y3, z3, normal-x1, normal-y1, normal-z1, normal-x2, normal-y2, normal-z2, normal-x3, normal-y3, normal-z3, red1, green1, blue1, red2, green2, blue2, red3, green3, blue3,

-------------------------------------------------------------------

obj第二个参数不是很理解,下面画圆球也用的LINES,

-------------------------------------------------------------

#! python2 pymol
#coding: utf-8

from pymol.cgo import *
from pymol import cmd

COLOR_dict={}
COLOR_dict['red']=[255,0,0]
COLOR_dict['green']=[0,255,0]
COLOR_dict['blue']=[0,0,255]
COLOR_dict['yellow']=[255,255,0]
RADIUS=0.3


def showpointcgo(points,name,color):
   obj = [BEGIN, LINES,COLOR,]    #initialize obj, color is white
   obj.extend(COLOR_dict[color])
   for a in points:                            #visualization of oulist (points that are too far off the protein (cube edges))
       obj.append(SPHERE)
       obj.append(float(a[0]))
       obj.append(float(a[1]))
       obj.append(float(a[2]))
       obj.append(RADIUS)
   obj.append(END)
   
   print obj
   #DO NOT try to visualize empty lists --> PyMOL would crash
   if len(points) != 0:        
       cmd.load_cgo(obj, name)
       #cmd.hide('cgo')
   cmd.zoom('all')
   




http://wap.sciencenet.cn/blog-950202-842109.html

上一篇:pymol的opengl CGO球体的画法
下一篇:pymol的opengl CGO--线段的画法

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2021-10-27 13:01

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部