Author: bugman Date: Mon Nov 17 14:02:58 2014 New Revision: 26600 URL: http://svn.gna.org/viewcvs/relax?rev=26600&view=rev Log: Merged revisions 26595-26598 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r26595 | bugman | 2014-11-17 11:56:50 +0100 (Mon, 17 Nov 2014) | 7 lines Set more reasonable default values for the lib.structure.pdb_write functions atom() and hetatm(). The occupancy now defaults to 1.0 instead of '', and the temperature factor to 0.0 instead of ''. This avoid painful errors when using these functions, as these arguments must be floating point numbers at all times, hence the default value of '' causes a TypeError. ........ r26596 | bugman | 2014-11-17 11:57:19 +0100 (Mon, 17 Nov 2014) | 3 lines Removed an accidentally committed debugging printout. ........ r26597 | bugman | 2014-11-17 12:04:25 +0100 (Mon, 17 Nov 2014) | 6 lines Updated the PDB file in the test_suite/shared_data/model_free/sphere/ directory. The relax library is now being used to create the PDB file. Additional TER and CONECT records are now being created so the result is a more correct PDB file. ........ r26598 | bugman | 2014-11-17 12:17:22 +0100 (Mon, 17 Nov 2014) | 3 lines Converted all ATOM records to HETATM in the sphere.pdb file. ........ Modified: branches/frame_order_cleanup/ (props changed) branches/frame_order_cleanup/lib/structure/pdb_write.py branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/create_sphere.py (contents, props changed) branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/sphere.pdb Propchange: branches/frame_order_cleanup/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Mon Nov 17 14:02:58 2014 @@ -1 +1 @@ -/trunk:1-26592 +/trunk:1-26598 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=26600&r1=26599&r2=26600&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/structure/pdb_write.py (original) +++ branches/frame_order_cleanup/lib/structure/pdb_write.py Mon Nov 17 14:02:58 2014 @@ -89,7 +89,7 @@ raise RelaxError("The PDB record '%s' contains NaN values." % record) -def atom(file, serial='', name='', alt_loc='', res_name='', chain_id='', res_seq='', icode='', x='', y='', z='', occupancy='', temp_factor='', element='', charge=''): +def atom(file, serial='', name='', alt_loc='', res_name='', chain_id='', res_seq='', icode='', x='', y='', z='', occupancy=1.0, temp_factor=0.0, element='', charge=''): """Generate the ATOM record. The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect9.html#ATOM}. @@ -972,7 +972,7 @@ file.write('\n') -def hetatm(file, serial='', name='', alt_loc='', res_name='', chain_id='', res_seq='', icode='', x='', y='', z='', occupancy='', temp_factor='', element='', charge=''): +def hetatm(file, serial='', name='', alt_loc='', res_name='', chain_id='', res_seq='', icode='', x='', y='', z='', occupancy=1.0, temp_factor=0.0, element='', charge=''): """Generate the HETATM record. The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect9.html#HETATM}. Modified: branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/create_sphere.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/create_sphere.py?rev=26600&r1=26599&r2=26600&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/create_sphere.py (original) +++ branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/create_sphere.py Mon Nov 17 14:02:58 2014 @@ -1,35 +1,11 @@ -#!/usr/bin/python +# relax script for creating the spherical PDB file. +# Copyright 2004-2014, Edward d'Auvergne -# Copyright 2004-2011, Edward d'Auvergne - +# Python module imports. from math import acos, cos, pi, sin, sqrt - -def pdb_line(file=None, atom_num=0, atom=None, res_num=0, res_name=None, vector=None): - """Function for adding a line to the PDB file.""" - - # ATOM. - file.write('%-4s' % 'ATOM') - - # Atom number and type. - file.write('%7i' % atom_num) - file.write(' %-4s' % atom) - - # Residue number and name. - file.write('%-4s' % res_name) - file.write('%5i ' % res_num) - - # Vector. - file.write('%8.3f' % vector[0]) - file.write('%8.3f' % vector[1]) - file.write('%8.3f' % vector[2]) - - # I don't know what. - file.write('%6.2f' % 1.0) - file.write('%6.2f' % 0.0) - - # End of line. - file.write('\n') +# relax module imports. +from lib.structure.pdb_write import conect, hetatm # Number of increments. @@ -102,10 +78,10 @@ continue # Nitrogen line. - pdb_line(file=file, atom_num=atom_num, atom='N', res_num=res_num, res_name='GLY', vector=[0.0, 0.0, 0.0]) + hetatm(file=file, serial=atom_num, name='N', res_seq=res_num, res_name='GLY', x=0.0, y=0.0, z=0.0) # Hydrogen line. - pdb_line(file=file, atom_num=atom_num+1, atom='H', res_num=res_num, res_name='GLY', vector=vectors[i]) + hetatm(file=file, serial=atom_num+1, name='H', res_seq=res_num, res_name='GLY', x=vectors[i][0], y=vectors[i][1], z=vectors[i][2]) # Increment the atom number and residue number. atom_num = atom_num + 2 @@ -115,8 +91,17 @@ used.append(vectors[i]) # Add a Trp indole NH for luck ;) -pdb_line(file=file, atom_num=atom_num, atom='NE1', res_num=res_num-1, res_name='GLY', vector=[0.0, 0.0, 0.0]) -pdb_line(file=file, atom_num=atom_num+1, atom='HE1', res_num=res_num-1, res_name='GLY', vector=[1/sqrt(3), 1/sqrt(3), 1/sqrt(3)]) +hetatm(file=file, serial=atom_num, name='NE1', res_seq=res_num-1, res_name='GLY', x=0.0, y=0.0, z=0.0) +hetatm(file=file, serial=atom_num+1, name='HE1', res_seq=res_num-1, res_name='GLY', x=1/sqrt(3), y=1/sqrt(3), z=1/sqrt(3)) + +# Connect everything. +atom_num = 1 +for i in range(len(vectors)): + conect(file=file, serial=atom_num, bonded1=atom_num+1) + conect(file=file, serial=atom_num+1, bonded1=atom_num) + atom_num = atom_num + 2 +conect(file=file, serial=atom_num, bonded1=atom_num+1) +conect(file=file, serial=atom_num+1, bonded1=atom_num) # End of PDB. file.write('END\n') Propchange: branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/create_sphere.py ------------------------------------------------------------------------------ --- svn:executable (original) +++ svn:executable (removed) @@ -1 +0,0 @@ -* Modified: branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/sphere.pdb URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/sphere.pdb?rev=26600&r1=26599&r2=26600&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/sphere.pdb (original) +++ branches/frame_order_cleanup/test_suite/shared_data/model_free/sphere/sphere.pdb Mon Nov 17 14:02:58 2014 @@ -1,21 +1,41 @@ -ATOM 1 N GLY 1 0.000 0.000 0.000 1.00 0.00 -ATOM 2 H GLY 1 0.745 0.000 -0.667 1.00 0.00 -ATOM 3 N GLY 2 0.000 0.000 0.000 1.00 0.00 -ATOM 4 H GLY 2 -0.373 0.645 -0.667 1.00 0.00 -ATOM 5 N GLY 3 0.000 0.000 0.000 1.00 0.00 -ATOM 6 H GLY 3 -0.373 -0.645 -0.667 1.00 0.00 -ATOM 7 N GLY 4 0.000 0.000 0.000 1.00 0.00 -ATOM 8 H GLY 4 1.000 0.000 0.000 1.00 0.00 -ATOM 9 N GLY 5 0.000 0.000 0.000 1.00 0.00 -ATOM 10 H GLY 5 -0.500 0.866 0.000 1.00 0.00 -ATOM 11 N GLY 6 0.000 0.000 0.000 1.00 0.00 -ATOM 12 H GLY 6 -0.500 -0.866 0.000 1.00 0.00 -ATOM 13 N GLY 7 0.000 0.000 0.000 1.00 0.00 -ATOM 14 H GLY 7 0.745 0.000 0.667 1.00 0.00 -ATOM 15 N GLY 8 0.000 0.000 0.000 1.00 0.00 -ATOM 16 H GLY 8 -0.373 0.645 0.667 1.00 0.00 -ATOM 17 N GLY 9 0.000 0.000 0.000 1.00 0.00 -ATOM 18 H GLY 9 -0.373 -0.645 0.667 1.00 0.00 -ATOM 19 NE1 GLY 9 0.000 0.000 0.000 1.00 0.00 -ATOM 20 HE1 GLY 9 0.577 0.577 0.577 1.00 0.00 +HETATM 1 N GLY 1 0.000 0.000 0.000 1.00 0.00 +HETATM 2 H GLY 1 0.745 0.000 -0.667 1.00 0.00 +HETATM 3 N GLY 2 0.000 0.000 0.000 1.00 0.00 +HETATM 4 H GLY 2 -0.373 0.645 -0.667 1.00 0.00 +HETATM 5 N GLY 3 0.000 0.000 0.000 1.00 0.00 +HETATM 6 H GLY 3 -0.373 -0.645 -0.667 1.00 0.00 +HETATM 7 N GLY 4 0.000 0.000 0.000 1.00 0.00 +HETATM 8 H GLY 4 1.000 0.000 0.000 1.00 0.00 +HETATM 9 N GLY 5 0.000 0.000 0.000 1.00 0.00 +HETATM 10 H GLY 5 -0.500 0.866 0.000 1.00 0.00 +HETATM 11 N GLY 6 0.000 0.000 0.000 1.00 0.00 +HETATM 12 H GLY 6 -0.500 -0.866 0.000 1.00 0.00 +HETATM 13 N GLY 7 0.000 0.000 0.000 1.00 0.00 +HETATM 14 H GLY 7 0.745 0.000 0.667 1.00 0.00 +HETATM 15 N GLY 8 0.000 0.000 0.000 1.00 0.00 +HETATM 16 H GLY 8 -0.373 0.645 0.667 1.00 0.00 +HETATM 17 N GLY 9 0.000 0.000 0.000 1.00 0.00 +HETATM 18 H GLY 9 -0.373 -0.645 0.667 1.00 0.00 +HETATM 19 NE1 GLY 9 0.000 0.000 0.000 1.00 0.00 +HETATM 20 HE1 GLY 9 0.577 0.577 0.577 1.00 0.00 +CONECT 1 2 +CONECT 2 1 +CONECT 3 4 +CONECT 4 3 +CONECT 5 6 +CONECT 6 5 +CONECT 7 8 +CONECT 8 7 +CONECT 9 10 +CONECT 10 9 +CONECT 11 12 +CONECT 12 11 +CONECT 13 14 +CONECT 14 13 +CONECT 15 16 +CONECT 16 15 +CONECT 17 18 +CONECT 18 17 +CONECT 19 20 +CONECT 20 19 END