views:

254

answers:

1

Hi,

I was looking in 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

+2  A: 

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)
awesomo