Author: bugman Date: Thu Jun 28 14:17:56 2012 New Revision: 17090 URL: http://svn.gna.org/viewcvs/relax?rev=17090&view=rev Log: Created the new Interatomic system test class for testing out the interatomic data containers. Added: branches/interatomic/test_suite/system_tests/interatomic.py - copied, changed from r17079, branches/interatomic/test_suite/system_tests/mol_res_spin.py branches/interatomic/test_suite/system_tests/scripts/interatomic_tests.py Modified: branches/interatomic/test_suite/system_tests/__init__.py Modified: branches/interatomic/test_suite/system_tests/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/test_suite/system_tests/__init__.py?rev=17090&r1=17089&r2=17090&view=diff ============================================================================== --- branches/interatomic/test_suite/system_tests/__init__.py (original) +++ branches/interatomic/test_suite/system_tests/__init__.py Thu Jun 28 14:17:56 2012 @@ -42,6 +42,7 @@ from frame_order import Frame_order from generic import Generic from grace import Grace +from interatomic import Interatomic from jw_mapping import Jw from load_spins import Load_spins from model_elimination import Modelim @@ -75,6 +76,7 @@ 'frame_order', 'generic', 'grace', + 'interatomic', 'jw_mapping', 'load_spins', 'model_elimination', @@ -158,6 +160,7 @@ suite_array.append(TestLoader().loadTestsFromTestCase(Frame_order)) suite_array.append(TestLoader().loadTestsFromTestCase(Generic)) suite_array.append(TestLoader().loadTestsFromTestCase(Grace)) + suite_array.append(TestLoader().loadTestsFromTestCase(Interatomic)) suite_array.append(TestLoader().loadTestsFromTestCase(Jw)) suite_array.append(TestLoader().loadTestsFromTestCase(Load_spins)) suite_array.append(TestLoader().loadTestsFromTestCase(Modelim)) Copied: branches/interatomic/test_suite/system_tests/interatomic.py (from r17079, branches/interatomic/test_suite/system_tests/mol_res_spin.py) URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/test_suite/system_tests/interatomic.py?p2=branches/interatomic/test_suite/system_tests/interatomic.py&p1=branches/interatomic/test_suite/system_tests/mol_res_spin.py&r1=17079&r2=17090&rev=17090&view=diff ============================================================================== --- branches/interatomic/test_suite/system_tests/mol_res_spin.py (original) +++ branches/interatomic/test_suite/system_tests/interatomic.py Thu Jun 28 14:17:56 2012 @@ -21,7 +21,7 @@ ############################################################################### # Module docstring. -"""System tests of the molecule, residue, and spin sequence operators.""" +"""System tests of the interatomic data container operations.""" # Python module imports. @@ -33,32 +33,23 @@ from status import Status; status = Status() -class Mol_res_spin(SystemTestCase): - """Class for testing the mol_res_spin functions.""" +class Interatomic(SystemTestCase): + """Class for testing the interatomic functions.""" - def setUp(self): - """Set up for all the functional tests.""" + def test_manipulation(self): + """Test the manipulation of interatomic data containers.""" - # Create the data pipe. - self.interpreter.pipe.create('mf', 'mf') + # Execute the script. + self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'interatomic_tests.py') + # The data. + select = [True]*5 + [False]*2 + [True]*5 + [False]*2 - def test_residue_delete(self): - """Test residue deletion.""" + # Check the data. + self.assertEqual(len(cdp.interatomic), 14) + for i in range(len(cdp.interatomic)): + # A print out to know where the problem is. + print("Checking container: %-30s %-30s" % (cdp.interatomic[i].spin_id1, cdp.interatomic[i].spin_id2)) - # Read a PDB file. - self.interpreter.structure.read_pdb(file='sphere.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'sphere') - - # Load the spins. - self.interpreter.structure.load_spins() - - # Test the original sequence data. - self.assertEqual(len(cdp.mol), 1) - self.assertEqual(len(cdp.mol[0].res), 9) - - # Delete the first residue. - self.interpreter.residue.delete(res_id='#sphere_mol1:1') - - # Test the remaining sequence data. - self.assertEqual(len(cdp.mol), 1) - self.assertEqual(len(cdp.mol[0].res), 8) + # The container checks. + self.assertEqual(cdp.interatomic[i].select, select[i]) Added: branches/interatomic/test_suite/system_tests/scripts/interatomic_tests.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/test_suite/system_tests/scripts/interatomic_tests.py?rev=17090&view=auto ============================================================================== --- branches/interatomic/test_suite/system_tests/scripts/interatomic_tests.py (added) +++ branches/interatomic/test_suite/system_tests/scripts/interatomic_tests.py Thu Jun 28 14:17:56 2012 @@ -1,0 +1,39 @@ +"""Script for checking operations on interatomic data containers.""" + +# Python module imports. +from os import sep + +# relax module imports. +from status import Status; status = Status() + + +# Path of the files. +str_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' + +# Create a data pipe. +self._execute_uf(uf_name='pipe.create', pipe_name="interatom testing", pipe_type='N-state') + +# Load the structures. +NUM_STR = 4 +for i in range(NUM_STR): + self._execute_uf(uf_name='structure.read_pdb', file='lactose_MCMM4_S1_'+repr(i+1), dir=str_path, parser='internal', set_model_num=i+1, set_mol_name='lactose_MCMM4_S1') + +# Load the sequence information. +self._execute_uf(uf_name='structure.load_spins', spin_id=':UNK@C*', ave_pos=False) +self._execute_uf(uf_name='structure.load_spins', spin_id=':UNK@H*', ave_pos=False) + +# Deselect the CH2 protons (the rotation of these doesn't work in the model, but the carbon doesn't move). +self._execute_uf(uf_name='deselect.spin', spin_id=':UNK@H6') +self._execute_uf(uf_name='deselect.spin', spin_id=':UNK@H7') +self._execute_uf(uf_name='deselect.spin', spin_id=':UNK@H17') +self._execute_uf(uf_name='deselect.spin', spin_id=':UNK@H18') + +# Create the interatomic data containers. +self._execute_uf(uf_name='dipole_pair.define', spin_id1='@C*', spin_id2='@H*', direct_bond=True) + +# Deselect all. +self._execute_uf(uf_name='deselect.interatom') + +# Select the non-CH2 bonds. +for i in [1, 2, 3, 4, 5, 7, 8, 9, 10, 11]: + self._execute_uf(uf_name='select.interatom', spin_id1=':UNK@C%i'%i)