At this point we would like to address a related question. Currently the
calculation of physical constant is done in a several steps. First, the
physical constant is calculated and the value is stored in the
data.dip_const_func or data.csa_const_func (grad, hess). Then, when the
relaxation rates are calculated, the physical constant is recalculated
by
the function create_dip_func or create_csa_func (grad, hess) (method
setup_equations in class Mf, maths_fns/mf.py).
comp_dip_const_func(data, data.bond_length)
comp_csa_const_func(data, data.csa)
for i in xrange(data.num_ri):
data.dip_comps_func[i] = data.dip_const_func
if data.create_dip_func[i]:
data.dip_comps_func[i] =
data.create_dip_func[i](data.dip_const_func)
if data.create_csa_func[i]:
data.csa_comps_func[i] =
data.create_csa_func[i](data.csa_const_func[data.remap_table[i]])
There is one exception, the dipolar physical constant is not
recalculated in
the case of calculation R1 relaxation rate, because the function
create_dip_func does not exist in this case. We do not see a reason for
such
a recalculation.
The reason is because of the m10 to m39 models built into relax. I
have made it possible to optimise the bond length and CSA information.
However these models are not stable with the current relaxation data.
I do plan on working with these in the future though, so it would be
useful to keep them. Note that for models m0 to m9, the
data.create_dip_func[i] and data.create_csa_func[i] function pointers
are set to None. Therefore for normal model-free analysis the
constant is not recalculated.
It seems better to us to just change the coefficient in the
functions comp_r1_dip_jw, comp_r2_dip_jw, comp_r1_csa_jw, comp_r2_csa_jw
(maths_fns/ri_comps.py). I guess, that this design was dedicated to
avoid
multiple calculation of the same interaction constant for each measured
relaxation rate. We would suggest to reach the same effect by this
construction:
for i in xrange(data.num_ri):
if data.const_func[0]:
data.const_func[i] = data.const_func[0]
else
data.create_const_func(data)
For models m10 to m39, this construct will not work. The constants
are already pre-calculated for models m0 to m9 so this is not needed.
Note, the comp_dip_const_func and comp_csa_const_func should be change
so
that, it is possible to call them just with the argument data
(maths_fns/ri_comps.py). Instead of:
def comp_dip_const_func(data, bond_length):
"""Calculate the dipolar constant.
...
if bond_length == 0.0:
data.dip_const_func = 1e99
else:
data.dip_const_func = 0.25 * data.dip_const_fixed *
bond_length**-6
It should look like:
def comp_dip_const_func(data):
"""Calculate the dipolar constant.
...
if data.internuclei_distance == 0.0:
data.const_func = 1e99
else:
data.const_func = 0.25 * data.dip_const_fixed *
data.internuclei_distance**-6
The bond_length arg was designed so that the bond length could either
come from a fixed value supplied by the user or from the parameter
vector when bond lengths or CSA values are optimised. This behaviour
might have to be preserved.
data.dip_const_func were renamed to more general data.const_func and
instead
of bond_length the function directly takes the internuclei distance for
the
current dipole-dipole interaction. The change of data.dip_const_func to
data.const_func later simplify the code design in the
maths_fns/ri_prime.py
. It will be reduced just to a multiplication of constant and the linear
combination of spectral density functions.
For models m10 to m39, I'm not sure if this design would work. Could
we redesign this in another way in which these complex models are
still functional?