Author: bugman Date: Mon Nov 17 11:56:50 2014 New Revision: 26595 URL: http://svn.gna.org/viewcvs/relax?rev=26595&view=rev Log: 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. 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=26595&r1=26594&r2=26595&view=diff ============================================================================== --- trunk/lib/structure/pdb_write.py (original) +++ trunk/lib/structure/pdb_write.py Mon Nov 17 11:56:50 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}. @@ -297,6 +297,7 @@ _handle_none(element), _handle_none(charge) ) + print text # Validate. _record_validate(text) @@ -972,7 +973,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}. _______________________________________________ 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