Author: bugman
Date: Thu Feb 19 14:55:42 2015
New Revision: 27674

URL: http://svn.gna.org/viewcvs/relax?rev=27674&view=rev
Log:
Merged revisions 27673 via svnmerge from 
svn+ssh://bug...@svn.gna.org/svn/relax/trunk

........
  r27673 | bugman | 2015-02-19 14:55:06 +0100 (Thu, 19 Feb 2015) | 9 lines
  
  Fix for bug #23293 (https://gna.org/bugs/?23293).
  
  This is the PDB HETATM loading error whereby the last HETATM record is 
sometimes not read from the
  PDB file.  The problem was two-fold.  Firstly the internal structural object 
_parse_mols_pdb()
  method for separating a PDB file into distinct molecules was terminating too 
early when a new
  molecule is found, so that the last PDB record is not appended to the records 
list for the molecule.
  Secondly the write_pdb() method was not handling the PDB sequential serial 
number correctly.
........

Modified:
    branches/nmrglue/   (props changed)
    branches/nmrglue/lib/structure/internal/object.py

Propchange: branches/nmrglue/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb 19 14:55:42 2015
@@ -1 +1 @@
-/trunk:1-27670
+/trunk:1-27673

Modified: branches/nmrglue/lib/structure/internal/object.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/nmrglue/lib/structure/internal/object.py?rev=27674&r1=27673&r2=27674&view=diff
==============================================================================
--- branches/nmrglue/lib/structure/internal/object.py   (original)
+++ branches/nmrglue/lib/structure/internal/object.py   Thu Feb 19 14:55:42 2015
@@ -735,9 +735,6 @@
 
                 # Reset the flag.
                 end = False
-
-                # Skip the rest of this loop.
-                continue
 
             # The molecule number.
             chain_id = records[i][21]
@@ -3040,7 +3037,6 @@
 
             # Loop over the molecules.
             index = 0
-            atom_serial = 0
             for mol in model.mol_loop():
                 # Printout.
                 if not model_records:
@@ -3053,9 +3049,6 @@
                     if mol.pdb_record[i] in [None, 'ATOM']:
                         atom_record = True
 
-                        # The atom number.
-                        atom_serial += 1
-
                         # Handle the funky atom name alignment.  From the PDB 
format documents:
                         # "Alignment of one-letter atom name such as C starts 
at column 14, while two-letter atom name such as FE starts at column 13."
                         if len(mol.atom_name[i]) == 1:
@@ -3064,12 +3057,12 @@
                             atom_name = "%s" % mol.atom_name[i]
 
                         # Write out.
-                        pdb_write.atom(file, serial=atom_serial, 
name=atom_name, res_name=mol.res_name[i], chain_id=CHAIN_ID_LIST[index], 
res_seq=mol.res_num[i], x=mol.x[i], y=mol.y[i], z=mol.z[i], occupancy=1.0, 
temp_factor=0, element=mol.element[i])
+                        pdb_write.atom(file, serial=ser_num, name=atom_name, 
res_name=mol.res_name[i], chain_id=CHAIN_ID_LIST[index], 
res_seq=mol.res_num[i], x=mol.x[i], y=mol.y[i], z=mol.z[i], occupancy=1.0, 
temp_factor=0, element=mol.element[i])
                         num_atom += 1
                         ser_num += 1
 
                         # Info for the TER record.
-                        ter_num = atom_serial + 1
+                        ter_num = ser_num + 1
                         ter_name = mol.res_name[i]
                         ter_chain_id = CHAIN_ID_LIST[index]
                         ter_res_num = mol.res_num[i]
@@ -3085,14 +3078,9 @@
                 for i in range(len(mol.atom_name)):
                     # Write the HETATM record.
                     if mol.pdb_record[i] == 'HETATM':
-                        # The atom number.
-                        atom_serial += 1
-
                         # Increment the atom number if a TER record was 
created.
-                        if atom_record and atom_serial == ter_num:
+                        if atom_record and ser_num == ter_num:
                             count_shift = True
-                        if atom_record and count_shift:
-                            atom_serial += 1
 
                         # Write out.
                         pdb_write.hetatm(file, serial=ser_num, 
name=self._translate(mol.atom_name[i]), res_name=mol.res_name[i], 
chain_id=CHAIN_ID_LIST[index], res_seq=mol.res_num[i], x=mol.x[i], y=mol.y[i], 
z=mol.z[i], occupancy=1.0, temp_factor=0.0, element=mol.element[i])


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@gna.org

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

Reply via email to