您所呈现的实际上与分子结构有什么关系(即使用PyMol的动机是什么)?
如果您正在绘制一些分子结构,我建议只输出带有球体坐标的自定义PDB文件(您可以使用每个ATOM线的B因子字段作为控制PyMol中每个原子着色的方法).
如果你没有绘制分子结构,最好使用PyMol的CGO接口.
从PyMol文档:
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.
一个简单的例子:
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)