Module physical_constants
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """Module containing all physical constants used in relax, as well as all associated functions."""
25
26
27
28 from math import pi
29 from string import ascii_letters, digits, upper
30
31
32 from float import nan
33 from relax_errors import RelaxError
34
35
36
37
38
39 h = 6.62606876 * 1e-34
40 """Planck's constant."""
41
42 h_bar = h / (2.0 * pi)
43 """Dirac's constant."""
44
45 mu0 = 4.0 * pi * 1e-7
46 """The magnetic constant or the permeability of vacuum."""
47
48 kB = 1.380650424 * 1e-23
49 """Boltzmann's constant in SI units of J.K^-1 (the last 2 digits of '24' are within the measured error limits)."""
50
51
52
53
54
55 N15_CSA = -172 * 1e-6
56 """The 15N CSA in the NH bond (default value)."""
57
58 NH_BOND_LENGTH = 1.02 * 1e-10
59 """The length of the NH bond (default value)."""
60
61 NH_BOND_LENGTH_RDC = 1.041 * 1e-10
62 """The length of the NH bond for RDCs (from Ottiger, M. and Bax A., J. Am. Chem. Soc. (1998), 120, 12334-12341)."""
63
64 CA_HA_BOND_LENGTH_RDC = 1.118 * 1e-10
65 """The length of the C_alpha-H_alpha bond for RDCs (from Ottiger, M. and Bax A., J. Am. Chem. Soc. (1998), 120, 12334-12341)."""
66
67 CA_C_BOND_LENGTH_RDC = 1.526 * 1e-10
68 """The length of the C_alpha-C_prime bond for RDCs (from Ottiger, M. and Bax A., J. Am. Chem. Soc. (1998), 120, 12334-12341)."""
69
70 C_N_BOND_LENGTH_RDC = 1.329 * 1e-10
71 """The length of the C_prime-N bond for RDCs (from Ottiger, M. and Bax A., J. Am. Chem. Soc. (1998), 120, 12334-12341)."""
72
73 C_HN_BOND_LENGTH_RDC = 2.067 * 1e-10
74 """The length of the C_prime-HN bond for RDCs (from Ottiger, M. and Bax A., J. Am. Chem. Soc. (1998), 120, 12334-12341)."""
75
76
77
78
79
80
82 """Calculate the dipolar constant.
83
84 The dipolar constant is defined as::
85
86 mu0 gI.gS.h_bar
87 d = - --- ----------- ,
88 4pi r**3
89
90 where:
91 - mu0 is the permeability of free space,
92 - gI and gS are the gyromagnetic ratios of the I and S spins,
93 - h_bar is Dirac's constant which is equal to Planck's constant divided by 2pi,
94 - r is the distance between the two spins.
95
96
97 @param gx: The gyromagnetic ratio of the heteronucleus (or first spin).
98 @type gx: float
99 @param gh: The gyromagnetic ratio of the proton (or second spin).
100 @type gh: float
101 @param r: The distance between the two nuclei.
102 @type r: float
103 """
104
105
106 if r == 0:
107 return nan
108
109
110 return - mu0 / (4.0*pi) * gx * gh * h_bar / r**3
111
112
113
114
115
117 """Calculate the pseudocontact shift constant.
118
119 The pseudocontact shift constant is defined as::
120
121 mu0 15kT 1
122 d = --- ----- ---- ,
123 4pi Bo**2 r**3
124
125 where:
126 - mu0 is the permeability of free space,
127 - k is Boltzmann's constant,
128 - T is the absolute temperature,
129 - Bo is the magnetic field strength,
130 - r is the distance between the paramagnetic centre (electron spin) and the nuclear spin.
131
132
133 @param T: The temperature in kelvin.
134 @type T: float
135 @param Bo: The magnetic field strength.
136 @type Bo: float
137 @param r: The distance between the two nuclei.
138 @type r: float
139 """
140
141
142 if r == 0:
143 return nan
144
145
146 return mu0 / (4.0*pi) * 15.0 * kB * T / Bo**2 / r**3
147
148
149
150
151
152
153 g13C = 6.728 * 1e7
154 """The 13C gyromagnetic ratio."""
155
156 g1H = 26.7522212 * 1e7
157 """The 1H gyromagnetic ratio."""
158
159
160 g15N = -2.7126 * 1e7
161 """The 15N gyromagnetic ratio."""
162
163
164 g17O = -3.628 * 1e7
165 """The 17O gyromagnetic ratio."""
166
167 g31P = 10.841 * 1e7
168 """The 31P gyromagnetic ratio."""
169
170
172 """Return the gyromagnetic ratio for the given nucleus type.
173
174 @keyword nucleus: The nucleus type.
175 @type nucleus: str
176 @raises RelaxError: If the nucleus type is unknown.
177 @returns: The desired gyromagnetic ratio.
178 @rtype: float
179 """
180
181
182 if nucleus == '13C':
183 return g13C
184 elif nucleus == '1H':
185 return g1H
186 elif nucleus == '15N':
187 return g15N
188 elif nucleus == '17O':
189 return g17O
190 elif nucleus == '31P':
191 return g31P
192 else:
193 raise RelaxError("The nucleus type " + repr(nucleus) + " is unknown.")
194
195
196
197
198
199 ArH = 1.00794
200 """Proton atomic mass."""
201
202 ArC = 12.0107
203 """Carbon atomic mass."""
204
205 ArN = 14.0067
206 """Nitrogen atomic mass."""
207
208 ArO = 15.9994
209 """Oxygen atomic mass."""
210
211 ArS = 32.065
212 """Sulphur atomic mass."""
213
214 ArCa = 40.078
215 """Calcium atomic mass."""
216
217
218
220 """Return the atomic mass for the given element type.
221
222 @keyword element: The element type.
223 @type element: str
224 @raises RelaxError: If the element type is unknown.
225 @returns: The desired atomic mass.
226 @rtype: float
227 """
228
229
230 if element == 'H':
231 return ArH
232 if element == '1H':
233 return 1.0
234 if element == '2H':
235 return 2.0
236
237
238 if element == 'C':
239 return ArC
240 if element == '12C':
241 return 12.0
242 if element == '13C':
243 return 13.0
244
245
246 if element == 'N':
247 return ArN
248 if element == '14N':
249 return 14.0
250 if element == '15N':
251 return 15.0
252
253
254 if element == 'O':
255 return ArO
256 if element == '16O':
257 return 16.0
258 if element == '17O':
259 return 17.0
260
261
262 if element == 'S':
263 return ArS
264
265
266 if upper(element) == 'CA':
267 return ArCa
268
269
270 raise RelaxError("The mass of the element " + repr(element) + " has not yet been programmed into relax.")
271
272
273
274
275
276
278 """Determine and return the element name for the given isotope.
279
280 @param isotope: The isotope name, such as '1H', '15N'.
281 @type isotope: str
282 @return: The element name.
283 @rtype: str
284 """
285
286
287 return isotope.strip(digits)
288
289
291 """Determine and return the isotope number for the given isotope.
292
293 @param isotope: The isotope name, such as '1H', '15N'.
294 @type isotope: str
295 @return: The isotope number.
296 @rtype: int
297 """
298
299
300 return int(isotope.strip(ascii_letters))
301