Author: bugman Date: Fri Jul 12 16:30:03 2013 New Revision: 20284 URL: http://svn.gna.org/viewcvs/relax?rev=20284&view=rev Log: Added parameter conversions to go from pA and kex to kge and keg. This is for the 'NS 2-site star' numerical model. The conversions have been added to the start of the target function to minimise mathematical operations to speed up the code. Modified: branches/relax_disp/lib/dispersion/ns_2site_star.py branches/relax_disp/target_functions/relax_disp.py Modified: branches/relax_disp/lib/dispersion/ns_2site_star.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/ns_2site_star.py?rev=20284&r1=20283&r2=20284&view=diff ============================================================================== --- branches/relax_disp/lib/dispersion/ns_2site_star.py (original) +++ branches/relax_disp/lib/dispersion/ns_2site_star.py Fri Jul 12 16:30:03 2013 @@ -50,9 +50,9 @@ @type r20b: float @keyword fg: Unknown. @type fg: unknown - @keyword kge: The forward exchange rate. + @keyword kge: The forward exchange rate from state A to state B. @type kge: float - @keyword keg: The reverse exchange rate. + @keyword keg: The reverse exchange rate from state B to state A. @type keg: float @keyword tcpmg: Unknown. @type tcpmg: unknown 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=20284&r1=20283&r2=20284&view=diff ============================================================================== --- branches/relax_disp/target_functions/relax_disp.py (original) +++ branches/relax_disp/target_functions/relax_disp.py Fri Jul 12 16:30:03 2013 @@ -495,6 +495,11 @@ pA = params[self.end_index[2]] kex = params[self.end_index[2]+1] + # Once off parameter conversions. + pB = 1.0 - pA + kge = pA * kex + keg = pB * kex + # Initialise. chi2_sum = 0.0 @@ -509,15 +514,15 @@ dw_frq = dw[spin_index] * self.frqs[spin_index, frq_index] # Back calculate the R2eff values. - r2eff_ns_2site_star(r20a=R20A[r20_index], r20b=R20B[r20_index], pA=pA, dw=dw_frq, kex=kex, 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): - if self.missing[spin_index, frq_index, point_index]: - self.back_calc[spin_index, frq_index, point_index] = self.values[spin_index, frq_index, point_index] - - # Calculate and return the chi-squared value. - chi2_sum += chi2(self.values[spin_index, frq_index], self.back_calc[spin_index, frq_index], self.errors[spin_index, frq_index]) - - # Return the total chi-squared value. - return chi2_sum + r2eff_ns_2site_star(r20a=R20A[r20_index], r20b=R20B[r20_index], pA=pA, kge=kge, keg=keg, 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): + if self.missing[spin_index, frq_index, point_index]: + self.back_calc[spin_index, frq_index, point_index] = self.values[spin_index, frq_index, point_index] + + # Calculate and return the chi-squared value. + chi2_sum += chi2(self.values[spin_index, frq_index], self.back_calc[spin_index, frq_index], self.errors[spin_index, frq_index]) + + # Return the total chi-squared value. + return chi2_sum