Author: bugman Date: Sun Oct 27 18:13:04 2013 New Revision: 21253 URL: http://svn.gna.org/viewcvs/relax?rev=21253&view=rev Log: Converted the 'IT99' dispersion model parameters to pA and dw. This is thanks to feedback from Nikolai Skrynnikov. I have no idea why the phi_ex and pA.dw^2 parameters were being used in the first place. The model results after the change are identical. Modified: branches/relax_disp/docs/latex/dispersion_models.tex branches/relax_disp/lib/dispersion/it99.py branches/relax_disp/specific_analyses/relax_disp/api.py branches/relax_disp/target_functions/relax_disp.py branches/relax_disp/test_suite/system_tests/relax_disp.py branches/relax_disp/user_functions/relax_disp.py Modified: branches/relax_disp/docs/latex/dispersion_models.tex URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/docs/latex/dispersion_models.tex?rev=21253&r1=21252&r2=21253&view=diff ============================================================================== --- branches/relax_disp/docs/latex/dispersion_models.tex (original) +++ branches/relax_disp/docs/latex/dispersion_models.tex Sun Oct 27 18:13:04 2013 @@ -34,7 +34,7 @@ LM63 3-site & Analytic & 3 & $\{\Rtwozero, \dots, \PhiexB, \kB, \PhiexC, \kC\}$ & Fast exchange, $\pA > \pB$ and $\pA > \pC$ & \citet{LuzMeiboom63} \\ CR72 & Analytic & 2 & $\{\Rtwozero, \dots, \pA, \dw, \kex\}$ & $\pA > \pB$ & \citet{CarverRichards72} \\ CR72 full & Analytic & 2 & $\{\RtwozeroA, \RtwozeroB, \dots, \pA, \dw, \kex\}$ & $\pA > \pB$ & \citet{CarverRichards72} \\ -IT99 & Analytic & 2 & $\{\Rtwozero, \dots, \Phiex, \pA.\dw^2, \kex\}$ & $\pA \gg \pB$ & \citet{IshimaTorchia99} \\ +IT99 & Analytic & 2 & $\{\Rtwozero, \dots, \pA, \dw, \kex\}$ & $\pA \gg \pB$ & \citet{IshimaTorchia99} \\ TSMFK01 & Analytic & 2 & $\{\RtwozeroA, \dots, \dw, \kAB\}$ & $\pA \gg \pB$ & \citet{Tollinger01} \\ NS CPMG 2-site expanded & Numeric & 2 & $\{\Rtwozero, \dots, \pA, \dw, \kex\}$ & $\pA > \pB$ & \citet{Tollinger01} \\ NS CPMG 2-site 3D & Numeric & 2 & $\{\Rtwozero, \dots, \pA, \dw, \kex\}$ & $\pA > \pB$ & - \\ Modified: branches/relax_disp/lib/dispersion/it99.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/it99.py?rev=21253&r1=21252&r2=21253&view=diff ============================================================================== --- branches/relax_disp/lib/dispersion/it99.py (original) +++ branches/relax_disp/lib/dispersion/it99.py Sun Oct 27 18:13:04 2013 @@ -52,7 +52,7 @@ from math import pi, sqrt -def r2eff_IT99(r20=None, phi_ex=None, padw2=None, tex=None, cpmg_frqs=None, back_calc=None, num_points=None): +def r2eff_IT99(r20=None, pA=None, pB=None, dw=None, tex=None, cpmg_frqs=None, back_calc=None, num_points=None): """Calculate the R2eff values for the IT99 model. See the module docstring for details. @@ -60,10 +60,12 @@ @keyword r20: The R20 parameter value (R2 with no exchange). @type r20: float - @keyword phi_ex: The phi_ex parameter value (pA * pB * delta_omega^2). - @type phi_ex: float - @keyword padw2: The pA.dw^2 parameter value. - @type padw2: float + @keyword pA: The population of state A. + @type pA: float + @keyword pB: The population of state B. + @type pB: float + @keyword dw: The chemical exchange difference between states A and B in rad/s. + @type dw: float @keyword tex: The tex parameter value (the time of exchange in s/rad). @type tex: float @keyword cpmg_frqs: The CPMG nu1 frequencies. @@ -75,11 +77,13 @@ """ # Repetitive calculations (to speed up calculations). + dw2 = dw**2 tex2 = tex**2 + padw2 = pA * dw2 pa2dw4 = padw2**2 # The numerator. - numer = phi_ex * tex + numer = padw2 * pB * tex # Loop over the time points, back calculating the R2eff values. for i in range(num_points): Modified: branches/relax_disp/specific_analyses/relax_disp/api.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/api.py?rev=21253&r1=21252&r2=21253&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/api.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/api.py Sun Oct 27 18:13:04 2013 @@ -606,7 +606,7 @@ params = [] for frq in loop_frq(): params.append('r2') - params += ['phi_ex', 'padw2', 'tex'] + params += ['pA', 'dw', 'tex'] # TSMFK01 model. elif model == MODEL_TSMFK01: Modified: branches/relax_disp/target_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/target_functions/relax_disp.py?rev=21253&r1=21252&r2=21253&view=diff ============================================================================== --- branches/relax_disp/target_functions/relax_disp.py (original) +++ branches/relax_disp/target_functions/relax_disp.py Sun Oct 27 18:13:04 2013 @@ -580,10 +580,13 @@ # Unpack the parameter values. R20 = params[:self.end_index[0]] - phi_ex = params[self.end_index[0]:self.end_index[1]] - padw2 = params[self.end_index[1]:self.end_index[2]] + dw = params[self.end_index[0]:self.end_index[1]] + pA = params[self.end_index[1]] tex = params[self.end_index[2]] + # Once off parameter conversions. + pB = 1.0 - pA + # Initialise. chi2_sum = 0.0 @@ -594,12 +597,11 @@ # The R20 index. r20_index = frq_index + spin_index*self.num_frq - # Convert phi_ex and pa.dw^2 from ppm^2 to (rad/s)^2. - phi_ex_scaled = phi_ex[spin_index] * self.frqs[spin_index, frq_index]**2 - padw2_scaled = padw2[spin_index] * self.frqs[spin_index, frq_index]**2 + # Convert dw from ppm to rad/s. + dw_frq = dw[spin_index] * self.frqs[spin_index, frq_index] # Back calculate the R2eff values. - r2eff_IT99(r20=R20[r20_index], phi_ex=phi_ex_scaled, padw2=padw2_scaled, tex=tex, cpmg_frqs=self.cpmg_frqs, back_calc=self.back_calc[spin_index, frq_index], num_points=self.num_disp_points) + r2eff_IT99(r20=R20[r20_index], pA=pA, pB=pB, dw=dw_frq, tex=tex, cpmg_frqs=self.cpmg_frqs, back_calc=self.back_calc[spin_index, frq_index], num_points=self.num_disp_points) # For all missing data points, set the back-calculated value to the measured values so that it has no effect on the chi-squared value. for point_index in range(self.num_disp_points): Modified: branches/relax_disp/test_suite/system_tests/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/system_tests/relax_disp.py?rev=21253&r1=21252&r2=21253&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/relax_disp.py (original) +++ branches/relax_disp/test_suite/system_tests/relax_disp.py Sun Oct 27 18:13:04 2013 @@ -694,14 +694,14 @@ spin71 = cdp.mol[0].res[1].spin[0] # Set the initial parameter values. - spin70.r2 = [7, 10] - spin70.phi_ex = 0.8 - spin70.padw2 = 260.0 - spin70.tex = 2e-4 - spin71.r2 = [5, 9] - spin71.phi_ex = 0.1 - spin71.padw2 = 0.0001 - spin71.tex = 1e-4 + spin70.r2 = [8.8, 16.6] + spin70.dw = 10.0 + spin70.pA = 0.5 + spin70.tex = 1000.09 + spin71.r2 = [1, 1] + spin71.dw = 10.0 + spin71.pA = 0.95 + spin71.tex = 0.1 # Low precision optimisation. self.interpreter.minimise(min_algor='simplex', line_search=None, hessian_mod=None, hessian_type=None, func_tol=1e-10, grad_tol=None, max_iter=10000, constraints=True, scaling=True, verbosity=1) @@ -711,23 +711,23 @@ print("%-20s %-20s %-20s" % ("Parameter", "Value (:70)", "Value (:71)")) print("%-20s %20.15g %20.15g" % ("R2 (500 MHz)", spin70.r2[0], spin71.r2[0])) print("%-20s %20.15g %20.15g" % ("R2 (800 MHz)", spin70.r2[1], spin71.r2[1])) - print("%-20s %20.15g %20.15g" % ("phi_ex", spin70.phi_ex, spin71.phi_ex)) - print("%-20s %20.15g %20.15g" % ("padw2", spin70.padw2, spin71.padw2)) + print("%-20s %20.15g %20.15g" % ("dw", spin70.dw, spin71.dw)) + print("%-20s %20.15g %20.15g" % ("pA", spin70.pA, spin71.pA)) print("%-20s %20.15g %20.15g" % ("tex", spin70.tex, spin71.tex)) print("%-20s %20.15g %20.15g\n" % ("chi2", spin70.chi2, spin71.chi2)) # Checks for residue :70. self.assertAlmostEqual(spin70.r2[0], 7.24913359483782, 4) self.assertAlmostEqual(spin70.r2[1], 10.0721943688644, 4) - self.assertAlmostEqual(spin70.phi_ex, 0.824075664284934, 4) - self.assertAlmostEqual(spin70.padw2, 264.941131087762, 4) + self.assertAlmostEqual(spin70.dw, 16.302386572665750, 4) + self.assertAlmostEqual(spin70.pA, 0.996889589501665, 4) self.assertAlmostEqual(spin70.tex*1000, 0.00020445116006575*1000, 4) self.assertAlmostEqual(spin70.chi2, 29.7980427316775, 4) # Checks for residue :71. self.assertAlmostEqual(spin71.r2[0], 4.96765137715714, 4) - self.assertAlmostEqual(spin71.phi_ex, 0.16487619476159, 4) - self.assertAlmostEqual(spin71.padw2, 0.000896297985759929, 3) + self.assertAlmostEqual(spin71.dw, 0.812098432417916, 4) + self.assertAlmostEqual(spin71.pA, 0.500000087728188, 3) self.assertAlmostEqual(spin71.tex*1000, 0.000125225494546911*1000, 4) self.assertAlmostEqual(spin71.chi2, 2.33683739438351, 4) Modified: branches/relax_disp/user_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/user_functions/relax_disp.py?rev=21253&r1=21252&r2=21253&view=diff ============================================================================== --- branches/relax_disp/user_functions/relax_disp.py (original) +++ branches/relax_disp/user_functions/relax_disp.py Sun Oct 27 18:13:04 2013 @@ -544,7 +544,7 @@ "%s: {%s, ..., %s, kB, %s, kC}" % (MODEL_LM63_3SITE, r2, phi_exB, phi_exC), "%s: {%s, ..., pA, %s, %s}" % (MODEL_CR72, r2, dw, kex), "%s: {%s, %s, ..., pA, %s, %s}" % (MODEL_CR72_FULL, r2a, r2b, dw, kex), - "%s: {%s, ..., %s, %s, %s}" % (MODEL_IT99, r2, phi_ex, padw2, kex), + "%s: {%s, ..., pA, %s, %s}" % (MODEL_IT99, r2, dw, kex), "%s: {%s, ..., %s, k_AB}" % (MODEL_TSMFK01, r2a, dw), "%s: {%s, ..., pA, %s, %s}" % (MODEL_NS_CPMG_2SITE_3D, r2, dw, kex), "%s: {%s, %s, ..., pA, %s, %s}" % (MODEL_NS_CPMG_2SITE_3D_FULL, r2a, r2b, dw, kex), @@ -595,7 +595,7 @@ uf.desc[-1].add_item_list_element("'%s'" % MODEL_LM63_3SITE, "The original Luz and Meiboom (1963) 3-site fast exchange equation with parameters {R20, ..., phi_ex, kex, phi_ex2, kex2},") uf.desc[-1].add_item_list_element("'%s'" % MODEL_CR72, "The reduced Carver and Richards (1972) 2-site equation for all time scales whereby the simplification R20A = R20B is assumed. The parameters are {R20, ..., pA, dw, kex},") uf.desc[-1].add_item_list_element("'%s'" % MODEL_CR72_FULL, "The full Carver and Richards (1972) 2-site equation for all time scales with parameters {R20A, R20B, ..., pA, dw, kex},") -uf.desc[-1].add_item_list_element("'%s'" % MODEL_IT99, "The Ishima and Torchia (1999) 2-site model for all time scales with pA >> pB and with parameters {R20, ..., phi_ex, padw2, kex},") +uf.desc[-1].add_item_list_element("'%s'" % MODEL_IT99, "The Ishima and Torchia (1999) 2-site model for all time scales with pA >> pB and with parameters {R20, ..., pA, dw, kex},") uf.desc[-1].add_item_list_element("'%s'" % MODEL_TSMFK01, "The Tollinger, Kay et al. (2001) 2-site very-slow exchange model, range of microsecond to second time scale. Applicable in the limit of slow exchange, when |R20A-R20B| << k_AB,kB << 1/tau_CP. R20A is the transverse relaxation rate of site A in the absence of exchange. 2*tau_CP is is the time between successive 180 deg. pulses. The parameters are {R20A, ..., dw, k_AB}.") uf.desc[-1].add_paragraph("The currently supported numeric models are:") uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_CPMG_2SITE_3D, "The reduced numerical solution for the 2-site Bloch-McConnell equations using 3D magnetisation vectors whereby the simplification R20A = R20B is assumed. Its parameters are {R20, ..., pA, dw, kex},")