Author: bugman Date: Wed Oct 8 09:24:19 2014 New Revision: 26206 URL: http://svn.gna.org/viewcvs/relax?rev=26206&view=rev Log: Merged revisions 26205 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r26205 | bugman | 2014-10-08 09:22:04 +0200 (Wed, 08 Oct 2014) | 9 lines 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: branches/frame_order_cleanup/ (props changed) branches/frame_order_cleanup/lib/structure/pdb_write.py Propchange: branches/frame_order_cleanup/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Wed Oct 8 09:24:19 2014 @@ -1 +1 @@ -/trunk:1-26203 +/trunk:1-26205 Modified: branches/frame_order_cleanup/lib/structure/pdb_write.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/structure/pdb_write.py?rev=26206&r1=26205&r2=26206&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/structure/pdb_write.py (original) +++ branches/frame_order_cleanup/lib/structure/pdb_write.py Wed Oct 8 09:24:19 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),