Author: bugman Date: Wed Feb 4 17:22:38 2009 New Revision: 8731 URL: http://svn.gna.org/viewcvs/relax?rev=8731&view=rev Log: Added error checking to load_pdb() for when the number of molecules exceeds the set_mol_name list. Modified: 1.3/generic_fns/structure/scientific.py Modified: 1.3/generic_fns/structure/scientific.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/scientific.py?rev=8731&r1=8730&r2=8731&view=diff ============================================================================== --- 1.3/generic_fns/structure/scientific.py (original) +++ 1.3/generic_fns/structure/scientific.py Wed Feb 4 17:22:38 2009 @@ -614,6 +614,10 @@ for mol in model.molecules[key]: mol_conts[-1][-1].data.append(mol) + # Check. + if set_mol_name and mol_index >= len(set_mol_name): + raise RelaxError, "The %s molecules read exceeds the number of molecule names supplied in %s." % (mol_index+1, set_mol_name) + # Update structures. self.target_mol_name(set=set_mol_name, target=new_mol_name, index=mol_index, mol_num=mol_index+1+mol_offset, file=file) mol_index = mol_index + 1