Author: bugman Date: Wed Feb 1 13:28:57 2012 New Revision: 15286 URL: http://svn.gna.org/viewcvs/relax?rev=15286&view=rev Log: Started to convert the frame order rotor model to quasi-random numerical integration. Modified: branches/frame_order_testing/maths_fns/frame_order.py Modified: branches/frame_order_testing/maths_fns/frame_order.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/maths_fns/frame_order.py?rev=15286&r1=15285&r2=15286&view=diff ============================================================================== --- branches/frame_order_testing/maths_fns/frame_order.py (original) +++ branches/frame_order_testing/maths_fns/frame_order.py Wed Feb 1 13:28:57 2012 @@ -36,7 +36,7 @@ from maths_fns.alignment_tensor import to_5D, to_tensor from maths_fns.chi2 import chi2 from maths_fns.coord_transform import spherical_to_cartesian -from maths_fns.frame_order_matrix_ops import compile_2nd_matrix_free_rotor, compile_2nd_matrix_iso_cone, compile_2nd_matrix_iso_cone_free_rotor, compile_2nd_matrix_iso_cone_torsionless, compile_2nd_matrix_pseudo_ellipse, compile_2nd_matrix_pseudo_ellipse_free_rotor, compile_2nd_matrix_pseudo_ellipse_torsionless, compile_2nd_matrix_rotor, reduce_alignment_tensor, pcs_numeric_int_iso_cone, pcs_numeric_int_iso_cone_mcint, pcs_numeric_int_iso_cone_torsionless, pcs_numeric_int_iso_cone_torsionless_mcint, pcs_numeric_int_pseudo_ellipse, pcs_numeric_int_pseudo_ellipse_qrint, pcs_numeric_int_pseudo_ellipse_torsionless, pcs_numeric_int_pseudo_ellipse_torsionless_mcint, pcs_numeric_int_rotor, pcs_numeric_int_rotor_mcint +from maths_fns.frame_order_matrix_ops import compile_2nd_matrix_free_rotor, compile_2nd_matrix_iso_cone, compile_2nd_matrix_iso_cone_free_rotor, compile_2nd_matrix_iso_cone_torsionless, compile_2nd_matrix_pseudo_ellipse, compile_2nd_matrix_pseudo_ellipse_free_rotor, compile_2nd_matrix_pseudo_ellipse_torsionless, compile_2nd_matrix_rotor, reduce_alignment_tensor, pcs_numeric_int_iso_cone, pcs_numeric_int_iso_cone_mcint, pcs_numeric_int_iso_cone_torsionless, pcs_numeric_int_iso_cone_torsionless_mcint, pcs_numeric_int_pseudo_ellipse, pcs_numeric_int_pseudo_ellipse_qrint, pcs_numeric_int_pseudo_ellipse_torsionless, pcs_numeric_int_pseudo_ellipse_torsionless_mcint, pcs_numeric_int_rotor, pcs_numeric_int_rotor_qrint from maths_fns.kronecker_product import kron_prod from maths_fns import order_parameters from maths_fns.rotation_matrix import euler_to_R_zyz @@ -270,13 +270,10 @@ self.drdc_theta = zeros((self.total_num_params, self.num_align, self.num_rdc), float64) self.d2rdc_theta = zeros((self.total_num_params, self.total_num_params, self.num_align, self.num_rdc), float64) - # The Sobol' sequence data. - if mcint: - self.create_sobol_data(m=3, n=200000) - - # The target function aliases (Monte Carlo integration). + # The Sobol' sequence data and target function aliases (quasi-random integration). if mcint: if model == 'pseudo-ellipse': + self.create_sobol_data(m=3, n=self.num_int_pts) self.func = self.func_pseudo_ellipse_qrint elif model == 'pseudo-ellipse, torsionless': self.func = self.func_pseudo_ellipse_torsionless_mcint @@ -295,7 +292,8 @@ elif model == 'line, free rotor': self.func = self.func_line_free_rotor_mcint elif model == 'rotor': - self.func = self.func_rotor_mcint + self.create_sobol_data(m=1, n=self.num_int_pts) + self.func = self.func_rotor_qrint elif model == 'rigid': self.func = self.func_rigid elif model == 'free rotor': @@ -507,7 +505,7 @@ # PCS via Monte Carlo integration. if self.pcs_flag: # Numerical integration of the PCSs. - pcs_numeric_int_rotor_mcint(N=self.num_int_pts, sigma_max=pi, c=self.pcs_const, full_in_ref_frame=self.full_in_ref_frame, r_pivot_atom=self.r_pivot_atom, r_pivot_atom_rev=self.r_pivot_atom_rev, r_ln_pivot=self.r_ln_pivot, A=self.A_3D, R_eigen=self.R_eigen, RT_eigen=RT_eigen, Ri_prime=self.Ri_prime, pcs_theta=self.pcs_theta, pcs_theta_err=self.pcs_theta_err, missing_pcs=self.missing_pcs, error_flag=False) + pcs_numeric_int_rotor_qrint(N=self.num_int_pts, sigma_max=pi, c=self.pcs_const, full_in_ref_frame=self.full_in_ref_frame, r_pivot_atom=self.r_pivot_atom, r_pivot_atom_rev=self.r_pivot_atom_rev, r_ln_pivot=self.r_ln_pivot, A=self.A_3D, R_eigen=self.R_eigen, RT_eigen=RT_eigen, Ri_prime=self.Ri_prime, pcs_theta=self.pcs_theta, pcs_theta_err=self.pcs_theta_err, missing_pcs=self.missing_pcs, error_flag=False) # Calculate and sum the single alignment chi-squared value (for the PCS). for i in xrange(self.num_align): @@ -1613,10 +1611,10 @@ return chi2_sum - def func_rotor_mcint(self, params): + def func_rotor_qrint(self, params): """Target function for rotor model optimisation. - This function optimises the isotropic cone model parameters using the RDC and PCS base data. Simple Monte Carlo integration is used for the PCS. + This function optimises the isotropic cone model parameters using the RDC and PCS base data. Quasi-random, Sobol' sequence based, numerical integration is used for the PCS. @param params: The vector of parameter values. These are the tensor rotation angles {alpha, beta, gamma, theta, phi, sigma_max}. @@ -1678,7 +1676,7 @@ # PCS via Monte Carlo integration. if self.pcs_flag: # Numerical integration of the PCSs. - pcs_numeric_int_rotor_mcint(N=self.num_int_pts, sigma_max=sigma_max, c=self.pcs_const, full_in_ref_frame=self.full_in_ref_frame, r_pivot_atom=self.r_pivot_atom, r_pivot_atom_rev=self.r_pivot_atom_rev, r_ln_pivot=self.r_ln_pivot, A=self.A_3D, R_eigen=self.R_eigen, RT_eigen=RT_eigen, Ri_prime=self.Ri_prime, pcs_theta=self.pcs_theta, pcs_theta_err=self.pcs_theta_err, missing_pcs=self.missing_pcs, error_flag=False) + pcs_numeric_int_rotor_qrint(points=self.sobol_angles, sigma_max=sigma_max, c=self.pcs_const, full_in_ref_frame=self.full_in_ref_frame, r_pivot_atom=self.r_pivot_atom, r_pivot_atom_rev=self.r_pivot_atom_rev, r_ln_pivot=self.r_ln_pivot, A=self.A_3D, R_eigen=self.R_eigen, RT_eigen=RT_eigen, Ri_prime=self.Ri_prime, pcs_theta=self.pcs_theta, pcs_theta_err=self.pcs_theta_err, missing_pcs=self.missing_pcs, error_flag=False) # Calculate and sum the single alignment chi-squared value (for the PCS). for i in xrange(self.num_align):