Author: bugman Date: Thu Jun 13 14:15:40 2013 New Revision: 20090 URL: http://svn.gna.org/viewcvs/relax?rev=20090&view=rev Log: Merged revisions 20088-20089 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r20088 | bugman | 2013-06-13 11:44:23 +0200 (Thu, 13 Jun 2013) | 6 lines Improved the functionality of the interatom.read_dist user function. The file data is now stripped using lib.io.strip to remove comments and blank lines. And now if the iteratomic data container cannot be found, it is created instead of raising a RelaxError. ........ r20089 | bugman | 2013-06-13 11:52:47 +0200 (Thu, 13 Jun 2013) | 3 lines Improvements to the RelaxZeroVectorWarning - the warning message was terribly out of date. ........ Modified: branches/relax_disp/ (props changed) branches/relax_disp/lib/warnings.py branches/relax_disp/pipe_control/interatomic.py branches/relax_disp/pipe_control/structure/main.py Propchange: branches/relax_disp/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Thu Jun 13 14:15:40 2013 @@ -1,1 +1,1 @@ -/trunk:1-20086 +/trunk:1-20089 Modified: branches/relax_disp/lib/warnings.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/warnings.py?rev=20090&r1=20089&r2=20090&view=diff ============================================================================== --- branches/relax_disp/lib/warnings.py (original) +++ branches/relax_disp/lib/warnings.py Thu Jun 13 14:15:40 2013 @@ -113,10 +113,10 @@ # PDB warnings. ############### -# Zero length XH bond vector. +# Zero length interactomic vector. class RelaxZeroVectorWarning(BaseWarning): - def __init__(self, res): - self.text = "The XH bond vector for residue " + repr(res) + " is of zero length." + def __init__(self, spin_id1, spin_id2): + self.text = "The interatomic vector between the spins '%s' and '%s' is of zero length." % (spin_id1, spin_id2) # The atom is missing from the PDB file. Modified: branches/relax_disp/pipe_control/interatomic.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/interatomic.py?rev=20090&r1=20089&r2=20090&view=diff ============================================================================== --- branches/relax_disp/pipe_control/interatomic.py (original) +++ branches/relax_disp/pipe_control/interatomic.py Thu Jun 13 14:15:40 2013 @@ -36,7 +36,7 @@ from pipe_control.mol_res_spin import Selection, count_spins, exists_mol_res_spin_data, return_spin, spin_loop from pipe_control import pipes from lib.errors import RelaxError, RelaxInteratomInconsistentError, RelaxNoInteratomError, RelaxNoSpinError -from lib.io import extract_data, write_data +from lib.io import extract_data, strip, write_data from lib.warnings import RelaxWarning, RelaxZeroVectorWarning @@ -152,7 +152,7 @@ raise RelaxInteratomInconsistentError(pipe1, pipe2) -def create_interatom(spin_id1=None, spin_id2=None, pipe=None): +def create_interatom(spin_id1=None, spin_id2=None, pipe=None, verbose=False): """Create and return the interatomic data container for the two spins. @keyword spin_id1: The spin ID string of the first atom. @@ -161,9 +161,15 @@ @type spin_id2: str @keyword pipe: The data pipe to create the interatomic data container for. This defaults to the current data pipe if not supplied. @type pipe: str or None + @keyword verbose: A flag which if True will result printouts. + @type verbose: bool @return: The newly created interatomic data container. @rtype: data.interatomic.InteratomContainer instance """ + + # Printout. + if verbose: + print("Creating an interatomic data container between the spins '%s' and '%s'." % (spin_id1, spin_id2)) # The data pipe. if pipe == None: @@ -451,8 +457,9 @@ if not exists_mol_res_spin_data(): raise RelaxNoSequenceError - # Extract the data from the file. + # Extract the data from the file, and clean it up. file_data = extract_data(file, dir, sep=sep) + file_data = strip(file_data) # Loop over the RDC data. data = [] @@ -490,9 +497,9 @@ # Get the interatomic data container. interatom = return_interatom(spin_id1, spin_id2) - # No container found. + # No container found, so create it. if interatom == None: - raise RelaxNoInteratomError(spin_id1=spin_id1, spin_id2=spin_id2) + interatom = create_interatom(spin_id1=spin_id1, spin_id2=spin_id2, verbose=True) # Store the averaged distance. interatom.r = ave_dist @@ -703,7 +710,7 @@ # Test for zero length. if norm_factor == 0.0: - warn(RelaxZeroVectorWarning(id)) + warn(RelaxZeroVectorWarning(spin_id1=interatom.spin_id1, spin_id2=interatom.spin_id2)) # Calculate the normalised vector. else: Modified: branches/relax_disp/pipe_control/structure/main.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/structure/main.py?rev=20090&r1=20089&r2=20090&view=diff ============================================================================== --- branches/relax_disp/pipe_control/structure/main.py (original) +++ branches/relax_disp/pipe_control/structure/main.py Thu Jun 13 14:15:40 2013 @@ -976,6 +976,7 @@ # Get the bond info. bond_vectors, attached_name, warnings = cdp.structure.bond_vectors(attached_atom=attached, model_num=model, res_num=res_num, spin_name=spin.name, spin_num=spin.num, return_name=True, return_warnings=True) + id2 = generate_spin_id_unique(res_num=res_num, res_name=None, spin_name=spin.name) # No attached atom. if not bond_vectors: @@ -1005,7 +1006,7 @@ # Test for zero length. if norm_factor == 0.0: - warn(RelaxZeroVectorWarning(id)) + warn(RelaxZeroVectorWarning(spin_id1=id, spin_id2=id2)) # Calculate the normalised vector. else: