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 the 'n_state_model' user function class."""
25 __docformat__ = 'plaintext'
26
27
28 from base_class import User_fn_class
29 import arg_check
30 from specific_fns.setup import n_state_model_obj
31
32
34 """Class for the N-state models."""
35
93
94
95 - def cone_pdb(self, cone_type=None, scale=1.0, file='cone.pdb', dir=None, force=False):
96 """Create a PDB file representing the cone models from the centre of mass (CoM) analysis.
97
98 Keyword Arguments
99 ~~~~~~~~~~~~~~~~~
100
101 cone_type: The type of cone model to represent.
102
103 scale: Value for scaling the pivot-CoM distance which the size of the cone defaults to.
104
105 file: The name of the PDB file.
106
107 dir: The directory where the file is located.
108
109 force: A flag which, if set to True, will overwrite the any pre-existing file.
110
111
112 Description
113 ~~~~~~~~~~~
114
115 This function creates a PDB file containing an artificial geometric structure to represent
116 the various cone models. These models include:
117
118 'diff in cone'
119 'diff on cone'
120
121 The model can be selected by setting the cone_type argument to one of these strings. The
122 cone is represented as an isotropic cone with its axis parallel to the average pivot-CoM
123 vector, the vertex placed at the pivot point of the domain motions, and the length of the
124 edge of the cone equal to the pivot-CoM distance multipled by the scaling argument. The
125 resultant PDB file can subsequently read into any molecular viewer.
126
127 There are four different types of residue within the PDB. The pivot point is represented as
128 as a single carbon atom of the residue 'PIV'. The cone consists of numerous H atoms of the
129 residue 'CON'. The average pivot-CoM vector is presented as the residue 'AVE' with one
130 carbon atom positioned at the pivot and the other at the head of the vector (after scaling
131 by the scale argument). Finally, if Monte Carlo have been performed, there will be multiple
132 'MCC' residues representing the cone for each simulation, and multiple 'MCA' residues
133 representing the varying average pivot-CoM vector for each simulation.
134
135 To create the diffusion in a cone PDB representation, a uniform distribution of vectors on a
136 sphere is generated using spherical coordinates with the polar angle defined from the
137 average pivot-CoM vector. By incrementing the polar angle using an arccos distribution, a
138 radial array of vectors representing latitude are created while incrementing the azimuthal
139 angle evenly creates the longitudinal vectors. These are all placed into the PDB file as H
140 atoms and are all connected using PDB CONECT records. Each H atom is connected to its two
141 neighbours on the both the longitude and latitude. This creates a geometric PDB object with
142 longitudinal and latitudinal lines representing the filled cone.
143 """
144
145
146 if self._exec_info.intro:
147 text = self._exec_info.ps3 + "n_state_model.cone_pdb("
148 text = text + "cone_type=" + repr(cone_type)
149 text = text + ", scale=" + repr(scale)
150 text = text + ", file=" + repr(file)
151 text = text + ", dir=" + repr(dir)
152 text = text + ", force=" + repr(force) + ")"
153 print(text)
154
155
156 arg_check.is_str(cone_type, 'cone type')
157 arg_check.is_num(scale, 'scaling factor')
158 arg_check.is_str(file, 'file name')
159 arg_check.is_str(dir, 'directory name', can_be_none=True)
160 arg_check.is_bool(force, 'force flag')
161
162
163 n_state_model_obj._cone_pdb(cone_type=cone_type, scale=scale, file=file, dir=dir, force=force)
164
165
167 """Eliminate the structures or states with no probability.
168
169 Examples
170 ~~~~~~~~
171
172 Simply type:
173
174 relax> n_state_model.elim_no_prob(N=8)
175 """
176
177
178 if self._exec_info.intro:
179 text = self._exec_info.ps3 + "n_state_model.elim_no_prob()"
180 print(text)
181
182
183 n_state_model_obj._elim_no_prob()
184
185
187 """Set the number of states in the N-state model.
188
189 Keyword Arguments
190 ~~~~~~~~~~~~~~~~~
191
192 N: The number of states.
193
194
195 Description
196 ~~~~~~~~~~~
197
198 Prior to optimisation, the number of states in the N-state model can be specified. If the
199 number of states is not set, then this parameter will be equal to the number of loaded
200 structures.
201
202
203 Examples
204 ~~~~~~~~
205
206 To set up an 8-state model, type:
207
208 relax> n_state_model.number_of_states(N=8)
209 """
210
211
212 if self._exec_info.intro:
213 text = self._exec_info.ps3 + "n_state_model.number_of_states("
214 text = text + "N=" + repr(N) + ")"
215 print(text)
216
217
218 arg_check.is_int(N, 'number of states N')
219
220
221 n_state_model_obj._number_of_states(N=N)
222
223
224 - def ref_domain(self, ref=None):
225 """Set the reference domain for the '2-domain' N-state model.
226
227 Keyword Arguments
228 ~~~~~~~~~~~~~~~~~
229
230 ref: The domain which will act as the frame of reference. This is only valid for the
231 '2-domain' N-state model.
232
233
234 Description
235 ~~~~~~~~~~~
236
237 Prior to optimisation of the '2-domain' N-state model, which of the two domains will act as
238 the frame of reference must be specified. The N-states will be rotations of the other
239 domain, so to switch the frame of reference to the other domain simply transpose the
240 rotation matrices.
241
242
243 Examples
244 ~~~~~~~~
245
246 To set up a 5-state model with 'C' domain being the frame of reference, type:
247
248 relax> n_state_model.ref_domain(ref='C')
249 """
250
251
252 if self._exec_info.intro:
253 text = self._exec_info.ps3 + "n_state_model.ref_domain("
254 text = text + "ref=" + repr(ref) + ")"
255 print(text)
256
257
258 arg_check.is_str(ref, 'reference frame')
259
260
261 n_state_model_obj._ref_domain(ref=ref)
262
263
265 """Select the N-state model type and set up the model.
266
267 Keyword Arguments
268 ~~~~~~~~~~~~~~~~~
269
270 model: The name of the preset N-state model.
271
272
273 Description
274 ~~~~~~~~~~~
275
276 Prior to optimisation, the N-state model type should be selected. The preset models are:
277
278 '2-domain' - The N-state model for a system of two domains, where one domain experiences a
279 a reduced tensor.
280
281 'population' - The N-state model whereby only populations are optimised. The structures
282 loaded into relax are assumed to be fixed. I.e. if two domains are present, the Euler
283 angles for each state are fixed. The parameters of the model include the weight or
284 probability for each state and the alignment tensor - {p0, p1, ..., pN, Axx, Ayy, Axy, Axz,
285 Ayz}.
286
287 'fixed' - The N-state model whereby all motions are fixed and all populations are fixed to
288 the set probabilities. The parameters of the model are simply the alignment tensor, {Axx,
289 Ayy, Axy, Axz, Ayz}.
290
291
292 Examples
293 ~~~~~~~~
294
295 To analyse populations of states, type:
296
297 relax> n_state_model.select_model(model='populations')
298 """
299
300
301 if self._exec_info.intro:
302 text = self._exec_info.ps3 + "n_state_model.select_model("
303 text = text + "model=" + repr(model) + ")"
304 print(text)
305
306
307 arg_check.is_str(model, 'model')
308
309
310 n_state_model_obj._select_model(model=model)
311