1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 from math import pi
25 import platform
26 import numpy
27 from os import sep
28 from re import search
29 from shutil import copytree
30 from tempfile import mkdtemp
31
32
33 from base_classes import SystemTestCase
34 from data import Relax_data_store; ds = Relax_data_store()
35 import dep_check
36 from generic_fns import pipes
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
42
43
44 SYSTEM = platform.system()
45 RELEASE = platform.release()
46 VERSION = platform.version()
47 WIN32_VER = platform.win32_ver()
48 DIST = platform.dist()
49 ARCH = platform.architecture()
50 MACH = platform.machine()
51 PROC = platform.processor()
52 PY_VER = platform.python_version()
53 NUMPY_VER = numpy.__version__
54 LIBC_VER = platform.libc_ver()
55
56
57 if SYSTEM == 'Windows' or SYSTEM == 'Microsoft':
58
59 SYSTEM = 'Windows'
60
61
62
63 -class Mf(SystemTestCase):
64 """TestCase class for the functional tests of model-free analysis."""
65
71
72
74 """Method for returning a string to help debug the minimisation.
75
76 @param spin: The SpinContainer of the optimised spin.
77 @type spin: SpinContainer instance
78 @return: The debugging string.
79 @rtype: str
80 """
81
82
83 string = 'Optimisation failure.\n\n'
84
85
86 string = string + "%-18s%-25s\n" % ("System: ", SYSTEM)
87 string = string + "%-18s%-25s\n" % ("Release: ", RELEASE)
88 string = string + "%-18s%-25s\n" % ("Version: ", VERSION)
89 string = string + "%-18s%-25s\n" % ("Win32 version: ", (WIN32_VER[0] + " " + WIN32_VER[1] + " " + WIN32_VER[2] + " " + WIN32_VER[3]))
90 string = string + "%-18s%-25s\n" % ("Distribution: ", (DIST[0] + " " + DIST[1] + " " + DIST[2]))
91 string = string + "%-18s%-25s\n" % ("Architecture: ", (ARCH[0] + " " + ARCH[1]))
92 string = string + "%-18s%-25s\n" % ("Machine: ", MACH)
93 string = string + "%-18s%-25s\n" % ("Processor: ", PROC)
94 string = string + "%-18s%-25s\n" % ("Python version: ", PY_VER)
95 string = string + "%-18s%-25s\n" % ("Numpy version: ", NUMPY_VER)
96 string = string + "%-18s%-25s\n" % ("Libc version: ", (LIBC_VER[0] + " " + LIBC_VER[1]))
97
98
99
100 string = string + '\n'
101 if spin.local_tm != None:
102 string = string + "%-15s %30.16g\n" % ('local_tm (ns):', spin.local_tm * 1e9)
103 if spin.s2 != None:
104 string = string + "%-15s %30.16g\n" % ('s2:', spin.s2)
105 if spin.s2f != None:
106 string = string + "%-15s %30.16g\n" % ('s2f:', spin.s2f)
107 if spin.s2s != None:
108 string = string + "%-15s %30.16g\n" % ('s2s:', spin.s2s)
109 if spin.te != None:
110 string = string + "%-15s %30.13g\n" % ('te (ps):', spin.te * 1e12)
111 if spin.tf != None:
112 string = string + "%-15s %30.13g\n" % ('tf (ps):', spin.tf * 1e12)
113 if spin.ts != None:
114 string = string + "%-15s %30.13g\n" % ('ts (ps):', spin.ts * 1e12)
115 if spin.rex != None:
116 string = string + "%-15s %30.17g\n" % ('rex:', spin.rex * (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2)
117 string = string + "%-15s %30.17g\n" % ('chi2:', spin.chi2)
118 string = string + "%-15s %30i\n" % ('iter:', spin.iter)
119 string = string + "%-15s %30i\n" % ('f_count:', spin.f_count)
120 string = string + "%-15s %30i\n" % ('g_count:', spin.g_count)
121 string = string + "%-15s %30i\n" % ('h_count:', spin.h_count)
122 string = string + "%-15s %30s\n" % ('warning:', spin.warning)
123
124
125 return string
126
127
138
139
141 """Check if the contents of 2 objects are the same."""
142
143
144 self.assertEqual(dir(obj1), dir(obj2))
145
146
147 for name in dir(obj1):
148
149 if skip and name in skip:
150 continue
151
152
153 if search('^_', name):
154 continue
155
156
157 if name in list(obj1.__class__.__dict__.keys()):
158 continue
159
160
161 print(("\t" + name))
162
163
164 sub_obj1 = getattr(obj1, name)
165 sub_obj2 = getattr(obj2, name)
166
167
168 self.assertEqual(type(sub_obj1), type(sub_obj2))
169
170
171 self.assertEqual(str(sub_obj1), str(sub_obj2))
172
173
175 """Test catching bug #14872, the unicode string selection failure as submitted by Olivier Serve."""
176
177
178 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_14872_unicode_selection.py')
179
180
182 """Test catching bug #14941, the local tm global model selection problem as submitted by Mikaela Stewart (mikaela dot stewart att gmail dot com)."""
183
184
185 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_14941_local_tm_global_selection.py')
186
187
189 """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)."""
190
191
192 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_15050.py')
193
194
196 """Test catching bugs #12582, #12591 and #12607 as submitted by Chris Brosey."""
197
198
199 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bugs_12582_12591_12607.py')
200
201
202 self.assertNotEqual(cdp.mol[0].res[1].spin[0].s2, 1.0)
203
204
206 """Test catching bug #18790, the negative relaxation data RelaxError reported by Vitaly Vostrikov."""
207
208
209 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_18790_negative_error.py')
210
211
213 """Creating model m4 with parameters {S2, te, Rex} using model_free.create_model()."""
214
215
216 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'create_m4.py')
217
218
219 self.assertEqual(cdp.mol[0].res[1].spin[0].model, 'm4')
220 self.assertEqual(cdp.mol[0].res[1].spin[0].params, ['s2', 'te', 'rex'])
221
222
224 """Check the execution of auto_analyses.dauvergne_protocol."""
225
226
227 ds.tmpdir = mkdtemp()
228
229
230 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'dauvergne_protocol.py')
231
232
233 self.assertEqual(cdp.diff_tensor.type, 'sphere')
234 self.assertAlmostEqual(cdp.diff_tensor.tm, 1e-8)
235 self.assertEqual(cdp.diff_tensor.fixed, True)
236
237
238 self.assertAlmostEqual(cdp.chi2, 4e-19)
239
240
241 mol_names = ["sphere_mol1"] * 9
242 res_names = ["GLY"] * 9
243 res_nums = range(1, 10)
244 spin_names = ["N"] * 9
245 spin_nums = numpy.array(range(9)) * 2 + 1
246
247
248 i = 0
249 for spin, mol_name, res_num, res_name in spin_loop(full_info=True):
250
251 self.assertEqual(mol_name, mol_names[i])
252 self.assertEqual(res_name, res_names[i])
253 self.assertEqual(res_num, res_nums[i])
254 self.assertEqual(spin.name, spin_names[i])
255 self.assertEqual(spin.num, spin_nums[i])
256
257
258 self.assertEqual(spin.select, True)
259 self.assertEqual(spin.fixed, False)
260 self.assertEqual(spin.proton_type, '1H')
261 self.assertEqual(spin.heteronuc_type, '15N')
262 self.assertEqual(spin.attached_proton, None)
263 self.assertEqual(spin.nucleus, None)
264 self.assertAlmostEqual(spin.r, 1.02 * 1e-10)
265 self.assertAlmostEqual(spin.csa, -172e-6)
266
267
268 self.assertEqual(spin.model, 'm2')
269 self.assertEqual(spin.equation, 'mf_orig')
270 self.assertEqual(len(spin.params), 2)
271 self.assertEqual(spin.params[0], 's2')
272 self.assertEqual(spin.params[1], 'te')
273 self.assertAlmostEqual(spin.s2, 0.8)
274 self.assertEqual(spin.s2f, None)
275 self.assertEqual(spin.s2s, None)
276 self.assertEqual(spin.local_tm, None)
277 self.assertAlmostEqual(spin.te, 20e-12)
278 self.assertEqual(spin.tf, None)
279 self.assertEqual(spin.ts, None)
280 self.assertEqual(spin.rex, None)
281
282
283 self.assertEqual(spin.chi2, None)
284 self.assertEqual(spin.iter, None)
285 self.assertEqual(spin.f_count, None)
286 self.assertEqual(spin.g_count, None)
287 self.assertEqual(spin.h_count, None)
288 self.assertEqual(spin.warning, None)
289
290
291 i += 1
292
293
295 """Back-calculate relaxation data."""
296
297
298 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'generate_ri.py')
299
300
302 """Test the creation of a LaTeX table of model-free results, mimicking the latex_mf_table.py sample script."""
303
304
305 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'latex_mf_table.py')
306
307
309 """Test the optimisation of the test set {tm=10, S2=0.8, te=40}."""
310
311
312 self.interpreter.run(script_file=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')
313
314
315 frq = ['400', '500', '600', '700', '800', '900', '1000']
316
317
318 for i in range(len(frq)):
319 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)
320 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)
321 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)
322
323
324 self.interpreter.value.set([15.0e-9, 1.0, 0.0], ['local_tm', 's2', 'te'])
325
326
327 self.interpreter.minimise('newton', 'gmw', 'back')
328
329
330 spin = cdp.mol[0].res[0].spin[0]
331
332
333 self.value_test(spin, local_tm=10, s2=0.8, te=40, chi2=0.0)
334
335
337 """Test the optimisation of the test set {tm=10, S2=0.8, te=40}."""
338
339
340 self.interpreter.run(script_file=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')
341
342
343 frq = ['400', '500', '600', '700', '800', '900', '1000']
344
345
346 for i in range(len(frq)):
347 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)
348 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)
349 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)
350
351
352 self.interpreter.value.set([15.0e-9, 1.0, 0.0], ['local_tm', 's2', 'te'])
353
354
355 self.interpreter.minimise('newton', 'gmw', 'back')
356
357
358 spin = cdp.mol[0].res[0].spin[0]
359
360
361 self.value_test(spin, local_tm=10, s2=0.8, te=40, chi2=0.0)
362
363
365 """Test the optimisation of the test set {tm=10, S2=0.8, te=40}."""
366
367
368 self.interpreter.run(script_file=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')
369
370
371 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)
372 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)
373 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)
374 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)
375 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)
376 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)
377 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)
378 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)
379 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)
380
381
382 self.interpreter.value.set([15.0e-9, 1.0, 0.0], ['local_tm', 's2', 'te'])
383
384
385 self.interpreter.minimise('newton', 'gmw', 'back')
386
387
388 spin = cdp.mol[0].res[0].spin[0]
389
390
391 self.value_test(spin, local_tm=10, s2=0.8, te=40, chi2=0.0)
392
393
395 """Test the optimisation of the m0 model-free model against the tm0 parameter grid."""
396
397
398 cdp._model = 'm0'
399 cdp._value_test = self.value_test
400
401
402 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
403
404
406 """Test the optimisation of the m1 model-free model against the tm0 parameter grid."""
407
408
409 cdp._model = 'm1'
410 cdp._value_test = self.value_test
411
412
413 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
414
415
417 """Test the optimisation of the m2 model-free model against the tm0 parameter grid."""
418
419
420 cdp._model = 'm2'
421 cdp._value_test = self.value_test
422
423
424 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
425
426
428 """Test the optimisation of the m3 model-free model against the tm0 parameter grid."""
429
430
431 cdp._model = 'm3'
432 cdp._value_test = self.value_test
433
434
435 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
436
437
439 """Test the optimisation of the m4 model-free model against the tm0 parameter grid."""
440
441
442 cdp._model = 'm4'
443 cdp._value_test = self.value_test
444
445
446 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
447
448
450 """Test the optimisation of the m1 model-free model against the tm1 parameter grid."""
451
452
453 cdp._model = 'm1'
454 cdp._value_test = self.value_test
455
456
457 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm1_grid.py')
458
459
461 """Test the optimisation of the m2 model-free model against the tm2 parameter grid."""
462
463
464 cdp._model = 'm2'
465 cdp._value_test = self.value_test
466
467
468 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py')
469
470
472 """Test the optimisation of the m4 model-free model against the tm2 parameter grid."""
473
474
475 cdp._model = 'm4'
476 cdp._value_test = self.value_test
477
478
479 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py')
480
481
483 """Test the optimisation of the m3 model-free model against the tm3 parameter grid."""
484
485
486 cdp._model = 'm3'
487 cdp._value_test = self.value_test
488
489
490 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm3_grid.py')
491
492
494 """Test the optimisation of the m4 model-free model against the tm4 parameter grid."""
495
496
497 cdp._model = 'm4'
498 cdp._value_test = self.value_test
499
500
501 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm4_grid.py')
502
503
505 """Test the optimisation of the m5 model-free model against the tm5 parameter grid."""
506
507
508 cdp._model = 'm5'
509 cdp._value_test = self.value_test
510
511
512 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm5_grid.py')
513
514
516 """Test the optimisation of the m6 model-free model against the tm6 parameter grid."""
517
518
519 cdp._model = 'm6'
520 cdp._value_test = self.value_test
521
522
523 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm6_grid.py')
524
525
527 """Test the optimisation of the m7 model-free model against the tm7 parameter grid."""
528
529
530 cdp._model = 'm7'
531 cdp._value_test = self.value_test
532
533
534 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm7_grid.py')
535
536
538 """Test the optimisation of the m8 model-free model against the tm8 parameter grid."""
539
540
541 cdp._model = 'm8'
542 cdp._value_test = self.value_test
543
544
545 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm8_grid.py')
546
547
549 """Test the optimisation of the m9 model-free model against the tm9 parameter grid."""
550
551
552 cdp._model = 'm9'
553 cdp._value_test = self.value_test
554
555
556 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm9_grid.py')
557
558
560 """Try a very minimal model-free analysis on the OMP relaxation data."""
561
562
563 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'omp_model_free.py')
564
565
566 dp = pipes.get_pipe('final')
567
568
569 self.assertEqual(dp.mol[0].res[0].spin[0].select_sim, [True, False, True])
570 self.assertEqual(dp.mol[0].res[1].spin[0].select_sim, [True, True, False])
571 self.assertEqual(dp.mol[0].res[2].spin[0].select_sim, [True, True, True])
572 self.assert_(not hasattr(dp.mol[0].res[3].spin[0], 'select_sim'))
573
574
576 """Mapping the {S2, te, Rex} chi2 space through the OpenDX user function dx.map()."""
577
578
579 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opendx_s2_te_rex.py')
580
581
583 """Mapping the {theta, phi, Da} chi2 space through the OpenDX user function dx.map()."""
584
585
586 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
587
588
589 self.interpreter.structure.read_pdb(file='pdb', dir=path, read_model=1)
590 self.interpreter.structure.load_spins('@N')
591 self.interpreter.structure.vectors(attached='H')
592
593
594 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)
595 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)
596 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)
597 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)
598 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)
599 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)
600
601
602 self.interpreter.diffusion_tensor.init((1.601 * 1e7, 1.34, 72.4, 90-77.9), param_types=4)
603 self.interpreter.value.set([N15_CSA, NH_BOND_LENGTH], ['csa', 'r'])
604 self.interpreter.value.set([0.8, 50 * 1e-12, 0.0], ['s2', 'te', 'rex'])
605 self.interpreter.value.set('15N', 'heteronuc_type')
606 self.interpreter.value.set('1H', 'proton_type')
607
608
609 self.interpreter.model_free.select_model(model='m4')
610
611
612 self.interpreter.dx.map(params=['theta', 'phi', 'Da'], spin_id=':2', inc=2, lower=[0, 0, -0.5*1e7], upper=[pi, 2.0*pi, 1.0*1e7], file_prefix='devnull')
613
614
616 """Mapping the {local_tm, S2, te} chi2 space through the OpenDX user function dx.map()."""
617
618
619 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
620
621
622 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2)
623
624
625 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)
626 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)
627 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)
628 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)
629 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)
630 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)
631
632
633 self.interpreter.value.set([N15_CSA, NH_BOND_LENGTH], ['csa', 'r'])
634 self.interpreter.value.set('15N', 'heteronuc_type')
635 self.interpreter.value.set('1H', 'proton_type')
636
637
638 self.interpreter.model_free.select_model(model='tm2')
639
640
641 self.interpreter.dx.map(params=['local_tm', 's2', 'te'], spin_id=':2', inc=2, lower=[5e-9, 0.0, 0.0], file_prefix='devnull')
642
643
645 """Constrained BFGS opt, backtracking line search {S2=0.970, te=2048, Rex=0.149}
646
647 The optimisation options are:
648 - BFGS optimisation.
649 - Backtracking line search.
650 - Constrained.
651
652 The true data set is:
653 - S2 = 0.970
654 - te = 2048 ps
655 - Rex = 0.149 s^-1
656 """
657
658
659 self.interpreter.run(script_file=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')
660
661
662 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
663
664
665 self.interpreter.minimise('bfgs', 'back')
666
667
668 spin = cdp.mol[0].res[1].spin[0]
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
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 select = True
865 s2 = 0.9699999999999995
866 te = 2048.000000000022283
867 rex = 0.14900000000000566 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
868 chi2 = 3.1024517431117421e-27
869 iter = [154, 156, 157, 158, 162, 175, 203]
870 f_count = [598, 695, 701, 722, 735, 744, 758, 955]
871 g_count = [161, 162, 163, 164, 165, 169, 182, 209]
872 h_count = 0
873 warning = None
874
875
876 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
877 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
878
879
881 """Constrained BFGS opt, More and Thuente line search {S2=0.970, te=2048, Rex=0.149}
882
883 The optimisation options are:
884 - BFGS optimisation.
885 - More and Thuente line search.
886 - Constrained.
887
888 The true data set is:
889 - S2 = 0.970
890 - te = 2048 ps
891 - Rex = 0.149 s^-1
892 """
893
894
895 self.interpreter.run(script_file=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')
896
897
898 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
899
900
901 self.interpreter.minimise('bfgs', 'mt')
902
903
904 spin = cdp.mol[0].res[1].spin[0]
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
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
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 select = True
1050 s2 = 0.9700000000000580
1051 te = 2048.000000011044449
1052 rex = 0.148999999998904 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1053 chi2 = 4.3978813282102374e-23
1054 iter = 120
1055 f_count = [377, 381, 384, 386, 388]
1056 g_count = [377, 381, 384, 386, 388]
1057 h_count = 0
1058 warning = None
1059
1060
1061 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1062 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1063
1064
1066 """Constrained coordinate descent opt, backtracking line search {S2=0.970, te=2048, Rex=0.149}
1067
1068 The optimisation options are:
1069 - Coordinate descent optimisation.
1070 - Backtracking line search.
1071 - Constrained.
1072
1073 The true data set is:
1074 - S2 = 0.970
1075 - te = 2048 ps
1076 - Rex = 0.149 s^-1
1077 """
1078
1079
1080 self.interpreter.run(script_file=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')
1081
1082
1083 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1084
1085
1086 self.interpreter.minimise('cd', 'back', max_iter=50)
1087
1088
1089 spin = cdp.mol[0].res[1].spin[0]
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 select = True
1119 s2 = 0.9097900390625
1120 te = 25.00000000000000
1121 rex = 1.24017333984375 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1122 chi2 = 53.476155463267176
1123 iter = 50
1124 f_count = 131
1125 g_count = 51
1126 h_count = 0
1127 warning = 'Maximum number of iterations reached'
1128
1129
1130 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1131 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1132
1133
1135 """Constrained coordinate descent opt, More and Thuente line search {S2=0.970, te=2048, Rex=0.149}
1136
1137 The optimisation options are:
1138 - Coordinate descent optimisation.
1139 - More and Thuente line search.
1140 - Constrained.
1141
1142 The true data set is:
1143 - S2 = 0.970
1144 - te = 2048 ps
1145 - Rex = 0.149 s^-1
1146 """
1147
1148
1149 self.interpreter.run(script_file=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')
1150
1151
1152 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1153
1154
1155 self.interpreter.minimise('cd', 'mt')
1156
1157
1158 spin = cdp.mol[0].res[1].spin[0]
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
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
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259 select = True
1260 s2 = 0.9700000000219674
1261 te = 2048.000001534187049
1262 rex = 0.14899999946977982 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1263 chi2 = 2.3477234248531005e-18
1264 iter = [198, 200]
1265 f_count = [738, 757, 874]
1266 g_count = [738, 757, 874]
1267 h_count = 0
1268 warning = None
1269
1270
1271 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1272 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1273
1274
1276 """Constrained Newton opt, GMW Hessian mod, backtracking line search {S2=0.970, te=2048, Rex=0.149}
1277
1278 The optimisation options are:
1279 - Newton optimisation.
1280 - GMW Hessian modification.
1281 - Backtracking line search.
1282 - Constrained.
1283
1284 The true data set is:
1285 - S2 = 0.970
1286 - te = 2048 ps
1287 - Rex = 0.149 s^-1
1288 """
1289
1290
1291 self.interpreter.run(script_file=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')
1292
1293
1294 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1295
1296
1297 self.interpreter.minimise('newton', 'gmw', 'back')
1298
1299
1300 spin = cdp.mol[0].res[1].spin[0]
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
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401 select = True
1402 s2 = 0.9699999999999994
1403 te = 2048.000000000045020
1404 rex = 0.14900000000001817 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1405 chi2 = 7.3040158179665562e-28
1406 iter = 18
1407 f_count = [55, 57, 94]
1408 g_count = [23]
1409 h_count = 18
1410 warning = None
1411
1412
1413 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1414 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1415
1416
1418 """Constrained Newton opt, GMW Hessian mod, More and Thuente line search {S2=0.970, te=2048, Rex=0.149}
1419
1420 The optimisation options are:
1421 - Newton optimisation.
1422 - GMW Hessian modification.
1423 - More and Thuente line search.
1424 - Constrained.
1425
1426 The true data set is:
1427 - S2 = 0.970
1428 - te = 2048 ps
1429 - Rex = 0.149 s^-1
1430 """
1431
1432
1433 self.interpreter.run(script_file=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')
1434
1435
1436 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1437
1438
1439 self.interpreter.minimise('newton', 'gmw', 'mt')
1440
1441
1442 self.monte_carlo()
1443
1444
1445 spin = cdp.mol[0].res[1].spin[0]
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
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576 select = True
1577 s2 = 0.9699999999999993
1578 te = 2048.000000000041837
1579 rex = 0.14900000000002225 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1580 chi2 = 6.8756889983348349e-28
1581 iter = 22
1582 f_count = [91, 95, 153, 159, 160, 165]
1583 g_count = [91, 95, 153, 159, 160, 165]
1584 h_count = 22
1585 warning = None
1586
1587
1588 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1589 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1590
1591
1593 """Constrained steepest descent opt, backtracking line search {S2=0.970, te=2048, Rex=0.149}
1594
1595 The optimisation options are:
1596 - Steepest descent optimisation.
1597 - Backtracking line search.
1598 - Constrained.
1599
1600 The true data set is:
1601 - S2 = 0.970
1602 - te = 2048 ps
1603 - Rex = 0.149 s^-1
1604 """
1605
1606
1607 self.interpreter.run(script_file=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')
1608
1609
1610 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1611
1612
1613 self.interpreter.minimise('sd', 'back', max_iter=50)
1614
1615
1616 spin = cdp.mol[0].res[1].spin[0]
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 select = True
1646 s2 = 0.91579220834688024
1647 te = 0.30568658722531733
1648 rex = 0.34008409798366124 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1649 chi2 = 68.321956795264342
1650 iter = 50
1651 f_count = 134
1652 g_count = 51
1653 h_count = 0
1654 warning = 'Maximum number of iterations reached'
1655
1656
1657 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1658 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1659
1660
1662 """Constrained steepest descent opt, More and Thuente line search {S2=0.970, te=2048, Rex=0.149}
1663
1664 The optimisation options are:
1665 - Steepest descent optimisation.
1666 - More and Thuente line search.
1667 - Constrained.
1668
1669 The true data set is:
1670 - S2 = 0.970
1671 - te = 2048 ps
1672 - Rex = 0.149 s^-1
1673 """
1674
1675
1676 self.interpreter.run(script_file=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')
1677
1678
1679 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex'])
1680
1681
1682 self.interpreter.minimise('sd', 'mt', max_iter=50)
1683
1684
1685 spin = cdp.mol[0].res[1].spin[0]
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714 select = True
1715 s2 = 0.91619994957822126
1716 te = 0.12319687570987945
1717 rex = 0.16249110942961512 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
1718 chi2 = 73.843613546506191
1719 iter = 50
1720 f_count = 108
1721 g_count = 108
1722 h_count = 0
1723 warning = 'Maximum number of iterations reached'
1724
1725
1726 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1727 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1728
1729
1731 """Constrained grid search {S2=0.970, te=2048, Rex=0.149}.
1732
1733 The optimisation options are:
1734 - Constrained grid search.
1735
1736 The true data set is:
1737 - S2 = 0.970
1738 - te = 2048 ps
1739 - Rex = 0.149 s^-1
1740 """
1741
1742
1743 self.interpreter.run(script_file=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')
1744
1745
1746 self.interpreter.grid_search(inc=11)
1747
1748
1749 spin = cdp.mol[0].res[1].spin[0]
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778 select = True
1779 s2 = 1.0
1780 te = 0.0
1781 rex = 0.0
1782 chi2 = 3.9844117908982288
1783 iter = 1331
1784 f_count = 1331
1785 g_count = 0
1786 h_count = 0
1787 warning = None
1788
1789
1790 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False)
1791 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1792
1793
1795 """Reading of relaxation data using the user function relax_data.read()."""
1796
1797
1798 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
1799
1800
1801 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2)
1802
1803
1804 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)
1805
1806
1807 self.assertEqual(cdp.mol[0].res[1].spin[0].ri_data['R1_600'], 1.3874977659397683)
1808 self.assertEqual(cdp.mol[0].res[1].spin[0].ri_data_err['R1_600'], 0.027749955318795365)
1809
1810
1812 """Read a relax 1.2 model-free results file using the user function results.read()."""
1813
1814
1815 self.interpreter.results.read(file='results_1.2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free')
1816
1817
1818 print(cdp)
1819
1820
1821 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]
1822 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]
1823 model = ['m6', 'm8', 'm6', 'm6', 'm5', 'm5', 'm6', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm8']
1824 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']]
1825 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]
1826 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]
1827 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]
1828 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]
1829 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]
1830 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]
1831
1832
1833 ri_ids = ['R1_500', 'R2_500', 'NOE_500', 'R1_600', 'R2_600', 'NOE_600', 'R1_750', 'R2_750', 'NOE_750']
1834 types_list = ['R1', 'R2', 'NOE', 'R1', 'R2', 'NOE', 'R1', 'R2', 'NOE']
1835 frqs_list = [500000000.0] * 3 + [600000000.0] * 3 + [750000000.0] * 3
1836 ri_type = {}
1837 frqs = {}
1838 for i in range(len(ri_ids)):
1839 ri_type[ri_ids[i]] = types_list[i]
1840 frqs[ri_ids[i]] = frqs_list[i]
1841
1842 ri_data = {}
1843 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]
1844 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]
1845 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]
1846 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]
1847 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]
1848 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]
1849 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]
1850 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]
1851 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]
1852
1853 ri_data_err = {}
1854 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]
1855 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]
1856 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]
1857 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]
1858 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]
1859 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]
1860 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]
1861 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]
1862 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]
1863
1864
1865 self.assertEqual(cdp.pipe_type, 'mf')
1866 self.assertEqual(cdp.hybrid_pipes, [])
1867
1868
1869 self.assertEqual(cdp.diff_tensor.type, 'sphere')
1870 self.assertEqual(cdp.diff_tensor.tm, 6.2029050826362826e-09)
1871
1872
1873 self.assertEqual(cdp.chi2, 88.0888600975)
1874 self.assertEqual(cdp.iter, 1)
1875 self.assertEqual(cdp.f_count, 20)
1876 self.assertEqual(cdp.g_count, 2)
1877 self.assertEqual(cdp.h_count, 1)
1878 self.assertEqual(cdp.warning, None)
1879
1880
1881 self.assertEqual(cdp.ri_ids, ri_ids)
1882 for ri_id in ri_ids:
1883 self.assertEqual(cdp.ri_type[ri_id], ri_type[ri_id])
1884 self.assertEqual(cdp.frq[ri_id], frqs[ri_id])
1885
1886
1887 j = 0
1888 for i in xrange(len(cdp.mol[0].res)):
1889
1890 res = cdp.mol[0].res[i]
1891 spin = cdp.mol[0].res[i].spin[0]
1892
1893
1894 print(res)
1895 print(spin)
1896
1897
1898 self.assertEqual(res.num, num[i])
1899 self.assertEqual(res.name, 'XXX')
1900 self.assertEqual(spin.num, None)
1901 self.assertEqual(spin.name, None)
1902 self.assertEqual(spin.select, select[i])
1903 self.assertEqual(spin.fixed, False)
1904
1905
1906 if not select[i]:
1907 continue
1908
1909
1910 self.assertEqual(spin.heteronuc_type, '15N')
1911 self.assertEqual(spin.proton_type, '1H')
1912 self.assertEqual(spin.attached_proton, None)
1913 self.assertEqual(spin.nucleus, None)
1914
1915
1916 self.assertEqual(spin.model, model[j])
1917 self.assertEqual(spin.equation, 'mf_ext')
1918 self.assertEqual(spin.params, params[j])
1919 self.assertEqual(spin.s2, s2[j])
1920 self.assertEqual(spin.s2f, s2f[j])
1921 self.assertEqual(spin.s2s, s2s[j])
1922 self.assertEqual(spin.local_tm, None)
1923 self.assertEqual(spin.te, None)
1924 if tf[j] != None:
1925 tf[j] = tf[j]*1e-12
1926 self.assertEqual(spin.tf, tf[j])
1927 self.assertEqual(spin.ts, ts[j]*1e-12)
1928 if rex[j] != None:
1929 rex[j] = rex[j]/(2.0*pi*500000000.0)**2
1930 self.assertEqual(spin.rex, rex[j])
1931 self.assertEqual(spin.r, 1.0200000000000001e-10)
1932 self.assertEqual(spin.csa, -0.00016999999999999999)
1933
1934
1935 self.assertEqual(spin.chi2, None)
1936 self.assertEqual(spin.iter, None)
1937 self.assertEqual(spin.f_count, None)
1938 self.assertEqual(spin.g_count, None)
1939 self.assertEqual(spin.h_count, None)
1940 self.assertEqual(spin.warning, None)
1941
1942
1943 for ri_id in cdp.ri_ids:
1944 print(ri_id)
1945 self.assertEqual(spin.ri_data[ri_id], ri_data[ri_id][j])
1946 self.assertEqual(spin.ri_data_err[ri_id], ri_data_err[ri_id][j])
1947
1948
1949 j = j + 1
1950
1951
1953 """Read the truncated relax 1.2 model-free results file for PSE-4."""
1954
1955
1956 self.interpreter.results.read(file='pse4_trunc', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free')
1957
1958
1959 print(cdp)
1960
1961
1962 num = [24, 27]
1963 name = ['ser', 'gln']
1964 eqi = [None, 'mf_ext']
1965 select = [False, True]
1966 model = [None, 'm5']
1967 params = [[], ['s2f', 's2', 'ts']]
1968 s2 = [None, 0.86578779694713515]
1969 s2f = [None, 0.88618694421409949]
1970 s2s = [None, 0.97698098871784322]
1971 s2s_sim = [[None, None, None],
1972 [0.95852080081635382, 0.97574415413309512, 0.97293450506144197]]
1973 tf = [None, None]
1974 ts = [None, 598.8142249659868e-12]
1975 rex = [None, None]
1976 r = [None, 1.0200000000000001e-10]
1977 csa = [None, -0.00017199999999999998]
1978 ri_ids = ['R1_800', 'NOE_800', 'R1_600', 'R2_600', 'NOE_600', 'R1_500', 'R2_500', 'NOE_500']
1979 ri_type_list = ['R1', 'NOE', 'R1', 'R2', 'NOE', 'R1', 'R2', 'NOE']
1980 frq_list = [799744000.0]*2 + [599737000.0]*3 + [499719000.0]*3
1981 ri_data_list = [[],
1982 [0.6835, 0.81850000000000001, 0.98409999999999997, 16.5107, 0.79796699999999998, 1.3174999999999999, 15.381500000000001, 0.73046900000000003]]
1983 ri_data_err_list = [[],
1984 [0.026957200000000001, 0.025881000000000001, 0.0243073, 0.497137, 0.028663000000000001, 0.038550000000000001, 0.40883999999999998, 0.022016299999999999]]
1985 ri_type = {}
1986 frq = {}
1987 ri_data = [{}, {}]
1988 ri_data_err = [{}, {}]
1989 for i in range(len(ri_ids)):
1990 ri_type[ri_ids[i]] = ri_type_list[i]
1991 frq[ri_ids[i]] = frq_list[i]
1992 ri_data[1][ri_ids[i]] = ri_data_list[1][i]
1993 ri_data_err[1][ri_ids[i]] = ri_data_err_list[1][i]
1994
1995
1996 self.assertEqual(cdp.pipe_type, 'mf')
1997 self.assertEqual(cdp.hybrid_pipes, [])
1998
1999
2000 self.assertEqual(cdp.diff_tensor.type, 'ellipsoid')
2001 self.assertEqual(cdp.diff_tensor.tm, 1.2682770910095516e-08)
2002 self.assertEqual(cdp.diff_tensor.tm_err, 2.4053909822304126e-11)
2003 self.assertEqual(cdp.diff_tensor.tm_sim[0], 1.2666656725867738e-08)
2004 self.assertEqual(cdp.diff_tensor.tm_sim[1], 1.2689812011679408e-08)
2005 self.assertEqual(cdp.diff_tensor.tm_sim[2], 1.2698266641804573e-08)
2006
2007
2008 self.assertEqual(cdp.chi2, 935.13348627485448)
2009 self.assertEqual(cdp.chi2_sim[0], 898.0981500197106)
2010 self.assertEqual(cdp.chi2_sim[1], 904.11113814725172)
2011 self.assertEqual(cdp.chi2_sim[2], 902.03890817023728)
2012 self.assertEqual(cdp.iter, 1)
2013 self.assertEqual(cdp.iter_sim[0], 23)
2014 self.assertEqual(cdp.iter_sim[1], 30)
2015 self.assertEqual(cdp.iter_sim[2], 16)
2016 self.assertEqual(cdp.f_count, 21)
2017 self.assertEqual(cdp.f_count_sim[0], 61)
2018 self.assertEqual(cdp.f_count_sim[1], 501)
2019 self.assertEqual(cdp.f_count_sim[2], 59)
2020 self.assertEqual(cdp.g_count, 2)
2021 self.assertEqual(cdp.g_count_sim[0], 27)
2022 self.assertEqual(cdp.g_count_sim[1], 34)
2023 self.assertEqual(cdp.g_count_sim[2], 20)
2024 self.assertEqual(cdp.h_count, 1)
2025 self.assertEqual(cdp.h_count_sim[0], 23)
2026 self.assertEqual(cdp.h_count_sim[1], 30)
2027 self.assertEqual(cdp.h_count_sim[2], 16)
2028 self.assertEqual(cdp.warning, None)
2029 self.assertEqual(cdp.warning_sim[0], None)
2030 self.assertEqual(cdp.warning_sim[1], None)
2031 self.assertEqual(cdp.warning_sim[2], None)
2032
2033
2034 self.assertEqual(cdp.ri_ids, ri_ids)
2035 for ri_id in ri_ids:
2036 self.assertEqual(cdp.ri_type[ri_id], ri_type[ri_id])
2037 self.assertEqual(cdp.frq[ri_id], frq[ri_id])
2038
2039
2040 for i in xrange(len(cdp.mol[0].res)):
2041
2042 res = cdp.mol[0].res[i]
2043 spin = cdp.mol[0].res[i].spin[0]
2044
2045
2046 print(res)
2047 print(spin)
2048
2049
2050 self.assertEqual(res.num, num[i])
2051 self.assertEqual(res.name, name[i])
2052 self.assertEqual(spin.num, None)
2053 self.assertEqual(spin.name, None)
2054 self.assertEqual(spin.select, select[i])
2055 self.assertEqual(spin.fixed, False)
2056
2057
2058 self.assertEqual(spin.heteronuc_type, '15N')
2059 self.assertEqual(spin.proton_type, '1H')
2060 self.assertEqual(spin.attached_proton, 'H')
2061
2062
2063
2064
2065 self.assertEqual(spin.model, model[i])
2066 self.assertEqual(spin.equation, eqi[i])
2067 self.assertEqual(spin.params, params[i])
2068 self.assertEqual(spin.s2, s2[i])
2069 self.assertEqual(spin.s2f, s2f[i])
2070 self.assertEqual(spin.s2s, s2s[i])
2071 self.assertEqual(spin.local_tm, None)
2072 self.assertEqual(spin.te, None)
2073 self.assertEqual(spin.tf, tf[i])
2074 self.assertEqual(spin.ts, ts[i])
2075 self.assertEqual(spin.rex, rex[i])
2076 self.assertEqual(spin.r, r[i])
2077 self.assertEqual(spin.csa, csa[i])
2078 for j in range(3):
2079 self.assertEqual(spin.s2s_sim[j], s2s_sim[i][j])
2080
2081
2082 self.assertEqual(spin.chi2, None)
2083 self.assertEqual(spin.iter, None)
2084 self.assertEqual(spin.f_count, None)
2085 self.assertEqual(spin.g_count, None)
2086 self.assertEqual(spin.h_count, None)
2087 self.assertEqual(spin.warning, None)
2088
2089
2090 if i == 0:
2091 self.assertEqual(spin.ri_data, {})
2092 self.assertEqual(spin.ri_data_err, {})
2093 else:
2094 for ri_id in ri_ids:
2095 self.assertEqual(spin.ri_data[ri_id], ri_data[i][ri_id])
2096 self.assertEqual(spin.ri_data_err[ri_id], ri_data_err[i][ri_id])
2097
2098
2100 """Read the truncated relax 1.2 model-free results file for TEM-1."""
2101
2102
2103 self.interpreter.results.read(file='tem1_trunc', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free')
2104
2105
2106 print(cdp)
2107
2108
2109 num = [26, 27, 29, 30, 31, 32, 33, 34]
2110 name = ['His', 'Pro', 'Thr', 'Leu', 'Val', 'Lys', 'Val', 'Lys']
2111 eqi = [None, None, None, 'mf_ext', 'mf_orig', 'mf_orig', None, 'mf_orig']
2112 select = [False, False, False, True, True, True, False, True]
2113 model = [None, None, None, 'm5', 'm2', 'm1', None, 'm1']
2114 params = [None, None, None, ['s2f', 's2', 'ts'], ['s2', 'te'], ['s2'], None, ['s2']]
2115 s2 = [None, None, None, 0.85674161305142216, 0.89462664243726608, 0.90201790111143165, None, 0.92099297347361675]
2116 s2f = [None, None, None, 0.88220054271390302, None, None, None, None]
2117 s2s = [None, None, None, 0.97114156200339452, None, None, None, None]
2118 te = [None, None, None, None, 43.262426916926735*1e-12, None, None, None]
2119 tf = [None, None, None, None, None, None, None, None]
2120 ts = [None, None, None, 2385.912514843546*1e-12, None, None, None, None]
2121 rex = [None, None, None, None, None, None, None, None]
2122 r = [None, None, None, 1.0200000000000001e-10, 1.0200000000000001e-10, 1.0200000000000001e-10, None, 1.0200000000000001e-10]
2123 csa = [None, None, None, -0.00017199999999999998, -0.00017199999999999998, -0.00017199999999999998, None, -0.00017199999999999998]
2124 ri_ids = ['R1_800', 'R2_800', 'R1_600', 'R2_600', 'NOE_600', 'R1_500', 'R2_500', 'NOE_500']
2125 ri_type_list = ['R1', 'R2', 'R1', 'R2', 'NOE', 'R1', 'R2', 'NOE']
2126 frq_list = [799812000.0]*2 + [599739000.0]*3 + [499827000.0]*3
2127 ri_data_list = [[],
2128 [],
2129 [],
2130 [0.75680000000000003, 18.797999999999998, 1.0747, 16.477, 0.86873100000000003, 1.2625999999999999, 15.3367, 0.77803197999999996],
2131 [0.75019999999999998, 19.201599999999999, 1.0617000000000001, 17.652899999999999, 0.73757200000000001, 1.3165, 15.949, 0.72442474000000001],
2132 [0.75860000000000005, 19.303799999999999, 1.0605, 16.593699999999998, 0.79137500000000005, 1.3425, 15.327199999999999, 0.83449132000000004],
2133 [],
2134 [0.71919999999999995, 20.165400000000002, 1.0729, 17.291899999999998, 0.80444599999999999, 1.2971999999999999, 15.9963, 0.73164684999999996]]
2135 ri_data_err_list = [[],
2136 [],
2137 [],
2138 [0.028001600000000001, 0.21729999999999999, 0.031166300000000001, 0.44487900000000002, 0.043210699999999998, 0.054291800000000001, 0.69015199999999999, 0.038901600000000001],
2139 [0.028899999999999999, 0.25640000000000002, 0.030789299999999999, 0.476628, 0.036686799999999999, 0.0566095, 0.71770500000000004, 0.036221200000000002],
2140 [0.033399999999999999, 0.2233, 0.030754500000000001, 0.44802999999999998, 0.039363000000000002, 0.057727500000000001, 0.689724, 0.041724600000000001],
2141 [],
2142 [0.027699999999999999, 0.52810000000000001, 0.031399999999999997, 0.46688099999999999, 0.040013100000000003, 0.055779599999999999, 0.71983399999999997, 0.036582299999999998]]
2143 ri_type = {}
2144 frq = {}
2145 ri_data = []
2146 ri_data_err = []
2147 for i in range(len(ri_data_list)):
2148 ri_data.append({})
2149 ri_data_err.append({})
2150
2151 for i in range(len(ri_ids)):
2152 ri_type[ri_ids[i]] = ri_type_list[i]
2153 frq[ri_ids[i]] = frq_list[i]
2154 for j in range(len(ri_data_list)):
2155 if len(ri_data_list[j]):
2156 ri_data[j][ri_ids[i]] = ri_data_list[j][i]
2157 ri_data_err[j][ri_ids[i]] = ri_data_err_list[j][i]
2158
2159 chi2 = [None, None, None, 7.9383923597292441, 10.93852890925343, 3.1931459495488084, None, 8.3598891989018611]
2160 iter = [None, None, None, 55, 10, 3, None, 3]
2161 f_count = [None, None, None, 170, 148, 10, None, 10]
2162 g_count = [None, None, None, 60, 14, 6, None, 6]
2163 h_count = [None, None, None, 55, 10, 3, None, 3]
2164
2165
2166 self.assertEqual(cdp.pipe_type, 'mf')
2167 self.assertEqual(cdp.hybrid_pipes, [])
2168
2169
2170 self.assertEqual(cdp.diff_tensor.type, 'ellipsoid')
2171 self.assertEqual(cdp.diff_tensor.tm, 1.2526607261882971e-08)
2172 self.assertEqual(cdp.diff_tensor.Da, 2784606.8835473624)
2173 self.assertEqual(cdp.diff_tensor.Dr, 0.097243698709517518)
2174 self.assertEqual(cdp.diff_tensor.alpha, 48.852555276419558 / 360.0 * 2.0 * pi)
2175 self.assertEqual(cdp.diff_tensor.beta, 9.7876096346750447 / 360.0 * 2.0 * pi)
2176 self.assertEqual(cdp.diff_tensor.gamma, 42.15815798778408 / 360.0 * 2.0 * pi)
2177
2178
2179 self.assertEqual(cdp.ri_ids, ri_ids)
2180 for ri_id in ri_ids:
2181 self.assertEqual(cdp.ri_type[ri_id], ri_type[ri_id])
2182 self.assertEqual(cdp.frq[ri_id], frq[ri_id])
2183
2184
2185 for i in xrange(len(cdp.mol[0].res)):
2186
2187 res = cdp.mol[0].res[i]
2188 spin = cdp.mol[0].res[i].spin[0]
2189
2190
2191 print(res)
2192 print(spin)
2193
2194
2195 self.assertEqual(res.num, num[i])
2196 self.assertEqual(res.name, name[i])
2197 self.assertEqual(spin.num, None)
2198 self.assertEqual(spin.name, None)
2199 self.assertEqual(spin.select, select[i])
2200 self.assertEqual(spin.fixed, False)
2201
2202
2203 self.assertEqual(spin.heteronuc_type, '15N')
2204 self.assertEqual(spin.proton_type, '1H')
2205 self.assertEqual(spin.attached_proton, 'H')
2206
2207
2208
2209
2210 self.assertEqual(spin.model, model[i])
2211 self.assertEqual(spin.equation, eqi[i])
2212 self.assertEqual(spin.params, params[i])
2213 self.assertEqual(spin.s2, s2[i])
2214 self.assertEqual(spin.s2f, s2f[i])
2215 self.assertEqual(spin.s2s, s2s[i])
2216 self.assertEqual(spin.local_tm, None)
2217 self.assertEqual(spin.te, te[i])
2218 self.assertEqual(spin.tf, tf[i])
2219 self.assertEqual(spin.ts, ts[i])
2220 self.assertEqual(spin.rex, rex[i])
2221 self.assertEqual(spin.r, r[i])
2222 self.assertEqual(spin.csa, csa[i])
2223
2224
2225 self.assertEqual(spin.chi2, chi2[i])
2226 self.assertEqual(spin.iter, iter[i])
2227 self.assertEqual(spin.f_count, f_count[i])
2228 self.assertEqual(spin.g_count, g_count[i])
2229 self.assertEqual(spin.h_count, h_count[i])
2230 self.assertEqual(spin.warning, None)
2231
2232
2233 print ri_data
2234 if not ri_data[i].keys():
2235 self.assertEqual(spin.ri_data, {})
2236 self.assertEqual(spin.ri_data_err, {})
2237 else:
2238 for ri_id in ri_ids:
2239 self.assertEqual(spin.ri_data[ri_id], ri_data[i][ri_id])
2240 self.assertEqual(spin.ri_data_err[ri_id], ri_data_err[i][ri_id])
2241
2242
2244 """Read a relax 1.3 model-free results file using the user function results.read()."""
2245
2246
2247 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP'
2248
2249
2250 self.interpreter.pipe.create('1.3', 'mf')
2251 self.interpreter.results.read(file='final_results_trunc_1.3', dir=path)
2252
2253
2254 self.interpreter.pipe.create('1.2', 'mf')
2255 self.interpreter.results.read(file='final_results_trunc_1.2', dir=path)
2256
2257
2258 pipe_12 = pipes.get_pipe('1.2')
2259 pipe_13 = pipes.get_pipe('1.3')
2260
2261
2262 print("Comparison of the objects of the base data pipe:")
2263 self.object_comparison(obj1=pipe_12, obj2=pipe_13, skip=['mol', 'diff_tensor'])
2264
2265
2266 print("Comparison of the objects of the diffusion tensor:")
2267 self.object_comparison(obj1=pipe_12.diff_tensor, obj2=pipe_13.diff_tensor)
2268
2269
2270 self.assertEqual(len(pipe_12.mol), len(pipe_13.mol))
2271
2272
2273 for i in xrange(len(pipe_12.mol)):
2274
2275 print("Comparison of the objects of the molecule:")
2276 self.object_comparison(obj1=pipe_12.mol[i], obj2=pipe_13.mol[i], skip=['res'])
2277
2278
2279 self.assertEqual(len(pipe_12.mol[i].res), len(pipe_13.mol[i].res))
2280
2281
2282 for j in xrange(len(pipe_12.mol[i].res)):
2283
2284 if j > 10:
2285 break
2286
2287
2288 print("Comparison of the objects of the residue:")
2289 self.object_comparison(obj1=pipe_12.mol[i].res[j], obj2=pipe_13.mol[i].res[j], skip=['spin'])
2290
2291
2292 self.assertEqual(len(pipe_12.mol[i].res[j].spin), len(pipe_13.mol[i].res[j].spin))
2293
2294
2295 for k in xrange(len(pipe_12.mol[i].res[j].spin)):
2296
2297 print("Comparison of the objects of the spin:")
2298 self.object_comparison(obj1=pipe_12.mol[i].res[j].spin[k], obj2=pipe_13.mol[i].res[j].spin[k])
2299
2300
2301
2303 """Selecting model m4 with parameters {S2, te, Rex} using model_free.select_model()."""
2304
2305
2306 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
2307
2308
2309 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2)
2310
2311
2312 self.interpreter.model_free.select_model(model='m4')
2313
2314
2315 self.assertEqual(cdp.mol[0].res[1].spin[0].model, 'm4')
2316 self.assertEqual(cdp.mol[0].res[1].spin[0].params, ['s2', 'te', 'rex'])
2317
2318
2320 """Setting the bond length through the user function value.set()."""
2321
2322
2323 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
2324
2325
2326 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2)
2327
2328
2329 self.interpreter.value.set(NH_BOND_LENGTH, 'r')
2330
2331
2332 self.assertEqual(cdp.mol[0].res[1].spin[0].r, NH_BOND_LENGTH)
2333
2334
2336 """Setting the CSA value through the user function value.set()."""
2337
2338
2339 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
2340
2341
2342 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2)
2343
2344
2345 self.interpreter.value.set(N15_CSA, 'csa')
2346
2347
2348 self.assertEqual(cdp.mol[0].res[1].spin[0].csa, N15_CSA)
2349
2350
2352 """Setting both the CSA value and bond length through the user function value.set()."""
2353
2354
2355 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149'
2356
2357
2358 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2)
2359
2360
2361 self.interpreter.value.set([N15_CSA, NH_BOND_LENGTH], ['csa', 'r'])
2362
2363
2364 self.assertEqual(cdp.mol[0].res[1].spin[0].csa, N15_CSA)
2365 self.assertEqual(cdp.mol[0].res[1].spin[0].r, NH_BOND_LENGTH)
2366
2367
2369 """Test the optimisation of the tm0 model-free parameter grid."""
2370
2371
2372 cdp._model = 'tm0'
2373 cdp._value_test = self.value_test
2374
2375
2376 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
2377
2378
2380 """Test the optimisation of the tm1 model-free parameter grid."""
2381
2382
2383 cdp._model = 'tm1'
2384 cdp._value_test = self.value_test
2385
2386
2387 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm1_grid.py')
2388
2389
2391 """Test the optimisation of the tm2 model-free parameter grid."""
2392
2393
2394 cdp._model = 'tm2'
2395 cdp._value_test = self.value_test
2396
2397
2398 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py')
2399
2400
2402 """Test the optimisation of the tm3 model-free parameter grid."""
2403
2404
2405 cdp._model = 'tm3'
2406 cdp._value_test = self.value_test
2407
2408
2409 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm3_grid.py')
2410
2411
2413 """Test the optimisation of the tm4 model-free parameter grid."""
2414
2415
2416 cdp._model = 'tm4'
2417 cdp._value_test = self.value_test
2418
2419
2420 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm4_grid.py')
2421
2422
2424 """Test the optimisation of the tm5 model-free parameter grid."""
2425
2426
2427 cdp._model = 'tm5'
2428 cdp._value_test = self.value_test
2429
2430
2431 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm5_grid.py')
2432
2433
2435 """Test the optimisation of the tm6 model-free parameter grid."""
2436
2437
2438 cdp._model = 'tm6'
2439 cdp._value_test = self.value_test
2440
2441
2442 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm6_grid.py')
2443
2444
2446 """Test the optimisation of the tm7 model-free parameter grid."""
2447
2448
2449 cdp._model = 'tm7'
2450 cdp._value_test = self.value_test
2451
2452
2453 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm7_grid.py')
2454
2455
2457 """Test the optimisation of the tm8 model-free parameter grid."""
2458
2459
2460 cdp._model = 'tm8'
2461 cdp._value_test = self.value_test
2462
2463
2464 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm8_grid.py')
2465
2466
2468 """Test the optimisation of the tm9 model-free parameter grid."""
2469
2470
2471 cdp._model = 'tm9'
2472 cdp._value_test = self.value_test
2473
2474
2475 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm9_grid.py')
2476
2477
2479 """Try a component of model-free analysis on Tyler Reddy's peptide data (truncated)."""
2480
2481
2482 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'tylers_peptide.py')
2483
2484
2486 """Writing of model-free results using the user function results.write()."""
2487
2488
2489 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP'
2490
2491
2492 self.interpreter.results.read(file='final_results_trunc_1.2', dir=path)
2493
2494
2495 file = DummyFileObject()
2496
2497
2498 self.interpreter.results.write(file=file, dir=path)
2499
2500
2501 test_lines = file.readlines()
2502 file.close()
2503
2504
2505 a, b, c = platform.python_version_tuple()
2506 if dep_check.xml_type == 'internal' and int(a) >= 2 and int(b) >= 7 and int(c) >= 3:
2507 file = open_read_file(file_name='final_results_trunc_1.3_new', dir=path)
2508 else:
2509 file = open_read_file(file_name='final_results_trunc_1.3', dir=path)
2510 true_lines = file.readlines()
2511 file.close()
2512
2513
2514 for i in xrange(len(test_lines)):
2515
2516
2517 if i == 1 or i == 2:
2518 continue
2519
2520
2521 try:
2522 test_line = eval(test_lines[i])
2523 except:
2524 test_line = test_lines[i]
2525
2526
2527 try:
2528 true_line = eval(true_lines[i])
2529 except:
2530 true_line = true_lines[i]
2531
2532
2533 self.assertEqual(test_line, true_line)
2534
2535
2536 - 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):
2537 """Test the optimisation values."""
2538
2539
2540 mesg = self.mesg_opt_debug(spin)
2541
2542
2543 if iter != None and not isinstance(iter, list):
2544 iter = [iter]
2545 if f_count != None and not isinstance(f_count, list):
2546 f_count = [f_count]
2547 if g_count != None and not isinstance(g_count, list):
2548 g_count = [g_count]
2549 if h_count != None and not isinstance(h_count, list):
2550 h_count = [h_count]
2551
2552
2553
2554
2555
2556 self.assertEqual(spin.select, select, msg=mesg)
2557
2558
2559 if local_tm != None:
2560 self.assertAlmostEqual(spin.local_tm / 1e-9, local_tm, msg=mesg)
2561 else:
2562 self.assertEqual(spin.local_tm, None, msg=mesg)
2563
2564
2565 if s2 != None:
2566 self.assertAlmostEqual(spin.s2, s2, msg=mesg)
2567 else:
2568 self.assertEqual(spin.s2, None, msg=mesg)
2569
2570
2571 if s2f != None:
2572 self.assertAlmostEqual(spin.s2f, s2f, 5, msg=mesg)
2573 else:
2574 self.assertEqual(spin.s2f, None, msg=mesg)
2575
2576
2577 if s2s != None:
2578 self.assertAlmostEqual(spin.s2s, s2s, 5, msg=mesg)
2579 else:
2580 self.assertEqual(spin.s2s, None, msg=mesg)
2581
2582
2583 if isinstance(te, float):
2584 self.assertAlmostEqual(spin.te / 1e-12, te, 5, msg=mesg)
2585 elif te == None:
2586 self.assertEqual(spin.te, None, msg=mesg)
2587
2588
2589 if isinstance(tf, float):
2590 self.assertAlmostEqual(spin.tf / 1e-12, tf, 4, msg=mesg)
2591 elif tf == None:
2592 self.assertEqual(spin.tf, None, msg=mesg)
2593
2594
2595 if isinstance(ts, float):
2596 self.assertAlmostEqual(spin.ts / 1e-12, ts, 4, msg=mesg)
2597 elif ts == None:
2598 self.assertEqual(spin.ts, None, msg=mesg)
2599
2600
2601 if isinstance(rex, float):
2602 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)
2603 elif rex == None:
2604 self.assertEqual(spin.rex, None, msg=mesg)
2605
2606
2607 if chi2 != None:
2608 self.assertAlmostEqual(spin.chi2, chi2, msg=mesg)
2609 if iter != None:
2610 self.assert_(spin.iter in iter, msg=mesg)
2611 if f_count != None:
2612 self.assert_(spin.f_count in f_count, msg=mesg)
2613 if g_count != None:
2614 self.assert_(spin.g_count in g_count, msg=mesg)
2615 if h_count != None:
2616 self.assert_(spin.h_count in h_count, msg=mesg)
2617 if warning != None:
2618 self.assertEqual(spin.warning, warning, msg=mesg)
2619