开发者

Draw a colored sphere from cartesian coordinates in pymol

开发者 https://www.devze.com 2022-12-16 03:00 出处:网络
I was looking in 开发者_StackOverflow中文版the wiki how to convert the following information about beads, cartesian coordinates + energy :

I was looking in 开发者_StackOverflow中文版the wiki how to convert the following information about beads, cartesian coordinates + energy :

23.4 54.6 12.3 -123.5 54.5 23.1 9.45 -56.7 .......

to a draw in pymol that contains for each atom a sphere of radius R, centered on its coordinates, and with color, in a rainbow gradient.

Thanks


Does what you're rendering actually have anything to do with molecular structure (i.e. what is the motivation for using PyMol)?

If you are drawing some molecular structure, I would recommend just outputting a custom PDB file with the sphere coordinates (you can use the B-factor field per ATOM line as a way of controlling per-atom coloring in PyMol).

If you are not drawing a molecular structure, you would be best off using the CGO interface of PyMol.

From the PyMol documentation:

CGO spheres are generated by the SPHERE command.

SPHERE, x,y,z,d

where x,y,z are the coordinates of the sphere centre and d is the diameter of the sphere. Note how a COLOR command is used to set the colour of a sphere. As with LINES you only need a COLOR command when the colour of the next sphere to be drawn changes.

A simple example:

from pymol.cgo import *
from pymol import cmd

spherelist = [
   COLOR,    0.100,    1.000,    0.000,
   SPHERE,   30.304,   30.407,   30.531,0.30,
   COLOR,    1.000,    0.000,    0.000,
   SPHERE,   30.250,   30.250,   30.250,0.20,
    ]

cmd.load_cgo(spherelist, 'segment',   1)
0

精彩评论

暂无评论...
验证码 换一张
取 消