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