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-2011 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax 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 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax 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 relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Python module imports. 
24  from os import sep 
25   
26  # relax module imports. 
27  from base_classes import SystemTestCase 
28  from data import Relax_data_store; ds = Relax_data_store() 
29  from status import Status; status = Status() 
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.interpreter.run(script_file=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, 11, 28, 51, 59, 71, 91, 104, 116, 133, 150, 167] 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 xrange(12): 69 print((cdp.mol[0].res[i].spin[0])) 70 # Check the residue and spin info. 71 self.assertEqual(cdp.mol[0].res[i].num, i+1) 72 self.assertEqual(cdp.mol[0].res[i].name, res_name[i]) 73 self.assertEqual(len(cdp.mol[0].res[i].spin), 1) 74 self.assertEqual(cdp.mol[0].res[i].spin[0].num, spin_num[i]) 75 self.assertEqual(cdp.mol[0].res[i].spin[0].name, spin_name[i]) 76 77 # Angles have been calculated. 78 if hasattr(cdp.mol[0].res[i].spin[0], 'attached_atom'): 79 # The attached proton. 80 self.assertEqual(cdp.mol[0].res[i].spin[0].attached_atom, attached_atoms[i]) 81 82 # The XH vector. 83 for j in xrange(3): 84 self.assertAlmostEqual(cdp.mol[0].res[i].spin[0].xh_vect[j], xh_vects[i][j]) 85 86 # Check the alpha angles. 87 self.assertAlmostEqual(cdp.mol[0].res[i].spin[0].alpha, alpha[i]) 88 89 # No angles calculated. 90 else: 91 self.assertEqual(attached_atoms[i], None) 92 self.assert_(not hasattr(cdp.mol[0].res[i].spin[0], 'xh_vect')) 93 self.assert_(not hasattr(cdp.mol[0].res[i].spin[0], 'alpha'))
94