pdb2blend conversion tool v1.2

I start a new thread for the new version.
The thread according pdb2blend v1.0 is here: http://blenderartists.org/forum/showthread.php?t=67279

I fixed these file convention problems of the first version.
Now you should be able to import pdb files from databases like PDB (http://www.rcsb.org) properly.
Please try it out and report bugs!
For those who didn’t read the first thread:

It’s more a wizard than a conversion tool as the pdb-files only provides atom types and positions and connectivity tables. The script builds balls of different sizes for any atom with materials linked to the atom types. When chosen the atoms are connected by sticks with rounded ends.
The tool is now working somehow. You can download it at http://www.malte-reimold.de/blender/pdb2blend.html as well as some pdb molecule files for testing purposes for those who are not familiar with molecule models.

I built this script with blender 2.41 and Python 2.4 on WinXP.

Please try the script and give me some feedback about functionality on other platforms or versions.

Thanks very much for this script ! :slight_smile:

It works so far very well. A friend of mine was searching for that in Maya and XSI where there is an expensive plugin. He’s now very interested to use Blender :slight_smile:

Thanks !

Hi, thanks for the update.
The script works well. Very good job.

Files from this large database work::slight_smile:

There is a zip file with at least 200 .pdb files that work here::slight_smile:
All the ones I tested worked. Never get to test all of them.

Your dna test file was 3 min to build sticks and bones.

Some files from::frowning:
Dont work…
but I have enough .pdb files to last me forever anyway.:slight_smile:

Thanks M.A.

Thanks for the update, the previous one didn’t work for me at all. This works here in Blender 242a, Python 2.3, SuSE Linux 9.2. Whatever code in this is responsible for it being backward compatible with Python 2.3, please don’t change this :slight_smile:

Now I have a highly flexible way of working with PDB models in addition to exporting RIB’s from VMD, and POVRay variants like POVChem, Grasp4POV, POVscript, and PyMOL and Jmol.

Thanks again,


Hello, thanks for your script. It imports pdbs from CORINA (http://www.molecular-networks.com/online_demos/corina_demo.html ) with the right positions but it appears it can only recognize one atom type. Is this a problem with the pdbs? I’m using Blender 2.42a. Regards, rwst
P.S. I just see the pdbs work if you remove and everything after ’ 0.00 0.00’ in the ATOM lines. Thanks anyway!

That is very cool!

I remember years ago having to parse the PDB file format for an online Shockwave 3D viewer ( interactive ) - as the file only stores positiions, it was challenging figuring out how to recreate structures such as bonds etc from them optimally - also, some of the PDB files stored huge amounts of data.

If anyone on Mac or PC is interested, you can view the interactive demo here…

You can specify PDB ids and load them directly - they will stream from the main server ( you’ll probably get a security alert, as it tries to load the data from a different server, the main one in the US ).

Keep up the great work with the Blender plugin - I’m sure we’ll see some great renders of molecules with lots of fancy rendering features ( AO, NPR etc )

for a very fast way to build a structure in blender i use a small script which makes a vertex for each ATOM entry in a pdb file. This takes about 1 second for a file with 7000 atoms.
After that i add a sphere as child to that mesh and use DupliVert to display it at each vertex. The advantage is that you still have control over the appearance of balls after creation.
For anyone who has problems with some pdb files, Babel or OpenBabel solves a lot of them.

Hey, do you know of any way to get solvent-accessible structures (from MSMS or the like) into blender?

Thanks for your comments and bug reports!
I will try to improve pdb2blend according all of your suggestions and to eliminate the reported bugs!

I was thinking about this strategy too - especially for big structures.

Not yet. It should be possible to build such surfaces from structures in blender. However if the programs you use store those surfaces in special file formats it should be possible to extract the information one needs too build up a surface in blender.

Whats about starting your script with building vertices for ATOMs and edges for CONECTs. And in a 2nd run you assign Meshes to these.
For the Atoms you can DupliVert everything you love to but I am not sure how easy it is to handle the connections.

VMD can export solvent surfaces as STLs or OBJs - but the geometry is rather poor.

I solved my problem using PMV, written by the same people who maintain msms. It can calculate surfaces and output STLs of pretty decent quality.

i have mail you some days before for extending the script for some more files.
and functionality.

sorry for not answering your mail yet. I had a lot of work and so it left my mind too fast.
However - why not? I will mail you a concept of the way I think this script could be improved.

This is indeed the way I want to go. However my idea is to place two additional vertices at the middle of the connection and use vertex groups for atom types. This way multimaterial meshes can be built leading to simple stick-models when using wire-materials.
I want to separate import- and modelling routines, making it easier to handle molecules and even to change the 3d structure in blender.

Intermalte, are there any updates on this script’s development? It doesn’t seem to be compatible with Blender 2.43 . . . will this happen soon?

Thanks in advance for any info!


what would be cool is if this script allowed for interaction mapping of the imported molecules, its just that it would allow for great animations for talks/presentations.

Has anyone got it working under 2.43?

Works fine with 2.44, 2.45. I presume the problem may be with the pdb files you are trying to import, the links above to pdb files work well.

This is a great script, just what I needed for my current project! But, I am having a problem. It doesn’t make the sticks connecting all the spheres. I downloaded this .pdb and can import it correctly into Blender with this script. However, when you compare what you get in Blender with the view of it here, you can see that there is a big difference. Only a few atoms are connected thanks to the CONECT tags at the botton of the .pdb file, but not all of them like they are shown in the WebMol viewer. I would really like all of the sticks to be made, but do not know how to do this. Thanks for your help and work on this script!

By definition, PDB files must only contain atom coordinates, not bond records (which, as you correctly noticed, are defined as CONECT records). PDB files CAN contain extra info though. Most molecular viewers draw bonds between atoms by making the assumption that atoms with a certain distance must be bonded. Usually this assumption is sufficient to draw a reasonable molecule, for things like DNA, proteins and peptides. But for drugs, co-factors, and other small and strained molecules, it is not always a safe assumption that atoms are bound if they are close together. This is really a general limitation in the PDB file format.

You have at least two choices to draw bonds correctly: 1) explicitly write them out as CONECT records in the PDB file then load that file, or 2) draw them after the PDB file has been interpreted, by making the distance assumption. Roughly speaking, you can assume that a useful distance to assume is when d is less than the sum of the van der Waals radii of the atoms in question (that is, draw a bond when there is interpenetration of vdW spheres). Van der Waals radii can be looked up all over the web, or in the classical reference (A.Bondi, J. Phys. Chem., 68, 441-452, 1964).

I guess another alternative would be to import your PDB file into some molecular modeling program, and have it write out explicit CONECT records. I can’t think of any free program that will do so reliably, off the top of my head. It really shouldn’t be too terribly tedious to edit the CONECT records manually for a single file.

The PRODRG server ( davapc1.bioch.dundee.ac.uk/prodrg ) generates PDBs with CONECT statements for small molecules, and it’s free for non-profit use. Like Omega says, you can infer the bonds in case of proteins and DNA.