[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2677] contrib/py/scripts/addons/ io_import_pdb_atomic_blender.py:

Clemens Barth barth at root-1.de
Mon Nov 28 19:38:30 CET 2011


Revision: 2677
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2677
Author:   blendphys
Date:     2011-11-28 18:38:26 +0000 (Mon, 28 Nov 2011)
Log Message:
-----------


Dear all.

A very important specialty of PDB files wasn't considered. This is why 
for some PDB files, the sticks wer badly represented.
The bug was removed.

Cheers,

Blendphys.

Modified Paths:
--------------
    contrib/py/scripts/addons/io_import_pdb_atomic_blender.py

Modified: contrib/py/scripts/addons/io_import_pdb_atomic_blender.py
===================================================================
--- contrib/py/scripts/addons/io_import_pdb_atomic_blender.py	2011-11-28 15:59:05 UTC (rev 2676)
+++ contrib/py/scripts/addons/io_import_pdb_atomic_blender.py	2011-11-28 18:38:26 UTC (rev 2677)
@@ -978,9 +978,19 @@
         if line == "":
             break  
 
+        # If there is a "TER" we need to put empty entries into the lists
+        # in order to not destroy the order of atom numbers and same numbers
+        # used for sticks. "TER? What is that?" TER indicates the end of a 
+        # list of ATOM/HETATM records for a chain.
+        if "TER" in line:
+            atom_element.append("TER")
+            atom_name.append("TER")
+            atom_R.append(0.0)
+            atom_color.append([0,0,0])
+            atom_xyz_vec.append(Vector((0,0,0)))   
+            j += 1
         # If 'ATOM or 'HETATM' appears in the line then do ...
-        if "ATOM" in line or "HETATM" in line:
-      
+        elif "ATOM" in line or "HETATM" in line:
 
             # What follows is due to deviations which appear from PDB to
             # PDB file. it is very special. PLEASE, DO NOT CHANGE! From here ...
@@ -1197,7 +1207,7 @@
             # register it!
             if FLAG_BAR == False:
                 stick_atom1.append(atom1)
-                stick_atom2.append(atom2)      
+                stick_atom2.append(atom2)
                 Number_of_sticks += 1   
                 j += 1
 
@@ -1206,9 +1216,11 @@
 
     ATOM_PDB_FILEPATH_p.close()
     # So far, all atoms and sticks have been registered.
+    
 
 
 
+
     #
     #
     #
@@ -1455,6 +1467,10 @@
     # which has been created on the top during reading the PDB file. 
     # Example: atom_all_types_list = ["hydrogen", "carbon", ...]
     for atom_type in atom_all_types_list:
+    
+        # Don't draw 'TER atoms'.
+        if atom_type[0] == "TER":
+            continue
    
         # This is the draw list, which contains all atoms of one type (e.g. 
         # all hydrogens) ...



More information about the Bf-extensions-cvs mailing list