Import .pdb file format into Rhino


Could anyone please recommend a good way to prepare a .pdb file for importing into Rhino? .pdb files are used with the PyMOL software for visualizing 3D protein structures from the Protein Data Bank. I would like to be able to visualize each atom of the protein from PyMOL as a dot or point in Rhino. Any help on this would be much appreciated.

Thank you.

There is an example here on how to make a plug-in to read PDB files
Is that what you’re looking for?

This is exactly the kind of thing I’m looking for, but the plugin says it only works with I have Rhino for Mac. Any thoughts on a Mac-compatible version. Thanks so much.

Rhino for Mac does not support plugins yet, so that is not going to work. What you could conceivably do is to convert your pdb to xyz format using e.g. OpenBabel, then get all the xyz coordinates out using a text editor like textwrangler (this supports block editing, which may come in handy) and read in a file with only xyz coordinates, each coordinate triple on one line, x,y and z separated by a comma (csv style). Rhino has a special import points functionality.

Ah OK thanks. So I got OpenBabel, and it converted the pdb file to XYZ Cartesian Coordinates format. The file looks like this now in the Text Editor:

N -6.87300 21.08200 25.31200
C -6.69600 22.00300 26.44700
C -6.31800 23.39100 25.92900
O -5.31300 23.98100 26.35200
N -7.14700 23.87100 25.01300
C -6.89100 25.19300 24.42800
C -6.80100 26.22800 25.54300
O -5.82900 26.99900 25.56100
C -7.92300 25.62600 23.32300
O -9.23800 25.38600 23.90800
C -7.70400 24.94300 21.97400

I tried to import this into Rhino, and it didn’t work. Could you please explain how to change this into the format that you mentioned so that Rhino can read it? Thanks again.

Remove also the N, C, O labels. Then import it, for example as a point cloud or as individual points.

-6.87300 21.08200 25.31200 
-6.69600 22.00300 26.44700 
-6.31800 23.39100 25.92900 
-5.31300 23.98100 26.35200 
-7.14700 23.87100 25.01300 
-6.89100 25.19300 24.42800 
-6.80100 26.22800 25.54300 
-5.82900 26.99900 25.56100 
-7.92300 25.62600 23.32300 
-9.23800 25.38600 23.90800 
-7.70400 24.94300 21.97400

Awesome, that worked. Thanks. But now the bonds between the points are missing. Is there a way to maintain the bonds between the atoms (points)?

Not in this approach, no. For that you would have to create like a script that is aware not only atom positions but also bonds.
I’m not sure if Mac Rhino already has Python scripting functionality. If so, you could start with combining or with the Rhino scripting functionality.

I see. So what exactly is meant by “combining with the Rhino scripting functionality”? When I open each of these links, I see quite a few scripts. Thanks.

I mean that you would use the PDB-related python code to read in a PDB file such that it has an object model in memory, followed by querying the object model for atom locations and between which atoms there is a bond. Using that information you can add the atom locations as points (or spheres) and the bonds as lines between them.

OK, thanks. I’m pretty new to Rhino/programming. So I need to write the PDB-related python code myself? Once I have that code, how can I run it in Rhino to read in the PDB file?

It looks like VMD (free) will export to .obj format:

I’ve never used it, so I don’t know what you’ll wind up with when you import it into Rhino.

Using VMD to export to .obj format was able bring in the atoms but not the bonds between the atoms. Is there some way I can bring in the bonds? Thank you. Here is what it looks like in Rhino:

There’s a VMD mailing list:

You might want to search it or ask your question there. I have no experience with it whatsoever.

OK cool. Thanks.

Ahmed, i was just curious about this topic. Did you managed to get the bonds between atoms? Or did you find another workaround ? I need to model molecules in rhinoceros too :frowning: