Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io_mesh_pdb/__init__.py2
-rw-r--r--io_mesh_pdb/import_pdb.py40
2 files changed, 32 insertions, 10 deletions
diff --git a/io_mesh_pdb/__init__.py b/io_mesh_pdb/__init__.py
index 4868ac25..c08c642e 100644
--- a/io_mesh_pdb/__init__.py
+++ b/io_mesh_pdb/__init__.py
@@ -464,7 +464,7 @@ class CLASS_atom_pdb_load_button(Operator):
# This is the class for the file dialog.
class ImportPDB(Operator, ImportHelper):
bl_idname = "import_mesh.pdb"
- bl_label = "Import Protein Data Bank (*.pdb)"
+ bl_label = "Import Protein Data Bank(*.pdb)"
filename_ext = ".pdb"
filter_glob = StringProperty(default="*.pdb", options={'HIDDEN'},)
diff --git a/io_mesh_pdb/import_pdb.py b/io_mesh_pdb/import_pdb.py
index 8a860cbb..69008142 100644
--- a/io_mesh_pdb/import_pdb.py
+++ b/io_mesh_pdb/import_pdb.py
@@ -557,17 +557,39 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
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 ...
- short_name = line[13:14]
- if short_name.isupper() == True:
+ # PDB file. It is very special!
+ #
+ # PLEASE, DO NOT CHANGE! ............................... from here
+ if line[12:13] == " " or line[12:13].isdigit() == True:
+ short_name = line[13:14]
if line[14:15].islower() == True:
- short_name = short_name + line[14:15]
- else:
+ short_name = short_name + line[14:15]
+ elif line[12:13].isupper() == True:
short_name = line[12:13]
- if short_name.isupper() == True:
- if line[13:14].islower() == True:
- short_name = short_name + line[13:14]
- # ... to here.
+ if line[13:14].isalpha() == True:
+ short_name = short_name + line[13:14]
+ else:
+ print("Atomic Blender: Strange error in PDB file.\n"
+ "Look for element names at positions 13-16 and 78-79.\n")
+ return -1
+
+ if len(line) >= 78:
+
+ if line[76:77] == " ":
+ short_name2 = line[76:77]
+ else:
+ short_name2 = line[76:78]
+
+ if short_name2.isalpha() == True:
+ FOUND = False
+ for element in ATOM_PDB_ELEMENTS:
+ if str.upper(short_name2) == str.upper(element.short_name):
+ FOUND = True
+ break
+ if FOUND == False:
+ short_name = short_name2
+ # ....................................................... to here.
+
# Go through all elements and find the element of the current atom.
FLAG_FOUND = False