diff options
author | Clemens Barth <barth@root-1.de> | 2019-03-16 12:25:01 +0300 |
---|---|---|
committer | Clemens Barth <barth@root-1.de> | 2019-03-16 12:29:29 +0300 |
commit | d17b93756929e1b7bf5cce8a3073fa532f750e39 (patch) | |
tree | 7feecc9aad844fad2728b52b2404f215d38737c2 | |
parent | d2ef462ad911e1c12f4b3dd49e2180f81061d9cf (diff) |
Fix: the 'CONECT' identifier has been corrected.
On October 19th 2018, the 'CONECT' identifier was changed to 'CONNECT'. This is wrong
because in a PDB file a stick is identified as 'CONECT'. I recognized that this morning
and could not load any sticks. I have put a note into the code. Please leave it as is!
There are still some errors afterwards, which I will solve later on.
-rw-r--r-- | io_mesh_pdb/import_pdb.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/io_mesh_pdb/import_pdb.py b/io_mesh_pdb/import_pdb.py index dd561042..ae3a4618 100644 --- a/io_mesh_pdb/import_pdb.py +++ b/io_mesh_pdb/import_pdb.py @@ -365,10 +365,10 @@ def read_pdb_file_sticks(filepath_pdb, use_sticks_bonds, all_atoms): split_list = line.split(' ') # Go to the first entry - if "CONNECT" not in split_list[0]: + if "CONECT" not in split_list[0]: for line in filepath_pdb_p: split_list = line.split(' ') - if "CONNECT" in split_list[0]: + if "CONECT" in split_list[0]: break Number_of_sticks = 0 @@ -381,21 +381,25 @@ def read_pdb_file_sticks(filepath_pdb, use_sticks_bonds, all_atoms): if line == "": break # ... or here, when no 'CONNECT' appears anymore. - if "CONNECT" not in line: + if "CONECT" not in line: break + # Note 2019-03-16: in a PDB file the identifier for sticks is called + # 'CONECT' and NOT 'CONNECT'! Please leave this as is, otherwise the + # sticks are NOT correctly loaded. + # The strings of the atom numbers do have a clear position in the file # (From 7 to 12, from 13 to 18 and so on.) and one needs to consider # this. One could also use the split function but then one gets into # trouble if there are lots of atoms: For instance, it may happen that # one has - # CONNECT 11111 22244444 + # CONECT 11111 22244444 # # In Fact it means that atom No. 11111 has a connection with atom # No. 222 but also with atom No. 44444. The split function would give # me only two numbers (11111 and 22244444), which is wrong. - # Cut spaces from the right and 'CONNECT' at the beginning + # Cut spaces from the right and 'CONECT' at the beginning line = line.rstrip() line = line[6:] # Amount of loops @@ -832,10 +836,10 @@ def draw_sticks_dupliverts(all_atoms, i += 1 # Build the mesh. - mesh = bpy.data.meshes.new("Sticks"+stick[0]) + mesh = bpy.data.meshes.new("Sticks_"+stick[0]) mesh.from_pydata(vertices, [], faces) mesh.update() - new_mesh = bpy.data.objects.new("Sticks"+stick[0], mesh) + new_mesh = bpy.data.objects.new(stick[0]+"_sticks_mesh", mesh) bpy.context.collection.objects.link(new_mesh) # Build the object. @@ -1142,8 +1146,7 @@ def import_pdb(Ball_type, use_camera, use_light, filepath_pdb): - - + # List of materials atom_material_list = [] |