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 math import pi
25 from re import match
26 from types import DictType, ListType
27
28
29
30
31
34 """Class containing all the program data."""
35
36
37
38 self.h = 6.62606876e-34
39 self.h_bar = self.h / ( 2.0*pi )
40 self.mu0 = 4.0 * pi * 1e-7
41
42
43 self.pdb = SpecificData()
44
45
46 self.diff = DiffTensorData()
47
48
49 self.res = Residue()
50
51
52 self.run_names = []
53
54
55 self.run_types = []
56
57
58 self.hybrid_runs = {}
59
60
61 self.chi2 = {}
62 self.iter = {}
63 self.f_count = {}
64 self.g_count = {}
65 self.h_count = {}
66 self.warning = {}
67
68
69
71 text = "The data class containing all permanent program data.\n"
72 text = text + "The class contains the following objects:\n"
73 for name in dir(self):
74 if match("^__", name):
75 continue
76 text = text + " " + name + ", " + `type(getattr(self, name))` + "\n"
77 return text
78
79
80
81
82
83
86 """Empty data container."""
87
88
90
91 text = "%-25s%-100s\n\n" % ("Data structure", "Value")
92
93
94 for name in dir(self):
95 if match("^__", name):
96 continue
97 text = text + "%-25s%-100s\n" % (name, `getattr(self, name)`)
98
99
100 return text
101
102
103
104
105
108 """Dictionary type class for specific data."""
109
110
112 text = "Data:\n"
113 if len(self) == 0:
114 text = text + " {}\n"
115 else:
116 i = 0
117 for key in self.keys():
118 if i == 0:
119 text = text + " { "
120 else:
121 text = text + " , "
122 text = text + "Key " + `key` + ":\n"
123 for name in dir(self[key]):
124 if match("^__", name):
125 continue
126 text = text + " " + name + ", " + `type(getattr(self[key], name))` + "\n"
127 i = i + 1
128 text = text + " }\n"
129
130 return text
131
132
134 """Function for adding an empty container to the dictionary."""
135
136 self[key] = Element()
137
138
139
140
141
142
145 """Dictionary type class for the diffusion tensor data.
146
147 The non-default diffusion parameters are calculated on the fly.
148 """
149
150
152 """Function for adding an empty container to the dictionary.
153
154 This overwrites the function from the parent class SpecificData.
155 """
156
157 self[key] = DiffTensorElement()
158
159
160
163 """An empty data container for the diffusion tensor elements."""
164
165
167 """Function for calculating the parameters on the fly."""
168
169
170
171
172
173 if name == 'Diso':
174 return 1.0 / (6.0 * self.tm)
175
176
177
178
179
180
181 if name == 'Dper':
182 return self.Diso - 1.0/3.0 * self.Da
183
184
185 if name == 'Dpar':
186 return self.Diso + 2.0/3.0 * self.Da
187
188
189 if name == 'Dratio':
190 return self.Dpar / self.Dper
191
192
193
194
195
196
197 if name == 'Dx':
198 return self.Diso - 1.0/3.0 * self.Da * (1.0 + 3.0*self.Dr)
199
200
201 if name == 'Dy':
202 return self.Diso - 1.0/3.0 * self.Da * (1.0 - 3.0*self.Dr)
203
204
205 if name == 'Dz':
206 return self.Diso + 2.0/3.0 * self.Da
207
208
209
210 raise AttributeError, name
211
212
213
214
215
216
219 """Class containing all the residue specific data."""
220
221
223 text = "Class containing all the residue specific data.\n\n"
224
225
226 if not len(self):
227 text = text + "The class contains no data.\n"
228
229
230 else:
231 text = text + "The residue container contains the following keys:\n"
232 for key in self:
233 text = text + " " + `key` + "\n"
234 text = text + "\nThese can be accessed by typing 'self.relax.data.res[key]'.\n"
235
236 return text
237
238
240 """Function for adding an empty container to the dictionary."""
241
242 self[key] = ResidueList()
243
244
247 """Empty data container for residue specific data."""
248
249
251 text = "Sequence data.\n\n"
252 text = text + "%-8s%-8s%-8s%-10s" % ("Index", "Number", "Name", "Selected") + "\n"
253 for i in xrange(len(self)):
254 text = text + "%-8i%-8i%-8s%-10i" % (i, self[i].num, self[i].name, self[i].select) + "\n"
255 text = text + "\nThese can be accessed by typing 'self.relax.data.res[key][index]'.\n"
256 return text
257
258
260 """Function for appending an empty container to the list."""
261
262 self.append(Element())
263