1 from Numeric import copy
2
5 "An additional layer of equations to simplify the relaxation equations, gradients, and hessians."
6
7
8
10 """An additional layer of equations to simplify the relaxation equations, gradients, and hessians.
11
12 The R1 and R2 equations are left alone, while the NOE is decomposed into the cross relaxation rate equation and the R1 equation.
13
14
15 The relaxation hessians
16 ~~~~~~~~~~~~~~~~~~~~~~~
17
18 Data structure: self.data.d2ri
19 Dimension: 3D, (parameters, parameters, relaxation data)
20 Type: Numeric array, Float64
21 Dependencies: self.data.ri_prime, self.data.dri_prime, self.data.d2ri_prime
22 Required by: self.data.d2chi2
23
24
25 Formulae
26 ~~~~~~~~
27
28 d2R1() d2R1'()
29 --------------- = ---------------
30 dthetaj.dthetak dthetaj.dthetak
31
32
33 d2R2() d2R2'()
34 --------------- = ---------------
35 dthetaj.dthetak dthetaj.dthetak
36
37
38 d2NOE() gH 1 / / dR1() dR1() d2R1() \
39 --------------- = -- . ------- . | sigma_noe() . | 2 . ------- . ------- - R1() . --------------- |
40 dthetaj.dthetak gN R1()**3 \ \ dthetaj dthetak dthetaj.dthetak /
41
42 / dsigma_noe() dR1() dR1() dsigma_noe() d2sigma_noe() \ \
43 - R1() . | ------------ . ------- + ------- . ------------ - R1() . --------------- | |
44 \ dthetaj dthetak dthetaj dthetak dthetaj.dthetak / /
45 """
46
47
48 self.d2Ri_prime()
49
50
51 self.data.d2ri = copy.deepcopy(self.data.d2ri_prime)
52
53
54 for i in range(self.mf.data.num_ri):
55 if self.mf.data.data_types[i] == 'NOE':
56 r1_index = self.mf.data.noe_r1_table[i]
57 r1 = self.data.ri_prime[r1_index]
58 if r1 == None:
59 raise NameError, "Incomplete code, need to somehow calculate the r1 value."
60 for param1 in range(len(self.data.ri_param_types)):
61 for param2 in range(param1 + 1):
62 if r1 == 0:
63 self.data.d2ri[param1, param2, i] = 1e99
64 else:
65 a = self.data.ri_prime[i] * (2.0 * self.data.dri_prime[param1, r1_index] * self.data.dri_prime[param2, r1_index] - r1 * self.data.d2ri_prime[param1, param2, r1_index])
66 b = r1 * (self.data.dri_prime[param1, i] * self.data.dri_prime[param2, r1_index] + self.data.dri_prime[param1, i] * self.data.dri_prime[param2, r1_index] - r1 * self.data.d2ri_prime[param1, param2, i])
67 self.data.d2ri[param1, param2, i] = (self.mf.data.gh/self.mf.data.gx) * (1.0 / r1**3) * (a - b)
68 if param1 != param2:
69 self.data.d2ri[param2, param1, i] = self.data.d2ri[param1, param2, i]
70