Author: bugman Date: Thu Jun 21 09:59:06 2012 New Revision: 17008 URL: http://svn.gna.org/viewcvs/relax?rev=17008&view=rev Log: More print outs and better data loading checks in the dipole_pair user functions. 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=17008&r1=17007&r2=17008&view=diff ============================================================================== --- branches/interatomic/generic_fns/dipole_pair.py (original) +++ branches/interatomic/generic_fns/dipole_pair.py Thu Jun 21 09:59:06 2012 @@ -131,6 +131,7 @@ # Print out. if verbose: + print("Magnetic dipole-dipole interactions are now defined for the following spins:\n") write_data(out=sys.stdout, headings=["Spin_ID_1", "Spin_ID_2"], data=ids) @@ -204,6 +205,7 @@ raise RelaxError("No data could be extracted from the file.") # Print out. + print("The following averaged distances have been read:\n") write_data(out=sys.stdout, headings=["Spin_ID_1", "Spin_ID_2", "Ave_distance"], data=data) @@ -244,6 +246,7 @@ raise RelaxError("No data could be set.") # Print out. + print("The following averaged distances have been set:\n") write_data(out=sys.stdout, headings=["Spin_ID_1", "Spin_ID_2", "Ave_distance"], data=data) @@ -260,9 +263,12 @@ # Print out. if ave: print("Averaging all vectors.") + else: + print("No averaging of the vectors.") # Loop over the interatomic data containers. no_vectors = True + pos_info = False for interatom in interatomic_loop(): # Get the spin info. spin1 = return_spin(interatom.spin_id1) @@ -273,6 +279,9 @@ continue if not hasattr(spin2, 'pos'): continue + + # Positional information flag. + pos_info = True # Both single positions. if is_float(spin1.pos[0]) and is_float(spin2.pos[0]): @@ -351,6 +360,10 @@ spin2_str = spin2.num print("Calculated %s %s-%s unit vector%s between the spins '%s' and '%s'." % (num, spin1_str, spin2_str, plural, interatom.spin_id1, interatom.spin_id2)) + # Catch the problem of no positional information being present. + if not pos_info: + raise RelaxError("Positional information could not be found for any spins.") + # Right, catch the problem of missing vectors to prevent massive user confusion! if no_vectors: raise RelaxError("No vectors could be extracted.")