Author: bugman
Date: Wed Oct  8 09:22:04 2014
New Revision: 26205

URL: http://svn.gna.org/viewcvs/relax?rev=26205&view=rev
Log:
Improvements for PDB creation in the relax library for out of bounds structural 
coordinates.

The lib.structure.pdb_write module atom() and hetatm() functions will now more 
gracefully handle
atomic coordinates which are outside of the PDB limits of [-999.999, 9999.999]. 
 When such
coordinates are encountered, instead of producing a too long PDB line which 
does not pass the
validation step, the functions will set the coordinates to the boundary value.  
This will at least
allow a valid PDB file to be created, despite the warping of the coordinates.


Modified:
    trunk/lib/structure/pdb_write.py

Modified: trunk/lib/structure/pdb_write.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/structure/pdb_write.py?rev=26205&r1=26204&r2=26205&view=diff
==============================================================================
--- trunk/lib/structure/pdb_write.py    (original)
+++ trunk/lib/structure/pdb_write.py    Wed Oct  8 09:22:04 2014
@@ -269,6 +269,16 @@
     @type charge:           int
     """
 
+    # Coordinate bounds.
+    pdb_min = -999.999
+    pdb_max = 9999.999
+    coord = [x, y, z]
+    for i in range(3):
+        if coord[i] != '' and coord[i] < pdb_min:
+            coord[i] = pdb_min
+        if coord[i] != '' and coord[i] > pdb_max:
+            coord[i] = pdb_max
+
     # The formatted record.
     text = "%-6s%5s %-4s%1s%3s %1s%4s%1s   %8.3f%8.3f%8.3f%6.2f%6.2f          
%2s%2s" % (
         'ATOM',
@@ -279,9 +289,9 @@
         _handle_none(chain_id),
         _handle_none(res_seq),
         _handle_none(icode),
-        _handle_none(x),
-        _handle_none(y),
-        _handle_none(z),
+        _handle_none(coord[0]),
+        _handle_none(coord[1]),
+        _handle_none(coord[2]),
         _handle_none(occupancy),
         _handle_none(temp_factor),
         _handle_none(element),
@@ -1082,6 +1092,16 @@
     @type charge:           int
     """
 
+    # Coordinate bounds.
+    pdb_min = -999.999
+    pdb_max = 9999.999
+    coord = [x, y, z]
+    for i in range(3):
+        if coord[i] != '' and coord[i] < pdb_min:
+            coord[i] = pdb_min
+        if coord[i] != '' and coord[i] > pdb_max:
+            coord[i] = pdb_max
+
     # The formatted record.
     text = "%-6s%5s %4s%1s%3s %1s%4s%1s   %8.3f%8.3f%8.3f%6.2f%6.2f          
%2s%2s" % (
         'HETATM',
@@ -1092,9 +1112,9 @@
         _handle_none(chain_id),
         _handle_none(res_seq),
         _handle_none(icode),
-        _handle_none(x),
-        _handle_none(y),
-        _handle_none(z),
+        _handle_none(coord[0]),
+        _handle_none(coord[1]),
+        _handle_none(coord[2]),
         _handle_none(occupancy),
         _handle_none(temp_factor),
         _handle_none(element),


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

This is the relax-commits mailing list
[email protected]

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