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
30
31
32 from lib.float import nan
33
34
35
36
37
38 h = 6.62606876 * 1e-34
39 """Planck's constant."""
40
41 h_bar = h / (2.0 * pi)
42 """Dirac's constant."""
43
44 mu0 = 4.0 * pi * 1e-7
45 """The magnetic constant or the permeability of vacuum."""
46
47 kB = 1.380650424 * 1e-23
48 """Boltzmann's constant in SI units of J.K^-1 (the last 2 digits of '24' are within the measured error limits)."""
49
50
51
52
53
54 N15_CSA = -172 * 1e-6
55 """The 15N CSA in the NH bond (default value)."""
56
57 NH_BOND_LENGTH = 1.02 * 1e-10
58 """The length of the NH bond (default value)."""
59
60 NH_BOND_LENGTH_RDC = 1.041 * 1e-10
61 """The length of the NH bond for RDCs (from Ottiger, M. and Bax A., J. Am. Chem. Soc. (1998), 120, 12334-12341)."""
62
63 CA_HA_BOND_LENGTH_RDC = 1.118 * 1e-10
64 """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)."""
65
66 CA_C_BOND_LENGTH_RDC = 1.526 * 1e-10
67 """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)."""
68
69 C_N_BOND_LENGTH_RDC = 1.329 * 1e-10
70 """The length of the C_prime-N bond for RDCs (from Ottiger, M. and Bax A., J. Am. Chem. Soc. (1998), 120, 12334-12341)."""
71
72 C_HN_BOND_LENGTH_RDC = 2.067 * 1e-10
73 """The length of the C_prime-HN bond for RDCs (from Ottiger, M. and Bax A., J. Am. Chem. Soc. (1998), 120, 12334-12341)."""
74
75
76
77
78
79
81 """Calculate the dipolar constant.
82
83 The dipolar constant is defined as::
84
85 mu0 gI.gS.h_bar
86 d = - --- ----------- ,
87 4pi r**3
88
89 where:
90 - mu0 is the permeability of free space,
91 - gI and gS are the gyromagnetic ratios of the I and S spins,
92 - h_bar is Dirac's constant which is equal to Planck's constant divided by 2pi,
93 - r is the distance between the two spins.
94
95
96 @param gx: The gyromagnetic ratio of the heteronucleus (or first spin).
97 @type gx: float
98 @param gh: The gyromagnetic ratio of the proton (or second spin).
99 @type gh: float
100 @param r: The distance between the two nuclei.
101 @type r: float
102 """
103
104
105 if r == 0:
106 return nan
107
108
109 return - mu0 / (4.0*pi) * gx * gh * h_bar / r**3
110
111
112
113
114
116 """Calculate the pseudocontact shift constant.
117
118 The pseudocontact shift constant is defined as::
119
120 mu0 15kT 1
121 d = --- ----- ---- ,
122 4pi Bo**2 r**3
123
124 where:
125 - mu0 is the permeability of free space,
126 - k is Boltzmann's constant,
127 - T is the absolute temperature,
128 - Bo is the magnetic field strength,
129 - r is the distance between the paramagnetic centre (electron spin) and the nuclear spin.
130
131
132 @param T: The temperature in kelvin.
133 @type T: float
134 @param Bo: The magnetic field strength.
135 @type Bo: float
136 @param r: The distance between the two nuclei.
137 @type r: float
138 """
139
140
141 if r == 0:
142 return nan
143
144
145 return mu0 / (4.0*pi) * 15.0 * kB * T / Bo**2 / r**3
146
147
148
149
150
151
153 """Determine and return the element name for the given isotope.
154
155 @param isotope: The isotope name, such as '1H', '15N'.
156 @type isotope: str
157 @return: The element name.
158 @rtype: str
159 """
160
161
162 return isotope.strip(digits)
163
164
166 """Determine and return the isotope number for the given isotope.
167
168 @param isotope: The isotope name, such as '1H', '15N'.
169 @type isotope: str
170 @return: The isotope number.
171 @rtype: int
172 """
173
174
175 return int(isotope.strip(ascii_letters))
176