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

Source Code for Module test_suite.system_tests.unit_vectors

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2008-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 status import Status; status = Status() 
28  from test_suite.system_tests.base_classes import SystemTestCase 
29   
30   
31 -class Unit_vectors(SystemTestCase):
32 """Class for testing the calculation of unit vectors.""" 33
34 - def setUp(self):
35 """Set up for all the functional tests.""" 36 37 # Create the data pipe. 38 self.interpreter.pipe.create('mf', 'mf')
39 40
41 - def test_calc_unit_vectors1(self):
42 """Load the PDB file and calculate the XH unit vectors.""" 43 44 # Read the PDB file. 45 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) 46 47 # Load the spins. 48 self.interpreter.structure.load_spins(spin_id='@N') 49 self.interpreter.structure.load_spins(spin_id='@H') 50 51 # Calculate the unit vectors. 52 self.interpreter.interatom.define(spin_id1='@N', spin_id2='@H', direct_bond=True) 53 self.interpreter.interatom.unit_vectors() 54 55 # Leu 3. 56 self.assertEqual(cdp.mol[0].res[2].spin[0].num, 24) 57 self.assertEqual(cdp.mol[0].res[2].spin[0].name, 'N') 58 self.assert_(hasattr(cdp.interatomic[0], 'vector')) 59 self.assertNotEqual(cdp.interatomic[0].vector, None) 60 self.assertAlmostEqual(cdp.interatomic[0].vector[0], 0.40899187) 61 self.assertAlmostEqual(cdp.interatomic[0].vector[1], -0.80574458) 62 self.assertAlmostEqual(cdp.interatomic[0].vector[2], 0.42837054)
63 64
65 - def test_calc_unit_vectors2(self):
66 """Load the PDB file and calculate the XH unit vectors (with spin numbers removed).""" 67 68 # Read the PDB file. 69 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) 70 71 # Load the spins. 72 self.interpreter.structure.load_spins(spin_id='@N') 73 self.interpreter.structure.load_spins(spin_id='@H') 74 75 # Remove the spin numbers. 76 self.interpreter.spin.number(force=True) 77 78 # Calculate the unit vectors. 79 self.interpreter.interatom.define(spin_id1='@N', spin_id2='@H', direct_bond=True) 80 self.interpreter.interatom.unit_vectors() 81 82 # Leu 3. 83 self.assertEqual(cdp.mol[0].res[2].spin[0].num, None) 84 self.assertEqual(cdp.mol[0].res[2].spin[0].name, 'N') 85 self.assert_(hasattr(cdp.interatomic[0], 'vector')) 86 self.assertNotEqual(cdp.interatomic[0].vector, None) 87 self.assertAlmostEqual(cdp.interatomic[0].vector[0], 0.40899187) 88 self.assertAlmostEqual(cdp.interatomic[0].vector[1], -0.80574458) 89 self.assertAlmostEqual(cdp.interatomic[0].vector[2], 0.42837054)
90