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 pi
24 import platform
25 import numpy
26 from os import sep
27 from re import search
28 from shutil import copytree
29 import sys
30 from tempfile import mkdtemp
31
32
33 from data import Relax_data_store; ds = Relax_data_store()
34 import dep_check
35 from generic_fns import pipes
36 from generic_fns.interatomic import interatomic_loop
37 from generic_fns.mol_res_spin import spin_loop
38 from physical_constants import N15_CSA, NH_BOND_LENGTH
39 from relax_io import DummyFileObject, open_read_file
40 from status import Status; status = Status()
41 from test_suite.system_tests.base_classes import SystemTestCase
42
43
44
45 SYSTEM = platform.system()
46 RELEASE = platform.release()
47 VERSION = platform.version()
48 WIN32_VER = platform.win32_ver()
49 DIST = platform.dist()
50 ARCH = platform.architecture()
51 MACH = platform.machine()
52 PROC = platform.processor()
53 PY_VER = platform.python_version()
54 NUMPY_VER = numpy.__version__
55 LIBC_VER = platform.libc_ver()
56
57
58 if SYSTEM == 'Windows' or SYSTEM == 'Microsoft':
59
60 SYSTEM = 'Windows'
61
62
63
64 -class Mf(SystemTestCase):
65 """TestCase class for the functional tests of model-free analysis."""
66
68 """Set up for all the functional tests."""
69
70
71 self.interpreter.pipe.create('mf', 'mf')
72
73
75 """Common code for the test_read_results_1_3*() tests."""
76
77
78 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP'
79
80
81 self.interpreter.pipe.create('1.2', 'mf')
82 self.interpreter.results.read(file='final_results_trunc_1.2', dir=path)
83
84
85 pipe_12 = pipes.get_pipe('1.2')
86 pipe_13 = pipes.get_pipe('1.3')
87
88
89 print("Comparison of the objects of the base data pipe:")
90 self.object_comparison(obj1=pipe_12, obj2=pipe_13, skip=['mol', 'interatomic', 'diff_tensor'])
91
92
93 print("Comparison of the objects of the diffusion tensor:")
94 self.object_comparison(obj1=pipe_12.diff_tensor, obj2=pipe_13.diff_tensor)
95
96
97 self.assertEqual(len(pipe_12.mol), len(pipe_13.mol))
98
99
100 for i in range(len(pipe_12.mol)):
101
102 print("Comparison of the objects of the molecule:")
103 self.object_comparison(obj1=pipe_12.mol[i], obj2=pipe_13.mol[i], skip=['res'])
104
105
106 self.assertEqual(len(pipe_12.mol[i].res), len(pipe_13.mol[i].res))
107
108
109 for j in range(len(pipe_12.mol[i].res)):
110
111 if j > 10:
112 break
113
114
115 print("Comparison of the objects of the residue:")
116 self.object_comparison(obj1=pipe_12.mol[i].res[j], obj2=pipe_13.mol[i].res[j], skip=['spin'])
117
118
119 self.assertEqual(len(pipe_12.mol[i].res[j].spin), len(pipe_13.mol[i].res[j].spin))
120
121
122 for k in range(len(pipe_12.mol[i].res[j].spin)):
123
124 print("Comparison of the objects of the spin:")
125 self.object_comparison(obj1=pipe_12.mol[i].res[j].spin[k], obj2=pipe_13.mol[i].res[j].spin[k])
126
127
128 for i in range(len(pipe_12.interatomic)):
129
130 print("Comparison of the objects of the molecule:")
131 self.object_comparison(obj1=pipe_12.interatomic[i], obj2=pipe_13.interatomic[i])
132
133
135 """Method for returning a string to help debug the minimisation.
136
137 @param spin: The SpinContainer of the optimised spin.
138 @type spin: SpinContainer instance
139 @return: The debugging string.
140 @rtype: str
141 """
142
143
144 string = 'Optimisation failure.\n\n'
145
146
147 string = string + "%-18s%-25s\n" % ("System: ", SYSTEM)
148 string = string + "%-18s%-25s\n" % ("Release: ", RELEASE)
149 string = string + "%-18s%-25s\n" % ("Version: ", VERSION)
150 string = string + "%-18s%-25s\n" % ("Win32 version: ", (WIN32_VER[0] + " " + WIN32_VER[1] + " " + WIN32_VER[2] + " " + WIN32_VER[3]))
151 string = string + "%-18s%-25s\n" % ("Distribution: ", (DIST[0] + " " + DIST[1] + " " + DIST[2]))
152 string = string + "%-18s%-25s\n" % ("Architecture: ", (ARCH[0] + " " + ARCH[1]))
153 string = string + "%-18s%-25s\n" % ("Machine: ", MACH)
154 string = string + "%-18s%-25s\n" % ("Processor: ", PROC)
155 string = string + "%-18s%-25s\n" % ("Python version: ", PY_VER)
156 string = string + "%-18s%-25s\n" % ("Numpy version: ", NUMPY_VER)
157 string = string + "%-18s%-25s\n" % ("Libc version: ", (LIBC_VER[0] + " " + LIBC_VER[1]))
158
159
160
161 string = string + '\n'
162 if spin.local_tm != None:
163 string = string + "%-15s %30.16g\n" % ('local_tm (ns):', spin.local_tm * 1e9)
164 if spin.s2 != None:
165 string = string + "%-15s %30.16g\n" % ('s2:', spin.s2)
166 if spin.s2f != None:
167 string = string + "%-15s %30.16g\n" % ('s2f:', spin.s2f)
168 if spin.s2s != None:
169 string = string + "%-15s %30.16g\n" % ('s2s:', spin.s2s)
170 if spin.te != None:
171 string = string + "%-15s %30.13g\n" % ('te (ps):', spin.te * 1e12)
172 if spin.tf != None:
173 string = string + "%-15s %30.13g\n" % ('tf (ps):', spin.tf * 1e12)
174 if spin.ts != None:
175 string = string + "%-15s %30.13g\n" % ('ts (ps):', spin.ts * 1e12)
176 if spin.rex != None:
177 string = string + "%-15s %30.17g\n" % ('rex:', spin.rex * (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2)
178 string = string + "%-15s %30.17g\n" % ('chi2:', spin.chi2)
179 string = string + "%-15s %30i\n" % ('iter:', spin.iter)
180 string = string + "%-15s %30i\n" % ('f_count:', spin.f_count)
181 string = string + "%-15s %30i\n" % ('g_count:', spin.g_count)
182 string = string + "%-15s %30i\n" % ('h_count:', spin.h_count)
183 string = string + "%-15s %30s\n" % ('warning:', spin.warning)
184
185
186 return string
187
188
199
200
202 """Check if the contents of 2 objects are the same."""
203
204
205 self.assertEqual(dir(obj1), dir(obj2))
206
207
208 for name in dir(obj1):
209
210 if skip and name in skip:
211 continue
212
213
214 if search('^_', name):
215 continue
216
217
218 if name in list(obj1.__class__.__dict__.keys()):
219 continue
220
221
222 print("\t" + name)
223
224
225 sub_obj1 = getattr(obj1, name)
226 sub_obj2 = getattr(obj2, name)
227
228
229 self.assertEqual(type(sub_obj1), type(sub_obj2))
230
231
232 if isinstance(sub_obj1, dict):
233 self.assertEqual(sub_obj1, sub_obj2)
234 else:
235 self.assertEqual(str(sub_obj1), str(sub_obj2))
236
237
239 """Test catching bug #14872, the unicode string selection failure as submitted by Olivier Serve."""
240
241
242 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_14872_unicode_selection.py')
243
244
246 """Test catching bug #14941, the local tm global model selection problem as submitted by Mikaela Stewart (mikaela dot stewart att gmail dot com)."""
247
248
249 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_14941_local_tm_global_selection.py')
250
251
253 """Test catching bug #15050, 'PipeContainer' object has no attribute 'diff_tensor' error as submitted by Tiago Pais (https://web.archive.org/web/https://gna.org/users/tpais)."""
254
255
256 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_15050.py')
257
258
260 """Test catching bugs #12582, #12591 and #12607 as submitted by Chris Brosey."""
261
262
263 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bugs_12582_12591_12607.py')
264
265
266 self.assertNotEqual(cdp.mol[0].res[1].spin[0].s2, 1.0)
267
268
270 """Test catching bug #18790, the negative relaxation data RelaxError reported by Vitaly Vostrikov."""
271
272
273 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_18790_negative_error.py')
274
275
277 """Bug #20213 catch, the model selection failure due to the presence of Asp and Gln sidechain N spins."""
278
279
280 ds.tmpdir = mkdtemp()
281
282
283 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_20213_asn_sidechain.py')
284
285
287 """Creating model m4 with parameters {S2, te, Rex} using model_free.create_model()."""
288
289
290 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'create_m4.py')
291
292
293 self.assertEqual(cdp.mol[0].res[1].spin[0].model, 'm4')
294 self.assertEqual(cdp.mol[0].res[1].spin[0].params, ['s2', 'te', 'rex'])
295
296
298 """Check the execution of auto_analyses.dauvergne_protocol."""
299
300
301 ds.tmpdir = mkdtemp()
302
303
304 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'dauvergne_protocol.py')
305
306
307 self.assertEqual(cdp.diff_tensor.type, 'sphere')
308 self.assertAlmostEqual(cdp.diff_tensor.tm, 1e-8)
309 self.assertEqual(cdp.diff_tensor.fixed, True)
310
311
312 self.assertAlmostEqual(cdp.chi2, 4e-19)
313
314
315 mol_names = ["sphere_mol1"] * 20
316 res_names = ["GLY"] * 20
317 res_nums = []
318 for i in range(1, 10):
319 res_nums.append(i)
320 res_nums.append(i)
321 res_nums.append(i)
322 res_nums.append(i)
323 spin_names = ["N", "H"] * 9 + ["NE1", "HE1"]
324 spin_nums = list(range(1, 21))
325 isotopes = ["15N", "1H"] * 10
326 csa = [-172e-6, None] * 10
327 select = [True, False] * 10
328 fixed = [False, False] * 10
329 s2 = [0.8, None] * 10
330 te = [20e-12, None] * 10
331
332
333 i = 0
334 for spin, mol_name, res_num, res_name in spin_loop(full_info=True):
335
336 self.assertEqual(mol_name, mol_names[i])
337 self.assertEqual(res_name, res_names[i])
338 self.assertEqual(res_num, res_nums[i])
339 self.assertEqual(spin.name, spin_names[i])
340 self.assertEqual(spin.num, spin_nums[i])
341
342
343 self.assertEqual(spin.select, select[i])
344 self.assertEqual(spin.fixed, fixed[i])
345 self.assertEqual(spin.isotope, isotopes[i])
346 if csa[i] == None:
347 self.assertEqual(spin.csa, None)
348 else:
349 self.assertAlmostEqual(spin.csa, csa[i])
350
351
352 self.assertEqual(spin.model, 'm2')
353 self.assertEqual(spin.equation, 'mf_orig')
354 self.assertEqual(len(spin.params), 2)
355 self.assertEqual(spin.params[0], 's2')
356 self.assertEqual(spin.params[1], 'te')
357 if s2[i] == None:
358 self.assertEqual(spin.s2, None)
359 else:
360 self.assertAlmostEqual(spin.s2, 0.8)
361 self.assertEqual(spin.s2f, None)
362 self.assertEqual(spin.s2s, None)
363 self.assertEqual(spin.local_tm, None)
364 if te[i] == None:
365 self.assertEqual(spin.te, None)
366 else:
367 self.assertAlmostEqual(spin.te, 20e-12)
368 self.assertEqual(spin.tf, None)
369 self.assertEqual(spin.ts, None)
370 self.assertEqual(spin.rex, None)
371
372
373 self.assertEqual(spin.chi2, None)
374 self.assertEqual(spin.iter, None)
375 self.assertEqual(spin.f_count, None)
376 self.assertEqual(spin.g_count, None)
377 self.assertEqual(spin.h_count, None)
378 self.assertEqual(spin.warning, None)
379
380
381 i += 1
382
383
384 i = 0
385 for interatom in interatomic_loop():
386 self.assertAlmostEqual(interatom.r, 1.02 * 1e-10)
387
388
390 """Back-calculate relaxation data."""
391
392
393 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'generate_ri.py')
394
395
397 """Test the creation of a LaTeX table of model-free results, mimicking the latex_mf_table.py sample script."""
398
399
400 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'latex_mf_table.py')
401
402
404 """Test the optimisation of the test set {tm=10, S2=0.8, te=40}."""
405
406
407 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_local_tm_10_S2_0_8_te_40.py')
408
409
410 frq = ['400', '500', '600', '700', '800', '900', '1000']
411
412
413 for i in range(len(frq)):
414 self.interpreter.relax_data.read('NOE_%s'%frq[i], 'NOE', float(frq[i])*1e6, 'noe.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
415 self.interpreter.relax_data.read('R1_%s'%frq[i], 'R1', float(frq[i])*1e6, 'r1.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
416 self.interpreter.relax_data.read('R2_%s'%frq[i], 'R2', float(frq[i])*1e6, 'r2.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
417
418
419 self.interpreter.value.set([15.0e-9, 1.0, 0.0], ['local_tm', 's2', 'te'])
420
421
422 self.interpreter.minimise('newton', 'gmw', 'back')
423
424
425 spin = cdp.mol[0].res[0].spin[0]
426
427
428 self.value_test(spin, local_tm=10, s2=0.8, te=40, chi2=0.0)
429
430
432 """Test the optimisation of the test set {tm=10, S2=0.8, te=40}."""
433
434
435 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_local_tm_10_S2_0_8_te_40.py')
436
437
438 frq = ['400', '500', '600', '700', '800', '900', '1000']
439
440
441 for i in range(len(frq)):
442 self.interpreter.relax_data.read('NOE_%s'%frq[i], 'NOE', float(frq[i])*1e6, 'noe.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
443 self.interpreter.relax_data.read('R1_%s'%frq[i], 'R1', float(frq[i])*1e6, 'r1.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
444 self.interpreter.relax_data.read('R2_%s'%frq[i], 'R2', float(frq[i])*1e6, 'r2.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
445
446
447 self.interpreter.value.set([15.0e-9, 1.0, 0.0], ['local_tm', 's2', 'te'])
448
449
450 self.interpreter.minimise('newton', 'gmw', 'back')
451
452
453 spin = cdp.mol[0].res[0].spin[0]
454
455
456 self.value_test(spin, local_tm=10, s2=0.8, te=40, chi2=0.0)
457
458
460 """Test the optimisation of the test set {tm=10, S2=0.8, te=40}."""
461
462
463 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_local_tm_10_S2_0_8_te_40.py')
464
465
466 self.interpreter.relax_data.read('R2_700', 'R2', 700*1e6, 'r2.700.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
467 self.interpreter.relax_data.read('NOE_500', 'NOE', 500*1e6, 'noe.500.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
468 self.interpreter.relax_data.read('R1_500', 'R1', 500*1e6, 'r1.500.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
469 self.interpreter.relax_data.read('R1_900', 'R1', 900*1e6, 'r1.900.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
470 self.interpreter.relax_data.read('NOE_900', 'NOE', 900*1e6, 'noe.900.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
471 self.interpreter.relax_data.read('R2_900', 'R2', 900*1e6, 'r2.900.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
472 self.interpreter.relax_data.read('R1_700', 'R1', 700*1e6, 'r1.700.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
473 self.interpreter.relax_data.read('NOE_700', 'NOE', 700*1e6, 'noe.700.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
474 self.interpreter.relax_data.read('R2_500', 'R2', 500*1e6, 'r2.500.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4, spin_id='@N')
475
476
477 self.interpreter.value.set([15.0e-9, 1.0, 0.0], ['local_tm', 's2', 'te'])
478
479
480 self.interpreter.minimise('newton', 'gmw', 'back')
481
482
483 spin = cdp.mol[0].res[0].spin[0]
484
485
486 self.value_test(spin, local_tm=10, s2=0.8, te=40, chi2=0.0)
487
488
490 """Test the optimisation of the m0 model-free model against the tm0 parameter grid."""
491
492
493 cdp._model = 'm0'
494 cdp._value_test = self.value_test
495
496
497 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
498
499
501 """Test the optimisation of the m1 model-free model against the tm0 parameter grid."""
502
503
504 cdp._model = 'm1'
505 cdp._value_test = self.value_test
506
507
508 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
509
510
512 """Test the optimisation of the m2 model-free model against the tm0 parameter grid."""
513
514
515 cdp._model = 'm2'
516 cdp._value_test = self.value_test
517
518
519 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
520
521
523 """Test the optimisation of the m3 model-free model against the tm0 parameter grid."""
524
525
526 cdp._model = 'm3'
527 cdp._value_test = self.value_test
528
529
530 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
531
532
534 """Test the optimisation of the m4 model-free model against the tm0 parameter grid."""
535
536
537 cdp._model = 'm4'
538 cdp._value_test = self.value_test
539
540
541 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
542
543
545 """Test the optimisation of the m1 model-free model against the tm1 parameter grid."""
546
547
548 cdp._model = 'm1'
549 cdp._value_test = self.value_test
550
551
552 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm1_grid.py')
553
554
556 """Test the optimisation of the m2 model-free model against the tm2 parameter grid."""
557
558
559 cdp._model = 'm2'
560 cdp._value_test = self.value_test
561
562
563 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py')
564
565
567 """Test the optimisation of the m4 model-free model against the tm2 parameter grid."""
568
569
570 cdp._model = 'm4'
571 cdp._value_test = self.value_test
572
573
574 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py')
575
576
578 """Test the optimisation of the m3 model-free model against the tm3 parameter grid."""
579
580
581 cdp._model = 'm3'
582 cdp._value_test = self.value_test
583
584
585 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm3_grid.py')
586
587
589 """Test the optimisation of the m4 model-free model against the tm4 parameter grid."""
590
591
592 cdp._model = 'm4'
593 cdp._value_test = self.value_test
594
595
596 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm4_grid.py')
597
598
600 """Test the optimisation of the m5 model-free model against the tm5 parameter grid."""
601
602
603 cdp._model = 'm5'
604 cdp._value_test = self.value_test
605
606
607 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm5_grid.py')
608
609
611 """Test the optimisation of the m6 model-free model against the tm6 parameter grid."""
612
613
614 cdp._model = 'm6'
615 cdp._value_test = self.value_test
616
617
618 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm6_grid.py')
619
620
622 """Test the optimisation of the m7 model-free model against the tm7 parameter grid."""
623
624
625 cdp._model = 'm7'
626 cdp._value_test = self.value_test
627
628
629 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm7_grid.py')
630
631
633 """Test the optimisation of the m8 model-free model against the tm8 parameter grid."""
634
635
636 cdp._model = 'm8'
637 cdp._value_test = self.value_test
638
639
640 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm8_grid.py')
641
642
644 """Test the optimisation of the m9 model-free model against the tm9 parameter grid."""
645
646
647 cdp._model = 'm9'
648 cdp._value_test = self.value_test
649
650
651 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm9_grid.py')
652
653
655 """Try a very minimal model-free analysis on the OMP relaxation data."""
656
657
658 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'omp_model_free.py')
659
660
661 dp = pipes.get_pipe('final')
662
663
664 self.assertEqual(dp.mol[0].res[0].spin[0].select_sim, [True, False, True])
665 self.assertEqual(dp.mol[0].res[1].spin[0].select_sim, [True, True, False])
666 self.assertEqual(dp.mol[0].res[2].spin[0].select_sim, [True, True, True])
667 self.assert_(not hasattr(dp.mol[0].res[3].spin[0], 'select_sim'))
668
669
671 """Mapping the {S2, te, Rex} chi2 space through the OpenDX user function dx.map()."""
672
673
674 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opendx_s2_te_rex.py')
675
676
678 """Mapping the {theta, phi, Da} chi2 space through the OpenDX user function dx.map()."""
679
680
681 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
682
683
684 self.interpreter.structure.read_pdb(file='pdb', dir=path, read_model=1)
685
686
687 self.interpreter.structure.load_spins('@N')
688
689
690 self.interpreter.relax_data.read('R1_600', 'R1', 600.0*1e6, 'r1.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
691 self.interpreter.relax_data.read('R2_600', 'R2', 600.0*1e6, 'r2.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
692 self.interpreter.relax_data.read('NOE_600', 'NOE', 600.0*1e6, 'noe.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
693 self.interpreter.relax_data.read('R1_500', 'R1', 500.0*1e6, 'r1.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
694 self.interpreter.relax_data.read('R2_500', 'R2', 500.0*1e6, 'r2.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
695 self.interpreter.relax_data.read('NOE_500', 'NOE', 500.0*1e6, 'noe.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
696
697
698 self.interpreter.diffusion_tensor.init((1.601 * 1e7, 1.34, 72.4, 90-77.9), param_types=4)
699
700
701 self.interpreter.structure.load_spins('@H')
702 self.interpreter.dipole_pair.define(spin_id1='@N', spin_id2='@H', direct_bond=True)
703 self.interpreter.dipole_pair.set_dist(spin_id1='@N', spin_id2='@H', ave_dist=1.02 * 1e-10)
704 self.interpreter.dipole_pair.unit_vectors()
705
706
707 self.interpreter.value.set(N15_CSA, 'csa')
708 self.interpreter.value.set([0.8, 50 * 1e-12, 0.0], ['s2', 'te', 'rex'])
709
710
711 self.interpreter.spin.isotope('15N', spin_id='@N')
712 self.interpreter.spin.isotope('1H', spin_id='@H')
713
714
715 self.interpreter.model_free.select_model(model='m4')
716
717
718 self.interpreter.dx.map(params=['theta', 'phi', 'Da'], spin_id='#pdb_mol1:2@N', inc=2, lower=[0, 0, -0.5*1e7], upper=[pi, 2.0*pi, 1.0*1e7], file_prefix='devnull')
719
720
722 """Mapping the {local_tm, S2, te} chi2 space through the OpenDX user function dx.map()."""
723
724
725 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
726
727
728 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2)
729
730
731 self.interpreter.relax_data.read('R1_600', 'R1', 600.0*1e6, 'r1.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
732 self.interpreter.relax_data.read('R2_600', 'R2', 600.0*1e6, 'r2.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
733 self.interpreter.relax_data.read('NOE_600', 'NOE', 600.0*1e6, 'noe.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
734 self.interpreter.relax_data.read('R1_500', 'R1', 500.0*1e6, 'r1.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
735 self.interpreter.relax_data.read('R2_500', 'R2', 500.0*1e6, 'r2.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
736 self.interpreter.relax_data.read('NOE_500', 'NOE', 500.0*1e6, 'noe.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
737
738
739 self.interpreter.spin.name('N')
740 self.interpreter.spin.element('N')
741
742
743 self.interpreter.sequence.attach_protons()
744
745
746 self.interpreter.dipole_pair.define(spin_id1='@N', spin_id2='@H', direct_bond=True)
747 self.interpreter.dipole_pair.set_dist(spin_id1='@N', spin_id2='@H', ave_dist=1.02 * 1e-10)
748
749
750 self.interpreter.value.set(N15_CSA, 'csa')
751
752
753 self.interpreter.spin.isotope('15N', spin_id='@N')
754 self.interpreter.spin.isotope('1H', spin_id='@H')
755
756
757 self.interpreter.model_free.select_model(model='tm2')
758
759
760 self.interpreter.dx.map(params=['local_tm', 's2', 'te'], spin_id=':2@N', inc=2, lower=[5e-9, 0.0, 0.0], file_prefix='devnull')
761
762
764 """Constrained BFGS opt, backtracking line search {S2=0.970, te=2048, Rex=0.149}
765
766 The optimisation options are:
767 - BFGS optimisation.
768 - Backtracking line search.
769 - Constrained.
770
771 The true data set is:
772 - S2 = 0.970
773 - te = 2048 ps
774 - Rex = 0.149 s^-1
775 """
776
777
778 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py')
779
780
781 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
782
783
784 self.interpreter.minimise('bfgs', 'back')
785
786
787 spin = cdp.mol[0].res[1].spin[0]
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983 select = True
984 s2 = 0.9699999999999995
985 te = 2048.000000000022283
986 rex = 0.14900000000000566 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
987 chi2 = 3.1024517431117421e-27
988 iter = [154, 156, 157, 158, 162, 175, 203]
989 f_count = [598, 695, 701, 722, 735, 744, 758, 955]
990 g_count = [161, 162, 163, 164, 165, 169, 182, 209]
991 h_count = 0
992 warning = None
993
994
995 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
996 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
997
998
1000 """Constrained BFGS opt, More and Thuente line search {S2=0.970, te=2048, Rex=0.149}
1001
1002 The optimisation options are:
1003 - BFGS optimisation.
1004 - More and Thuente line search.
1005 - Constrained.
1006
1007 The true data set is:
1008 - S2 = 0.970
1009 - te = 2048 ps
1010 - Rex = 0.149 s^-1
1011 """
1012
1013
1014 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py')
1015
1016
1017 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1018
1019
1020 self.interpreter.minimise('bfgs', 'mt')
1021
1022
1023 spin = cdp.mol[0].res[1].spin[0]
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168 select = True
1169 s2 = 0.9700000000000580
1170 te = 2048.000000011044449
1171 rex = 0.148999999998904 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1172 chi2 = 4.3978813282102374e-23
1173 iter = 120
1174 f_count = [377, 381, 384, 386, 388]
1175 g_count = [377, 381, 384, 386, 388]
1176 h_count = 0
1177 warning = None
1178
1179
1180 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1181 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1182
1183
1185 """Constrained coordinate descent opt, backtracking line search {S2=0.970, te=2048, Rex=0.149}
1186
1187 The optimisation options are:
1188 - Coordinate descent optimisation.
1189 - Backtracking line search.
1190 - Constrained.
1191
1192 The true data set is:
1193 - S2 = 0.970
1194 - te = 2048 ps
1195 - Rex = 0.149 s^-1
1196 """
1197
1198
1199 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py')
1200
1201
1202 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1203
1204
1205 self.interpreter.minimise('cd', 'back', max_iter=50)
1206
1207
1208 spin = cdp.mol[0].res[1].spin[0]
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237 select = True
1238 s2 = 0.9097900390625
1239 te = 25.00000000000000
1240 rex = 1.24017333984375 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1241 chi2 = 53.476155463267176
1242 iter = 50
1243 f_count = 131
1244 g_count = 51
1245 h_count = 0
1246 warning = 'Maximum number of iterations reached'
1247
1248
1249 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1250 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1251
1252
1254 """Constrained coordinate descent opt, More and Thuente line search {S2=0.970, te=2048, Rex=0.149}
1255
1256 The optimisation options are:
1257 - Coordinate descent optimisation.
1258 - More and Thuente line search.
1259 - Constrained.
1260
1261 The true data set is:
1262 - S2 = 0.970
1263 - te = 2048 ps
1264 - Rex = 0.149 s^-1
1265 """
1266
1267
1268 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py')
1269
1270
1271 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1272
1273
1274 self.interpreter.minimise('cd', 'mt')
1275
1276
1277 spin = cdp.mol[0].res[1].spin[0]
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378 select = True
1379 s2 = 0.9700000000219674
1380 te = 2048.000001534187049
1381 rex = 0.14899999946977982 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1382 chi2 = 2.3477234248531005e-18
1383 iter = [198, 200]
1384 f_count = [738, 757, 874]
1385 g_count = [738, 757, 874]
1386 h_count = 0
1387 warning = None
1388
1389
1390 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1391 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1392
1393
1395 """Constrained Newton opt, GMW Hessian mod, backtracking line search {S2=0.970, te=2048, Rex=0.149}
1396
1397 The optimisation options are:
1398 - Newton optimisation.
1399 - GMW Hessian modification.
1400 - Backtracking line search.
1401 - Constrained.
1402
1403 The true data set is:
1404 - S2 = 0.970
1405 - te = 2048 ps
1406 - Rex = 0.149 s^-1
1407 """
1408
1409
1410 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py')
1411
1412
1413 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1414
1415
1416 self.interpreter.minimise('newton', 'gmw', 'back')
1417
1418
1419 spin = cdp.mol[0].res[1].spin[0]
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520 select = True
1521 s2 = 0.9699999999999994
1522 te = 2048.000000000045020
1523 rex = 0.14900000000001817 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1524 chi2 = 7.3040158179665562e-28
1525 iter = 18
1526 f_count = [55, 57, 94]
1527 g_count = [23]
1528 h_count = 18
1529 warning = None
1530
1531
1532 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1533 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1534
1535
1537 """Constrained Newton opt, GMW Hessian mod, More and Thuente line search {S2=0.970, te=2048, Rex=0.149}
1538
1539 The optimisation options are:
1540 - Newton optimisation.
1541 - GMW Hessian modification.
1542 - More and Thuente line search.
1543 - Constrained.
1544
1545 The true data set is:
1546 - S2 = 0.970
1547 - te = 2048 ps
1548 - Rex = 0.149 s^-1
1549 """
1550
1551
1552 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py')
1553
1554
1555 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1556
1557
1558 self.interpreter.minimise('newton', 'gmw', 'mt')
1559
1560
1561 self.monte_carlo()
1562
1563
1564 spin = cdp.mol[0].res[1].spin[0]
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695 select = True
1696 s2 = 0.9699999999999993
1697 te = 2048.000000000041837
1698 rex = 0.14900000000002225 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1699 chi2 = 6.8756889983348349e-28
1700 iter = 22
1701 f_count = [91, 95, 153, 159, 160, 165]
1702 g_count = [91, 95, 153, 159, 160, 165]
1703 h_count = 22
1704 warning = None
1705
1706
1707 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1708 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1709
1710
1712 """Constrained steepest descent opt, backtracking line search {S2=0.970, te=2048, Rex=0.149}
1713
1714 The optimisation options are:
1715 - Steepest descent optimisation.
1716 - Backtracking line search.
1717 - Constrained.
1718
1719 The true data set is:
1720 - S2 = 0.970
1721 - te = 2048 ps
1722 - Rex = 0.149 s^-1
1723 """
1724
1725
1726 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py')
1727
1728
1729 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1730
1731
1732 self.interpreter.minimise('sd', 'back', max_iter=50)
1733
1734
1735 spin = cdp.mol[0].res[1].spin[0]
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764 select = True
1765 s2 = 0.91579220834688024
1766 te = 0.30568658722531733
1767 rex = 0.34008409798366124 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1768 chi2 = 68.321956795264342
1769 iter = 50
1770 f_count = 134
1771 g_count = 51
1772 h_count = 0
1773 warning = 'Maximum number of iterations reached'
1774
1775
1776 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1777 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1778
1779
1781 """Constrained steepest descent opt, More and Thuente line search {S2=0.970, te=2048, Rex=0.149}
1782
1783 The optimisation options are:
1784 - Steepest descent optimisation.
1785 - More and Thuente line search.
1786 - Constrained.
1787
1788 The true data set is:
1789 - S2 = 0.970
1790 - te = 2048 ps
1791 - Rex = 0.149 s^-1
1792 """
1793
1794
1795 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py')
1796
1797
1798 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1799
1800
1801 self.interpreter.minimise('sd', 'mt', max_iter=50)
1802
1803
1804 spin = cdp.mol[0].res[1].spin[0]
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833 select = True
1834 s2 = 0.91619994957822126
1835 te = 0.12319687570987945
1836 rex = 0.16249110942961512 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1837 chi2 = 73.843613546506191
1838 iter = 50
1839 f_count = 108
1840 g_count = 108
1841 h_count = 0
1842 warning = 'Maximum number of iterations reached'
1843
1844
1845 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1846 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1847
1848
1850 """Constrained grid search {S2=0.970, te=2048, Rex=0.149}.
1851
1852 The optimisation options are:
1853 - Constrained grid search.
1854
1855 The true data set is:
1856 - S2 = 0.970
1857 - te = 2048 ps
1858 - Rex = 0.149 s^-1
1859 """
1860
1861
1862 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py')
1863
1864
1865 self.interpreter.grid_search(inc=11)
1866
1867
1868 spin = cdp.mol[0].res[1].spin[0]
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897 select = True
1898 s2 = 1.0
1899 te = 0.0
1900 rex = 0.0
1901 chi2 = 3.9844117908982288
1902 iter = 1331
1903 f_count = 1331
1904 g_count = 0
1905 h_count = 0
1906 warning = None
1907
1908
1909 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1910 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1911
1912
1914 """Reading of relaxation data using the user function relax_data.read()."""
1915
1916
1917 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
1918
1919
1920 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2)
1921
1922
1923 self.interpreter.relax_data.read(ri_id='R1_600', ri_type='R1', frq=600.0 * 1e6, file='r1.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4)
1924
1925
1926 self.assertEqual(cdp.mol[0].res[1].spin[0].ri_data['R1_600'], 1.3874977659397683)
1927 self.assertEqual(cdp.mol[0].res[1].spin[0].ri_data_err['R1_600'], 0.027749955318795365)
1928
1929
1931 """Read a relax 1.2 model-free results file using the user function results.read()."""
1932
1933
1934 self.interpreter.results.read(file='results_1.2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free')
1935
1936
1937 print(cdp)
1938
1939
1940 num = [3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35]
1941 select = [False, False, False, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False, False]
1942 model = ['m6', 'm8', 'm6', 'm6', 'm5', 'm5', 'm6', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm8']
1943 params = [['s2f', 'tf', 's2', 'ts'], ['s2f', 'tf', 's2', 'ts', 'rex'], ['s2f', 'tf', 's2', 'ts'], ['s2f', 'tf', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 'tf', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 'tf', 's2', 'ts', 'rex']]
1944 s2 = [0.36670427146403667, 0.29007016882193892, 0.32969827132809559, 0.32795333510352148, 0.48713005133752196, 0.40269538236298569, 0.40700811448591556, 0.4283551026406261, 0.51176783207279875, 0.40593664887508263, 0.39437732735324443, 0.51457448574034614, 0.3946900969237977, 0.44740698217286901, 0.48527716982891644, 0.40845486062540021, 0.45839900995265137, 0.52650140958170921, 0.4293599736020427, 0.4057313062564018, 0.49877862202992485, 0.2592017578673716]
1945 s2f = [0.74487419686217116, 0.75358958979175727, 0.77751085082436211, 0.79095600331751026, 0.81059857999556584, 0.83190224667917501, 0.80119109731193627, 0.83083248649122576, 0.86030420847112021, 0.84853537580616367, 0.82378413185968968, 0.82419108009774422, 0.85121172821954216, 0.8736616181472916, 0.84117641395909415, 0.82881488883235521, 0.82697284935760407, 0.85172375147802715, 0.81366357660551614, 0.80525752789388483, 0.87016608774434312, 0.72732036363757913]
1946 s2s = [0.49230363061145249, 0.38491796164819009, 0.4240433056059994, 0.41462904855388333, 0.60095102971952741, 0.48406574687168274, 0.50800379067049317, 0.51557336720143987, 0.59486845122178478, 0.47839684761453399, 0.47873867934666214, 0.62433881919629686, 0.46368028522041266, 0.51210557140148982, 0.57690296800513374, 0.49281795745831319, 0.55430962492751434, 0.61815983018913379, 0.5276873464009153, 0.50385285725620466, 0.57319933407525203, 0.35637907423767778]
1947 tf = [51.972302580836775, 40.664901270582988, 28.130299965023671, 33.804249387275249, None, None, 39.01236115991609, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 44.039078787981225]
1948 ts = [4485.91415175767, 4102.7781982031429, 3569.2837792404325, 6879.5308400989479, 3372.9879908647699, 4029.0617588044606, 4335.5290462417324, 4609.1336532777468, 2628.5638771308277, 3618.1332115807745, 6208.3028336637644, 3763.0843884066526, 3847.9994107906346, 2215.2061317769703, 2936.1282626562524, 3647.0715185456729, 3803.6990762708042, 2277.5259401416288, 3448.4496004396187, 3884.6917561878495, 1959.3267951363712, 4100.8496898773756]
1949 rex = [None, 0.37670424516405815, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 0.71472288436387088]
1950
1951
1952 ri_ids = ['R1_500', 'R2_500', 'NOE_500', 'R1_600', 'R2_600', 'NOE_600', 'R1_750', 'R2_750', 'NOE_750']
1953 types_list = ['R1', 'R2', 'NOE', 'R1', 'R2', 'NOE', 'R1', 'R2', 'NOE']
1954 frqs_list = [500000000.0] * 3 + [600000000.0] * 3 + [750000000.0] * 3
1955 ri_type = {}
1956 frqs = {}
1957 for i in range(len(ri_ids)):
1958 ri_type[ri_ids[i]] = types_list[i]
1959 frqs[ri_ids[i]] = frqs_list[i]
1960
1961 ri_data = {}
1962 ri_data['R1_500'] = [2.2480000000000002, 2.2679999999999998, 2.2309999999999999, 2.383, 2.1960000000000002, 2.3570000000000002, 2.3340000000000001, 2.3999999999999999, 2.2839999999999998, 2.3889999999999998, 2.375, 2.274, 2.407, 2.3220000000000001, 2.2130000000000001, 2.351, 2.3260000000000001, 2.2949999999999999, 2.2829999999999999, 2.302, 2.2719999999999998, 2.2280000000000002]
1963 ri_data['R2_500'] = [5.3419999999999996, 5.3730000000000002, 5.1280000000000001, 5.6749999999999998, 5.9669999999999996, 5.8410000000000002, 5.774, 6.0419999999999998, 6.3129999999999997, 5.9210000000000003, 6.1269999999999998, 6.1120000000000001, 6.0570000000000004, 5.6399999999999997, 6.2809999999999997, 5.8890000000000002, 5.875, 6.1429999999999998, 5.7370000000000001, 5.5490000000000004, 5.7110000000000003, 5.4020000000000001]
1964 ri_data['NOE_500'] = [0.4617, 0.46560000000000001, 0.61670000000000003, 0.60860000000000003, 0.68869999999999998, 0.6663, 0.58620000000000005, 0.64939999999999998, 0.61070000000000002, 0.61180000000000001, 0.73129999999999995, 0.69650000000000001, 0.65139999999999998, 0.4929, 0.65920000000000001, 0.63029999999999997, 0.64380000000000004, 0.53500000000000003, 0.63839999999999997, 0.65000000000000002, 0.49909999999999999, 0.45979999999999999]
1965 ri_data['R1_600'] = [1.8879999999999999, 1.992, 2.0270000000000001, 1.9790000000000001, 1.9399999999999999, 2.0550000000000002, 2.0030000000000001, 2.0139999999999998, 1.982, 2.1000000000000001, 2.008, 1.927, 2.1019999999999999, 2.0830000000000002, 1.9910000000000001, 2.036, 1.9990000000000001, 1.9490000000000001, 1.976, 1.9870000000000001, 2.0, 1.9379999999999999]
1966 ri_data['R2_600'] = [5.6100000000000003, 5.7869999999999999, 5.4029999999999996, 6.1849999999999996, 6.3150000000000004, 5.9809999999999999, 6.1600000000000001, 6.2460000000000004, 6.4340000000000002, 6.0069999999999997, 6.399, 6.6799999999999997, 6.1369999999999996, 5.952, 6.3239999999999998, 5.9699999999999998, 6.3979999999999997, 6.4379999999999997, 6.1139999999999999, 6.0960000000000001, 6.3250000000000002, 6.1050000000000004]
1967 ri_data['NOE_600'] = [0.62929999999999997, 0.64429999999999998, 0.5393, 0.71509999999999996, 0.73870000000000002, 0.75580000000000003, 0.64239999999999997, 0.74429999999999996, 0.69440000000000002, 0.73140000000000005, 0.7681, 0.73399999999999999, 0.75680000000000003, 0.62470000000000003, 0.73529999999999995, 0.73740000000000006, 0.73080000000000001, 0.6603, 0.70899999999999996, 0.69040000000000001, 0.59199999999999997, 0.56830000000000003]
1968 ri_data['R1_750'] = [1.6220000000000001, 1.706, 1.73, 1.665, 1.627, 1.768, 1.706, 1.7030000000000001, 1.7649999999999999, 1.8129999999999999, 1.675, 1.6339999999999999, 1.845, 1.7829999999999999, 1.764, 1.7470000000000001, 1.681, 1.647, 1.6850000000000001, 1.667, 1.7010000000000001, 1.6850000000000001]
1969 ri_data['R2_750'] = [6.2619999999999996, 6.5359999999999996, 5.8959999999999999, 6.6840000000000002, 6.8819999999999997, 6.7569999999999997, 6.5620000000000003, 7.0030000000000001, 6.9740000000000002, 6.649, 6.9829999999999997, 7.2309999999999999, 6.4429999999999996, 6.6840000000000002, 6.8070000000000004, 6.4850000000000003, 6.9400000000000004, 6.944, 6.4640000000000004, 6.4889999999999999, 6.9009999999999998, 6.9539999999999997]
1970 ri_data['NOE_750'] = [0.61909999999999998, 0.65890000000000004, 0.72009999999999996, 0.71009999999999995, 0.75219999999999998, 0.80420000000000003, 0.70020000000000004, 0.81999999999999995, 0.81040000000000001, 0.83409999999999995, 0.81299999999999994, 0.81910000000000005, 0.7782, 0.74760000000000004, 0.8115, 0.7379, 0.81100000000000005, 0.78249999999999997, 0.75729999999999997, 0.78259999999999996, 0.75139999999999996, 0.65210000000000001]
1971
1972 ri_data_err = {}
1973 ri_data_err['R1_500'] = [0.044999999999999998, 0.044999999999999998, 0.044499999999999998, 0.048000000000000001, 0.043999999999999997, 0.047, 0.0465, 0.048000000000000001, 0.045499999999999999, 0.048000000000000001, 0.047500000000000001, 0.045499999999999999, 0.048000000000000001, 0.0465, 0.044499999999999998, 0.047, 0.0465, 0.045499999999999999, 0.045499999999999999, 0.045999999999999999, 0.045499999999999999, 0.044499999999999998]
1974 ri_data_err['R2_500'] = [0.107, 0.1075, 0.10249999999999999, 0.1135, 0.11899999999999999, 0.11650000000000001, 0.11600000000000001, 0.121, 0.1265, 0.11799999999999999, 0.123, 0.122, 0.1215, 0.1125, 0.17599999999999999, 0.11749999999999999, 0.11749999999999999, 0.123, 0.1145, 0.111, 0.1145, 0.108]
1975 ri_data_err['NOE_500'] = [0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003]
1976 ri_data_err['R1_600'] = [0.037999999999999999, 0.040000000000000001, 0.040500000000000001, 0.0395, 0.0385, 0.041000000000000002, 0.040000000000000001, 0.040500000000000001, 0.040000000000000001, 0.042000000000000003, 0.041500000000000002, 0.039, 0.042000000000000003, 0.042000000000000003, 0.0395, 0.040500000000000001, 0.040000000000000001, 0.039, 0.0395, 0.040000000000000001, 0.040500000000000001, 0.039]
1977 ri_data_err['R2_600'] = [0.1125, 0.11550000000000001, 0.108, 0.1235, 0.1265, 0.1275, 0.123, 0.125, 0.1285, 0.12, 0.128, 0.13350000000000001, 0.1225, 0.11899999999999999, 0.1265, 0.1195, 0.128, 0.129, 0.1225, 0.122, 0.1265, 0.1225]
1978 ri_data_err['NOE_600'] = [0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003]
1979 ri_data_err['R1_750'] = [0.032500000000000001, 0.034000000000000002, 0.035000000000000003, 0.033500000000000002, 0.032500000000000001, 0.035499999999999997, 0.034000000000000002, 0.034000000000000002, 0.035499999999999997, 0.036499999999999998, 0.033500000000000002, 0.032500000000000001, 0.036999999999999998, 0.035499999999999997, 0.035499999999999997, 0.035000000000000003, 0.033500000000000002, 0.033000000000000002, 0.034000000000000002, 0.033000000000000002, 0.034000000000000002, 0.033500000000000002]
1980 ri_data_err['R2_750'] = [0.1255, 0.1305, 0.11799999999999999, 0.13400000000000001, 0.13800000000000001, 0.13550000000000001, 0.13150000000000001, 0.14050000000000001, 0.13950000000000001, 0.13300000000000001, 0.14000000000000001, 0.14449999999999999, 0.129, 0.13400000000000001, 0.13600000000000001, 0.1295, 0.13850000000000001, 0.13900000000000001, 0.1295, 0.13, 0.13800000000000001, 0.13900000000000001]
1981 ri_data_err['NOE_750'] = [0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003]
1982
1983
1984 self.assertEqual(cdp.pipe_type, 'mf')
1985 self.assertEqual(cdp.hybrid_pipes, [])
1986
1987
1988 self.assertEqual(cdp.diff_tensor.type, 'sphere')
1989 self.assertEqual(cdp.diff_tensor.tm, 6.2029050826362826e-09)
1990
1991
1992 self.assertEqual(cdp.chi2, 88.0888600975)
1993 self.assertEqual(cdp.iter, 1)
1994 self.assertEqual(cdp.f_count, 20)
1995 self.assertEqual(cdp.g_count, 2)
1996 self.assertEqual(cdp.h_count, 1)
1997 self.assertEqual(cdp.warning, None)
1998
1999
2000 self.assertEqual(cdp.ri_ids, ri_ids)
2001 for ri_id in ri_ids:
2002 self.assertEqual(cdp.ri_type[ri_id], ri_type[ri_id])
2003 self.assertEqual(cdp.frq[ri_id], frqs[ri_id])
2004
2005
2006 j = 0
2007 for i in range(len(cdp.mol[0].res)):
2008
2009 res = cdp.mol[0].res[i]
2010 spin = cdp.mol[0].res[i].spin[0]
2011 h_spin = None
2012 if len(cdp.mol[0].res[i].spin) > 1:
2013 h_spin = cdp.mol[0].res[i].spin[1]
2014
2015
2016 print(res)
2017 print(spin)
2018
2019
2020 self.assertEqual(res.num, num[i])
2021 self.assertEqual(res.name, 'XXX')
2022 self.assertEqual(spin.num, None)
2023 if select[i]:
2024 self.assertEqual(spin.name, 'N')
2025 self.assertEqual(spin.fixed, False)
2026 else:
2027 self.assertEqual(spin.name, None)
2028 self.assertEqual(spin.select, select[i])
2029 if h_spin:
2030 self.assertEqual(h_spin.num, None)
2031 self.assertEqual(h_spin.name, 'H')
2032 self.assertEqual(h_spin.select, False)
2033
2034
2035 if not select[i]:
2036 continue
2037
2038
2039 self.assertEqual(spin.isotope, '15N')
2040 self.assertEqual(h_spin.isotope, '1H')
2041
2042
2043 self.assertEqual(spin.model, model[j])
2044 self.assertEqual(spin.equation, 'mf_ext')
2045 self.assertEqual(spin.params, params[j])
2046 self.assertEqual(spin.s2, s2[j])
2047 self.assertEqual(spin.s2f, s2f[j])
2048 self.assertEqual(spin.s2s, s2s[j])
2049 self.assertEqual(spin.local_tm, None)
2050 self.assertEqual(spin.te, None)
2051 if tf[j] != None:
2052 tf[j] = tf[j]*1e-12
2053 self.assertEqual(spin.tf, tf[j])
2054 self.assertEqual(spin.ts, ts[j]*1e-12)
2055 if rex[j] != None:
2056 rex[j] = rex[j]/(2.0*pi*500000000.0)**2
2057 self.assertEqual(spin.rex, rex[j])
2058 self.assertEqual(spin.csa, -0.00016999999999999999)
2059
2060
2061 self.assertEqual(spin.chi2, None)
2062 self.assertEqual(spin.iter, None)
2063 self.assertEqual(spin.f_count, None)
2064 self.assertEqual(spin.g_count, None)
2065 self.assertEqual(spin.h_count, None)
2066 self.assertEqual(spin.warning, None)
2067
2068
2069 for ri_id in cdp.ri_ids:
2070 print(ri_id)
2071 self.assertEqual(spin.ri_data[ri_id], ri_data[ri_id][j])
2072 self.assertEqual(spin.ri_data_err[ri_id], ri_data_err[ri_id][j])
2073
2074
2075 j = j + 1
2076
2077
2078 for i in range(len(cdp.interatomic)):
2079 self.assertEqual(cdp.interatomic[i].r, 1.0200000000000001e-10)
2080
2081
2083 """Read the truncated relax 1.2 model-free results file for PSE-4."""
2084
2085
2086 self.interpreter.results.read(file='pse4_trunc', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free')
2087
2088
2089 print(cdp)
2090
2091
2092 num = [24, 27]
2093 name = ['ser', 'gln']
2094 eqi = [None, 'mf_ext']
2095 select = [False, True]
2096 model = [None, 'm5']
2097 params = [[], ['s2f', 's2', 'ts']]
2098 s2 = [None, 0.86578779694713515]
2099 s2f = [None, 0.88618694421409949]
2100 s2s = [None, 0.97698098871784322]
2101 s2s_sim = [[None, None, None],
2102 [0.95852080081635382, 0.97574415413309512, 0.97293450506144197]]
2103 tf = [None, None]
2104 ts = [None, 598.8142249659868e-12]
2105 rex = [None, None]
2106 csa = [None, -0.00017199999999999998]
2107 ri_ids = ['R1_800', 'NOE_800', 'R1_600', 'R2_600', 'NOE_600', 'R1_500', 'R2_500', 'NOE_500']
2108 ri_type_list = ['R1', 'NOE', 'R1', 'R2', 'NOE', 'R1', 'R2', 'NOE']
2109 frq_list = [799744000.0]*2 + [599737000.0]*3 + [499719000.0]*3
2110 ri_data_list = [[],
2111 [0.6835, 0.81850000000000001, 0.98409999999999997, 16.5107, 0.79796699999999998, 1.3174999999999999, 15.381500000000001, 0.73046900000000003]]
2112 ri_data_err_list = [[],
2113 [0.026957200000000001, 0.025881000000000001, 0.0243073, 0.497137, 0.028663000000000001, 0.038550000000000001, 0.40883999999999998, 0.022016299999999999]]
2114 ri_type = {}
2115 frq = {}
2116 ri_data = [{}, {}]
2117 ri_data_err = [{}, {}]
2118 for i in range(len(ri_ids)):
2119 ri_type[ri_ids[i]] = ri_type_list[i]
2120 frq[ri_ids[i]] = frq_list[i]
2121 ri_data[1][ri_ids[i]] = ri_data_list[1][i]
2122 ri_data_err[1][ri_ids[i]] = ri_data_err_list[1][i]
2123
2124
2125 r = [None, 1.0200000000000001e-10]
2126
2127
2128 self.assertEqual(cdp.pipe_type, 'mf')
2129 self.assertEqual(cdp.hybrid_pipes, [])
2130
2131
2132 self.assertEqual(cdp.diff_tensor.type, 'ellipsoid')
2133 self.assertEqual(cdp.diff_tensor.tm, 1.2682770910095516e-08)
2134 self.assertEqual(cdp.diff_tensor.tm_err, 2.4053909822304126e-11)
2135 self.assertEqual(cdp.diff_tensor.tm_sim[0], 1.2666656725867738e-08)
2136 self.assertEqual(cdp.diff_tensor.tm_sim[1], 1.2689812011679408e-08)
2137 self.assertEqual(cdp.diff_tensor.tm_sim[2], 1.2698266641804573e-08)
2138
2139
2140 self.assertEqual(cdp.chi2, 935.13348627485448)
2141 self.assertEqual(cdp.chi2_sim[0], 898.0981500197106)
2142 self.assertEqual(cdp.chi2_sim[1], 904.11113814725172)
2143 self.assertEqual(cdp.chi2_sim[2], 902.03890817023728)
2144 self.assertEqual(cdp.iter, 1)
2145 self.assertEqual(cdp.iter_sim[0], 23)
2146 self.assertEqual(cdp.iter_sim[1], 30)
2147 self.assertEqual(cdp.iter_sim[2], 16)
2148 self.assertEqual(cdp.f_count, 21)
2149 self.assertEqual(cdp.f_count_sim[0], 61)
2150 self.assertEqual(cdp.f_count_sim[1], 501)
2151 self.assertEqual(cdp.f_count_sim[2], 59)
2152 self.assertEqual(cdp.g_count, 2)
2153 self.assertEqual(cdp.g_count_sim[0], 27)
2154 self.assertEqual(cdp.g_count_sim[1], 34)
2155 self.assertEqual(cdp.g_count_sim[2], 20)
2156 self.assertEqual(cdp.h_count, 1)
2157 self.assertEqual(cdp.h_count_sim[0], 23)
2158 self.assertEqual(cdp.h_count_sim[1], 30)
2159 self.assertEqual(cdp.h_count_sim[2], 16)
2160 self.assertEqual(cdp.warning, None)
2161 self.assertEqual(cdp.warning_sim[0], None)
2162 self.assertEqual(cdp.warning_sim[1], None)
2163 self.assertEqual(cdp.warning_sim[2], None)
2164
2165
2166 self.assertEqual(cdp.ri_ids, ri_ids)
2167 for ri_id in ri_ids:
2168 self.assertEqual(cdp.ri_type[ri_id], ri_type[ri_id])
2169 self.assertEqual(cdp.frq[ri_id], frq[ri_id])
2170
2171
2172 for i in range(len(cdp.mol[0].res)):
2173
2174 res = cdp.mol[0].res[i]
2175 spin = cdp.mol[0].res[i].spin[0]
2176 h_spin = cdp.mol[0].res[i].spin[1]
2177
2178
2179 print(res)
2180 print(spin)
2181
2182
2183 self.assertEqual(res.num, num[i])
2184 self.assertEqual(res.name, name[i])
2185 self.assertEqual(spin.num, None)
2186 self.assertEqual(spin.name, 'N')
2187 self.assertEqual(spin.select, select[i])
2188 self.assertEqual(spin.fixed, False)
2189 self.assertEqual(h_spin.num, None)
2190 self.assertEqual(h_spin.name, 'H')
2191 self.assertEqual(h_spin.select, False)
2192
2193
2194 self.assertEqual(spin.isotope, '15N')
2195 self.assertEqual(h_spin.isotope, '1H')
2196
2197
2198 self.assertEqual(spin.model, model[i])
2199 self.assertEqual(spin.equation, eqi[i])
2200 self.assertEqual(spin.params, params[i])
2201 self.assertEqual(spin.s2, s2[i])
2202 self.assertEqual(spin.s2f, s2f[i])
2203 self.assertEqual(spin.s2s, s2s[i])
2204 self.assertEqual(spin.local_tm, None)
2205 self.assertEqual(spin.te, None)
2206 self.assertEqual(spin.tf, tf[i])
2207 self.assertEqual(spin.ts, ts[i])
2208 self.assertEqual(spin.rex, rex[i])
2209 self.assertEqual(spin.csa, csa[i])
2210 for j in range(3):
2211 self.assertEqual(spin.s2s_sim[j], s2s_sim[i][j])
2212
2213
2214 self.assertEqual(spin.chi2, None)
2215 self.assertEqual(spin.iter, None)
2216 self.assertEqual(spin.f_count, None)
2217 self.assertEqual(spin.g_count, None)
2218 self.assertEqual(spin.h_count, None)
2219 self.assertEqual(spin.warning, None)
2220
2221
2222 if i == 0:
2223 self.assertEqual(spin.ri_data, {})
2224 self.assertEqual(spin.ri_data_err, {})
2225 else:
2226 for ri_id in ri_ids:
2227 self.assertEqual(spin.ri_data[ri_id], ri_data[i][ri_id])
2228 self.assertEqual(spin.ri_data_err[ri_id], ri_data_err[i][ri_id])
2229
2230
2231 for i in range(len(cdp.interatomic)):
2232 self.assertEqual(cdp.interatomic[i].r, r[i])
2233
2234
2236 """Read the truncated relax 1.2 model-free results file for TEM-1."""
2237
2238
2239 self.interpreter.results.read(file='tem1_trunc', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free')
2240
2241
2242 print(cdp)
2243
2244
2245 num = [26, 27, 29, 30, 31, 32, 33, 34]
2246 name = ['His', 'Pro', 'Thr', 'Leu', 'Val', 'Lys', 'Val', 'Lys']
2247 eqi = [None, None, None, 'mf_ext', 'mf_orig', 'mf_orig', None, 'mf_orig']
2248 select = [False, False, False, True, True, True, False, True]
2249 model = [None, None, None, 'm5', 'm2', 'm1', None, 'm1']
2250 params = [None, None, None, ['s2f', 's2', 'ts'], ['s2', 'te'], ['s2'], None, ['s2']]
2251 s2 = [None, None, None, 0.85674161305142216, 0.89462664243726608, 0.90201790111143165, None, 0.92099297347361675]
2252 s2f = [None, None, None, 0.88220054271390302, None, None, None, None]
2253 s2s = [None, None, None, 0.97114156200339452, None, None, None, None]
2254 te = [None, None, None, None, 43.262426916926735*1e-12, None, None, None]
2255 tf = [None, None, None, None, None, None, None, None]
2256 ts = [None, None, None, 2385.912514843546*1e-12, None, None, None, None]
2257 rex = [None, None, None, None, None, None, None, None]
2258 csa = [None, None, None, -0.00017199999999999998, -0.00017199999999999998, -0.00017199999999999998, None, -0.00017199999999999998]
2259 ri_ids = ['R1_800', 'R2_800', 'R1_600', 'R2_600', 'NOE_600', 'R1_500', 'R2_500', 'NOE_500']
2260 ri_type_list = ['R1', 'R2', 'R1', 'R2', 'NOE', 'R1', 'R2', 'NOE']
2261 frq_list = [799812000.0]*2 + [599739000.0]*3 + [499827000.0]*3
2262 ri_data_list = [[],
2263 [],
2264 [],
2265 [0.75680000000000003, 18.797999999999998, 1.0747, 16.477, 0.86873100000000003, 1.2625999999999999, 15.3367, 0.77803197999999996],
2266 [0.75019999999999998, 19.201599999999999, 1.0617000000000001, 17.652899999999999, 0.73757200000000001, 1.3165, 15.949, 0.72442474000000001],
2267 [0.75860000000000005, 19.303799999999999, 1.0605, 16.593699999999998, 0.79137500000000005, 1.3425, 15.327199999999999, 0.83449132000000004],
2268 [],
2269 [0.71919999999999995, 20.165400000000002, 1.0729, 17.291899999999998, 0.80444599999999999, 1.2971999999999999, 15.9963, 0.73164684999999996]]
2270 ri_data_err_list = [[],
2271 [],
2272 [],
2273 [0.028001600000000001, 0.21729999999999999, 0.031166300000000001, 0.44487900000000002, 0.043210699999999998, 0.054291800000000001, 0.69015199999999999, 0.038901600000000001],
2274 [0.028899999999999999, 0.25640000000000002, 0.030789299999999999, 0.476628, 0.036686799999999999, 0.0566095, 0.71770500000000004, 0.036221200000000002],
2275 [0.033399999999999999, 0.2233, 0.030754500000000001, 0.44802999999999998, 0.039363000000000002, 0.057727500000000001, 0.689724, 0.041724600000000001],
2276 [],
2277 [0.027699999999999999, 0.52810000000000001, 0.031399999999999997, 0.46688099999999999, 0.040013100000000003, 0.055779599999999999, 0.71983399999999997, 0.036582299999999998]]
2278 ri_type = {}
2279 frq = {}
2280 ri_data = []
2281 ri_data_err = []
2282 for i in range(len(ri_data_list)):
2283 ri_data.append({})
2284 ri_data_err.append({})
2285
2286 for i in range(len(ri_ids)):
2287 ri_type[ri_ids[i]] = ri_type_list[i]
2288 frq[ri_ids[i]] = frq_list[i]
2289 for j in range(len(ri_data_list)):
2290 if len(ri_data_list[j]):
2291 ri_data[j][ri_ids[i]] = ri_data_list[j][i]
2292 ri_data_err[j][ri_ids[i]] = ri_data_err_list[j][i]
2293
2294 chi2 = [None, None, None, 7.9383923597292441, 10.93852890925343, 3.1931459495488084, None, 8.3598891989018611]
2295 iter = [None, None, None, 55, 10, 3, None, 3]
2296 f_count = [None, None, None, 170, 148, 10, None, 10]
2297 g_count = [None, None, None, 60, 14, 6, None, 6]
2298 h_count = [None, None, None, 55, 10, 3, None, 3]
2299
2300
2301 r = [None, None, None, 1.0200000000000001e-10, 1.0200000000000001e-10, 1.0200000000000001e-10, None, 1.0200000000000001e-10]
2302
2303
2304 self.assertEqual(cdp.pipe_type, 'mf')
2305 self.assertEqual(cdp.hybrid_pipes, [])
2306
2307
2308 self.assertEqual(cdp.diff_tensor.type, 'ellipsoid')
2309 self.assertEqual(cdp.diff_tensor.tm, 1.2526607261882971e-08)
2310 self.assertEqual(cdp.diff_tensor.Da, 2784606.8835473624)
2311 self.assertEqual(cdp.diff_tensor.Dr, 0.097243698709517518)
2312 self.assertEqual(cdp.diff_tensor.alpha, 48.852555276419558 / 360.0 * 2.0 * pi)
2313 self.assertEqual(cdp.diff_tensor.beta, 9.7876096346750447 / 360.0 * 2.0 * pi)
2314 self.assertEqual(cdp.diff_tensor.gamma, 42.15815798778408 / 360.0 * 2.0 * pi)
2315
2316
2317 self.assertEqual(cdp.ri_ids, ri_ids)
2318 for ri_id in ri_ids:
2319 self.assertEqual(cdp.ri_type[ri_id], ri_type[ri_id])
2320 self.assertEqual(cdp.frq[ri_id], frq[ri_id])
2321
2322
2323 for i in range(len(cdp.mol[0].res)):
2324
2325 res = cdp.mol[0].res[i]
2326 spin = cdp.mol[0].res[i].spin[0]
2327 h_spin = cdp.mol[0].res[i].spin[1]
2328
2329
2330 print(res)
2331 print(spin)
2332
2333
2334 self.assertEqual(res.num, num[i])
2335 self.assertEqual(res.name, name[i])
2336 self.assertEqual(spin.num, None)
2337 self.assertEqual(spin.name, 'N')
2338 self.assertEqual(spin.select, select[i])
2339 self.assertEqual(spin.fixed, False)
2340 self.assertEqual(h_spin.num, None)
2341 self.assertEqual(h_spin.name, 'H')
2342 self.assertEqual(h_spin.select, False)
2343
2344
2345 self.assertEqual(spin.isotope, '15N')
2346 self.assertEqual(h_spin.isotope, '1H')
2347
2348
2349 self.assertEqual(spin.model, model[i])
2350 self.assertEqual(spin.equation, eqi[i])
2351 self.assertEqual(spin.params, params[i])
2352 self.assertEqual(spin.s2, s2[i])
2353 self.assertEqual(spin.s2f, s2f[i])
2354 self.assertEqual(spin.s2s, s2s[i])
2355 self.assertEqual(spin.local_tm, None)
2356 self.assertEqual(spin.te, te[i])
2357 self.assertEqual(spin.tf, tf[i])
2358 self.assertEqual(spin.ts, ts[i])
2359 self.assertEqual(spin.rex, rex[i])
2360 self.assertEqual(spin.csa, csa[i])
2361
2362
2363 self.assertEqual(spin.chi2, chi2[i])
2364 self.assertEqual(spin.iter, iter[i])
2365 self.assertEqual(spin.f_count, f_count[i])
2366 self.assertEqual(spin.g_count, g_count[i])
2367 self.assertEqual(spin.h_count, h_count[i])
2368 self.assertEqual(spin.warning, None)
2369
2370
2371 if not ri_data[i].keys():
2372 self.assertEqual(spin.ri_data, {})
2373 self.assertEqual(spin.ri_data_err, {})
2374 else:
2375 for ri_id in ri_ids:
2376 self.assertEqual(spin.ri_data[ri_id], ri_data[i][ri_id])
2377 self.assertEqual(spin.ri_data_err[ri_id], ri_data_err[i][ri_id])
2378
2379
2380 for i in range(len(cdp.interatomic)):
2381 self.assertEqual(cdp.interatomic[i].r, r[i])
2382
2383
2396
2397
2410
2411
2424
2425
2427 """Read a 1.3 model-free results file (relax XML version 2) with corrupted floats.
2428
2429 The floats are deliberately mangled to test the IEEE-754 reading.
2430 """
2431
2432
2433 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP'
2434
2435
2436 self.interpreter.pipe.create('1.3', 'mf')
2437 self.interpreter.results.read(file='final_results_trunc_1.3_v2_broken', dir=path)
2438
2439
2440 self.check_read_results_1_3()
2441
2442
2455
2456
2458 """Selecting model m4 with parameters {S2, te, Rex} using model_free.select_model()."""
2459
2460
2461 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
2462
2463
2464 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2)
2465
2466
2467 self.interpreter.model_free.select_model(model='m4')
2468
2469
2470 self.assertEqual(cdp.mol[0].res[1].spin[0].model, 'm4')
2471 self.assertEqual(cdp.mol[0].res[1].spin[0].params, ['s2', 'te', 'rex'])
2472
2473
2475 """Setting the CSA value through the user function value.set()."""
2476
2477
2478 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
2479
2480
2481 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2)
2482
2483
2484 self.interpreter.value.set(N15_CSA, 'csa')
2485
2486
2487 self.assertEqual(cdp.mol[0].res[1].spin[0].csa, N15_CSA)
2488
2489
2491 """Test the optimisation of the tm0 model-free parameter grid."""
2492
2493
2494 cdp._model = 'tm0'
2495 cdp._value_test = self.value_test
2496
2497
2498 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
2499
2500
2502 """Test the optimisation of the tm1 model-free parameter grid."""
2503
2504
2505 cdp._model = 'tm1'
2506 cdp._value_test = self.value_test
2507
2508
2509 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm1_grid.py')
2510
2511
2513 """Test the optimisation of the tm2 model-free parameter grid."""
2514
2515
2516 cdp._model = 'tm2'
2517 cdp._value_test = self.value_test
2518
2519
2520 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py')
2521
2522
2524 """Test the optimisation of the tm3 model-free parameter grid."""
2525
2526
2527 cdp._model = 'tm3'
2528 cdp._value_test = self.value_test
2529
2530
2531 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm3_grid.py')
2532
2533
2535 """Test the optimisation of the tm4 model-free parameter grid."""
2536
2537
2538 cdp._model = 'tm4'
2539 cdp._value_test = self.value_test
2540
2541
2542 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm4_grid.py')
2543
2544
2546 """Test the optimisation of the tm5 model-free parameter grid."""
2547
2548
2549 cdp._model = 'tm5'
2550 cdp._value_test = self.value_test
2551
2552
2553 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm5_grid.py')
2554
2555
2557 """Test the optimisation of the tm6 model-free parameter grid."""
2558
2559
2560 cdp._model = 'tm6'
2561 cdp._value_test = self.value_test
2562
2563
2564 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm6_grid.py')
2565
2566
2568 """Test the optimisation of the tm7 model-free parameter grid."""
2569
2570
2571 cdp._model = 'tm7'
2572 cdp._value_test = self.value_test
2573
2574
2575 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm7_grid.py')
2576
2577
2579 """Test the optimisation of the tm8 model-free parameter grid."""
2580
2581
2582 cdp._model = 'tm8'
2583 cdp._value_test = self.value_test
2584
2585
2586 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm8_grid.py')
2587
2588
2590 """Test the optimisation of the tm9 model-free parameter grid."""
2591
2592
2593 cdp._model = 'tm9'
2594 cdp._value_test = self.value_test
2595
2596
2597 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm9_grid.py')
2598
2599
2601 """Try a component of model-free analysis on Tyler Reddy's peptide data (truncated)."""
2602
2603
2604 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'tylers_peptide.py')
2605
2606
2608 """Writing of model-free results using the user function results.write()."""
2609
2610
2611 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP'
2612
2613
2614 self.interpreter.results.read(file='final_results_trunc_1.2', dir=path)
2615
2616
2617 file = DummyFileObject()
2618
2619
2620 self.interpreter.results.write(file=file, dir=path)
2621
2622
2623 test_lines = file.readlines()
2624 file.close()
2625
2626
2627 if sys.version_info[0] >= 3 and sys.version_info[1] >= 2:
2628 file = open_read_file(file_name='final_results_trunc_2.1_py3', dir=path)
2629
2630
2631 elif sys.version_info[0] >= 3 and sys.version_info[1] == 1:
2632 file = open_read_file(file_name='final_results_trunc_1.3_pre_py2.7.3_v2', dir=path)
2633
2634
2635 elif dep_check.xml_type == 'internal' and sys.version_info[0] >= 2 and sys.version_info[1] >= 7 and sys.version_info[2] >= 3:
2636 file = open_read_file(file_name='final_results_trunc_1.3_v2', dir=path)
2637
2638
2639 else:
2640 file = open_read_file(file_name='final_results_trunc_1.3_pre_py2.7.3_v2', dir=path)
2641
2642
2643 true_lines = file.readlines()
2644 file.close()
2645
2646
2647 for i in range(len(test_lines)):
2648
2649
2650 if i == 1 or i == 2:
2651 continue
2652
2653
2654 test = test_lines[i]
2655 true = true_lines[i]
2656
2657
2658 try:
2659
2660 if search('<value>', test):
2661 test = test.lstrip()
2662 test = test.replace('<value>', '')
2663 test = test.replace('</value>', '')
2664 if search('<ieee_754_byte_array>', test):
2665 test = test.lstrip()
2666 test = test.replace('<ieee_754_byte_array>', '')
2667 test = test.replace('</ieee_754_byte_array>', '')
2668
2669 test = eval(test)
2670 except:
2671 pass
2672
2673
2674 try:
2675
2676 if search('<value>', true):
2677 true = true.lstrip()
2678 true = true.replace('<value>', '')
2679 true = true.replace('</value>', '')
2680 if search('<ieee_754_byte_array>', true):
2681 true = true.lstrip()
2682 true = true.replace('<ieee_754_byte_array>', '')
2683 true = true.replace('</ieee_754_byte_array>', '')
2684
2685 true = eval(true)
2686 except:
2687 pass
2688
2689
2690 self.assertEqual(test, true)
2691
2692
2693 - def value_test(self, spin, select=True, local_tm=None, s2=None, s2f=None, s2s=None, te=None, tf=None, ts=None, rex=None, chi2=None, iter=None, f_count=None, g_count=None, h_count=None, warning=None):
2694 """Test the optimisation values."""
2695
2696
2697 mesg = self.mesg_opt_debug(spin)
2698
2699
2700 if iter != None and not isinstance(iter, list):
2701 iter = [iter]
2702 if f_count != None and not isinstance(f_count, list):
2703 f_count = [f_count]
2704 if g_count != None and not isinstance(g_count, list):
2705 g_count = [g_count]
2706 if h_count != None and not isinstance(h_count, list):
2707 h_count = [h_count]
2708
2709
2710
2711
2712
2713 self.assertEqual(spin.select, select, msg=mesg)
2714
2715
2716 if local_tm != None:
2717 self.assertAlmostEqual(spin.local_tm / 1e-9, local_tm, msg=mesg)
2718 else:
2719 self.assertEqual(spin.local_tm, None, msg=mesg)
2720
2721
2722 if s2 != None:
2723 self.assertAlmostEqual(spin.s2, s2, msg=mesg)
2724 else:
2725 self.assertEqual(spin.s2, None, msg=mesg)
2726
2727
2728 if s2f != None:
2729 self.assertAlmostEqual(spin.s2f, s2f, 5, msg=mesg)
2730 else:
2731 self.assertEqual(spin.s2f, None, msg=mesg)
2732
2733
2734 if s2s != None:
2735 self.assertAlmostEqual(spin.s2s, s2s, 5, msg=mesg)
2736 else:
2737 self.assertEqual(spin.s2s, None, msg=mesg)
2738
2739
2740 if isinstance(te, float):
2741 self.assertAlmostEqual(spin.te / 1e-12, te, 5, msg=mesg)
2742 elif te == None:
2743 self.assertEqual(spin.te, None, msg=mesg)
2744
2745
2746 if isinstance(tf, float):
2747 self.assertAlmostEqual(spin.tf / 1e-12, tf, 4, msg=mesg)
2748 elif tf == None:
2749 self.assertEqual(spin.tf, None, msg=mesg)
2750
2751
2752 if isinstance(ts, float):
2753 self.assertAlmostEqual(spin.ts / 1e-12, ts, 4, msg=mesg)
2754 elif ts == None:
2755 self.assertEqual(spin.ts, None, msg=mesg)
2756
2757
2758 if isinstance(rex, float):
2759 self.assertAlmostEqual(spin.rex * (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2, rex * (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2, msg=mesg)
2760 elif rex == None:
2761 self.assertEqual(spin.rex, None, msg=mesg)
2762
2763
2764 if chi2 != None:
2765 self.assertAlmostEqual(spin.chi2, chi2, msg=mesg)
2766 if iter != None:
2767 self.assert_(spin.iter in iter, msg=mesg)
2768 if f_count != None:
2769 self.assert_(spin.f_count in f_count, msg=mesg)
2770 if g_count != None:
2771 self.assert_(spin.g_count in g_count, msg=mesg)
2772 if h_count != None:
2773 self.assert_(spin.h_count in h_count, msg=mesg)
2774 if warning != None:
2775 self.assertEqual(spin.warning, warning, msg=mesg)
2776