Author: bugman Date: Tue Nov 25 14:16:41 2008 New Revision: 8022 URL: http://svn.gna.org/viewcvs/relax?rev=8022&view=rev Log: Merged revisions 8014,8016 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3 ........ r8014 | bugman | 2008-11-21 18:35:42 +0100 (Fri, 21 Nov 2008) | 3 lines The structure.load_spins() user function now tests if a structure has been loaded. ........ r8016 | bugman | 2008-11-21 18:38:37 +0100 (Fri, 21 Nov 2008) | 3 lines Added a missing RelaxError import. ........ Modified: branches/spectral_errors/ (props changed) branches/spectral_errors/generic_fns/structure/main.py Propchange: branches/spectral_errors/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Tue Nov 25 14:16:41 2008 @@ -1,1 +1,1 @@ -/1.3:1-7996 +/1.3:1-8021 Modified: branches/spectral_errors/generic_fns/structure/main.py URL: http://svn.gna.org/viewcvs/relax/branches/spectral_errors/generic_fns/structure/main.py?rev=8022&r1=8021&r2=8022&view=diff ============================================================================== --- branches/spectral_errors/generic_fns/structure/main.py (original) +++ branches/spectral_errors/generic_fns/structure/main.py Tue Nov 25 14:16:41 2008 @@ -35,7 +35,7 @@ from generic_fns.sequence import write_header, write_line from generic_fns.structure.internal import Internal from generic_fns.structure.scientific import Scientific_data -from relax_errors import RelaxError, RelaxFileError, RelaxNoSequenceError, RelaxPdbError +from relax_errors import RelaxError, RelaxFileError, RelaxNoPdbError, RelaxNoSequenceError, RelaxPdbError from relax_io import get_file_path, open_write_file from relax_warnings import RelaxWarning, RelaxNoPDBFileWarning, RelaxZeroVectorWarning @@ -57,12 +57,16 @@ # Test if the current data pipe exists. pipes.test() + # Alias the current data pipe. + cdp = pipes.get_pipe() + + # Test if the structure exists. + if not hasattr(cdp, 'structure') or not cdp.structure.num > 0: + raise RelaxNoPdbError + # Print out. print "Adding the following spins to the relax data store.\n" write_header(sys.stdout, mol_name_flag=True, res_num_flag=True, res_name_flag=True, spin_num_flag=True, spin_name_flag=True) - - # Alias the current data pipe. - cdp = pipes.get_pipe() # Loop over all atoms of the spin_id selection. for mol_name, res_num, res_name, atom_num, atom_name, element, pos in cdp.structure.atom_loop(atom_id=spin_id, str_id=str_id, mol_name_flag=True, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, element_flag=True, pos_flag=True, ave=ave_pos):