Author: bugman Date: Thu Aug 11 17:32:59 2011 New Revision: 14367 URL: http://svn.gna.org/viewcvs/relax?rev=14367&view=rev Log: Merged revisions 14361-14366 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3 ........ r14361 | bugman | 2011-08-11 16:38:36 +0200 (Thu, 11 Aug 2011) | 5 lines Bug fix for the data.align_tensor.calc_eta() function - divide by zeros are now avoided. When Azz is zero, eta is now set to NaN. ........ r14362 | bugman | 2011-08-11 16:41:38 +0200 (Thu, 11 Aug 2011) | 3 lines Typo fix in the unused and incomplete dfunc function. ........ r14363 | bugman | 2011-08-11 16:45:31 +0200 (Thu, 11 Aug 2011) | 5 lines Bug fix for the data.align_tensor.calc_R() function - divide by zeros are now avoided. When Aa is zero, Ar is now set to NaN. ........ r14364 | bugman | 2011-08-11 16:56:16 +0200 (Thu, 11 Aug 2011) | 5 lines Fix for the test_opt_constr_bfgs_mt_S2_0_970_te_2048_Rex_0_149 model-free system test on MS Windows. The te parameter check was too strict. ........ r14365 | bugman | 2011-08-11 17:04:28 +0200 (Thu, 11 Aug 2011) | 3 lines Another divide by zero problem is being caught in the RDC Q-factor code. ........ r14366 | bugman | 2011-08-11 17:13:28 +0200 (Thu, 11 Aug 2011) | 3 lines The dipolar_constant() and pcs_constant() functions now catch division by zero problems. ........ Modified: branches/gui_testing/ (props changed) branches/gui_testing/data/align_tensor.py branches/gui_testing/generic_fns/rdc.py branches/gui_testing/maths_fns/relax_fit.c branches/gui_testing/physical_constants.py branches/gui_testing/test_suite/system_tests/model_free.py Propchange: branches/gui_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Thu Aug 11 17:32:59 2011 @@ -1,1 +1,1 @@ -/1.3:1-14355 +/1.3:1-14366 Modified: branches/gui_testing/data/align_tensor.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/data/align_tensor.py?rev=14367&r1=14366&r2=14367&view=diff ============================================================================== --- branches/gui_testing/data/align_tensor.py (original) +++ branches/gui_testing/data/align_tensor.py Thu Aug 11 17:32:59 2011 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003-2004, 2006-2010 Edward d'Auvergne # +# Copyright (C) 2003-2011 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -29,6 +29,7 @@ # relax module imports. from data_classes import Element +from float import nan from maths_fns.rotation_matrix import R_to_euler_zyz from relax_errors import RelaxError from relax_xml import fill_object_contents, xml_to_object @@ -265,6 +266,10 @@ @rtype: float """ + # Zero Azz value, so return NaN. + if A_diag[2, 2] == 0: + return nan + # Return eta. return (A_diag[0, 0] - A_diag[1, 1]) / A_diag[2, 2] @@ -761,6 +766,10 @@ @rtype: float """ + # Zero Aa value, so return NaN. + if Aa == 0: + return nan + # Return R. return Ar / Aa Modified: branches/gui_testing/generic_fns/rdc.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/generic_fns/rdc.py?rev=14367&r1=14366&r2=14367&view=diff ============================================================================== --- branches/gui_testing/generic_fns/rdc.py (original) +++ branches/gui_testing/generic_fns/rdc.py Thu Aug 11 17:32:59 2011 @@ -31,6 +31,7 @@ from warnings import warn # relax module imports. +from float import nan from generic_fns import grace, pipes from generic_fns.align_tensor import get_tensor_index from generic_fns.mol_res_spin import exists_mol_res_spin_data, return_spin, spin_loop @@ -301,7 +302,10 @@ D = dj * cdp.align_tensors[cdp.align_ids.index(align_id)].A_diag Da = 1.0/3.0 * (D[2, 2] - (D[0, 0]+D[1, 1])/2.0) Dr = 1.0/3.0 * (D[0, 0] - D[1, 1]) - R = Dr / Da + if Da == 0: + R = nan + else: + R = Dr / Da norm = 2.0 * (Da)**2 * (4.0 + 3.0*R**2)/5.0 if Da == 0.0: norm = 1e-15 Modified: branches/gui_testing/maths_fns/relax_fit.c URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/maths_fns/relax_fit.c?rev=14367&r1=14366&r2=14367&view=diff ============================================================================== --- branches/gui_testing/maths_fns/relax_fit.c (original) +++ branches/gui_testing/maths_fns/relax_fit.c Thu Aug 11 17:32:59 2011 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Edward d'Auvergne + * Copyright (C) 2006-2011 Edward d'Auvergne * * This file is part of the program relax. * @@ -140,7 +140,7 @@ /* Temp Declarations */ double aaa[MAXPARAMS] = {1.0, 2.0}; int i; - double* params; + double *params; /* Parse the function arguments, the only argument should be the parameter array */ if (!PyArg_ParseTuple(args, "O", ¶ms_arg)) Modified: branches/gui_testing/physical_constants.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/physical_constants.py?rev=14367&r1=14366&r2=14367&view=diff ============================================================================== --- branches/gui_testing/physical_constants.py (original) +++ branches/gui_testing/physical_constants.py Thu Aug 11 17:32:59 2011 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2007-2009 Edward d'Auvergne # +# Copyright (C) 2007-2011 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -29,6 +29,7 @@ from string import ascii_letters, digits, upper # relax module imports. +from float import nan from relax_errors import RelaxError @@ -101,6 +102,10 @@ @type r: float """ + # Catch zero bond lengths, returning NaN. + if r == 0: + return nan + # Calculate and return the value. return - mu0 / (4.0*pi) * gx * gh * h_bar / r**3 @@ -132,6 +137,10 @@ @param r: The distance between the two nuclei. @type r: float """ + + # Catch zero bond lengths, returning NaN. + if r == 0: + return nan # Calculate and return the value. return mu0 / (4.0*pi) * 15.0 * kB * T / Bo**2 / r**3 Modified: branches/gui_testing/test_suite/system_tests/model_free.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/test_suite/system_tests/model_free.py?rev=14367&r1=14366&r2=14367&view=diff ============================================================================== --- branches/gui_testing/test_suite/system_tests/model_free.py (original) +++ branches/gui_testing/test_suite/system_tests/model_free.py Thu Aug 11 17:32:59 2011 @@ -2569,7 +2569,7 @@ # te correlation time. if type(te) == float: - self.assertAlmostEqual(spin.te / 1e-12, te, 6, msg=mesg) + self.assertAlmostEqual(spin.te / 1e-12, te, 5, msg=mesg) elif te == None: self.assertEqual(spin.te, None, msg=mesg)