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 os import sep
25
26
27 from base_classes import SystemTestCase
28 from data import Relax_data_store; ds = Relax_data_store()
29 import dep_check
30 from status import Status; status = Status()
31
32
34 """Class for testing the calculation of unit vectors."""
35
36 - def __init__(self, methodName='runTest'):
37 """Skip scientific Python tests if not installed.
38
39 @keyword methodName: The name of the test.
40 @type methodName: str
41 """
42
43
44 super(Unit_vectors, self).__init__(methodName)
45
46
48 """Set up for all the functional tests."""
49
50
51 self.interpreter.pipe.create('mf', 'mf')
52
53
55 """Load the PDB file using the Scientific parser and calculate the XH unit vectors."""
56
57
58 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='scientific')
59
60
61 self.interpreter.structure.load_spins(spin_id='@N')
62
63
64 self.interpreter.structure.vectors(attached='H')
65
66
67 self.assert_(hasattr(cdp.mol[0].res[2].spin[0], 'xh_vect'))
68 self.assertEqual(cdp.mol[0].res[2].spin[0].num, 28)
69 self.assertEqual(cdp.mol[0].res[2].spin[0].name, 'N')
70 self.assertNotEqual(cdp.mol[0].res[2].spin[0].xh_vect, None)
71 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[0], 0.40899187)
72 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[1], -0.80574458)
73 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[2], 0.42837054)
74
75
77 """Load the PDB file using the Scientific parser and calculate the XH unit vectors (with spin numbers removed)."""
78
79
80 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='scientific')
81
82
83 self.interpreter.structure.load_spins(spin_id='@N')
84
85
86 self.interpreter.spin.number(force=True)
87
88
89 self.interpreter.structure.vectors(attached='H')
90
91
92 self.assert_(hasattr(cdp.mol[0].res[2].spin[0], 'xh_vect'))
93 self.assertEqual(cdp.mol[0].res[2].spin[0].num, None)
94 self.assertEqual(cdp.mol[0].res[2].spin[0].name, 'N')
95 self.assertNotEqual(cdp.mol[0].res[2].spin[0].xh_vect, None)
96 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[0], 0.40899187)
97 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[1], -0.80574458)
98 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[2], 0.42837054)
99
100
102 """Load the PDB file using the internal parser and calculate the XH unit vectors."""
103
104
105 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='internal')
106
107
108 self.interpreter.structure.load_spins(spin_id='@N')
109
110
111 self.interpreter.structure.vectors(attached='H')
112
113
114 self.assert_(hasattr(cdp.mol[0].res[2].spin[0], 'xh_vect'))
115 self.assertEqual(cdp.mol[0].res[2].spin[0].num, 28)
116 self.assertEqual(cdp.mol[0].res[2].spin[0].name, 'N')
117 self.assertNotEqual(cdp.mol[0].res[2].spin[0].xh_vect, None)
118 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[0], 0.40899187)
119 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[1], -0.80574458)
120 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[2], 0.42837054)
121
122
124 """Load the PDB file using the internal parser and calculate the XH unit vectors from it (with spin numbers removed)."""
125
126
127 self.interpreter.structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='internal')
128
129
130 self.interpreter.structure.load_spins(spin_id='@N')
131
132
133 self.interpreter.spin.number(force=True)
134
135
136 self.interpreter.structure.vectors(attached='H')
137
138
139 self.assert_(hasattr(cdp.mol[0].res[2].spin[0], 'xh_vect'))
140 self.assertEqual(cdp.mol[0].res[2].spin[0].num, None)
141 self.assertEqual(cdp.mol[0].res[2].spin[0].name, 'N')
142 self.assertNotEqual(cdp.mol[0].res[2].spin[0].xh_vect, None)
143 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[0], 0.40899187)
144 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[1], -0.80574458)
145 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].xh_vect[2], 0.42837054)
146