On 10 March 2011 18:09, Pavel Kaderavek <
pavel.kaderavek@xxxxxxxxx> wrote:
> Hi,
>
> Within this mail we need to discuss several related problems we faced when
> we started to think about the following patch. If it will be discussed
> separately the connection would be lost, therefore we decided to send it
> together. Of course we don't assume that everything will be put into the
> code in one huge patch, but it will be split into several parts.
>
> Originally, we wanted to discuss the selection of the equation in the
> function setup_equations in class Mf (maths_fns/mf.py). Currently, the
> equation for calculation physical constants and linear combination of
> spectral densities are selected just based on the type of relaxation rate
> (R1,R2,NOE).
>
> for i in xrange(data.num_ri):
> # The R1 equations.
> if data.ri_labels[i] == 'R1':
> data.create_csa_func[i] = comp_r1_csa_const
> data.create_csa_grad[i] = comp_r1_csa_const
> data.create_csa_hess[i] = comp_r1_csa_const
> data.create_dip_jw_func[i] = comp_r1_dip_jw
> data.create_dip_jw_grad[i] = comp_r1_dip_jw
> data.create_dip_jw_hess[i] = comp_r1_dip_jw
> data.create_csa_jw_func[i] = comp_r1_csa_jw
> data.create_csa_jw_grad[i] = comp_r1_csa_jw
> data.create_csa_jw_hess[i] = comp_r1_csa_jw
>
> # The R2 equations.
> elif data.ri_labels[i] == 'R2':
> data.create_dip_func[i] = comp_r2_dip_const
> data.create_dip_grad[i] = comp_r2_dip_const
> data.create_dip_hess[i] = comp_r2_dip_const
> data.create_csa_func[i] = comp_r2_csa_const
> data.create_csa_grad[i] = comp_r2_csa_const
> data.create_csa_hess[i] = comp_r2_csa_const
> data.create_rex_func[i] = comp_rex_const_func
> data.create_rex_grad[i] = comp_rex_const_grad
> data.create_dip_jw_func[i] = comp_r2_dip_jw
> data.create_dip_jw_grad[i] = comp_r2_dip_jw
> data.create_dip_jw_hess[i] = comp_r2_dip_jw
> data.create_csa_jw_func[i] = comp_r2_csa_jw
> data.create_csa_jw_grad[i] = comp_r2_csa_jw
> data.create_csa_jw_hess[i] = comp_r2_csa_jw
>
> # The NOE equations.
> elif data.ri_labels[i] == 'NOE':
> data.create_dip_jw_func[i] = comp_sigma_noe_dip_jw
> data.create_dip_jw_grad[i] = comp_sigma_noe_dip_jw
> data.create_dip_jw_hess[i] = comp_sigma_noe_dip_jw
> data.create_ri[i] = calc_noe
> data.create_dri[i] = calc_dnoe
> data.create_d2ri[i] = calc_d2noe
> if data.noe_r1_table[i] == None:
> data.get_r1[i] = calc_r1
> data.get_dr1[i] = calc_dr1
> data.get_d2r1[i] = calc_d2r1
> else:
> data.get_r1[i] = extract_r1
> data.get_dr1[i] = extract_dr1
> data.get_d2r1[i] = extract_d2r1
>
> It is necessary to select the equation based on both type of relaxation rate
> and also interaction type in the new code design. Therefore we suggest to
> change the code in following way:
>
> for i in xrange(data.num_ri):
> # The R1 equations.
> if data.ri_labels[i] == 'R1':
> if data.interactions == "dip"
> data.create_const_func[i] = comp_dip_const_func
> data.create_const_grad[i] = comp_dip_const_grad
> data.create_const_hess[i] = comp_dip_const_hess
> data.create_jw_func[i] = comp_r1_dip_jw
> data.create_jw_grad[i] = comp_r1_dip_jw
> data.create_jw_hess[i] = comp_r1_dip_jw
> elif data.interactions == "CSA"
> data.create_const_func[i] = comp_csa_const_func
> data.create_const_grad[i] = comp_csa_const_grad
> data.create_const_hess[i] = comp_csa_const_hess
> data.create_jw_func[i] = comp_r1_csa_jw
> data.create_jw_grad[i] = comp_r1_csa_jw
> data.create_jw_hess[i] = comp_r1_csa_jw
> elif data.interactions == "Rex"
> data.create_const_func[i] = comp_rex_const_func
> data.create_const_grad[i] = comp_rex_const_grad
> data.create_const_hess[i] = comp_rex_const_hess
> elif data.interactions == "cross-CSA-CSA"
> data.create_const_func[i] = comp_cross_csa_csa_const_func
> data.create_const_grad[i] = comp_cross_csa_csa_const_grad
> data.create_const_hess[i] = comp_cross_csa_csa_const_hess
> data.create_jw_func[i] = comp_r1_cross_csa_csa_jw
> data.create_jw_grad[i] = comp_r1_cross_csa_csa_jw
> data.create_jw_hess[i] = comp_r1_cross_csa_csa_jw
>
> # The R2 equations.
> elif data.ri_labels[i] == 'R2':
> if data.interactions == "dip"
> data.create_const_func[i] = comp_dip_const_func
> data.create_const_grad[i] = comp_dip_const_grad
> data.create_const_hess[i] = comp_dip_const_hess
> data.create_jw_func[i] = comp_r2_dip_jw
> data.create_jw_grad[i] = comp_r2_dip_jw
> data.create_jw_hess[i] = comp_r2_dip_jw
> elif data.interactions == "CSA"
> data.create_const_func[i] = comp_csa_const_func
> data.create_const_grad[i] = comp_csa_const_grad
> data.create_const_hess[i] = comp_csa_const_hess
> data.create_jw_func[i] = comp_r2_csa_jw
> data.create_jw_grad[i] = comp_r2_csa_jw
> data.create_jw_hess[i] = comp_r2_csa_jw
> elif data.interactions == "Rex"
> data.create_const_func[i] = comp_rex_const_func
> data.create_const_grad[i] = comp_rex_const_grad
> data.create_const_hess[i] = comp_rex_const_hess
> elif data.interactions == "cross-CSA-CSA"
> data.create_const_func[i] = comp_cross_csa_csa_const_func
> data.create_const_grad[i] = comp_cross_csa_csa_const_grad
> data.create_const_hess[i] = comp_cross_csa_csa_const_hess
> data.create_jw_func[i] = comp_r2_cross_csa_csa_jw
> data.create_jw_grad[i] = comp_r2_cross_csa_csa_jw
> data.create_jw_hess[i] = comp_r2_cross_csa_csa_jw
>
> # The NOE equations.
> elif data.ri_labels[i] == 'NOE':
> if data.interactions == "dip"
> data.create_const_func[i] = comp_dip_const_func
> data.create_const_grad[i] = comp_dip_const_grad
> data.create_const_hess[i] = comp_dip_const_hess
> data.create_jw_func[i] = comp_sigma_noe_dip_jw
> data.create_jw_grad[i] = comp_sigma_noe_dip_jw
> data.create_jw_hess[i] = comp_sigma_noe_dip_jw
>
> data.create_ri[i] = calc_noe
> data.create_dri[i] = calc_dnoe
> data.create_d2ri[i] = calc_d2noe
> if data.noe_r1_table[i] == None:
> data.get_r1[i] = calc_r1
> data.get_dr1[i] = calc_dr1
> data.get_d2r1[i] = calc_d2r1
> else:
> data.get_r1[i] = extract_r1
> data.get_dr1[i] = extract_dr1
> data.get_d2r1[i] = extract_d2r1