1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from math import cos, pi, sin, sqrt
24 import platform
25 import numpy
26 from numpy import array, dot, eye, float64, transpose, zeros
27 from os import sep
28 from tempfile import mkdtemp
29
30
31 from data_store import Relax_data_store; ds = Relax_data_store()
32 import dep_check
33 from lib.frame_order.conversions import create_rotor_axis_alpha, create_rotor_axis_spherical
34 from lib.frame_order.variables import MODEL_DOUBLE_ROTOR, MODEL_FREE_ROTOR, MODEL_ISO_CONE, MODEL_ISO_CONE_FREE_ROTOR, MODEL_ISO_CONE_TORSIONLESS, MODEL_PSEUDO_ELLIPSE, MODEL_PSEUDO_ELLIPSE_TORSIONLESS, MODEL_RIGID, MODEL_ROTOR
35 from lib.geometry.coord_transform import cartesian_to_spherical
36 from lib.geometry.rotations import axis_angle_to_R, euler_to_R_zyz, R_to_euler_zyz
37 from status import Status; status = Status()
38 from test_suite.system_tests.base_classes import SystemTestCase
39
40
41
42 SYSTEM = platform.system()
43 RELEASE = platform.release()
44 VERSION = platform.version()
45 WIN32_VER = platform.win32_ver()
46 DIST = platform.dist()
47 ARCH = platform.architecture()
48 MACH = platform.machine()
49 PROC = platform.processor()
50 PY_VER = platform.python_version()
51 NUMPY_VER = numpy.__version__
52 LIBC_VER = platform.libc_ver()
53
54
55 if SYSTEM == 'Windows' or SYSTEM == 'Microsoft':
56
57 SYSTEM = 'Windows'
58
59
60
61 x_axis = array([1, 0, 0], float64)
62 y_axis = array([0, 1, 0], float64)
63 z_axis = array([0, 0, 1], float64)
64 origin = array([0, 0, 0], float64)
65
66
68 """TestCase class for the functional tests of the frame order theories."""
69
70 - def __init__(self, methodName='runTest'):
71 """Skip the tests if scipy is not installed.
72
73 @keyword methodName: The name of the test.
74 @type methodName: str
75 """
76
77
78 super(Frame_order, self).__init__(methodName)
79
80
81 blacklist = [
82 'test_cam_qr_int_free_rotor_pcs',
83 'test_cam_qr_int_free_rotor_rdc',
84 'test_cam_qr_int_free_rotor2_pcs',
85 'test_cam_qr_int_free_rotor2_rdc',
86 'test_cam_qr_int_iso_cone_pcs',
87 'test_cam_qr_int_iso_cone_rdc',
88 'test_cam_qr_int_iso_cone_free_rotor_pcs',
89 'test_cam_qr_int_iso_cone_free_rotor_rdc',
90 'test_cam_qr_int_iso_cone_free_rotor2_pcs',
91 'test_cam_qr_int_iso_cone_free_rotor2_rdc',
92 'test_cam_qr_int_iso_cone_torsionless_pcs',
93 'test_cam_qr_int_iso_cone_torsionless_rdc',
94 'test_cam_qr_int_pseudo_ellipse2_pcs',
95 'test_cam_qr_int_pseudo_ellipse2_rdc',
96 'test_cam_qr_int_pseudo_ellipse_free_rotor_pcs',
97 'test_cam_qr_int_pseudo_ellipse_free_rotor_rdc',
98 'test_cam_qr_int_pseudo_ellipse_torsionless_pcs',
99 'test_cam_qr_int_pseudo_ellipse_torsionless_rdc',
100 'test_cam_qr_int_rigid_pcs',
101 'test_cam_qr_int_rigid_rdc',
102 'test_cam_qr_int_rotor_pcs',
103 'test_cam_qr_int_rotor_rdc',
104 'test_cam_qr_int_rotor_2_state_pcs',
105 'test_cam_qr_int_rotor_2_state_rdc',
106 'test_cam_qr_int_rotor2_pcs',
107 'test_cam_qr_int_rotor2_rdc',
108 'test_cam_quad_int_free_rotor_pcs',
109 'test_cam_quad_int_free_rotor_rdc',
110 'test_cam_quad_int_free_rotor2_pcs',
111 'test_cam_quad_int_free_rotor2_rdc',
112 'test_cam_quad_int_iso_cone_pcs',
113 'test_cam_quad_int_iso_cone_rdc',
114 'test_cam_quad_int_iso_cone_free_rotor_pcs',
115 'test_cam_quad_int_iso_cone_free_rotor_rdc',
116 'test_cam_quad_int_iso_cone_free_rotor2_pcs',
117 'test_cam_quad_int_iso_cone_free_rotor2_rdc',
118 'test_cam_quad_int_iso_cone_torsionless_pcs',
119 'test_cam_quad_int_iso_cone_torsionless_rdc',
120 'test_cam_quad_int_pseudo_ellipse2_pcs',
121 'test_cam_quad_int_pseudo_ellipse2_rdc',
122 'test_cam_quad_int_pseudo_ellipse_free_rotor_pcs',
123 'test_cam_quad_int_pseudo_ellipse_free_rotor_rdc',
124 'test_cam_quad_int_pseudo_ellipse_torsionless_pcs',
125 'test_cam_quad_int_pseudo_ellipse_torsionless_rdc',
126 'test_cam_quad_int_rigid_pcs',
127 'test_cam_quad_int_rigid_rdc',
128 'test_cam_quad_int_rotor_pcs',
129 'test_cam_quad_int_rotor_rdc',
130 'test_cam_quad_int_rotor_2_state_pcs',
131 'test_cam_quad_int_rotor_2_state_rdc',
132 'test_cam_quad_int_rotor2_pcs',
133 'test_cam_quad_int_rotor2_rdc'
134 ]
135
136
137 if methodName in blacklist:
138 status.skipped_tests.append([methodName, None, self._skip_type])
139
140
141 if not dep_check.scipy_module:
142
143 status.skipped_tests.append([methodName, 'Scipy', self._skip_type])
144
145
147 """Set up for all the functional tests."""
148
149
150 self.cam_path = status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'cam'+sep
151
152
153 ds.tmpdir = mkdtemp()
154
155
167
168
183
184
186 """Check the PDB model representation atom and residue names and numbers and coordinates.
187
188 Propeller blade atoms with the name 'BLD' are skipped, as well as the cone interior residues with the name 'CON'.
189
190
191 @keyword data: The list of data to check. The first dimension is for the representation, and the second for each atom. The lists of each atom consist of the residue number, residue name, atom number, atom name, and the 3D position.
192 @type data: list of list of lists
193 @keyword files: The list of files for each representation.
194 @type files: list of str
195 """
196
197
198 for i in range(len(data)):
199
200 self.interpreter.structure.delete()
201
202
203 self.interpreter.structure.read_pdb(file=files[i], dir=ds.tmpdir)
204
205
206 selection = cdp.structure.selection()
207 index = 0
208 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
209
210 if atom_name == 'BLD':
211 continue
212
213
214 if res_name == 'CON':
215 continue
216
217
218 print("Checking residue %s %s, atom %s %s, at position %s." % (data[i][index][0], data[i][index][1], data[i][index][2], data[i][index][3], data[i][index][4]))
219 print(" to residue %s %s, atom %s %s, at position %s." % (res_num, res_name, atom_num, atom_name, pos[0]))
220 self.assertEqual(data[i][index][0], res_num)
221 self.assertEqual(data[i][index][1], res_name)
222 self.assertEqual(data[i][index][2], atom_num)
223 self.assertEqual(data[i][index][3], atom_name)
224 self.assertAlmostEqual(data[i][index][4][0], pos[0][0], 3)
225 self.assertAlmostEqual(data[i][index][4][1], pos[0][1], 3)
226 self.assertAlmostEqual(data[i][index][4][2], pos[0][2], 3)
227
228
229 index += 1
230
231
232 - def flags(self, rdc=True, pcs=True, opt=False, quad_int=False):
240
241
243 """Method for returning a string to help debug the minimisation.
244
245 @return: The debugging string.
246 @rtype: str
247 """
248
249
250 string = 'Optimisation failure.\n\n'
251
252
253 string = string + "%-18s%-25s\n" % ("System: ", SYSTEM)
254 string = string + "%-18s%-25s\n" % ("Release: ", RELEASE)
255 string = string + "%-18s%-25s\n" % ("Version: ", VERSION)
256 string = string + "%-18s%-25s\n" % ("Win32 version: ", (WIN32_VER[0] + " " + WIN32_VER[1] + " " + WIN32_VER[2] + " " + WIN32_VER[3]))
257 string = string + "%-18s%-25s\n" % ("Distribution: ", (DIST[0] + " " + DIST[1] + " " + DIST[2]))
258 string = string + "%-18s%-25s\n" % ("Architecture: ", (ARCH[0] + " " + ARCH[1]))
259 string = string + "%-18s%-25s\n" % ("Machine: ", MACH)
260 string = string + "%-18s%-25s\n" % ("Processor: ", PROC)
261 string = string + "%-18s%-25s\n" % ("Python version: ", PY_VER)
262 string = string + "%-18s%-25s\n" % ("Numpy version: ", NUMPY_VER)
263 string = string + "%-18s%-25s\n" % ("Libc version: ", (LIBC_VER[0] + " " + LIBC_VER[1]))
264
265
266
267 string = string + "\n"
268 for param in ['ave_pos_x', 'ave_pos_y', 'ave_pos_z', 'ave_pos_alpha', 'ave_pos_beta', 'ave_pos_gamma', 'eigen_alpha', 'eigen_beta', 'eigen_gamma', 'axis_theta', 'axis_phi', 'cone_theta_x', 'cone_theta_y', 'cone_theta', 'cone_sigma_max', 'cone_sigma_max_2']:
269 if hasattr(cdp, param):
270 obj = getattr(cdp, param)
271 string = string + "%-15s %30.17g\n" % (param, obj)
272
273 string = string + "%-15s %30.17g\n" % ('chi2:', cdp.chi2)
274 if hasattr(cdp, 'sobol_max_points'):
275 string = string + "%-15s %30i\n" % ('sobol_max_points:', cdp.sobol_max_points)
276 if hasattr(cdp, 'iter') and cdp.iter != None:
277 string = string + "%-15s %30i\n" % ('iter:', cdp.iter)
278 if hasattr(cdp, 'f_count') and cdp.f_count != None:
279 string = string + "%-15s %30i\n" % ('f_count:', cdp.f_count)
280 if hasattr(cdp, 'g_count') and cdp.g_count != None:
281 string = string + "%-15s %30i\n" % ('g_count:', cdp.g_count)
282 if hasattr(cdp, 'h_count') and cdp.h_count != None:
283 string = string + "%-15s %30i\n" % ('h_count:', cdp.h_count)
284 if hasattr(cdp, 'warning'):
285 string = string + "%-15s %30s\n" % ('warning:', cdp.warning)
286
287
288 return string
289
290
292 """Rotate a vector along Z-axis around the origin.
293
294 @keyword origin: The origin of the final vector.
295 @type origin: numpy 3D, rank-1 array
296 @keyword length: The length of the Z-vector to rotate.
297 @type length: float
298 @keyword angle: The angle in rad to rotate by.
299 @type angle: float
300 @keyword axis: The direction in the xy-plane to rotate the vector along.
301 @type axis: numpy 3D, rank-1 array
302 @keyword R: A rotation matrix to be used before adding the origin.
303 @type R: numpy 3D, rank-2 array
304 @keyword neg: A flag which if True causes the negative Z-axis to be used.
305 @type neg: bool
306 @return: The final rotated vector shifted by the origin.
307 @rtype: numpy 3D, rank-1 array
308 """
309
310
311 point = zeros(3, float64)
312
313
314 point[2] = cos(angle)
315
316
317 point[0] = axis[0]*sin(angle)
318 point[1] = axis[1]*sin(angle)
319
320
321 if neg:
322 for i in range(3):
323 point[i] = -point[i]
324
325
326 if R is not None:
327 point = dot(R, point)
328
329
330 for i in range(3):
331 point[i] = point[i]*length + origin[i]
332
333
334 return point
335
336
337 - def setup_model(self, pipe_name='model', model=None, pivot=None, ave_pos_x=None, ave_pos_y=None, ave_pos_z=None, ave_pos_alpha=None, ave_pos_beta=None, ave_pos_gamma=None, pivot_disp=None, axis_alpha=None, axis_theta=None, axis_phi=None, eigen_alpha=None, eigen_beta=None, eigen_gamma=None, cone_theta=None, cone_theta_x=None, cone_theta_y=None, cone_sigma_max=None, cone_sigma_max_2=None):
338 """Set up for the given frame order model.
339
340 This will execute the following user functions:
341
342 - pipe.create to set up a data pipe for the model.
343 - frame_order.select_model.
344 - value.set for all given parameters.
345 - frame_order.pivot to define the pivot point.
346
347
348 @keyword pipe_name: The name of the new data pipe.
349 @type pipe_name: str
350 @keyword model: The frame order model to setup.
351 @type model: str
352 @keyword pivot: The pivot to setup.
353 @type pivot: list of float
354 @keyword ave_pos_x: The average domain position X coordinate.
355 @type ave_pos_x: None or float
356 @keyword ave_pos_y: The average domain position Y coordinate.
357 @type ave_pos_y: None or float
358 @keyword ave_pos_z: The average domain position Z coordinate.
359 @type ave_pos_z: None or float
360 @keyword ave_pos_alpha: The average domain position alpha Euler rotation angle.
361 @type ave_pos_alpha: None or float
362 @keyword ave_pos_beta: The average domain position beta Euler rotation angle.
363 @type ave_pos_beta: None or float
364 @keyword ave_pos_gamma: The average domain position gamma Euler rotation angle.
365 @type ave_pos_gamma: None or float
366 @keyword pivot_disp: The pivot displacement parameter.
367 @type pivot_disp: None or float
368 @keyword axis_alpha: The motional eigenframe axis alpha angle.
369 @type axis_alpha: None or float
370 @keyword axis_theta: The motional eigenframe axis theta spherical angle.
371 @type axis_theta: None or float
372 @keyword axis_phi: The motional eigenframe axis phi spherical angle.
373 @type axis_phi: None or float
374 @keyword eigen_alpha: The motional eigenframe alpha Euler rotation angle.
375 @type eigen_alpha: None or float
376 @keyword eigen_beta: The motional eigenframe beta Euler rotation angle.
377 @type eigen_beta: None or float
378 @keyword eigen_gamma: The motional eigenframe gamma Euler rotation angle.
379 @type eigen_gamma: None or float
380 @keyword cone_theta: The isotropic cone opening half angle.
381 @type cone_theta: None or float
382 @keyword cone_theta_x: The x-axis half cone angle.
383 @type cone_theta_x: None or float
384 @keyword cone_theta_y: The y-axis half cone angle.
385 @type cone_theta_y: None or float
386 @keyword cone_sigma_max: The maximum torsion angle.
387 @type cone_sigma_max: None or float
388 @keyword cone_sigma_max_2: The second maximum torsion angle.
389 @type cone_sigma_max_2: None or float
390 """
391
392
393 self.interpreter.pipe.create(pipe_name='PDB model', pipe_type='frame order')
394
395
396 atom_pos = 100.0 * eye(3)
397 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='X', res_num=1, pos=atom_pos[0], element='N')
398 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='Y', res_num=2, pos=atom_pos[1], element='N')
399 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='Z', res_num=3, pos=atom_pos[2], element='N')
400 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='nX', res_num=4, pos=-atom_pos[0], element='N')
401 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='nY', res_num=5, pos=-atom_pos[1], element='N')
402 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='nZ', res_num=6, pos=-atom_pos[2], element='N')
403 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='C', res_num=7, pos=[0.0, 0.0, 0.0], element='N')
404 self.interpreter.structure.add_atom(mol_name='axes', atom_name='Ti', res_name='O', res_num=8, pos=[0.0, 0.0, 0.0], element='Ti')
405
406
407 self.interpreter.domain(id='moving', spin_id=':1-7')
408 self.interpreter.domain(id='origin', spin_id=':8')
409 self.interpreter.frame_order.ref_domain('origin')
410
411
412 self.interpreter.frame_order.select_model(model)
413
414
415 if ave_pos_x != None:
416 self.interpreter.value.set(param='ave_pos_x', val=ave_pos_x)
417 if ave_pos_y != None:
418 self.interpreter.value.set(param='ave_pos_y', val=ave_pos_y)
419 if ave_pos_z != None:
420 self.interpreter.value.set(param='ave_pos_z', val=ave_pos_z)
421 if ave_pos_alpha != None:
422 self.interpreter.value.set(param='ave_pos_alpha', val=ave_pos_alpha)
423 if ave_pos_beta != None:
424 self.interpreter.value.set(param='ave_pos_beta', val=ave_pos_beta)
425 if ave_pos_gamma != None:
426 self.interpreter.value.set(param='ave_pos_gamma', val=ave_pos_gamma)
427 if pivot_disp != None:
428 self.interpreter.value.set(param='pivot_disp', val=pivot_disp)
429 if axis_alpha != None:
430 self.interpreter.value.set(param='axis_alpha', val=axis_alpha)
431 if axis_theta != None:
432 self.interpreter.value.set(param='axis_theta', val=axis_theta)
433 if axis_phi != None:
434 self.interpreter.value.set(param='axis_phi', val=axis_phi)
435 if eigen_alpha != None:
436 self.interpreter.value.set(param='eigen_alpha', val=eigen_alpha)
437 if eigen_beta != None:
438 self.interpreter.value.set(param='eigen_beta', val=eigen_beta)
439 if eigen_gamma != None:
440 self.interpreter.value.set(param='eigen_gamma', val=eigen_gamma)
441 if cone_theta != None:
442 self.interpreter.value.set(param='cone_theta', val=cone_theta)
443 if cone_theta_x != None:
444 self.interpreter.value.set(param='cone_theta_x', val=cone_theta_x)
445 if cone_theta_y != None:
446 self.interpreter.value.set(param='cone_theta_y', val=cone_theta_y)
447 if cone_sigma_max != None:
448 self.interpreter.value.set(param='cone_sigma_max', val=cone_sigma_max)
449 if cone_sigma_max_2 != None:
450 self.interpreter.value.set(param='cone_sigma_max_2', val=cone_sigma_max_2)
451
452
453 self.interpreter.frame_order.pivot(pivot=pivot, fix=True)
454
455
456 - def space_probe(self, ref_chi2=None, params=None, delta=3.0 / 360.0 * 2.0 * pi):
457 """Probe the space around the supposed minimum."""
458
459
460 self.interpreter.intro_off()
461
462
463 self.interpreter.minimise.calculate()
464 print("%-20s %10.5f" % ("chi2 minimum", cdp.chi2))
465 self.assertAlmostEqual(cdp.chi2, ref_chi2)
466
467
468 for param in params:
469 print("\n\nParam: %s" % param)
470 print("%-20s %10.5f" % ("chi2 orig", ref_chi2))
471
472
473 curr = getattr(cdp, param)
474
475
476 setattr(cdp, param, curr+delta)
477 self.interpreter.minimise.calculate()
478 print("%-20s %10.5f" % ("chi2 up", cdp.chi2))
479 self.assert_(cdp.chi2 > ref_chi2)
480
481
482 setattr(cdp, param, curr-delta)
483 self.interpreter.minimise.calculate()
484 print("%-20s %10.5f" % ("chi2 down", cdp.chi2))
485 self.assert_(cdp.chi2 > ref_chi2)
486
487
488 setattr(cdp, param, curr)
489
490
492 """Test the frame order auto-analysis using the rigid CaM test data."""
493
494
495 self.interpreter.run(script_file=self.cam_path+'auto_analysis_to_rigid.py')
496
497
499 """Test the operation of the frame_order.permute_axes user function for permutation 'A' when x <= y <= z."""
500
501
502 self.interpreter.reset()
503
504
505 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
506 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
507
508
509 cdp.cone_theta_x = orig_cone_theta_x = 1.0
510 cdp.cone_theta_y = orig_cone_theta_y = 2.0
511 cdp.cone_sigma_max = orig_cone_sigma_max = 3.0
512
513
514 orig_eigen_alpha = cdp.eigen_alpha
515 orig_eigen_beta = cdp.eigen_beta
516 orig_eigen_gamma = cdp.eigen_gamma
517
518
519 self.interpreter.frame_order.permute_axes('A')
520
521
522 self.assertEqual(cdp.cone_theta_x, 1.0)
523 self.assertEqual(cdp.cone_theta_y, 3.0)
524 self.assertEqual(cdp.cone_sigma_max, 2.0)
525
526
527 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
528 [ 0.62357991685585, -0.505348769456744, 0.596465177946379],
529 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
530
531
532 frame_new = transpose(array([-frame[:, 2], frame[:, 1], frame[:, 0]], float64))
533 alpha, beta, gamma = R_to_euler_zyz(frame_new)
534
535
536 self.assertAlmostEqual(cdp.eigen_alpha, alpha)
537 self.assertAlmostEqual(cdp.eigen_beta, beta)
538 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
539
540
542 """Test the operation of the frame_order.permute_axes user function for permutation 'B' when x <= y <= z."""
543
544
545 self.interpreter.reset()
546
547
548 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
549 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
550
551
552 cdp.cone_theta_x = orig_cone_theta_x = 1.0
553 cdp.cone_theta_y = orig_cone_theta_y = 2.0
554 cdp.cone_sigma_max = orig_cone_sigma_max = 3.0
555
556
557 orig_eigen_alpha = cdp.eigen_alpha
558 orig_eigen_beta = cdp.eigen_beta
559 orig_eigen_gamma = cdp.eigen_gamma
560
561
562 self.interpreter.frame_order.permute_axes('B')
563
564
565 self.assertEqual(cdp.cone_theta_x, 2.0)
566 self.assertEqual(cdp.cone_theta_y, 3.0)
567 self.assertEqual(cdp.cone_sigma_max, 1.0)
568
569
570 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
571 [ 0.62357991685585, -0.505348769456744, 0.596465177946379],
572 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
573
574
575 frame_new = transpose(array([frame[:, 2], frame[:, 0], frame[:, 1]], float64))
576 alpha, beta, gamma = R_to_euler_zyz(frame_new)
577
578
579 self.assertAlmostEqual(cdp.eigen_alpha, alpha)
580 self.assertAlmostEqual(cdp.eigen_beta, beta)
581 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
582
583
585 """Test the operation of the frame_order.permute_axes user function for permutation 'A' when x <= z <= y."""
586
587
588 self.interpreter.reset()
589
590
591 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
592 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
593
594
595 cdp.cone_theta_x = orig_cone_theta_x = 1.0
596 cdp.cone_theta_y = orig_cone_theta_y = 3.0
597 cdp.cone_sigma_max = orig_cone_sigma_max = 2.0
598
599
600 orig_eigen_alpha = cdp.eigen_alpha
601 orig_eigen_beta = cdp.eigen_beta
602 orig_eigen_gamma = cdp.eigen_gamma
603
604
605 self.interpreter.frame_order.permute_axes('A')
606
607
608 self.assertEqual(cdp.cone_theta_x, 1.0)
609 self.assertEqual(cdp.cone_theta_y, 2.0)
610 self.assertEqual(cdp.cone_sigma_max, 3.0)
611
612
613 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
614 [ 0.62357991685585, -0.505348769456744, 0.596465177946379],
615 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
616
617
618 frame_new = transpose(array([-frame[:, 2], frame[:, 1], frame[:, 0]], float64))
619 alpha, beta, gamma = R_to_euler_zyz(frame_new)
620
621
622 self.assertAlmostEqual(cdp.eigen_alpha, alpha)
623 self.assertAlmostEqual(cdp.eigen_beta, beta)
624 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
625
626
628 """Test the operation of the frame_order.permute_axes user function for permutation 'B' when x <= z <= y."""
629
630
631 self.interpreter.reset()
632
633
634 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
635 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
636
637
638 cdp.cone_theta_x = orig_cone_theta_x = 1.0
639 cdp.cone_theta_y = orig_cone_theta_y = 3.0
640 cdp.cone_sigma_max = orig_cone_sigma_max = 2.0
641
642
643 orig_eigen_alpha = cdp.eigen_alpha
644 orig_eigen_beta = cdp.eigen_beta
645 orig_eigen_gamma = cdp.eigen_gamma
646
647
648 self.interpreter.frame_order.permute_axes('B')
649
650
651 self.assertEqual(cdp.cone_theta_x, 2.0)
652 self.assertEqual(cdp.cone_theta_y, 3.0)
653 self.assertEqual(cdp.cone_sigma_max, 1.0)
654
655
656 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
657 [ 0.62357991685585, -0.505348769456744, 0.596465177946379],
658 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
659
660
661 frame_new = transpose(array([frame[:, 0], -frame[:, 2], frame[:, 1]], float64))
662 alpha, beta, gamma = R_to_euler_zyz(frame_new)
663
664
665 self.assertAlmostEqual(cdp.eigen_alpha, alpha)
666 self.assertAlmostEqual(cdp.eigen_beta, beta)
667 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
668
669
671 """Test the operation of the frame_order.permute_axes user function for permutation 'A' when z <= x <= y."""
672
673
674 self.interpreter.reset()
675
676
677 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
678 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
679
680
681 orig_cone_theta_x = cdp.cone_theta_x
682 orig_cone_theta_y = cdp.cone_theta_y
683 orig_cone_sigma_max = cdp.cone_sigma_max
684 orig_eigen_alpha = cdp.eigen_alpha
685 orig_eigen_beta = cdp.eigen_beta
686 orig_eigen_gamma = cdp.eigen_gamma
687
688
689 self.interpreter.frame_order.permute_axes('A')
690
691
692 self.assertEqual(cdp.cone_theta_x, 0.53277077276728502)
693 self.assertEqual(cdp.cone_theta_y, 0.8097621930390525)
694 self.assertEqual(cdp.cone_sigma_max, 1.2119285953475074)
695
696
697 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
698 [ 0.62357991685585, -0.505348769456744, 0.596465177946379],
699 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
700
701
702 frame_new = transpose(array([frame[:, 1], frame[:, 2], frame[:, 0]], float64))
703 alpha, beta, gamma = R_to_euler_zyz(frame_new)
704
705
706 self.assertAlmostEqual(cdp.eigen_alpha, alpha)
707 self.assertAlmostEqual(cdp.eigen_beta, beta)
708 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
709
710
712 """Test the operation of the frame_order.permute_axes user function for permutation 'B' when z <= x <= y."""
713
714
715 self.interpreter.reset()
716
717
718 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
719 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
720
721
722 orig_cone_theta_x = cdp.cone_theta_x
723 orig_cone_theta_y = cdp.cone_theta_y
724 orig_cone_sigma_max = cdp.cone_sigma_max
725 orig_eigen_alpha = cdp.eigen_alpha
726 orig_eigen_beta = cdp.eigen_beta
727 orig_eigen_gamma = cdp.eigen_gamma
728
729
730 self.interpreter.frame_order.permute_axes('B')
731
732
733 self.assertEqual(cdp.cone_theta_x, 0.53277077276728502)
734 self.assertEqual(cdp.cone_theta_y, 1.2119285953475074)
735 self.assertEqual(cdp.cone_sigma_max, 0.8097621930390525)
736
737
738 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
739 [ 0.62357991685585, -0.505348769456744, 0.596465177946379],
740 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
741
742
743 frame_new = transpose(array([frame[:, 0], -frame[:, 2], frame[:, 1]], float64))
744 alpha, beta, gamma = R_to_euler_zyz(frame_new)
745
746
747 self.assertAlmostEqual(cdp.eigen_alpha, alpha)
748 self.assertAlmostEqual(cdp.eigen_beta, beta)
749 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
750
751
753 """Test the double rotor frame order model of CaM."""
754
755
756 self.flags()
757 self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
758 self.check_chi2(0.080146041009531946)
759
760
762 """Test the double rotor frame order model of CaM (with only PCS data)."""
763
764
765 self.flags(rdc=False)
766 self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
767 self.check_chi2(0.00033425735965255754)
768
769
771 """Test the double rotor frame order model of CaM (with only RDC data)."""
772
773
774 self.flags(pcs=False)
775 self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
776 self.check_chi2(0.079814053829495801)
777
778
780 """Test the double rotor frame order model of CaM."""
781
782
783 self.flags()
784 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
785 self.check_chi2(0.046993590502437441)
786
787
789 """Test the double rotor frame order model of CaM (with only PCS data)."""
790
791
792 self.flags(rdc=False)
793 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
794 self.check_chi2(0.0030482390409642141)
795
796
798 """Test the double rotor frame order model of CaM (with only RDC data)."""
799
800
801 self.flags(pcs=False)
802 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
803 self.check_chi2(0.043946055085127944)
804
805
807 """Test the free rotor frame order model of CaM."""
808
809
810 self.flags(opt=True)
811 self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
812 self.check_chi2(0.049488502147038226)
813
814
816 """Test the free rotor frame order model of CaM."""
817
818
819 self.flags()
820 self.interpreter.run(script_file=self.cam_path+'free_rotor_missing_data.py')
821 self.check_chi2(0.038106832800436169)
822
823
825 """Test the free rotor frame order model of CaM (with only PCS data)."""
826
827
828 self.flags(rdc=False)
829 self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
830 self.check_chi2(0.00049268587082683434)
831
832
834 """Test the free rotor frame order model of CaM (with only RDC data)."""
835
836
837 self.flags(pcs=False)
838 self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
839 self.check_chi2(0.04899130610303442)
840
841
843 """Test the second free rotor frame order model of CaM."""
844
845
846 self.flags()
847 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
848 self.check_chi2(0.069952611688108693)
849
850
852 """Test the second free rotor frame order model of CaM (with only PCS data)."""
853
854
855 self.flags(rdc=False)
856 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
857 self.check_chi2(0.013207545726879745)
858
859
861 """Test the second free rotor frame order model of CaM (with only RDC data)."""
862
863
864 self.flags(pcs=False)
865 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
866 self.check_chi2(0.056744492444430819)
867
868
870 """Test the isotropic cone, free rotor frame order model of CaM."""
871
872
873 self.flags(opt=True)
874 self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
875 self.check_chi2(0.046263256206108584)
876
877
879 """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
880
881
882 self.flags(rdc=False)
883 self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
884 self.check_chi2(0.010223404689484922)
885
886
888 """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
889
890
891 self.flags(pcs=False)
892 self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
893 self.check_chi2(0.041428474106863025)
894
895
897 """Test the isotropic cone, free rotor frame order model of CaM."""
898
899
900 self.flags()
901 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
902 self.check_chi2(0.013068834561396353)
903
904
906 """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
907
908
909 self.flags(rdc=False)
910 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
911 self.check_chi2(0.0020824314952301057)
912
913
915 """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
916
917
918 self.flags(pcs=False)
919 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
920 self.check_chi2(0.010986403066166248)
921
922
924 """Test the second isotropic cone, free rotor frame order model of CaM."""
925
926
927 self.flags()
928 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
929 self.check_chi2(0.13135988423081582)
930
931
933 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
934
935
936 self.flags(rdc=False)
937 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
938 self.check_chi2(0.12580093734874642)
939
940
942 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
943
944
945 self.flags(pcs=False)
946 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
947 self.check_chi2(0.0055589468820694179)
948
949
951 """Test the second isotropic cone, free rotor frame order model of CaM."""
952
953
954 self.flags()
955 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
956 self.check_chi2(0.058320273132310863)
957
958
960 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
961
962
963 self.flags(rdc=False)
964 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
965 self.check_chi2(0.0095766977930929302)
966
967
969 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
970
971
972 self.flags(pcs=False)
973 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
974 self.check_chi2(0.048749202219945678)
975
976
978 """Test the second isotropic cone, free rotor frame order model of CaM."""
979
980
981 self.flags(opt=True)
982 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
983 self.check_chi2(0.052923535071890106)
984
985
987 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
988
989
990 self.flags(rdc=False)
991 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
992 self.check_chi2(0.025487205467282097)
993
994
996 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
997
998
999 self.flags(pcs=False)
1000 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
1001 self.check_chi2(0.03300256897164619)
1002
1003
1005 """Test the second isotropic cone, free rotor frame order model of CaM."""
1006
1007
1008 self.flags()
1009 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
1010 self.check_chi2(0.041445854907868764)
1011
1012
1014 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1015
1016
1017 self.flags(rdc=False)
1018 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
1019 self.check_chi2(0.02331739779637744)
1020
1021
1023 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1024
1025
1026 self.flags(pcs=False)
1027 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
1028 self.check_chi2(0.018129612955648935)
1029
1030
1032 """Test the second isotropic cone, free rotor frame order model of CaM."""
1033
1034
1035 self.flags()
1036 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
1037 self.check_chi2(0.07886558371162268)
1038
1039
1041 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1042
1043
1044 self.flags(rdc=False)
1045 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
1046 self.check_chi2(0.038891355121051734)
1047
1048
1050 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1051
1052
1053 self.flags(pcs=False)
1054 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
1055 self.check_chi2(0.039974228590570947)
1056
1057
1059 """Test the second isotropic cone, free rotor frame order model of CaM."""
1060
1061
1062 self.flags()
1063 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
1064 self.check_chi2(0.018922576784401186)
1065
1066
1068 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1069
1070
1071 self.flags(rdc=False)
1072 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
1073 self.check_chi2(0.003977725835776093)
1074
1075
1077 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1078
1079
1080 self.flags(pcs=False)
1081 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
1082 self.check_chi2(0.014947617377424345)
1083
1084
1086 """Test the rigid frame order model of CaM."""
1087
1088
1089 self.flags(opt=True)
1090 self.interpreter.run(script_file=self.cam_path+'rigid.py')
1091 self.check_chi2(0.081171019382935666)
1092
1093
1095 """Test the rigid frame order model of CaM (with only PCS data)."""
1096
1097
1098 self.flags(rdc=False)
1099 self.interpreter.run(script_file=self.cam_path+'rigid.py')
1100 self.check_chi2(6.1557756577162843e-09)
1101
1102
1104 """Test the rigid frame order model of CaM (with only RDC data)."""
1105
1106
1107 self.flags(pcs=False)
1108 self.interpreter.run(script_file=self.cam_path+'rigid.py')
1109 self.check_chi2(0.081171013227160013)
1110
1111
1113 """Test the rotor frame order model of CaM."""
1114
1115
1116 self.flags()
1117 self.interpreter.run(script_file=self.cam_path+'rotor.py')
1118 self.check_chi2(0.075072773007664212)
1119
1120
1122 """Test the rotor frame order model of CaM (with only PCS data)."""
1123
1124
1125 self.flags(rdc=False)
1126 self.interpreter.run(script_file=self.cam_path+'rotor.py')
1127 self.check_chi2(1.139566998206629e-06)
1128
1129
1131 """Test the rotor frame order model of CaM (with only RDC data)."""
1132
1133
1134 self.flags(pcs=False)
1135 self.interpreter.run(script_file=self.cam_path+'rotor.py')
1136 self.check_chi2(0.075071633440666002)
1137
1138
1140 """Test the 2-state rotor frame order model of CaM."""
1141
1142
1143 self.flags()
1144 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
1145 self.check_chi2(0.98321958150473276)
1146
1147
1149 """Test the 2-state rotor frame order model of CaM (with only PCS data)."""
1150
1151
1152 self.flags(rdc=False)
1153 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
1154 self.check_chi2(2.9152704264897967e-05)
1155
1156
1158 """Test the 2-state rotor frame order model of CaM (with only RDC data)."""
1159
1160
1161 self.flags(pcs=False)
1162 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
1163 self.check_chi2(0.98319606148815675)
1164
1165
1167 """Test the second rotor frame order model of CaM."""
1168
1169
1170 self.flags(opt=True)
1171 self.interpreter.run(script_file=self.cam_path+'rotor2.py')
1172 self.check_chi2(0.075040490418167072)
1173
1174
1176 """Test the second rotor frame order model of CaM (with only PCS data)."""
1177
1178
1179 self.flags(rdc=False)
1180 self.interpreter.run(script_file=self.cam_path+'rotor2.py')
1181 self.check_chi2(1.5787105392036996e-06)
1182
1183
1185 """Test the second rotor frame order model of CaM (with only RDC data)."""
1186
1187
1188 self.flags(pcs=False)
1189 self.interpreter.run(script_file=self.cam_path+'rotor2.py')
1190 self.check_chi2(0.075038911707627859)
1191
1192
1194 """Test the double rotor frame order model of CaM."""
1195
1196
1197 self.flags(quad_int=True)
1198 self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
1199 self.check_chi2(0.079828365857374614)
1200
1201
1203 """Test the double rotor frame order model of CaM (with only PCS data)."""
1204
1205
1206 self.flags(rdc=False, quad_int=True)
1207 self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
1208 self.check_chi2(1.6582207495230563e-05)
1209
1210
1212 """Test the double rotor frame order model of CaM (with only RDC data)."""
1213
1214
1215 self.flags(pcs=False, quad_int=True)
1216 self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
1217 self.check_chi2(0.079814053829495801)
1218
1219
1221 """Test the double rotor frame order model of CaM."""
1222
1223
1224 self.flags(quad_int=True)
1225 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
1226 self.check_chi2(0.57126501230322546)
1227
1228
1230 """Test the double rotor frame order model of CaM (with only PCS data)."""
1231
1232
1233 self.flags(rdc=False, quad_int=True)
1234 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
1235 self.check_chi2(0.5273196608417523)
1236
1237
1239 """Test the double rotor frame order model of CaM (with only RDC data)."""
1240
1241
1242 self.flags(pcs=False, quad_int=True)
1243 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
1244 self.check_chi2(0.043946055085127944)
1245
1246
1248 """Test the free rotor frame order model of CaM."""
1249
1250
1251 self.flags(quad_int=True)
1252 self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
1253 self.check_chi2(0.04899586148178818)
1254
1255
1257 """Test the free rotor frame order model of CaM."""
1258
1259
1260 self.flags(quad_int=True)
1261 self.interpreter.run(script_file=self.cam_path+'free_rotor_missing_data.py')
1262 self.check_chi2(0.037726306126177556)
1263
1264
1266 """Test the free rotor frame order model of CaM (with only PCS data)."""
1267
1268
1269 self.flags(rdc=False, quad_int=True)
1270 self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
1271 self.check_chi2(4.5205576772581238e-08)
1272
1273
1275 """Test the free rotor frame order model of CaM (with only RDC data)."""
1276
1277
1278 self.flags(pcs=False, quad_int=True)
1279 self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
1280 self.check_chi2(0.04899130610303442)
1281
1282
1284 """Test the second free rotor frame order model of CaM."""
1285
1286
1287 self.flags(quad_int=True)
1288 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
1289 self.check_chi2(0.06748978555251639)
1290
1291
1293 """Test the second free rotor frame order model of CaM (with only PCS data)."""
1294
1295
1296 self.flags(rdc=False, quad_int=True)
1297 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
1298 self.check_chi2(0.010744719591287448)
1299
1300
1302 """Test the second free rotor frame order model of CaM (with only RDC data)."""
1303
1304
1305 self.flags(pcs=False, quad_int=True)
1306 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
1307 self.check_chi2(0.056744492444430819)
1308
1309
1311 """Test the isotropic cone, free rotor frame order model of CaM."""
1312
1313
1314 self.flags(quad_int=True)
1315 self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
1316 self.check_chi2(0.041430522432421318)
1317
1318
1320 """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1321
1322
1323 self.flags(rdc=False, quad_int=True)
1324 self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
1325 self.check_chi2(4.8409613144085089e-08)
1326
1327
1329 """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1330
1331
1332 self.flags(pcs=False, quad_int=True)
1333 self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
1334 self.check_chi2(0.041428474106863025)
1335
1336
1338 """Test the isotropic cone, free rotor frame order model of CaM."""
1339
1340
1341 self.flags(quad_int=True)
1342 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
1343 self.check_chi2(0.01098760442625833)
1344
1345
1347 """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1348
1349
1350 self.flags(rdc=False, quad_int=True)
1351 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
1352 self.check_chi2(1.20136009208203e-06)
1353
1354
1356 """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1357
1358
1359 self.flags(pcs=False, quad_int=True)
1360 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
1361 self.check_chi2(0.010986403066166248)
1362
1363
1365 """Test the second isotropic cone, free rotor frame order model of CaM."""
1366
1367
1368 self.flags(quad_int=True)
1369 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
1370 self.check_chi2(0.027527295381115289)
1371
1372
1374 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1375
1376
1377 self.flags(rdc=False, quad_int=True)
1378 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
1379 self.check_chi2(0.021968348499045869)
1380
1381
1383 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1384
1385
1386 self.flags(pcs=False, quad_int=True)
1387 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
1388 self.check_chi2(0.0055589468820694179)
1389
1390
1392 """Test the second isotropic cone, free rotor frame order model of CaM."""
1393
1394
1395 self.flags(quad_int=True)
1396 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
1397 self.check_chi2(0.048766438238093554)
1398
1399
1401 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1402
1403
1404 self.flags(rdc=False, quad_int=True)
1405 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
1406 self.check_chi2(2.2862898875626613e-05)
1407
1408
1410 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1411
1412
1413 self.flags(pcs=False, quad_int=True)
1414 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
1415 self.check_chi2(0.048749202219945678)
1416
1417
1419 """Test the second isotropic cone, free rotor frame order model of CaM."""
1420
1421
1422 self.flags(quad_int=True)
1423 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
1424 self.check_chi2(0.033007827805689761)
1425
1426
1428 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1429
1430
1431 self.flags(rdc=False, quad_int=True)
1432 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
1433 self.check_chi2(1.534188648468986e-07)
1434
1435
1437 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1438
1439
1440 self.flags(pcs=False, quad_int=True)
1441 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
1442 self.check_chi2(0.03300256897164619)
1443
1444
1446 """Test the second isotropic cone, free rotor frame order model of CaM."""
1447
1448
1449 self.flags(quad_int=True)
1450 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
1451 self.check_chi2(0.018129059824815268)
1452
1453
1455 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1456
1457
1458 self.flags(rdc=False, quad_int=True)
1459 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
1460 self.check_chi2(6.0271332394266001e-07)
1461
1462
1464 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1465
1466
1467 self.flags(pcs=False, quad_int=True)
1468 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
1469 self.check_chi2(0.018129612955648935)
1470
1471
1473 """Test the second isotropic cone, free rotor frame order model of CaM."""
1474
1475
1476 self.flags(quad_int=True)
1477 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
1478 self.check_chi2(0.039974493838723132)
1479
1480
1482 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1483
1484
1485 self.flags(rdc=False, quad_int=True)
1486 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
1487 self.check_chi2(2.6524815218336224e-07)
1488
1489
1491 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1492
1493
1494 self.flags(pcs=False, quad_int=True)
1495 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
1496 self.check_chi2(0.039974228590570947)
1497
1498
1500 """Test the second isotropic cone, free rotor frame order model of CaM."""
1501
1502
1503 self.flags(quad_int=True)
1504 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
1505 self.check_chi2(0.014945243556224312)
1506
1507
1509 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
1510
1511
1512 self.flags(rdc=False, quad_int=True)
1513 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
1514 self.check_chi2(3.9260759922047933e-07)
1515
1516
1518 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
1519
1520
1521 self.flags(pcs=False, quad_int=True)
1522 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
1523 self.check_chi2(0.014947617377424345)
1524
1525
1527 """Test the rigid frame order model of CaM."""
1528
1529
1530 self.flags(quad_int=True)
1531 self.interpreter.run(script_file=self.cam_path+'rigid.py')
1532 self.check_chi2(0.081171019382935666)
1533
1534
1536 """Test the rigid frame order model of CaM (with only PCS data)."""
1537
1538
1539 self.flags(rdc=False, quad_int=True)
1540 self.interpreter.run(script_file=self.cam_path+'rigid.py')
1541 self.check_chi2(6.1557756577162843e-09)
1542
1543
1545 """Test the rigid frame order model of CaM (with only RDC data)."""
1546
1547
1548 self.flags(pcs=False, quad_int=True)
1549 self.interpreter.run(script_file=self.cam_path+'rigid.py')
1550 self.check_chi2(0.081171013227160013)
1551
1552
1554 """Test the rotor frame order model of CaM."""
1555
1556
1557 self.flags(quad_int=True)
1558 self.interpreter.run(script_file=self.cam_path+'rotor.py')
1559 self.check_chi2(0.075072773007664212)
1560
1561
1563 """Test the rotor frame order model of CaM (with only PCS data)."""
1564
1565
1566 self.flags(rdc=False, quad_int=True)
1567 self.interpreter.run(script_file=self.cam_path+'rotor.py')
1568 self.check_chi2(1.139566998206629e-06)
1569
1570
1572 """Test the rotor frame order model of CaM (with only RDC data)."""
1573
1574
1575 self.flags(pcs=False, quad_int=True)
1576 self.interpreter.run(script_file=self.cam_path+'rotor.py')
1577 self.check_chi2(0.075071633440666002)
1578
1579
1581 """Test the 2-state rotor frame order model of CaM."""
1582
1583
1584 self.flags(quad_int=True)
1585 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
1586 self.check_chi2(0.98321958150473276)
1587
1588
1590 """Test the 2-state rotor frame order model of CaM (with only PCS data)."""
1591
1592
1593 self.flags(rdc=False, quad_int=True)
1594 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
1595 self.check_chi2(2.9152704264897967e-05)
1596
1597
1599 """Test the 2-state rotor frame order model of CaM (with only RDC data)."""
1600
1601
1602 self.flags(pcs=False, quad_int=True)
1603 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
1604 self.check_chi2(0.98319606148815675)
1605
1606
1608 """Test the second rotor frame order model of CaM."""
1609
1610
1611 self.flags(quad_int=True)
1612 self.interpreter.run(script_file=self.cam_path+'rotor2.py')
1613 self.check_chi2(0.075040490418167072)
1614
1615
1617 """Test the second rotor frame order model of CaM (with only PCS data)."""
1618
1619
1620 self.flags(rdc=False, quad_int=True)
1621 self.interpreter.run(script_file=self.cam_path+'rotor2.py')
1622 self.check_chi2(1.5787105392036996e-06)
1623
1624
1626 """Test the second rotor frame order model of CaM (with only RDC data)."""
1627
1628
1629 self.flags(pcs=False, quad_int=True)
1630 self.interpreter.run(script_file=self.cam_path+'rotor2.py')
1631 self.check_chi2(0.075038911707627859)
1632
1633
1635 """Test the ability of the frame_order.sobol_setup user function to be able to count the number of Sobol' points used for the current parameter values."""
1636
1637
1638 self.interpreter.reset()
1639
1640
1641 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
1642 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
1643
1644
1645 self.interpreter.frame_order.sobol_setup(20)
1646
1647
1648 self.assertEqual(cdp.sobol_points_used, 20)
1649
1650
1652 """Test the frame_order.count_sobol_points user function."""
1653
1654
1655 self.interpreter.reset()
1656
1657
1658 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
1659 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
1660
1661
1662 self.interpreter.frame_order.count_sobol_points()
1663
1664
1665 self.assertEqual(cdp.sobol_points_used, 20)
1666
1667
1686
1687
1706
1707
1709 """Test the frame_order.count_sobol_points user function for the rigid model."""
1710
1711
1712 self.interpreter.reset()
1713
1714
1715 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep+'rigid'
1716 self.interpreter.state.load(data_path+sep+'frame_order')
1717
1718
1719 self.interpreter.frame_order.count_sobol_points()
1720
1721
1722 self.assert_(not hasattr(cdp, 'sobol_points_used'))
1723
1724
1743
1744
1750
1751
1753 """Check the frame_order.distribute user function PDB file for the isotropic cone model along the z-axis."""
1754
1755
1756 self.test_simulate_iso_cone_z_axis(type='dist')
1757
1758
1764
1765
1771
1772
1778
1779
1785
1786
1792
1793
1799
1800
1802 """Check the frame_order.distribute user function PDB file for the rotor model along the z-axis."""
1803
1804
1805 self.test_simulate_rotor_z_axis(type='dist')
1806
1807
1809 """Test the operation of the frame_order.pdb_model user function when an ensemble of structures are loaded."""
1810
1811
1812 self.interpreter.pipe.create('frame_order.pdb_model ensemble failure', 'frame order')
1813
1814
1815 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose'
1816 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=data_path, set_model_num=1, set_mol_name='lactose')
1817 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=data_path, set_model_num=2, set_mol_name='lactose')
1818 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_3.pdb', dir=data_path, set_model_num=3, set_mol_name='lactose')
1819
1820
1821 self.interpreter.frame_order.pivot([0, 0, 0], fix=True)
1822
1823
1824 self.interpreter.frame_order.select_model('rotor')
1825
1826
1827 self.interpreter.domain(id='lactose', spin_id=':UNK')
1828 self.interpreter.frame_order.ref_domain('lactose')
1829
1830
1831 self.interpreter.value.set(param='ave_pos_x', val=0.0)
1832 self.interpreter.value.set(param='ave_pos_y', val=0.0)
1833 self.interpreter.value.set(param='ave_pos_z', val=0.0)
1834 self.interpreter.value.set(param='ave_pos_alpha', val=0.0)
1835 self.interpreter.value.set(param='ave_pos_beta', val=0.0)
1836 self.interpreter.value.set(param='ave_pos_gamma', val=0.0)
1837 self.interpreter.value.set(param='axis_alpha', val=0.5)
1838 self.interpreter.value.set(param='cone_sigma_max', val=0.1)
1839
1840
1841 self.interpreter.monte_carlo.setup(10)
1842 self.interpreter.monte_carlo.initial_values()
1843
1844
1845 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir)
1846
1847
1849 """Test the operation of the frame_order.pdb_model user function when the pivot is outside of the PDB limits."""
1850
1851
1852 self.interpreter.pipe.create('frame_order.pdb_model ensemble failure', 'frame order')
1853
1854
1855 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose'
1856 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=data_path, set_mol_name='lactose')
1857
1858
1859 self.interpreter.frame_order.pivot([-995, 0, 0], fix=True)
1860
1861
1862 self.interpreter.frame_order.select_model('rotor')
1863
1864
1865 self.interpreter.domain(id='lactose', spin_id=':UNK')
1866 self.interpreter.frame_order.ref_domain('lactose')
1867
1868
1869 self.interpreter.value.set(param='ave_pos_x', val=0.0)
1870 self.interpreter.value.set(param='ave_pos_y', val=0.0)
1871 self.interpreter.value.set(param='ave_pos_z', val=0.0)
1872 self.interpreter.value.set(param='ave_pos_alpha', val=0.0)
1873 self.interpreter.value.set(param='ave_pos_beta', val=0.0)
1874 self.interpreter.value.set(param='ave_pos_gamma', val=0.0)
1875 self.interpreter.value.set(param='axis_alpha', val=0.5)
1876 self.interpreter.value.set(param='cone_sigma_max', val=0.1)
1877
1878
1879 self.interpreter.monte_carlo.setup(10)
1880 self.interpreter.monte_carlo.initial_values()
1881
1882
1883 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir)
1884
1885
1887 """Generate the rotor2 distribution of CaM."""
1888
1889
1890 self.interpreter.run(script_file=self.cam_path+'generate_rotor2_distribution.py')
1891
1892
1894 """Test the mapping of the Euler angle parameters for OpenDx viewing."""
1895
1896
1897 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'opendx_euler_angle_map.py')
1898
1899
1901 """Check the frame_order.pdb_model user function PDB file for the rotor model along the z-axis."""
1902
1903
1904 pivot2 = array([1, 0, 0], float64)
1905 pivot_disp = 100
1906 pivot1 = pivot2 + (z_axis-x_axis)/sqrt(2.0)*pivot_disp
1907 l = 20.0
1908
1909
1910 eigen_beta = -pi/4.0
1911 R = zeros((3, 3), float64)
1912 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
1913 print("Motional eigenframe:\n%s" % R)
1914
1915
1916 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot2, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=0.0, cone_sigma_max_2=0.0)
1917
1918
1919 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l)
1920
1921
1922 data = [
1923
1924 [ 1, 'PIV', 1, 'Piv1', pivot1],
1925 [ 1, 'PIV', 2, 'Piv2', pivot2],
1926
1927
1928 [ 1, 'RTX', 3, 'CTR', pivot2],
1929 [ 2, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta)],
1930 [ 3, 'RTX', 5, 'PRP', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta, neg=True)],
1931 [ 4, 'RTB', 6, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta)],
1932 [ 5, 'RTB', 188, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta)],
1933 [ 6, 'RTB', 370, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta)],
1934 [ 7, 'RTB', 552, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta)],
1935 [ 8, 'RTB', 734, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta, neg=True)],
1936 [ 9, 'RTB', 916, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta, neg=True)],
1937 [10, 'RTB', 1098, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta, neg=True)],
1938 [11, 'RTB', 1280, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta, neg=True)],
1939 [12, 'RTL', 1462, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0+eigen_beta)],
1940 [12, 'RTL', 1463, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0+eigen_beta, neg=True)],
1941
1942
1943 [ 1, 'RTX', 1464, 'CTR', pivot1],
1944 [ 2, 'RTX', 1465, 'PRP', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
1945 [ 3, 'RTX', 1466, 'PRP', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
1946 [ 4, 'RTB', 1467, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
1947 [ 5, 'RTB', 1649, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)],
1948 [ 6, 'RTB', 1831, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
1949 [ 7, 'RTB', 2013, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)],
1950 [ 8, 'RTB', 2195, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
1951 [ 9, 'RTB', 2377, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)],
1952 [10, 'RTB', 2559, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
1953 [11, 'RTB', 2741, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)],
1954 [12, 'RTL', 2923, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis)],
1955 [12, 'RTL', 2924, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis, neg=True)],
1956
1957
1958 [ 1, 'AXE', 2925, 'R', pivot2],
1959 [ 1, 'AXE', 2926, 'z-ax', pivot1],
1960 [ 1, 'AXE', 2927, 'z-ax', (pivot1-pivot2)*1.1+pivot2],
1961 ]
1962
1963
1964 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
1965
1966
1968 """Check the frame_order.pdb_model user function PDB file for the rotor model along the z-axis."""
1969
1970
1971 pivot2 = array([1, 0, 0], float64)
1972 pivot_disp = 100
1973 pivot1 = pivot2 + z_axis*pivot_disp
1974 l = 30.0
1975
1976
1977 eigen_beta = 0.0
1978 R = zeros((3, 3), float64)
1979 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
1980 print("Motional eigenframe:\n%s" % R)
1981
1982
1983 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot2, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=0.0, cone_sigma_max_2=0.0)
1984
1985
1986 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l)
1987
1988
1989 data = [
1990
1991 [ 1, 'PIV', 1, 'Piv1', pivot1],
1992 [ 1, 'PIV', 2, 'Piv2', pivot2],
1993
1994
1995 [ 1, 'RTX', 3, 'CTR', pivot2],
1996 [ 2, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0)],
1997 [ 3, 'RTX', 5, 'PRP', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0, neg=True)],
1998 [ 4, 'RTB', 6, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0)],
1999 [ 5, 'RTB', 188, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0)],
2000 [ 6, 'RTB', 370, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0)],
2001 [ 7, 'RTB', 552, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0)],
2002 [ 8, 'RTB', 734, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0, neg=True)],
2003 [ 9, 'RTB', 916, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0, neg=True)],
2004 [10, 'RTB', 1098, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0, neg=True)],
2005 [11, 'RTB', 1280, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0, neg=True)],
2006 [12, 'RTL', 1462, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0)],
2007 [12, 'RTL', 1463, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0, neg=True)],
2008
2009
2010 [ 1, 'RTX', 1464, 'CTR', pivot1],
2011 [ 2, 'RTX', 1465, 'PRP', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
2012 [ 3, 'RTX', 1466, 'PRP', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
2013 [ 4, 'RTB', 1467, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
2014 [ 5, 'RTB', 1649, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)],
2015 [ 6, 'RTB', 1831, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
2016 [ 7, 'RTB', 2013, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)],
2017 [ 8, 'RTB', 2195, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
2018 [ 9, 'RTB', 2377, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)],
2019 [10, 'RTB', 2559, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
2020 [11, 'RTB', 2741, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)],
2021 [12, 'RTL', 2923, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis)],
2022 [12, 'RTL', 2924, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis, neg=True)],
2023
2024
2025 [ 1, 'AXE', 2925, 'R', pivot2],
2026 [ 1, 'AXE', 2926, 'z-ax', pivot1],
2027 [ 1, 'AXE', 2927, 'z-ax', self.rotate_from_Z(origin=pivot2, length=pivot_disp*1.1, angle=0.0)],
2028 ]
2029
2030
2031 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
2032
2033
2035 """Check the frame_order.pdb_model user function PDB file for the rotor model with a xz-plane tilt."""
2036
2037
2038 pivot = array([1, 0, 1], float64)
2039 l = 100.0
2040
2041
2042 axis_alpha = pi / 2.0
2043 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64))
2044 print("\nRotor axis:\n %s" % axis)
2045 print("Rotor apex (100*axis + [1, 0, 1]):\n %s" % (l*axis + pivot))
2046
2047
2048 self.setup_model(pipe_name='PDB model', model='free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha)
2049
2050
2051 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=100.0)
2052
2053
2054 data = [
2055 [ 1, 'PIV', 1, 'Piv', pivot],
2056 [ 1, 'RTX', 2, 'CTR', pivot],
2057 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
2058 [ 3, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
2059 [ 4, 'RTB', 5, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
2060 [ 5, 'RTB', 187, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
2061 [ 6, 'RTB', 369, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
2062 [ 7, 'RTB', 551, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
2063 [ 8, 'RTB', 733, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
2064 [ 9, 'RTB', 915, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
2065 [10, 'RTB', 1097, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
2066 [11, 'RTB', 1279, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
2067 [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0)],
2068 [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0, neg=True)]
2069 ]
2070
2071
2072 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
2073
2074
2076 """Check the frame_order.pdb_model user function PDB file for the free rotor model along the z-axis."""
2077
2078
2079 pivot = array([1, 0, 0], float64)
2080 l = 30.0
2081
2082
2083 axis_alpha = pi / 2.0
2084 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64))
2085 print("\nRotor axis: %s" % axis)
2086 print("Rotor apex (100*axis + [1, 0, 0]):\n %s" % (l*axis + pivot))
2087
2088
2089 self.setup_model(pipe_name='PDB model', model='free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha)
2090
2091
2092 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l)
2093
2094
2095 data = [
2096 [ 1, 'PIV', 1, 'Piv', pivot],
2097 [ 1, 'RTX', 2, 'CTR', pivot],
2098 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
2099 [ 3, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
2100 [ 4, 'RTB', 5, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
2101 [ 5, 'RTB', 187, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
2102 [ 6, 'RTB', 369, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
2103 [ 7, 'RTB', 551, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
2104 [ 8, 'RTB', 733, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
2105 [ 9, 'RTB', 915, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
2106 [10, 'RTB', 1097, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
2107 [11, 'RTB', 1279, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
2108 [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0)],
2109 [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0, neg=True)]
2110 ]
2111
2112
2113 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
2114
2115
2117 """Check the frame_order.pdb_model user function PDB file for the isotropic cone model with a xz-plane tilt."""
2118
2119
2120 theta = 2.0
2121 pivot = array([1, 1, 1], float64)
2122 l = 45.0
2123 l_rotor = l + 5.0
2124
2125
2126 axis_theta = -pi/4.0
2127 axis = create_rotor_axis_spherical(axis_theta, 0.0)
2128 print("Rotor axis: %s" % axis)
2129 R = zeros((3, 3), float64)
2130 axis_angle_to_R([0, 1, 0], axis_theta, R)
2131
2132
2133 self.setup_model(pipe_name='PDB model', model='iso cone', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta, cone_sigma_max=0.0)
2134
2135
2136 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2137
2138
2139 inc = 2.0 * pi / 10.0
2140 vectors = zeros((10, 3), float64)
2141 for i in range(10):
2142
2143 phi = inc * i
2144
2145
2146 vectors[i, 0] = cos(phi)
2147 vectors[i, 1] = sin(phi)
2148
2149
2150 neg = [False, True]
2151 tle = ['a', 'b']
2152 data = []
2153 for i in range(2):
2154 data.append([
2155
2156 [ 1, 'PIV', 1, 'Piv', pivot],
2157
2158
2159 [ 1, 'RTX', 2, 'CTR', pivot],
2160 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2161 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2162 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])],
2163 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2164 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])],
2165 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])],
2166
2167
2168 [ 3, 'CNE', 733, 'APX', pivot],
2169 [ 3, 'CNE', 734, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], R=R, neg=neg[i])],
2170 [ 3, 'CNE', 735, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], R=R, neg=neg[i])],
2171 [ 3, 'CNE', 736, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], R=R, neg=neg[i])],
2172 [ 3, 'CNE', 737, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], R=R, neg=neg[i])],
2173 [ 3, 'CNE', 738, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], R=R, neg=neg[i])],
2174 [ 3, 'CNE', 739, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], R=R, neg=neg[i])],
2175 [ 3, 'CNE', 740, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], R=R, neg=neg[i])],
2176 [ 3, 'CNE', 741, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], R=R, neg=neg[i])],
2177 [ 3, 'CNE', 742, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], R=R, neg=neg[i])],
2178 [ 3, 'CNE', 743, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], R=R, neg=neg[i])],
2179
2180
2181 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
2182 ])
2183
2184
2185 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2186
2187
2189 """Check the frame_order.pdb_model user function PDB file for the isotropic cone model along the z-axis."""
2190
2191
2192 theta = 2.0
2193 pivot = array([1, 0, -2], float64)
2194 l = 25.0
2195 l_rotor = l + 5.0
2196
2197
2198 axis_theta = 0.0
2199 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, 0.0))
2200
2201
2202 self.setup_model(pipe_name='PDB model', model='iso cone', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta, cone_sigma_max=0.0)
2203
2204
2205 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2206
2207
2208 inc = 2.0 * pi / 10.0
2209 vectors = zeros((10, 3), float64)
2210 for i in range(10):
2211
2212 phi = inc * i
2213
2214
2215 vectors[i, 0] = cos(phi)
2216 vectors[i, 1] = sin(phi)
2217
2218
2219 neg = [False, True]
2220 tle = ['a', 'b']
2221 data = []
2222 for i in range(2):
2223 data.append([
2224
2225 [ 1, 'PIV', 1, 'Piv', pivot],
2226
2227
2228 [ 1, 'RTX', 2, 'CTR', pivot],
2229 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2230 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2231 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])],
2232 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2233 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])],
2234 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])],
2235
2236
2237 [ 3, 'CNE', 733, 'APX', pivot],
2238 [ 3, 'CNE', 734, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], neg=neg[i])],
2239 [ 3, 'CNE', 735, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], neg=neg[i])],
2240 [ 3, 'CNE', 736, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], neg=neg[i])],
2241 [ 3, 'CNE', 737, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], neg=neg[i])],
2242 [ 3, 'CNE', 738, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], neg=neg[i])],
2243 [ 3, 'CNE', 739, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], neg=neg[i])],
2244 [ 3, 'CNE', 740, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], neg=neg[i])],
2245 [ 3, 'CNE', 741, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], neg=neg[i])],
2246 [ 3, 'CNE', 742, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], neg=neg[i])],
2247 [ 3, 'CNE', 743, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], neg=neg[i])],
2248
2249
2250 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
2251 ])
2252
2253
2254 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2255
2256
2258 """Check the frame_order.pdb_model user function PDB file for the free rotor isotropic cone model with a xz-plane tilt."""
2259
2260
2261 theta = 2.0
2262 pivot = array([1, 1, 1], float64)
2263 l = 40.0
2264 l_rotor = l + 5.0
2265
2266
2267 axis_theta = -pi/4.0
2268 axis = create_rotor_axis_spherical(axis_theta, 0.0)
2269 print("Rotor axis: %s" % axis)
2270 R = zeros((3, 3), float64)
2271 axis_angle_to_R([0, 1, 0], axis_theta, R)
2272
2273
2274 self.setup_model(pipe_name='PDB model', model='iso cone, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta)
2275
2276
2277 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2278
2279
2280 inc = 2.0 * pi / 10.0
2281 vectors = zeros((10, 3), float64)
2282 for i in range(10):
2283
2284 phi = inc * i
2285
2286
2287 vectors[i, 0] = cos(phi)
2288 vectors[i, 1] = sin(phi)
2289
2290
2291 neg = [False, True]
2292 tle = ['a', 'b']
2293 data = []
2294 for i in range(2):
2295 data.append([
2296
2297 [ 1, 'PIV', 1, 'Piv', pivot],
2298
2299
2300 [ 1, 'RTX', 2, 'CTR', pivot],
2301 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2302 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2303 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2304 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2305 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2306 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])],
2307
2308
2309 [ 3, 'CNE', 733, 'APX', pivot],
2310 [ 3, 'CNE', 734, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], R=R, neg=neg[i])],
2311 [ 3, 'CNE', 735, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], R=R, neg=neg[i])],
2312 [ 3, 'CNE', 736, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], R=R, neg=neg[i])],
2313 [ 3, 'CNE', 737, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], R=R, neg=neg[i])],
2314 [ 3, 'CNE', 738, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], R=R, neg=neg[i])],
2315 [ 3, 'CNE', 739, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], R=R, neg=neg[i])],
2316 [ 3, 'CNE', 740, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], R=R, neg=neg[i])],
2317 [ 3, 'CNE', 741, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], R=R, neg=neg[i])],
2318 [ 3, 'CNE', 742, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], R=R, neg=neg[i])],
2319 [ 3, 'CNE', 743, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], R=R, neg=neg[i])],
2320
2321
2322 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
2323 ])
2324
2325
2326 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2327
2328
2330 """Check the frame_order.pdb_model user function PDB file for the free rotor isotropic cone model along the z-axis."""
2331
2332
2333 theta = 2.0
2334 pivot = array([1, 0, -2], float64)
2335 l = 25.0
2336 l_rotor = l + 5.0
2337
2338
2339 axis_theta = 0.0
2340 axis_phi = 0.0
2341 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, axis_phi))
2342
2343
2344 self.setup_model(pipe_name='PDB model', model='iso cone, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta)
2345
2346
2347 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2348
2349
2350 inc = 2.0 * pi / 10.0
2351 vectors = zeros((10, 3), float64)
2352 for i in range(10):
2353
2354 phi = inc * i
2355
2356
2357 vectors[i, 0] = cos(phi)
2358 vectors[i, 1] = sin(phi)
2359
2360
2361 neg = [False, True]
2362 tle = ['a', 'b']
2363 data = []
2364 for i in range(2):
2365 data.append([
2366
2367 [ 1, 'PIV', 1, 'Piv', pivot],
2368
2369
2370 [ 1, 'RTX', 2, 'CTR', pivot],
2371 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2372 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2373 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2374 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2375 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
2376 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])],
2377
2378
2379 [ 3, 'CNE', 733, 'APX', pivot],
2380 [ 3, 'CNE', 734, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], neg=neg[i])],
2381 [ 3, 'CNE', 735, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], neg=neg[i])],
2382 [ 3, 'CNE', 736, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], neg=neg[i])],
2383 [ 3, 'CNE', 737, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], neg=neg[i])],
2384 [ 3, 'CNE', 738, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], neg=neg[i])],
2385 [ 3, 'CNE', 739, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], neg=neg[i])],
2386 [ 3, 'CNE', 740, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], neg=neg[i])],
2387 [ 3, 'CNE', 741, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], neg=neg[i])],
2388 [ 3, 'CNE', 742, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], neg=neg[i])],
2389 [ 3, 'CNE', 743, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], neg=neg[i])],
2390
2391
2392 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
2393 ])
2394
2395
2396 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2397
2398
2400 """Check the frame_order.pdb_model user function PDB file for the torsionless isotropic cone model with a xz-plane tilt."""
2401
2402
2403 theta = 2.0
2404 pivot = array([1, 1, 1], float64)
2405 l = 40.0
2406 l_rotor = l + 5.0
2407
2408
2409 axis_theta = -pi/4.0
2410 axis = create_rotor_axis_spherical(axis_theta, 0.0)
2411 print("Rotor axis: %s" % axis)
2412 R = zeros((3, 3), float64)
2413 axis_angle_to_R([0, 1, 0], axis_theta, R)
2414
2415
2416 self.setup_model(pipe_name='PDB model', model='iso cone, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta)
2417
2418
2419 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2420
2421
2422 inc = 2.0 * pi / 10.0
2423 vectors = zeros((10, 3), float64)
2424 for i in range(10):
2425
2426 phi = inc * i
2427
2428
2429 vectors[i, 0] = cos(phi)
2430 vectors[i, 1] = sin(phi)
2431
2432
2433 neg = [False, True]
2434 tle = ['a', 'b']
2435 data = []
2436 for i in range(2):
2437 data.append([
2438
2439 [ 1, 'PIV', 1, 'Piv', pivot],
2440
2441
2442 [ 2, 'AXE', 2, 'R', pivot],
2443 [ 2, 'AXE', 3, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=axis_theta, neg=neg[i])],
2444 [ 2, 'AXE', 4, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=axis_theta, neg=neg[i])],
2445
2446
2447 [ 3, 'CNE', 5, 'APX', pivot],
2448 [ 3, 'CNE', 6, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], R=R, neg=neg[i])],
2449 [ 3, 'CNE', 7, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], R=R, neg=neg[i])],
2450 [ 3, 'CNE', 8, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], R=R, neg=neg[i])],
2451 [ 3, 'CNE', 9, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], R=R, neg=neg[i])],
2452 [ 3, 'CNE', 10, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], R=R, neg=neg[i])],
2453 [ 3, 'CNE', 11, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], R=R, neg=neg[i])],
2454 [ 3, 'CNE', 12, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], R=R, neg=neg[i])],
2455 [ 3, 'CNE', 13, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], R=R, neg=neg[i])],
2456 [ 3, 'CNE', 14, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], R=R, neg=neg[i])],
2457 [ 3, 'CNE', 15, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], R=R, neg=neg[i])],
2458
2459
2460 [ 1, 'TLE', 76, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
2461 ])
2462
2463
2464 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2465
2466
2468 """Check the frame_order.pdb_model user function PDB file for the torsionless isotropic cone model along the z-axis."""
2469
2470
2471 theta = 2.0
2472 pivot = array([1, 0, -2], float64)
2473 l = 25.0
2474 l_rotor = l + 5.0
2475
2476
2477 axis_theta = 0.0
2478 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, 0.0))
2479
2480
2481 self.setup_model(pipe_name='PDB model', model='iso cone, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta)
2482
2483
2484 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2485
2486
2487 inc = 2.0 * pi / 10.0
2488 vectors = zeros((10, 3), float64)
2489 for i in range(10):
2490
2491 phi = inc * i
2492
2493
2494 vectors[i, 0] = cos(phi)
2495 vectors[i, 1] = sin(phi)
2496
2497
2498 neg = [False, True]
2499 tle = ['a', 'b']
2500 data = []
2501 for i in range(2):
2502 data.append([
2503
2504 [ 1, 'PIV', 1, 'Piv', pivot],
2505
2506
2507 [ 2, 'AXE', 2, 'R', pivot],
2508 [ 2, 'AXE', 3, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=axis_theta, neg=neg[i])],
2509 [ 2, 'AXE', 4, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=axis_theta, neg=neg[i])],
2510
2511
2512 [ 3, 'CNE', 5, 'APX', pivot],
2513 [ 3, 'CNE', 6, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], neg=neg[i])],
2514 [ 3, 'CNE', 7, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], neg=neg[i])],
2515 [ 3, 'CNE', 8, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], neg=neg[i])],
2516 [ 3, 'CNE', 9, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], neg=neg[i])],
2517 [ 3, 'CNE', 10, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], neg=neg[i])],
2518 [ 3, 'CNE', 11, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], neg=neg[i])],
2519 [ 3, 'CNE', 12, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], neg=neg[i])],
2520 [ 3, 'CNE', 13, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], neg=neg[i])],
2521 [ 3, 'CNE', 14, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], neg=neg[i])],
2522 [ 3, 'CNE', 15, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], neg=neg[i])],
2523
2524
2525 [ 1, 'TLE', 76, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
2526 ])
2527
2528
2529 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2530
2531
2533 """Check the frame_order.pdb_model user function PDB file for the pseudo-ellipse model with a xz-plane tilt."""
2534
2535
2536 theta_x = 2.0
2537 theta_y = 0.1
2538 pivot = array([1, -2, 1.1], float64)
2539 l = 50.0
2540 l_rotor = l + 5.0
2541
2542
2543 eigen_beta = -pi/2.0
2544 R = zeros((3, 3), float64)
2545 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
2546 print("Motional eigenframe:\n%s" % R)
2547
2548
2549 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y, cone_sigma_max=0.0)
2550
2551
2552 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2553
2554
2555 inc = 2.0 * pi / 10.0
2556 vectors = zeros((10, 3), float64)
2557 theta_max = zeros(10, float64)
2558 for i in range(10):
2559
2560 phi = inc * i
2561
2562
2563 vectors[i, 0] = cos(phi)
2564 vectors[i, 1] = sin(phi)
2565
2566
2567 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
2568
2569
2570 neg = [False, True]
2571 tle = ['a', 'b']
2572 data = []
2573 for i in range(2):
2574 data.append([
2575
2576 [ 1, 'PIV', 1, 'Piv', pivot],
2577
2578
2579 [ 1, 'RTX', 2, 'CTR', pivot],
2580 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
2581 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
2582 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=eigen_beta, neg=neg[i])],
2583 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
2584 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=eigen_beta, neg=neg[i])],
2585 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=eigen_beta, neg=neg[i])],
2586
2587
2588 [ 1, 'AXE', 733, 'R', pivot],
2589 [ 2, 'AXE', 734, 'R', pivot],
2590 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0+eigen_beta, neg=neg[i])],
2591 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0+eigen_beta, neg=neg[i])],
2592 [ 2, 'AXE', 737, 'R', pivot],
2593 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])],
2594 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])],
2595
2596
2597 [ 3, 'CNE', 740, 'APX', pivot],
2598 [ 3, 'CNE', 741, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], R=R, neg=neg[i])],
2599 [ 3, 'CNE', 742, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], R=R, neg=neg[i])],
2600 [ 3, 'CNE', 743, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], R=R, neg=neg[i])],
2601 [ 3, 'CNE', 744, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], R=R, neg=neg[i])],
2602 [ 3, 'CNE', 745, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], R=R, neg=neg[i])],
2603 [ 3, 'CNE', 746, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], R=R, neg=neg[i])],
2604 [ 3, 'CNE', 747, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], R=R, neg=neg[i])],
2605 [ 3, 'CNE', 748, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], R=R, neg=neg[i])],
2606 [ 3, 'CNE', 749, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], R=R, neg=neg[i])],
2607 [ 3, 'CNE', 750, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], R=R, neg=neg[i])],
2608
2609
2610 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=eigen_beta, neg=neg[i])]
2611 ])
2612
2613
2614 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2615
2616
2618 """Check the frame_order.pdb_model user function PDB file for the pseudo-ellipse model along the z-axis."""
2619
2620
2621 theta_x = 2.0
2622 theta_y = 0.1
2623 pivot = array([1, 1, 1], float64)
2624 l = 40.0
2625 l_rotor = l + 5.0
2626
2627
2628 eigen_beta = 0.0
2629 R = zeros((3, 3), float64)
2630 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
2631 print("Motional eigenframe:\n%s" % R)
2632
2633
2634 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y, cone_sigma_max=0.0)
2635
2636
2637 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2638
2639
2640 inc = 2.0 * pi / 10.0
2641 vectors = zeros((10, 3), float64)
2642 theta_max = zeros(10, float64)
2643 for i in range(10):
2644
2645 phi = inc * i
2646
2647
2648 vectors[i, 0] = cos(phi)
2649 vectors[i, 1] = sin(phi)
2650
2651
2652 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
2653
2654
2655 neg = [False, True]
2656 tle = ['a', 'b']
2657 data = []
2658 for i in range(2):
2659 data.append([
2660
2661 [ 1, 'PIV', 1, 'Piv', pivot],
2662
2663
2664 [ 1, 'RTX', 2, 'CTR', pivot],
2665 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
2666 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
2667 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=0.0, neg=neg[i])],
2668 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
2669 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=0.0, neg=neg[i])],
2670 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=0.0, neg=neg[i])],
2671
2672
2673 [ 1, 'AXE', 733, 'R', pivot],
2674 [ 2, 'AXE', 734, 'R', pivot],
2675 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, neg=neg[i])],
2676 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, neg=neg[i])],
2677 [ 2, 'AXE', 737, 'R', pivot],
2678 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])],
2679 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])],
2680
2681
2682 [ 3, 'CNE', 740, 'APX', pivot],
2683 [ 3, 'CNE', 741, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], neg=neg[i])],
2684 [ 3, 'CNE', 742, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], neg=neg[i])],
2685 [ 3, 'CNE', 743, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], neg=neg[i])],
2686 [ 3, 'CNE', 744, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], neg=neg[i])],
2687 [ 3, 'CNE', 745, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], neg=neg[i])],
2688 [ 3, 'CNE', 746, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], neg=neg[i])],
2689 [ 3, 'CNE', 747, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], neg=neg[i])],
2690 [ 3, 'CNE', 748, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], neg=neg[i])],
2691 [ 3, 'CNE', 749, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], neg=neg[i])],
2692 [ 3, 'CNE', 750, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], neg=neg[i])],
2693
2694
2695 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=0.0, neg=neg[i])]
2696 ])
2697
2698
2699 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2700
2701
2703 """Check the frame_order.pdb_model user function PDB file for the free rotor pseudo-ellipse model with a xz-plane tilt."""
2704
2705
2706 theta_x = 2.0
2707 theta_y = 0.1
2708 pivot = array([1, -2, 1.1], float64)
2709 l = 50.0
2710 l_rotor = l + 5.0
2711
2712
2713 eigen_beta = -pi/2.0
2714 R = zeros((3, 3), float64)
2715 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
2716 print("Motional eigenframe:\n%s" % R)
2717
2718
2719 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y)
2720
2721
2722 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2723
2724
2725 inc = 2.0 * pi / 10.0
2726 vectors = zeros((10, 3), float64)
2727 theta_max = zeros(10, float64)
2728 for i in range(10):
2729
2730 phi = inc * i
2731
2732
2733 vectors[i, 0] = cos(phi)
2734 vectors[i, 1] = sin(phi)
2735
2736
2737 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
2738
2739
2740 neg = [False, True]
2741 tle = ['a', 'b']
2742 data = []
2743 for i in range(2):
2744 data.append([
2745
2746 [ 1, 'PIV', 1, 'Piv', pivot],
2747
2748
2749 [ 1, 'RTX', 2, 'CTR', pivot],
2750 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
2751 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
2752 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
2753 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
2754 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
2755 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=eigen_beta, neg=neg[i])],
2756
2757
2758 [ 1, 'AXE', 733, 'R', pivot],
2759 [ 2, 'AXE', 734, 'R', pivot],
2760 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0+eigen_beta, neg=neg[i])],
2761 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0+eigen_beta, neg=neg[i])],
2762 [ 2, 'AXE', 737, 'R', pivot],
2763 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])],
2764 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])],
2765
2766
2767 [ 3, 'CNE', 740, 'APX', pivot],
2768 [ 3, 'CNE', 741, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], R=R, neg=neg[i])],
2769 [ 3, 'CNE', 742, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], R=R, neg=neg[i])],
2770 [ 3, 'CNE', 743, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], R=R, neg=neg[i])],
2771 [ 3, 'CNE', 744, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], R=R, neg=neg[i])],
2772 [ 3, 'CNE', 745, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], R=R, neg=neg[i])],
2773 [ 3, 'CNE', 746, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], R=R, neg=neg[i])],
2774 [ 3, 'CNE', 747, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], R=R, neg=neg[i])],
2775 [ 3, 'CNE', 748, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], R=R, neg=neg[i])],
2776 [ 3, 'CNE', 749, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], R=R, neg=neg[i])],
2777 [ 3, 'CNE', 750, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], R=R, neg=neg[i])],
2778
2779
2780 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=eigen_beta, neg=neg[i])]
2781 ])
2782
2783
2784 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2785
2786
2788 """Check the frame_order.pdb_model user function PDB file for the free rotor pseudo-ellipse model along the z-axis."""
2789
2790
2791 theta_x = 2.0
2792 theta_y = 0.1
2793 pivot = array([1, 1, 1], float64)
2794 l = 40.0
2795 l_rotor = l + 5.0
2796
2797
2798 eigen_beta = 0.0
2799 R = zeros((3, 3), float64)
2800 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
2801 print("Motional eigenframe:\n%s" % R)
2802
2803
2804 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y)
2805
2806
2807 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2808
2809
2810 inc = 2.0 * pi / 10.0
2811 vectors = zeros((10, 3), float64)
2812 theta_max = zeros(10, float64)
2813 for i in range(10):
2814
2815 phi = inc * i
2816
2817
2818 vectors[i, 0] = cos(phi)
2819 vectors[i, 1] = sin(phi)
2820
2821
2822 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
2823
2824
2825 neg = [False, True]
2826 tle = ['a', 'b']
2827 data = []
2828 for i in range(2):
2829 data.append([
2830
2831 [ 1, 'PIV', 1, 'Piv', pivot],
2832
2833
2834 [ 1, 'RTX', 2, 'CTR', pivot],
2835 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
2836 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
2837 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
2838 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
2839 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
2840 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=0.0, neg=neg[i])],
2841
2842
2843 [ 1, 'AXE', 733, 'R', pivot],
2844 [ 2, 'AXE', 734, 'R', pivot],
2845 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, neg=neg[i])],
2846 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, neg=neg[i])],
2847 [ 2, 'AXE', 737, 'R', pivot],
2848 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])],
2849 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])],
2850
2851
2852 [ 3, 'CNE', 740, 'APX', pivot],
2853 [ 3, 'CNE', 741, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], neg=neg[i])],
2854 [ 3, 'CNE', 742, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], neg=neg[i])],
2855 [ 3, 'CNE', 743, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], neg=neg[i])],
2856 [ 3, 'CNE', 744, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], neg=neg[i])],
2857 [ 3, 'CNE', 745, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], neg=neg[i])],
2858 [ 3, 'CNE', 746, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], neg=neg[i])],
2859 [ 3, 'CNE', 747, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], neg=neg[i])],
2860 [ 3, 'CNE', 748, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], neg=neg[i])],
2861 [ 3, 'CNE', 749, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], neg=neg[i])],
2862 [ 3, 'CNE', 750, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], neg=neg[i])],
2863
2864
2865 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=0.0, neg=neg[i])]
2866 ])
2867
2868
2869 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2870
2871
2873 """Check the frame_order.pdb_model user function PDB file for the torsionless pseudo-ellipse model with a xz-plane tilt."""
2874
2875
2876 theta_x = 2.0
2877 theta_y = 0.1
2878 pivot = array([1, -2, 1.1], float64)
2879 l = 50.0
2880 l_rotor = l + 5.0
2881
2882
2883 eigen_beta = -pi/2.0
2884 R = zeros((3, 3), float64)
2885 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
2886 print("Motional eigenframe:\n%s" % R)
2887
2888
2889 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y)
2890
2891
2892 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2893
2894
2895 inc = 2.0 * pi / 10.0
2896 vectors = zeros((10, 3), float64)
2897 theta_max = zeros(10, float64)
2898 for i in range(10):
2899
2900 phi = inc * i
2901
2902
2903 vectors[i, 0] = cos(phi)
2904 vectors[i, 1] = sin(phi)
2905
2906
2907 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
2908
2909
2910 neg = [False, True]
2911 tle = ['a', 'b']
2912 data = []
2913 for i in range(2):
2914 data.append([
2915
2916 [ 1, 'PIV', 1, 'Piv', pivot],
2917
2918
2919 [ 1, 'AXE', 2, 'R', pivot],
2920 [ 2, 'AXE', 3, 'R', pivot],
2921 [ 2, 'AXE', 4, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, R=R, neg=neg[i])],
2922 [ 2, 'AXE', 5, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, R=R, neg=neg[i])],
2923 [ 2, 'AXE', 6, 'R', pivot],
2924 [ 2, 'AXE', 7, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, R=R, neg=neg[i])],
2925 [ 2, 'AXE', 8, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, R=R, neg=neg[i])],
2926 [ 2, 'AXE', 9, 'R', pivot],
2927 [ 2, 'AXE', 10, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, R=R, neg=neg[i])],
2928 [ 2, 'AXE', 11, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=0.0, R=R, neg=neg[i])],
2929
2930
2931 [ 3, 'CNE', 12, 'APX', pivot],
2932 [ 3, 'CNE', 13, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], R=R, neg=neg[i])],
2933 [ 3, 'CNE', 14, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], R=R, neg=neg[i])],
2934 [ 3, 'CNE', 15, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], R=R, neg=neg[i])],
2935 [ 3, 'CNE', 16, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], R=R, neg=neg[i])],
2936 [ 3, 'CNE', 17, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], R=R, neg=neg[i])],
2937 [ 3, 'CNE', 18, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], R=R, neg=neg[i])],
2938 [ 3, 'CNE', 19, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], R=R, neg=neg[i])],
2939 [ 3, 'CNE', 20, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], R=R, neg=neg[i])],
2940 [ 3, 'CNE', 21, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], R=R, neg=neg[i])],
2941 [ 3, 'CNE', 22, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], R=R, neg=neg[i])],
2942
2943
2944 [ 1, 'TLE', 83, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=eigen_beta, neg=neg[i])]
2945 ])
2946
2947
2948 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2949
2950
2952 """Check the frame_order.pdb_model user function PDB file for the torsionless pseudo-ellipse model along the z-axis."""
2953
2954
2955 theta_x = 2.0
2956 theta_y = 0.1
2957 pivot = array([1, 1, 1], float64)
2958 l = 40.0
2959 l_rotor = l + 5.0
2960
2961
2962 eigen_beta = 0.0
2963 R = zeros((3, 3), float64)
2964 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
2965 print("Motional eigenframe:\n%s" % R)
2966
2967
2968 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y)
2969
2970
2971 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
2972
2973
2974 inc = 2.0 * pi / 10.0
2975 vectors = zeros((10, 3), float64)
2976 theta_max = zeros(10, float64)
2977 for i in range(10):
2978
2979 phi = inc * i
2980
2981
2982 vectors[i, 0] = cos(phi)
2983 vectors[i, 1] = sin(phi)
2984
2985
2986 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
2987
2988
2989 neg = [False, True]
2990 tle = ['a', 'b']
2991 data = []
2992 for i in range(2):
2993 data.append([
2994
2995 [ 1, 'PIV', 1, 'Piv', pivot],
2996
2997
2998 [ 1, 'AXE', 2, 'R', pivot],
2999 [ 2, 'AXE', 3, 'R', pivot],
3000 [ 2, 'AXE', 4, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, neg=neg[i])],
3001 [ 2, 'AXE', 5, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, neg=neg[i])],
3002 [ 2, 'AXE', 6, 'R', pivot],
3003 [ 2, 'AXE', 7, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])],
3004 [ 2, 'AXE', 8, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])],
3005 [ 2, 'AXE', 9, 'R', pivot],
3006 [ 2, 'AXE', 10, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=neg[i])],
3007 [ 2, 'AXE', 11, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=0.0, neg=neg[i])],
3008
3009
3010 [ 3, 'CNE', 12, 'APX', pivot],
3011 [ 3, 'CNE', 13, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], neg=neg[i])],
3012 [ 3, 'CNE', 14, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], neg=neg[i])],
3013 [ 3, 'CNE', 15, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], neg=neg[i])],
3014 [ 3, 'CNE', 16, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], neg=neg[i])],
3015 [ 3, 'CNE', 17, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], neg=neg[i])],
3016 [ 3, 'CNE', 18, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], neg=neg[i])],
3017 [ 3, 'CNE', 19, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], neg=neg[i])],
3018 [ 3, 'CNE', 20, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], neg=neg[i])],
3019 [ 3, 'CNE', 21, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], neg=neg[i])],
3020 [ 3, 'CNE', 22, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], neg=neg[i])],
3021
3022
3023 [ 1, 'TLE', 83, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=0.0, neg=neg[i])]
3024 ])
3025
3026
3027 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
3028
3029
3031 """Check the frame_order.pdb_model user function PDB file for the rotor model with a xz-plane tilt."""
3032
3033
3034 pivot = array([1, 0, 1], float64)
3035 l = 100.0
3036
3037
3038 axis_alpha = pi / 2.0
3039 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64))
3040 print("\nRotor axis:\n %s" % axis)
3041 print("Rotor apex (100*axis + [1, 0, 1]):\n %s" % (l*axis + pivot))
3042
3043
3044 self.setup_model(pipe_name='PDB model', model='rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha, cone_sigma_max=0.0)
3045
3046
3047 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=100.0)
3048
3049
3050 data = [
3051 [ 1, 'PIV', 1, 'Piv', pivot],
3052 [ 1, 'RTX', 2, 'CTR', pivot],
3053 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
3054 [ 3, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
3055 [ 4, 'RTB', 5, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
3056 [ 5, 'RTB', 187, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0)],
3057 [ 6, 'RTB', 369, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
3058 [ 7, 'RTB', 551, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0)],
3059 [ 8, 'RTB', 733, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
3060 [ 9, 'RTB', 915, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0, neg=True)],
3061 [10, 'RTB', 1097, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
3062 [11, 'RTB', 1279, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0, neg=True)],
3063 [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0)],
3064 [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0, neg=True)]
3065 ]
3066
3067
3068 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
3069
3070
3072 """Check the frame_order.pdb_model user function PDB file for the rotor model along the z-axis."""
3073
3074
3075 pivot = array([1, 0, 0], float64)
3076 l = 30.0
3077
3078
3079 axis_alpha = pi / 2.0
3080 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64))
3081 print("\nRotor axis: %s" % axis)
3082 print("Rotor apex (100*axis + [1, 0, 0]):\n %s" % (l*axis + pivot))
3083
3084
3085 self.setup_model(pipe_name='PDB model', model='rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha, cone_sigma_max=0.0)
3086
3087
3088 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l)
3089
3090
3091 data = [
3092 [ 1, 'PIV', 1, 'Piv', pivot],
3093 [ 1, 'RTX', 2, 'CTR', pivot],
3094 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
3095 [ 3, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
3096 [ 4, 'RTB', 5, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
3097 [ 5, 'RTB', 187, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0)],
3098 [ 6, 'RTB', 369, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
3099 [ 7, 'RTB', 551, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0)],
3100 [ 8, 'RTB', 733, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
3101 [ 9, 'RTB', 915, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0, neg=True)],
3102 [10, 'RTB', 1097, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
3103 [11, 'RTB', 1279, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0, neg=True)],
3104 [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0)],
3105 [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0, neg=True)]
3106 ]
3107
3108
3109 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
3110
3111
3113 """Catch for a bug in optimisation when the cone_theta_x is set to zero in the pseudo-ellipse models."""
3114
3115
3116 self.interpreter.reset()
3117
3118
3119 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
3120 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
3121
3122
3123 cdp.cone_theta_x = 0.0
3124 cdp.cone_theta_y = 2.0
3125
3126
3127 self.interpreter.minimise.execute('simplex', max_iter=2)
3128
3129
3131 """Test the double rotor target function for the data from a rigid test molecule."""
3132
3133
3134 ds.model = MODEL_DOUBLE_ROTOR
3135
3136
3137 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
3138
3139
3140 self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
3141
3142
3144 """Test the free rotor target function for the data from a rigid test molecule."""
3145
3146
3147 ds.model = MODEL_FREE_ROTOR
3148
3149
3150 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
3151
3152
3153 self.assertAlmostEqual(cdp.chi2, 212124.83317383687)
3154
3155
3157 """Test the iso cone, free rotor target function for the data from a rigid test molecule."""
3158
3159
3160 ds.model = MODEL_ISO_CONE_FREE_ROTOR
3161
3162
3163 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
3164
3165
3166 self.assertAlmostEqual(cdp.chi2, 22295.500553417492)
3167
3168
3170 """Test the iso cone target function for the data from a rigid test molecule."""
3171
3172
3173 ds.model = MODEL_ISO_CONE
3174
3175
3176 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
3177
3178
3179 self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
3180
3181
3183 """Test the iso cone, torsionless target function for the data from a rigid test molecule."""
3184
3185
3186 ds.model = MODEL_ISO_CONE_TORSIONLESS
3187
3188
3189 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
3190
3191
3192 self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
3193
3194
3196 """Test the pseudo-ellipse target function for the data from a rigid test molecule."""
3197
3198
3199 ds.model = MODEL_PSEUDO_ELLIPSE
3200
3201
3202 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
3203
3204
3205 self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
3206
3207
3209 """Test the pseudo-ellipse, torsionless target function for the data from a rigid test molecule."""
3210
3211
3212 ds.model = MODEL_PSEUDO_ELLIPSE_TORSIONLESS
3213
3214
3215 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
3216
3217
3218 self.assertAlmostEqual(cdp.chi2, 0.011377491600681364)
3219
3220
3222 """Test the rigid target function for the data from a rigid test molecule."""
3223
3224
3225 ds.model = MODEL_RIGID
3226
3227
3228 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
3229
3230
3231 self.assertAlmostEqual(cdp.chi2, 0.0113763520134, 5)
3232
3233
3235 """Test the rotor target function for the data from a rigid test molecule."""
3236
3237
3238 ds.model = MODEL_ROTOR
3239
3240
3241 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
3242
3243
3244 self.assertAlmostEqual(cdp.chi2, 0.011377487066752203, 5)
3245
3246
3248 """Check the frame_order.simulate user function PDB file for the double rotor model with a xz-plane tilt for the first rotation mode."""
3249
3250
3251 cone_sigma_max = pi / 2.0
3252 cone_sigma_max_2 = 0.0
3253 pivot = array([20, 20, -20], float64)
3254 l = 100.0
3255 sim_num = 500
3256 pivot_disp = 100.0
3257
3258
3259 eigen_beta = -pi/4.0
3260 R = zeros((3, 3), float64)
3261 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
3262 print("Motional eigenframe:\n%s" % R)
3263
3264
3265 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2)
3266
3267
3268 if type == 'sim':
3269 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
3270 elif type == 'dist':
3271 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
3272
3273
3274 self.interpreter.structure.delete()
3275
3276
3277 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
3278
3279
3280 X_theta_min = cartesian_to_spherical([100, 0, 200])[1]
3281 X_theta_max = cartesian_to_spherical([-100, 0, 0])[1] + pi
3282 print("X vector theta range of [%.5f, %.5f]" % (X_theta_min, X_theta_max))
3283
3284
3285 selection = cdp.structure.selection()
3286 epsilon = 1e-3
3287 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
3288
3289 for i in range(sim_num):
3290
3291 new_pos = pos[i] - pivot
3292 r, theta, phi = cartesian_to_spherical(dot(transpose(R), new_pos))
3293
3294
3295 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
3296
3297
3298 if res_name in ['X', 'nX']:
3299 self.assert_(theta >= X_theta_min - epsilon)
3300 self.assert_(theta <= X_theta_max + epsilon)
3301 if phi < 0.1:
3302 self.assertAlmostEqual(phi, 0.0, 3)
3303 else:
3304 self.assertAlmostEqual(phi, pi, 3)
3305 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3306
3307
3308 elif res_name == 'Y':
3309 self.assert_(r/100.0 >= 1.0 - epsilon)
3310 self.assert_(theta >= pi/4.0 - epsilon)
3311 self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
3312 self.assertAlmostEqual(new_pos[1], 100.0, 3)
3313
3314
3315 elif res_name == 'Z':
3316 self.assert_(r/100.0 >= 1.0 - epsilon)
3317 self.assertAlmostEqual(new_pos[0], -70.711, 3)
3318 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3319 self.assertAlmostEqual(new_pos[2], 70.711, 3)
3320
3321
3322 elif res_name == 'nY':
3323 self.assert_(r/100.0 >= 1.0 - epsilon)
3324 self.assert_(theta >= pi/4.0 - epsilon)
3325 self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
3326 self.assertAlmostEqual(new_pos[1], -100.0, 3)
3327
3328
3329 elif res_name == 'nZ':
3330 self.assert_(r/100.0 >= 1.0 - epsilon)
3331 self.assert_(theta >= pi/4.0 - epsilon)
3332 self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
3333 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3334
3335
3336 elif res_name == 'C':
3337 self.assert_(r/100.0 <= 1.4142135623730951 + epsilon)
3338 if not (new_pos[0] == 0.0 and new_pos[1] == 0.0 and new_pos[2] == 0.0):
3339 self.assert_(theta >= pi/4.0 - epsilon)
3340 self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
3341 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3342
3343
3344 elif res_name == '0':
3345 self.assertAlmostEqual(r, 34.641016151377549, 4)
3346 self.assertAlmostEqual(pos[0], 0.0, 3)
3347 self.assertAlmostEqual(pos[1], 0.0, 3)
3348 self.assertAlmostEqual(pos[2], 0.0, 3)
3349
3350
3352 """Check the frame_order.simulate user function PDB file for the double rotor model along the z-axis for the first rotation mode."""
3353
3354
3355 cone_sigma_max = pi / 2.0
3356 cone_sigma_max_2 = 0.0
3357 pivot = array([20, 20, -20], float64)
3358 l = 100.0
3359 sim_num = 500
3360 pivot_disp = 100.0
3361
3362
3363 eigen_beta = 0.0
3364 R = zeros((3, 3), float64)
3365 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
3366 print("Motional eigenframe:\n%s" % R)
3367
3368
3369 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2)
3370
3371
3372 if type == 'sim':
3373 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
3374 elif type == 'dist':
3375 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
3376
3377
3378 self.interpreter.structure.delete()
3379
3380
3381 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
3382
3383
3384 X_theta_min = cartesian_to_spherical([100, 0, 200])[1]
3385 X_theta_max = cartesian_to_spherical([-100, 0, 0])[1] + pi
3386 print("X vector theta range of [%.5f, %.5f]" % (X_theta_min, X_theta_max))
3387
3388
3389 selection = cdp.structure.selection()
3390 epsilon = 1e-3
3391 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
3392
3393 for i in range(sim_num):
3394
3395 new_pos = pos[i] - pivot
3396 r, theta, phi = cartesian_to_spherical(new_pos)
3397
3398
3399 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
3400
3401
3402 if res_name in ['X', 'nX']:
3403 self.assert_(theta >= X_theta_min - epsilon)
3404 self.assert_(theta <= X_theta_max + epsilon)
3405 if phi < 0.1:
3406 self.assertAlmostEqual(phi, 0.0, 3)
3407 else:
3408 self.assertAlmostEqual(phi, pi, 3)
3409 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3410
3411
3412 elif res_name == 'Y':
3413 self.assert_(r/100.0 >= 1.0 - epsilon)
3414 self.assert_(theta >= pi/4.0 - epsilon)
3415 self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
3416 self.assertAlmostEqual(new_pos[1], 100.0, 3)
3417
3418
3419 elif res_name == 'Z':
3420 self.assert_(r/100.0 >= 1.0 - epsilon)
3421 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3422 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3423 self.assertAlmostEqual(new_pos[2], 100.0, 3)
3424
3425
3426 elif res_name == 'nY':
3427 self.assert_(r/100.0 >= 1.0 - epsilon)
3428 self.assert_(theta >= pi/4.0 - epsilon)
3429 self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
3430 self.assertAlmostEqual(new_pos[1], -100.0, 3)
3431
3432
3433 elif res_name == 'nZ':
3434 self.assert_(r/100.0 >= 1.0 - epsilon)
3435 self.assert_(theta >= pi/4.0 - epsilon)
3436 self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
3437 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3438
3439
3440 elif res_name == 'C':
3441 self.assert_(r/100.0 <= 1.4142135623730951 + epsilon)
3442 if not (new_pos[0] == 0.0 and new_pos[1] == 0.0 and new_pos[2] == 0.0):
3443 self.assert_(theta >= pi/4.0 - epsilon)
3444 self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
3445 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3446
3447
3448 elif res_name == '0':
3449 self.assertAlmostEqual(r, 34.641016151377549, 4)
3450 self.assertAlmostEqual(pos[0], 0.0, 3)
3451 self.assertAlmostEqual(pos[1], 0.0, 3)
3452 self.assertAlmostEqual(pos[2], 0.0, 3)
3453
3454
3456 """Check the frame_order.simulate user function PDB file for the double rotor model with a xz-plane tilt for the second rotation mode."""
3457
3458
3459 cone_sigma_max = 0.0
3460 cone_sigma_max_2 = pi / 2.0
3461 pivot = array([20, 20, -20], float64)
3462 l = 100.0
3463 sim_num = 500
3464 pivot_disp = 100.0
3465
3466
3467 eigen_beta = -pi/4.0
3468 R = zeros((3, 3), float64)
3469 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
3470 print("Motional eigenframe:\n%s" % R)
3471
3472
3473 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2)
3474
3475
3476 if type == 'sim':
3477 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
3478 elif type == 'dist':
3479 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
3480
3481
3482 self.interpreter.structure.delete()
3483
3484
3485 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
3486
3487
3488 selection = cdp.structure.selection()
3489 epsilon = 1e-3
3490 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
3491
3492 for i in range(sim_num):
3493
3494 new_pos = pos[i] - pivot
3495 r, theta, phi = cartesian_to_spherical(dot(transpose(R), new_pos))
3496
3497
3498 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
3499
3500
3501 if res_name == 'X':
3502 self.assertAlmostEqual(new_pos[0], 70.711, 3)
3503 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3504 self.assertAlmostEqual(new_pos[2], 70.711, 3)
3505
3506
3507 elif res_name == 'Y':
3508 self.assertAlmostEqual(r/100.0, 1.0, 3)
3509 self.assert_(new_pos[0] >= -70.711 - epsilon)
3510 self.assert_(new_pos[0] <= 70.711 + epsilon)
3511 self.assert_(new_pos[1] >= 0.0 - epsilon)
3512 self.assert_(new_pos[1] <= 100.0 + epsilon)
3513 self.assert_(new_pos[2] >= -70.711 - epsilon)
3514 self.assert_(new_pos[2] <= 70.711 + epsilon)
3515
3516
3517 elif res_name == 'Z':
3518 self.assertAlmostEqual(r/100.0, 1.0, 3)
3519 self.assert_(new_pos[0] >= -70.711 - epsilon)
3520 self.assert_(new_pos[0] <= 0.0 + epsilon)
3521 self.assert_(new_pos[1] >= -100.0 - epsilon)
3522 self.assert_(new_pos[1] <= 100.0 + epsilon)
3523 self.assert_(new_pos[2] >= 0.0 - epsilon)
3524 self.assert_(new_pos[2] <= 70.711 + epsilon)
3525
3526
3527 elif res_name == 'nX':
3528 self.assertAlmostEqual(new_pos[0], -70.711, 3)
3529 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3530 self.assertAlmostEqual(new_pos[2], -70.711, 3)
3531
3532
3533 elif res_name == 'nY':
3534 self.assertAlmostEqual(r/100.0, 1.0, 3)
3535 self.assert_(new_pos[0] >= -70.711 - epsilon)
3536 self.assert_(new_pos[0] <= 70.711 + epsilon)
3537 self.assert_(new_pos[1] >= -100.0 - epsilon)
3538 self.assert_(new_pos[1] <= 0.0 + epsilon)
3539 self.assert_(new_pos[2] >= -70.711 - epsilon)
3540 self.assert_(new_pos[2] <= 70.711 + epsilon)
3541
3542
3543 elif res_name == 'nZ':
3544 self.assertAlmostEqual(r/100.0, 1.0, 3)
3545 self.assert_(new_pos[0] >= 0.0 - epsilon)
3546 self.assert_(new_pos[0] <= 70.711 + epsilon)
3547 self.assert_(new_pos[1] >= -100.0 - epsilon)
3548 self.assert_(new_pos[1] <= 100.0 + epsilon)
3549 self.assert_(new_pos[2] >= -70.711 - epsilon)
3550 self.assert_(new_pos[2] <= 0.0 + epsilon)
3551
3552
3553 elif res_name == 'C':
3554 self.assertAlmostEqual(r, 0.0, 3)
3555 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3556 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3557 self.assertAlmostEqual(new_pos[2], 0.0, 3)
3558
3559
3560 elif res_name == '0':
3561 self.assertAlmostEqual(pos[0], 20.0, 3)
3562 self.assertAlmostEqual(pos[1], 20.0, 3)
3563 self.assertAlmostEqual(pos[2], -20.0, 3)
3564
3565
3567 """Check the frame_order.simulate user function PDB file for the double rotor model along the z-axis for the second rotation mode."""
3568
3569
3570 cone_sigma_max = 0.0
3571 cone_sigma_max_2 = pi / 2.0
3572 pivot = array([20, 20, -20], float64)
3573 l = 100.0
3574 sim_num = 500
3575 pivot_disp = 100.0
3576
3577
3578 eigen_beta = 0.0
3579 R = zeros((3, 3), float64)
3580 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
3581 print("Motional eigenframe:\n%s" % R)
3582
3583
3584 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2)
3585
3586
3587 if type == 'sim':
3588 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
3589 elif type == 'dist':
3590 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
3591
3592
3593 self.interpreter.structure.delete()
3594
3595
3596 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
3597
3598
3599 selection = cdp.structure.selection()
3600 epsilon = 1e-3
3601 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
3602
3603 for i in range(sim_num):
3604
3605 new_pos = pos[i] - pivot
3606 r, theta, phi = cartesian_to_spherical(new_pos)
3607
3608
3609 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
3610
3611
3612 if res_name == 'X':
3613 self.assertAlmostEqual(new_pos[0], 100.0, 3)
3614 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3615 self.assertAlmostEqual(new_pos[2], 0.0, 3)
3616
3617
3618 elif res_name == 'Y':
3619 self.assertAlmostEqual(r/100.0, 1.0, 3)
3620 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3621 self.assert_(new_pos[1] >= 0.0 - epsilon)
3622 self.assert_(new_pos[1] <= 100.0 + epsilon)
3623 self.assert_(new_pos[2] >= -100.0 - epsilon)
3624 self.assert_(new_pos[2] <= 100.0 + epsilon)
3625
3626
3627 elif res_name == 'Z':
3628 self.assertAlmostEqual(r/100.0, 1.0, 3)
3629 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3630 self.assert_(new_pos[1] >= -100.0 - epsilon)
3631 self.assert_(new_pos[1] <= 100.0 + epsilon)
3632 self.assert_(new_pos[2] >= 0.0 - epsilon)
3633 self.assert_(new_pos[2] <= 100.0 + epsilon)
3634
3635
3636 elif res_name == 'nX':
3637 self.assertAlmostEqual(new_pos[0], -100.0, 3)
3638 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3639 self.assertAlmostEqual(new_pos[2], 0.0, 3)
3640
3641
3642 elif res_name == 'nY':
3643 self.assertAlmostEqual(r/100.0, 1.0, 3)
3644 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3645 self.assert_(new_pos[1] >= -100.0 - epsilon)
3646 self.assert_(new_pos[1] <= 0.0 + epsilon)
3647 self.assert_(new_pos[2] >= -100.0 - epsilon)
3648 self.assert_(new_pos[2] <= 100.0 + epsilon)
3649
3650
3651 elif res_name == 'nZ':
3652 self.assertAlmostEqual(r/100.0, 1.0, 3)
3653 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3654 self.assert_(new_pos[1] >= -100.0 - epsilon)
3655 self.assert_(new_pos[1] <= 100.0 + epsilon)
3656 self.assert_(new_pos[2] >= -100.0 - epsilon)
3657 self.assert_(new_pos[2] <= 0.0 + epsilon)
3658
3659
3660 elif res_name == 'C':
3661 self.assertAlmostEqual(r, 0.0, 3)
3662 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3663 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3664 self.assertAlmostEqual(new_pos[2], 0.0, 3)
3665
3666
3667 elif res_name == '0':
3668 self.assertAlmostEqual(pos[0], 20.0, 3)
3669 self.assertAlmostEqual(pos[1], 20.0, 3)
3670 self.assertAlmostEqual(pos[2], -20.0, 3)
3671
3672
3674 """Check the frame_order.simulate user function PDB file for the free rotor model along the z-axis."""
3675
3676
3677 pivot = array([1, 0, 0], float64)
3678 l = 10.0
3679 sim_num = 500
3680
3681
3682 axis_alpha = pi / 2.0
3683 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64))
3684 print("\nRotor axis: %s" % axis)
3685 print("Rotor apex (100*axis + [1, 0, 0]):\n %s" % (l*axis + pivot))
3686
3687
3688 self.setup_model(pipe_name='PDB model', model='free rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha)
3689
3690
3691 if type == 'sim':
3692 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
3693 elif type == 'dist':
3694 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
3695
3696
3697 self.interpreter.structure.delete()
3698
3699
3700 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
3701
3702
3703 selection = cdp.structure.selection()
3704 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
3705
3706 for i in range(sim_num):
3707
3708 new_pos = pos[i] - pivot
3709 r, theta, phi = cartesian_to_spherical(new_pos)
3710
3711
3712 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
3713
3714
3715 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']:
3716 self.assertAlmostEqual(r/100.0, 1.0, 4)
3717 elif res_name == 'C':
3718 self.assertAlmostEqual(r, 0.0, 4)
3719
3720
3721 if res_name == 'X':
3722 self.assertAlmostEqual(theta, pi/2.0, 3)
3723 self.assertAlmostEqual(new_pos[2], 0.0, 3)
3724
3725
3726 elif res_name == 'Y':
3727 self.assertAlmostEqual(theta, pi/2.0, 3)
3728 self.assertAlmostEqual(new_pos[2], 0.0, 3)
3729
3730
3731 elif res_name == 'Z':
3732 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3733 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3734 self.assertAlmostEqual(new_pos[2], 100.0, 3)
3735
3736
3737 elif res_name == 'C':
3738 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3739 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3740 self.assertAlmostEqual(new_pos[2], 0.0, 3)
3741
3742
3743 elif res_name == 'C':
3744 self.assertAlmostEqual(pos[0], 0.0, 3)
3745 self.assertAlmostEqual(pos[1], 0.0, 3)
3746 self.assertAlmostEqual(pos[2], 0.0, 3)
3747
3748
3750 """Check the frame_order.simulate user function PDB file for the isotropic cone model along the z-axis."""
3751
3752
3753 cone_theta = 0.5
3754 cone_sigma_max = 0.3
3755 pivot = array([1, 0, -2], float64)
3756 l = 24.0
3757 sim_num = 500
3758
3759
3760 axis_theta = 0.0
3761 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, 0.0))
3762
3763
3764 self.setup_model(pipe_name='PDB model', model='iso cone', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=cone_theta, cone_sigma_max=cone_sigma_max)
3765
3766
3767 if type == 'sim':
3768 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
3769 elif type == 'dist':
3770 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
3771
3772
3773 self.interpreter.structure.delete()
3774
3775
3776 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
3777
3778
3779 selection = cdp.structure.selection()
3780 epsilon = 1e-3
3781 max_phi = 0.0
3782 lateral_slide = 0.07
3783 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
3784
3785 for i in range(sim_num):
3786
3787 new_pos = pos[i] - pivot
3788 r, theta, phi = cartesian_to_spherical(new_pos)
3789
3790
3791 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
3792
3793
3794 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']:
3795 self.assertAlmostEqual(r/100.0, 1.0, 4)
3796 elif res_name == 'C':
3797 self.assertAlmostEqual(r, 0.0, 4)
3798
3799
3800 if res_name == 'X':
3801 if abs(phi) > max_phi:
3802 max_phi = abs(phi)
3803 self.assert_(theta >= pi/2.0 - cone_theta - epsilon)
3804 self.assert_(theta <= pi/2.0 + cone_theta + epsilon)
3805 self.assert_(phi >= -cone_sigma_max - lateral_slide)
3806 self.assert_(phi <= cone_sigma_max + lateral_slide)
3807
3808
3809 elif res_name == 'Y':
3810 self.assert_(theta >= pi/2.0 - cone_theta - epsilon)
3811 self.assert_(theta <= pi/2.0 + cone_theta + epsilon)
3812 self.assert_(phi-pi/2.0 >= -cone_sigma_max - lateral_slide)
3813 self.assert_(phi-pi/2.0 <= cone_sigma_max + lateral_slide)
3814
3815
3816 elif res_name == 'Z':
3817 self.assert_(theta <= cone_theta + epsilon)
3818
3819
3820 elif res_name == 'C':
3821 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3822 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3823 self.assertAlmostEqual(new_pos[2], 0.0, 3)
3824
3825
3826 elif res_name == 'C':
3827 self.assertAlmostEqual(pos[0], 0.0, 3)
3828 self.assertAlmostEqual(pos[1], 0.0, 3)
3829 self.assertAlmostEqual(pos[2], 0.0, 3)
3830
3831
3832 print("Maximum phi for X and Y: %s" % max_phi)
3833
3834
3836 """Check the frame_order.simulate user function PDB file for the isotropic cone model with a xz-plane tilt."""
3837
3838
3839 cone_theta = 0.5
3840 cone_sigma_max = 0.3
3841 pivot = array([1, 0, -2], float64)
3842 l = 24.0
3843 sim_num = 500
3844
3845
3846 axis_theta = -pi/4.0
3847 axis = create_rotor_axis_spherical(axis_theta, 0.0)
3848 print("Rotor axis: %s" % axis)
3849 R = zeros((3, 3), float64)
3850 axis_angle_to_R([0, 1, 0], axis_theta, R)
3851
3852
3853 self.setup_model(pipe_name='PDB model', model='iso cone', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=axis_theta, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=cone_theta, cone_sigma_max=cone_sigma_max)
3854
3855
3856 if type == 'sim':
3857 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
3858 elif type == 'dist':
3859 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
3860
3861
3862 self.interpreter.structure.delete()
3863
3864
3865 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
3866
3867
3868 selection = cdp.structure.selection()
3869 epsilon = 1e-3
3870 max_phi = 0.0
3871 lateral_slide = 0.07
3872 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
3873
3874 for i in range(sim_num):
3875
3876 new_pos = pos[i] - pivot
3877 r, theta, phi = cartesian_to_spherical(dot(transpose(R), new_pos))
3878
3879
3880 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
3881
3882
3883 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']:
3884 self.assertAlmostEqual(r/100.0, 1.0, 4)
3885 elif res_name == 'C':
3886 self.assertAlmostEqual(r, 0.0, 4)
3887
3888
3889 if res_name == 'X':
3890 if abs(phi) > max_phi:
3891 max_phi = abs(phi)
3892 self.assert_(theta >= pi/2.0 - cone_theta - epsilon)
3893 self.assert_(theta <= pi/2.0 + cone_theta + epsilon)
3894 self.assert_(phi >= -cone_sigma_max - lateral_slide)
3895 self.assert_(phi <= cone_sigma_max + lateral_slide)
3896
3897
3898 elif res_name == 'Y':
3899 self.assert_(theta >= pi/2.0 - cone_theta - epsilon)
3900 self.assert_(theta <= pi/2.0 + cone_theta + epsilon)
3901 self.assert_(phi-pi/2.0 >= -cone_sigma_max - lateral_slide)
3902 self.assert_(phi-pi/2.0 <= cone_sigma_max + lateral_slide)
3903
3904
3905 elif res_name == 'Z':
3906 self.assert_(theta <= cone_theta + epsilon)
3907
3908
3909 elif res_name == 'C':
3910 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3911 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3912 self.assertAlmostEqual(new_pos[2], 0.0, 3)
3913
3914
3915 elif res_name == 'C':
3916 self.assertAlmostEqual(pos[0], 0.0, 3)
3917 self.assertAlmostEqual(pos[1], 0.0, 3)
3918 self.assertAlmostEqual(pos[2], 0.0, 3)
3919
3920
3921 print("Maximum phi for X and Y: %s" % max_phi)
3922
3923
3925 """Check the frame_order.simulate user function PDB file for the free rotor isotropic cone model along the z-axis."""
3926
3927
3928 cone_theta = 0.5
3929 pivot = array([1, 0, -2], float64)
3930 l = 24.0
3931 sim_num = 500
3932
3933
3934 axis_theta = 0.0
3935 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, 0.0))
3936
3937
3938 self.setup_model(pipe_name='PDB model', model='iso cone, free rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=cone_theta)
3939
3940
3941 if type == 'sim':
3942 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
3943 elif type == 'dist':
3944 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
3945
3946
3947 self.interpreter.structure.delete()
3948
3949
3950 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
3951
3952
3953 selection = cdp.structure.selection()
3954 epsilon = 1e-3
3955 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
3956
3957 for i in range(sim_num):
3958
3959 new_pos = pos[i] - pivot
3960 r, theta, phi = cartesian_to_spherical(new_pos)
3961
3962
3963 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
3964
3965
3966 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']:
3967 self.assertAlmostEqual(r/100.0, 1.0, 4)
3968 elif res_name == 'C':
3969 self.assertAlmostEqual(r, 0.0, 4)
3970
3971
3972 if res_name == 'X':
3973 self.assert_(theta >= pi/2.0 - cone_theta - epsilon)
3974 self.assert_(theta <= pi/2.0 + cone_theta + epsilon)
3975
3976
3977 elif res_name == 'Y':
3978 self.assert_(theta >= pi/2.0 - cone_theta - epsilon)
3979 self.assert_(theta <= pi/2.0 + cone_theta + epsilon)
3980
3981
3982 elif res_name == 'Z':
3983 self.assert_(theta <= cone_theta + epsilon)
3984
3985
3986 elif res_name == 'C':
3987 self.assertAlmostEqual(new_pos[0], 0.0, 3)
3988 self.assertAlmostEqual(new_pos[1], 0.0, 3)
3989 self.assertAlmostEqual(new_pos[2], 0.0, 3)
3990
3991
3992 elif res_name == 'C':
3993 self.assertAlmostEqual(pos[0], 0.0, 3)
3994 self.assertAlmostEqual(pos[1], 0.0, 3)
3995 self.assertAlmostEqual(pos[2], 0.0, 3)
3996
3997
3999 """Check the frame_order.simulate user function PDB file for the torsionless isotropic cone model along the z-axis."""
4000
4001
4002 cone_theta = 0.5
4003 pivot = array([1, 0, -2], float64)
4004 l = 24.0
4005 sim_num = 500
4006
4007
4008 axis_theta = 0.0
4009 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, 0.0))
4010
4011
4012 self.setup_model(pipe_name='PDB model', model='iso cone, torsionless', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=cone_theta)
4013
4014
4015 if type == 'sim':
4016 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
4017 elif type == 'dist':
4018 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
4019
4020
4021 self.interpreter.structure.delete()
4022
4023
4024 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
4025
4026
4027 selection = cdp.structure.selection()
4028 epsilon = 1e-3
4029 max_phi = 0.0
4030 lateral_slide = 0.07
4031 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
4032
4033 for i in range(sim_num):
4034
4035 new_pos = pos[i] - pivot
4036 r, theta, phi = cartesian_to_spherical(new_pos)
4037
4038
4039 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
4040
4041
4042 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']:
4043 self.assertAlmostEqual(r/100.0, 1.0, 4)
4044 elif res_name == 'C':
4045 self.assertAlmostEqual(r, 0.0, 4)
4046
4047
4048 if res_name == 'X':
4049 if abs(phi) > max_phi:
4050 max_phi = abs(phi)
4051 self.assert_(theta >= pi/2.0 - cone_theta - epsilon)
4052 self.assert_(theta <= pi/2.0 + cone_theta + epsilon)
4053 self.assert_(phi >= -lateral_slide)
4054 self.assert_(phi <= lateral_slide)
4055
4056
4057 elif res_name == 'Y':
4058 self.assert_(theta >= pi/2.0 - cone_theta - epsilon)
4059 self.assert_(theta <= pi/2.0 + cone_theta + epsilon)
4060 self.assert_(phi-pi/2.0 >= -lateral_slide)
4061 self.assert_(phi-pi/2.0 <= lateral_slide)
4062
4063
4064 elif res_name == 'Z':
4065 self.assert_(theta <= cone_theta + epsilon)
4066
4067
4068 elif res_name == 'C':
4069 self.assertAlmostEqual(new_pos[0], 0.0, 3)
4070 self.assertAlmostEqual(new_pos[1], 0.0, 3)
4071 self.assertAlmostEqual(new_pos[2], 0.0, 3)
4072
4073
4074 elif res_name == 'C':
4075 self.assertAlmostEqual(pos[0], 0.0, 3)
4076 self.assertAlmostEqual(pos[1], 0.0, 3)
4077 self.assertAlmostEqual(pos[2], 0.0, 3)
4078
4079
4080 print("Maximum phi for X and Y: %s" % max_phi)
4081
4082
4084 """Check the frame_order.simulate user function PDB file for the pseudo-ellipse model along the z-axis."""
4085
4086
4087 cone_theta_x = 2.0
4088 cone_theta_y = 0.5
4089 cone_sigma_max = 0.1
4090 pivot = array([1, 0, -2], float64)
4091 l = 50.0
4092 sim_num = 500
4093
4094
4095 eigen_beta = -pi/4.0
4096 R = zeros((3, 3), float64)
4097 euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
4098 print("Motional eigenframe:\n%s" % R)
4099
4100
4101 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=cone_theta_x, cone_theta_y=cone_theta_y, cone_sigma_max=cone_sigma_max)
4102
4103
4104 if type == 'sim':
4105 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
4106 elif type == 'dist':
4107 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
4108
4109
4110 self.interpreter.structure.delete()
4111
4112
4113 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
4114
4115
4116 selection = cdp.structure.selection()
4117 epsilon = 1e-3
4118 max_phi = 0.0
4119 lateral_slide = 0.17
4120 vertical_slide = 0.02
4121 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
4122
4123 for i in range(sim_num):
4124
4125 new_pos = pos[i] - pivot
4126 r, theta, phi = cartesian_to_spherical(dot(transpose(R), new_pos))
4127
4128
4129 print("Checking residue %s %s, atom %s %s, at shifted position [%8.3f, %8.3f, %8.3f], with spherical coordinates [%8.3f, %8.3f, %8.3f]." % (res_num, res_name, atom_num, atom_name, new_pos[0], new_pos[1], new_pos[2], r, theta, phi))
4130
4131
4132 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']:
4133 self.assertAlmostEqual(r/100.0, 1.0, 4)
4134 elif res_name == 'C':
4135 self.assertAlmostEqual(r, 0.0, 4)
4136
4137
4138 if res_name == 'X':
4139 self.assert_(theta >= pi/2.0 - cone_theta_x - epsilon)
4140 self.assert_(theta <= pi/2.0 + cone_theta_x + epsilon)
4141
4142
4143 elif res_name == 'Y':
4144 if abs(phi-pi/2.0) > max_phi:
4145 max_phi = abs(phi-pi/2.0)
4146 self.assert_(theta >= pi/2.0 - cone_theta_y - vertical_slide)
4147 self.assert_(theta <= pi/2.0 + cone_theta_y + vertical_slide)
4148 self.assert_(phi-pi/2.0 >= -cone_sigma_max - lateral_slide)
4149 self.assert_(phi-pi/2.0 <= cone_sigma_max + lateral_slide)
4150
4151
4152 elif res_name == 'Z':
4153 theta_max = cone_theta_x * cone_theta_y / sqrt((cos(phi)*cone_theta_y)**2 + (sin(phi)*cone_theta_x)**2)
4154 self.assert_(theta <= theta_max + epsilon)
4155
4156
4157 elif res_name == 'C':
4158 self.assertAlmostEqual(new_pos[0], 0.0, 3)
4159 self.assertAlmostEqual(new_pos[1], 0.0, 3)
4160 self.assertAlmostEqual(new_pos[2], 0.0, 3)
4161
4162
4163 elif res_name == 'C':
4164 self.assertAlmostEqual(pos[0], 0.0, 3)
4165 self.assertAlmostEqual(pos[1], 0.0, 3)
4166 self.assertAlmostEqual(pos[2], 0.0, 3)
4167
4168
4169 print("Maximum phi-pi/2.0 for Y: %s" % max_phi)
4170
4171
4173 """Check the frame_order.simulate user function PDB file for the pseudo-ellipse model along the z-axis."""
4174
4175
4176 cone_theta_x = 2.0
4177 cone_theta_y = 0.5
4178 cone_sigma_max = 0.1
4179 pivot = array([1, 0, -2], float64)
4180 l = 50.0
4181 sim_num = 500
4182
4183
4184 eigen_beta = 0.0
4185
4186
4187 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=cone_theta_x, cone_theta_y=cone_theta_y, cone_sigma_max=cone_sigma_max)
4188
4189
4190 if type == 'sim':
4191 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
4192 elif type == 'dist':
4193 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
4194
4195
4196 self.interpreter.structure.delete()
4197
4198
4199 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
4200
4201
4202 selection = cdp.structure.selection()
4203 epsilon = 1e-3
4204 max_phi = 0.0
4205 lateral_slide = 0.17
4206 vertical_slide = 0.02
4207 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
4208
4209 for i in range(sim_num):
4210
4211 new_pos = pos[i] - pivot
4212 r, theta, phi = cartesian_to_spherical(new_pos)
4213
4214
4215 print("Checking residue %s %s, atom %s %s, at shifted position [%8.3f, %8.3f, %8.3f], with spherical coordinates [%8.3f, %8.3f, %8.3f]." % (res_num, res_name, atom_num, atom_name, new_pos[0], new_pos[1], new_pos[2], r, theta, phi))
4216
4217
4218 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']:
4219 self.assertAlmostEqual(r/100.0, 1.0, 4)
4220 elif res_name == 'C':
4221 self.assertAlmostEqual(r, 0.0, 4)
4222
4223
4224 if res_name == 'X':
4225 self.assert_(theta >= pi/2.0 - cone_theta_x - epsilon)
4226 self.assert_(theta <= pi/2.0 + cone_theta_x + epsilon)
4227
4228
4229 elif res_name == 'Y':
4230 if abs(phi-pi/2.0) > max_phi:
4231 max_phi = abs(phi-pi/2.0)
4232 self.assert_(theta >= pi/2.0 - cone_theta_y - vertical_slide)
4233 self.assert_(theta <= pi/2.0 + cone_theta_y + vertical_slide)
4234 self.assert_(phi-pi/2.0 >= -cone_sigma_max - lateral_slide)
4235 self.assert_(phi-pi/2.0 <= cone_sigma_max + lateral_slide)
4236
4237
4238 elif res_name == 'Z':
4239 theta_max = cone_theta_x * cone_theta_y / sqrt((cos(phi)*cone_theta_y)**2 + (sin(phi)*cone_theta_x)**2)
4240 self.assert_(theta <= theta_max + epsilon)
4241
4242
4243 elif res_name == 'C':
4244 self.assertAlmostEqual(new_pos[0], 0.0, 3)
4245 self.assertAlmostEqual(new_pos[1], 0.0, 3)
4246 self.assertAlmostEqual(new_pos[2], 0.0, 3)
4247
4248
4249 elif res_name == 'C':
4250 self.assertAlmostEqual(pos[0], 0.0, 3)
4251 self.assertAlmostEqual(pos[1], 0.0, 3)
4252 self.assertAlmostEqual(pos[2], 0.0, 3)
4253
4254
4255 print("Maximum phi-pi/2.0 for Y: %s" % max_phi)
4256
4257
4259 """Check the frame_order.simulate user function PDB file for the free rotor pseudo-ellipse model along the z-axis."""
4260
4261
4262 cone_theta_x = 2.0
4263 cone_theta_y = 0.5
4264 pivot = array([1, 0, -2], float64)
4265 l = 50.0
4266 sim_num = 500
4267
4268
4269 eigen_beta = 0.0
4270
4271
4272 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, free rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=cone_theta_x, cone_theta_y=cone_theta_y)
4273
4274
4275 if type == 'sim':
4276 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
4277 elif type == 'dist':
4278 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
4279
4280
4281 self.interpreter.structure.delete()
4282
4283
4284 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
4285
4286
4287 selection = cdp.structure.selection()
4288 epsilon = 1e-3
4289 max_phi = 0.0
4290 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
4291
4292 for i in range(sim_num):
4293
4294 new_pos = pos[i] - pivot
4295 r, theta, phi = cartesian_to_spherical(new_pos)
4296
4297
4298 print("Checking residue %s %s, atom %s %s, at shifted position [%8.3f, %8.3f, %8.3f], with spherical coordinates [%8.3f, %8.3f, %8.3f]." % (res_num, res_name, atom_num, atom_name, new_pos[0], new_pos[1], new_pos[2], r, theta, phi))
4299
4300
4301 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']:
4302 self.assertAlmostEqual(r/100.0, 1.0, 4)
4303 elif res_name == 'C':
4304 self.assertAlmostEqual(r, 0.0, 4)
4305
4306
4307 if res_name in ['X', 'Y']:
4308 self.assert_(theta >= pi/2.0 - cone_theta_x - epsilon)
4309 self.assert_(theta <= pi/2.0 + cone_theta_x + epsilon)
4310
4311
4312 elif res_name == 'Z':
4313 theta_max = cone_theta_x * cone_theta_y / sqrt((cos(phi)*cone_theta_y)**2 + (sin(phi)*cone_theta_x)**2)
4314 self.assert_(theta <= theta_max + epsilon)
4315
4316
4317 elif res_name == 'C':
4318 self.assertAlmostEqual(new_pos[0], 0.0, 3)
4319 self.assertAlmostEqual(new_pos[1], 0.0, 3)
4320 self.assertAlmostEqual(new_pos[2], 0.0, 3)
4321
4322
4323 elif res_name == 'C':
4324 self.assertAlmostEqual(pos[0], 0.0, 3)
4325 self.assertAlmostEqual(pos[1], 0.0, 3)
4326 self.assertAlmostEqual(pos[2], 0.0, 3)
4327
4328
4329 print("Maximum phi-pi/2.0 for Y: %s" % max_phi)
4330
4331
4333 """Check the frame_order.simulate user function PDB file for the torsionless pseudo-ellipse model along the z-axis."""
4334
4335
4336 cone_theta_x = 2.0
4337 cone_theta_y = 0.5
4338 pivot = array([1, 0, -2], float64)
4339 l = 50.0
4340 sim_num = 500
4341
4342
4343 eigen_beta = 0.0
4344
4345
4346 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, torsionless', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=cone_theta_x, cone_theta_y=cone_theta_y)
4347
4348
4349 if type == 'sim':
4350 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
4351 elif type == 'dist':
4352 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
4353
4354
4355 self.interpreter.structure.delete()
4356
4357
4358 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
4359
4360
4361 selection = cdp.structure.selection()
4362 epsilon = 1e-3
4363 max_phi = 0.0
4364 lateral_slide = 0.23
4365 vertical_slide = 0.02
4366 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
4367
4368 for i in range(sim_num):
4369
4370 new_pos = pos[i] - pivot
4371 r, theta, phi = cartesian_to_spherical(new_pos)
4372
4373
4374 print("Checking residue %s %s, atom %s %s, at shifted position [%8.3f, %8.3f, %8.3f], with spherical coordinates [%8.3f, %8.3f, %8.3f]." % (res_num, res_name, atom_num, atom_name, new_pos[0], new_pos[1], new_pos[2], r, theta, phi))
4375
4376
4377 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']:
4378 self.assertAlmostEqual(r/100.0, 1.0, 4)
4379 elif res_name == 'C':
4380 self.assertAlmostEqual(r, 0.0, 4)
4381
4382
4383 if res_name == 'X':
4384 self.assert_(theta >= pi/2.0 - cone_theta_x - epsilon)
4385 self.assert_(theta <= pi/2.0 + cone_theta_x + epsilon)
4386
4387
4388 elif res_name == 'Y':
4389 if abs(phi-pi/2.0) > max_phi:
4390 max_phi = abs(phi-pi/2.0)
4391 self.assert_(theta >= pi/2.0 - cone_theta_y - vertical_slide)
4392 self.assert_(theta <= pi/2.0 + cone_theta_y + vertical_slide)
4393 self.assert_(phi-pi/2.0 >= -lateral_slide)
4394 self.assert_(phi-pi/2.0 <= lateral_slide)
4395
4396
4397 elif res_name == 'Z':
4398 theta_max = cone_theta_x * cone_theta_y / sqrt((cos(phi)*cone_theta_y)**2 + (sin(phi)*cone_theta_x)**2)
4399 self.assert_(theta <= theta_max + epsilon)
4400
4401
4402 elif res_name == 'C':
4403 self.assertAlmostEqual(new_pos[0], 0.0, 3)
4404 self.assertAlmostEqual(new_pos[1], 0.0, 3)
4405 self.assertAlmostEqual(new_pos[2], 0.0, 3)
4406
4407
4408 elif res_name == 'C':
4409 self.assertAlmostEqual(pos[0], 0.0, 3)
4410 self.assertAlmostEqual(pos[1], 0.0, 3)
4411 self.assertAlmostEqual(pos[2], 0.0, 3)
4412
4413
4414 print("Maximum phi-pi/2.0 for Y: %s" % max_phi)
4415
4416
4418 """Check the frame_order.simulate user function PDB file for the rotor model along the z-axis."""
4419
4420
4421 cone_sigma_max = 0.3
4422 pivot = array([1, 0, 0], float64)
4423 l = 30.0
4424 sim_num = 500
4425
4426
4427 axis_alpha = pi / 2.0
4428 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64))
4429 print("\nRotor axis: %s" % axis)
4430 print("Rotor apex (100*axis + [1, 0, 0]):\n %s" % (l*axis + pivot))
4431
4432
4433 self.setup_model(pipe_name='PDB model', model='rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha, cone_sigma_max=cone_sigma_max)
4434
4435
4436 if type == 'sim':
4437 self.interpreter.frame_order.simulate(file='simulation.pdb', dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
4438 elif type == 'dist':
4439 self.interpreter.frame_order.distribute(file='simulation.pdb', dir=ds.tmpdir, total=sim_num)
4440
4441
4442 self.interpreter.structure.delete()
4443
4444
4445 self.interpreter.structure.read_pdb(file='simulation.pdb', dir=ds.tmpdir)
4446
4447
4448 selection = cdp.structure.selection()
4449 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
4450
4451 for i in range(sim_num):
4452
4453 new_pos = pos[i] - pivot
4454 r, theta, phi = cartesian_to_spherical(new_pos)
4455
4456
4457 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
4458
4459
4460 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']:
4461 self.assertAlmostEqual(r/100.0, 1.0, 4)
4462 elif res_name == 'C':
4463 self.assertAlmostEqual(r, 0.0, 4)
4464
4465
4466 if res_name == 'X':
4467 self.assertAlmostEqual(theta, pi/2.0, 3)
4468 self.assert_(phi >= -cone_sigma_max)
4469 self.assert_(phi <= cone_sigma_max)
4470 self.assertAlmostEqual(new_pos[2], 0.0, 3)
4471
4472
4473 elif res_name == 'Y':
4474 self.assertAlmostEqual(theta, pi/2.0, 3)
4475 self.assert_(phi-pi/2.0 >= -cone_sigma_max)
4476 self.assert_(phi-pi/2.0 <= cone_sigma_max)
4477 self.assertAlmostEqual(new_pos[2], 0.0, 3)
4478
4479
4480 elif res_name == 'Z':
4481 self.assertAlmostEqual(new_pos[0], 0.0, 3)
4482 self.assertAlmostEqual(new_pos[1], 0.0, 3)
4483 self.assertAlmostEqual(new_pos[2], 100.0, 3)
4484
4485
4486 elif res_name == 'C':
4487 self.assertAlmostEqual(new_pos[0], 0.0, 3)
4488 self.assertAlmostEqual(new_pos[1], 0.0, 3)
4489 self.assertAlmostEqual(new_pos[2], 0.0, 3)
4490
4491
4492 elif res_name == 'C':
4493 self.assertAlmostEqual(pos[0], 0.0, 3)
4494 self.assertAlmostEqual(pos[1], 0.0, 3)
4495 self.assertAlmostEqual(pos[2], 0.0, 3)
4496
4497
4506
4507
4519
4520
4522 """Check the operation of the frame_order.sobol_setup user function with the model and parameters set up."""
4523
4524
4525 self.interpreter.pipe.create('test', 'frame order')
4526
4527
4528 self.interpreter.frame_order.select_model('iso cone')
4529
4530
4531 self.interpreter.value.set(param='ave_pos_x', val=0.0)
4532 self.interpreter.value.set(param='ave_pos_y', val=0.0)
4533 self.interpreter.value.set(param='ave_pos_z', val=0.0)
4534 self.interpreter.value.set(param='ave_pos_alpha', val=0.0)
4535 self.interpreter.value.set(param='ave_pos_beta', val=0.0)
4536 self.interpreter.value.set(param='ave_pos_gamma', val=0.0)
4537 self.interpreter.value.set(param='axis_theta', val=0.5)
4538 self.interpreter.value.set(param='axis_phi', val=0.1)
4539 self.interpreter.value.set(param='cone_theta', val=0.1)
4540 self.interpreter.value.set(param='cone_sigma_max', val=0.1)
4541
4542
4543 self.interpreter.frame_order.sobol_setup(200)
4544