1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 from ri_comps import r1_comps, dr1_comps, d2r1_comps
25 from ri_prime import func_ri_prime
26
27
28
29
30
31 -def calc_noe(data, i, frq_num, get_r1, params):
47
48
49 -def calc_dnoe(data, i, frq_num, get_dr1, params, j):
50 """Calculate the derivative of the NOE value.
51
52 Half this code needs to be shifted into the function initialisation code.
53 """
54
55
56 data.dr1[j, i] = get_dr1[i](data, i, frq_num, params, j)
57 if data.r1[i] == 0.0 and data.ri_prime[i] == 0.0:
58 data.dri[j, i] = 0.0
59 elif data.r1[i] == 0.0:
60 data.dri[j, i] = 1e99
61 else:
62 data.dri[j, i] = data.g_ratio * (1.0 / data.r1[i]**2) * (data.r1[i] * data.dri_prime[j, i] - data.ri_prime[i] * data.dr1[j, i])
63
64
65 -def calc_d2noe(data, i, frq_num, get_d2r1, params, j, k):
66 """Calculate the second partial derivative of the NOE value.
67
68 Half this code needs to be shifted into the function initialisation code.
69 """
70
71
72 data.d2r1[j, k, i] = get_d2r1[i](data, i, frq_num, params, j, k)
73 if data.r1[i] == 0.0 and data.ri_prime[i] == 0.0:
74 data.d2ri[j, k, i] = 0.0
75 elif data.r1[i] == 0.0:
76 data.d2ri[j, k, i] = 1e99
77 else:
78 a = data.ri_prime[i] * (2.0 * data.dr1[j, i] * data.dr1[k, i] - data.r1[i] * data.d2r1[j, k, i])
79 b = data.r1[i] * (data.dri_prime[j, i] * data.dr1[k, i] + data.dr1[j, i] * data.dri_prime[k, i] - data.r1[i] * data.d2ri_prime[j, k, i])
80 data.d2ri[j, k, i] = data.g_ratio * (1.0 / data.r1[i]**3) * (a - b)
81
82
83
84
85
86
87 -def calc_r1(data, i, frq_num, params):
88 """Calculate the R1 value if there is no R1 data corresponding to the NOE data.
89
90 R1() = dip_const_func . dip_Jw_R1_func + csa_const_func . csa_Jw_R1_func
91 """
92
93
94 data.r1_data.remap_table = data.remap_table
95 data.r1_data.jw = data.jw
96 data.r1_data.dip_const_func = data.dip_const_func
97 data.r1_data.csa_const_func = data.csa_const_func
98
99
100 r1_comps(data.r1_data, i, params)
101
102
103 ri = func_ri_prime(data.r1_data)
104 return ri[i]
105
106
107 -def calc_dr1(data, i, frq_num, params, j):
108 """Calculate the R1 value if there is no R1 data corresponding to the NOE data.
109
110 dR1()
111 ----- = dip_const_func . dip_Jw_R1_grad + csa_const_func . csa_Jw_R1_grad
112 dJw
113
114 dR1()
115 ----- = 0
116 dRex
117
118 dR1()
119 ----- = dip_const_grad . dip_Jw_R1_func
120 dr
121
122 dR1()
123 ----- = csa_const_grad . csa_Jw_R1_func
124 dcsa
125 """
126
127
128 data.r1_data.remap_table = data.remap_table
129 data.r1_data.djw = data.djw
130 data.r1_data.dip_const_grad = data.dip_const_grad
131 data.r1_data.csa_const_grad = data.csa_const_grad
132
133
134 dr1_comps(data.r1_data, i, params)
135
136
137 dri = data.r1_data.create_dri_prime[j](data.r1_data)
138
139 return dri[i]
140
141
142 -def calc_d2r1(data, i, frq_num, params, j, k):
143 """Calculate the R1 value if there is no R1 data corresponding to the NOE data."""
144
145
146 data.r1_data.remap_table = data.remap_table
147 data.r1_data.d2jw = data.d2jw
148 data.r1_data.dip_const_hess = data.dip_const_hess
149 data.r1_data.csa_const_hess = data.csa_const_hess
150
151
152 d2r1_comps(data.r1_data, i, params)
153
154
155 if data.r1_data.create_d2ri_prime[j][k]:
156 d2ri = data.r1_data.create_d2ri_prime[j][k](data.r1_data)
157 return d2ri[i]
158 else:
159 return 0.0
160
161
162
163
164
165
167 """Get the R1 value from data.ri_prime"""
168
169 return data.ri_prime[data.noe_r1_table[i]]
170
171
173 """Get the dR1 value from data.dri_prime"""
174
175 return data.dri_prime[j, data.noe_r1_table[i]]
176
177
179 """Get the d2R1 value from data.d2ri_prime"""
180
181 return data.d2ri_prime[j, k, data.noe_r1_table[i]]
182