Author: bugman Date: Thu Jun 28 15:09:03 2012 New Revision: 17096 URL: http://svn.gna.org/viewcvs/relax?rev=17096&view=rev Log: Fixes for the dipole_pair.define user function uncovered by the Interatomic.test_manipulation system test. Modified: branches/interatomic/generic_fns/dipole_pair.py Modified: branches/interatomic/generic_fns/dipole_pair.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/generic_fns/dipole_pair.py?rev=17096&r1=17095&r2=17096&view=diff ============================================================================== --- branches/interatomic/generic_fns/dipole_pair.py (original) +++ branches/interatomic/generic_fns/dipole_pair.py Thu Jun 28 15:09:03 2012 @@ -58,12 +58,17 @@ for spin2, mol_name2, res_num2, res_name2, id2 in spin_loop(spin_id2, full_info=True, return_id=True): # Directly bonded atoms. if direct_bond: + # Different molecules. + if mol_name1 != mol_name2: + continue + # From structural info. - if hasattr(cdp, 'structure') and not cdp.structure.are_bonded(atom_id1=id1, atom_id2=id2): - continue + if hasattr(cdp, 'structure') and cdp.structure.get_molecule(mol_name1, model=1): + if not cdp.structure.are_bonded(atom_id1=id1, atom_id2=id2): + continue # From the residue info. - elif not hasattr(cdp, 'structure'): + else: # No element info. if not hasattr(spin1, 'element'): raise RelaxError("The spin '%s' does not have the element type set." % id1)