Package test_suite :: Package system_tests :: Module angles
[hide private]
[frames] | no frames]

Source Code for Module test_suite.system_tests.angles

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2006-2013 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
 6  #                                                                             # 
 7  # This program is free software: you can redistribute it and/or modify        # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation, either version 3 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # This program is distributed in the hope that it will be useful,             # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
19  #                                                                             # 
20  ############################################################################### 
21   
22  # Python module imports. 
23  from os import sep 
24   
25  # relax module imports. 
26  from data_store import Relax_data_store; ds = Relax_data_store() 
27  from pipe_control.interatomic import return_interatom_list 
28  from status import Status; status = Status() 
29  from test_suite.system_tests.base_classes import SystemTestCase 
30   
31   
32 -class Angles(SystemTestCase):
33 """Class for testing the angle calculation function.""" 34
35 - def test_angles(self):
36 """The user function angles().""" 37 38 # Execute the script. 39 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'angles.py') 40 41 # Res info. 42 res_name = ['GLY', 'PRO', 'LEU', 'GLY', 'SER', 'MET', 'ASP', 'SER', 'PRO', 'PRO', 'GLU', 'GLY'] 43 spin_num = [1, 10, 24, 43, 50, 61, 78, 90, 101, 115, 129, 144] 44 spin_name = ['N']*12 45 attached_atoms = [None, None, 'H', 'H', 'H', 'H', 'H', 'H', None, None, 'H', 'H'] 46 xh_vects = [ 47 None, 48 None, 49 [0.408991870425, -0.805744582632, 0.428370537602], 50 [-0.114123686687, -0.989411605119, -0.0896686109685], 51 [-0.0162975723187, -0.975817142584, 0.217980029763], 52 [-0.255934111969, -0.960517663248, -0.109103386377], 53 [0.922628022844, 0.38092966093, 0.0604162634271], 54 [0.926402811426, 0.281593806116, 0.249965516299], 55 None, 56 None, 57 [0.820296708196, 0.570330671495, -0.0428513205774], 58 [-0.223383112106, -0.034680483158, -0.974113571055] 59 ] 60 alpha = [None, None, 2.8102691247870459, 2.6063738282640672, 2.9263088853837358, 2.5181004004450211, 1.3361463581932049, 1.5031623128368377, None, None, 1.0968465542222101, 1.1932423104331247] 61 62 # Molecule checks. 63 self.assertEqual(len(cdp.mol), 1) 64 self.assertEqual(cdp.mol[0].name, 'Ap4Aase_res1-12_mol1') 65 self.assertEqual(len(cdp.mol[0].res), 12) 66 67 # Checks for the first 12 residues. 68 for i in range(12): 69 # Check the residue and spin info. 70 self.assertEqual(cdp.mol[0].res[i].num, i+1) 71 self.assertEqual(cdp.mol[0].res[i].name, res_name[i]) 72 self.assertEqual(cdp.mol[0].res[i].spin[0].num, spin_num[i]) 73 self.assertEqual(cdp.mol[0].res[i].spin[0].name, spin_name[i]) 74 75 # Get the interatomic container. 76 interatoms = return_interatom_list(cdp.mol[0].res[i].spin[0]._spin_ids[0]) 77 78 # Check the containers. 79 self.assert_(len(interatoms) <= 1) 80 81 # No interatomic container. 82 if not interatoms: 83 # The spin info. 84 self.assertEqual(len(cdp.mol[0].res[i].spin), 1) 85 86 # Check the interatomic info. 87 else: 88 # The spin info. 89 self.assertEqual(len(cdp.mol[0].res[i].spin), 2) 90 self.assertEqual(cdp.mol[0].res[i].spin[1].name, attached_atoms[i]) 91 92 # The vector. 93 for j in range(3): 94 self.assertAlmostEqual(interatoms[0].vector[j], xh_vects[i][j]) 95 96 # Check the alpha angles. 97 self.assertAlmostEqual(interatoms[0].alpha, alpha[i])
98