Author: bugman Date: Fri Dec 14 17:00:41 2012 New Revision: 18139 URL: http://svn.gna.org/viewcvs/relax?rev=18139&view=rev Log: Created the N_state_model.test_frame_order_align_fit to demonstrate a rare bug. This bug is when alignment tensors, RDC and PCS data is copied from a frame order data pipe to a N-state model data pipe and a single tensor is optimised. Added: branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/frame_order_align_fit.py - copied, changed from r18137, branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/missing_data_test.py Modified: branches/frame_order_testing/test_suite/system_tests/n_state_model.py Modified: branches/frame_order_testing/test_suite/system_tests/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/n_state_model.py?rev=18139&r1=18138&r2=18139&view=diff ============================================================================== --- branches/frame_order_testing/test_suite/system_tests/n_state_model.py (original) +++ branches/frame_order_testing/test_suite/system_tests/n_state_model.py Fri Dec 14 17:00:41 2012 @@ -439,6 +439,33 @@ self.assertEqual(spin_orig.pcs[id], spin_new.pcs[id]) + def test_frame_order_align_fit(self): + """Test the use of alignment tensors, RDCs and PCSs from a frame order data pipe for the N-state model.""" + + # Execute the script. + self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'frame_order_align_fit.py') + + # The actual tensors. + A_5D = [] + A_5D.append([1.42219822168827662867e-04, -1.44543001566521341940e-04, -7.07796211648713973798e-04, -6.01619494082773244303e-04, 2.02008007072950861996e-04]) + A_5D.append([3.56720663040924505435e-04, -2.68385787902088840916e-04, -1.69361406642305853832e-04, 1.71873715515064501074e-04, -3.05790155096090983822e-04]) + A_5D.append([2.32088908680377300801e-07, 2.08076808579168379617e-06, -2.21735465435989729223e-06, -3.74311563209448033818e-06, -2.40784858070560310370e-06]) + A_5D.append([-2.62495279588228071048e-04, 7.35617367964106275147e-04, 6.39754192258981332648e-05, 6.27880171180572523460e-05, 2.01197582457700226708e-04]) + + # Check the tensors. + for i in range(1): + self.assertAlmostEqual(cdp.align_tensors[i].Axx, A_5D[i][0]) + self.assertAlmostEqual(cdp.align_tensors[i].Ayy, A_5D[i][1]) + self.assertAlmostEqual(cdp.align_tensors[i].Axy, A_5D[i][2]) + self.assertAlmostEqual(cdp.align_tensors[i].Axz, A_5D[i][3]) + self.assertAlmostEqual(cdp.align_tensors[i].Ayz, A_5D[i][4]) + + # Test the optimised values. + self.assertAlmostEqual(cdp.chi2, 0.0) + self.assertAlmostEqual(cdp.q_rdc, 0.0) + self.assertAlmostEqual(cdp.q_pcs, 0.0) + + def test_lactose_n_state_fixed(self): """The 4-state model analysis of lactose using RDCs and PCSs.""" Copied: branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/frame_order_align_fit.py (from r18137, branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/missing_data_test.py) URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/frame_order_align_fit.py?p2=branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/frame_order_align_fit.py&p1=branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/missing_data_test.py&r1=18137&r2=18139&rev=18139&view=diff ============================================================================== --- branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/missing_data_test.py (original) +++ branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/frame_order_align_fit.py Fri Dec 14 17:00:41 2012 @@ -12,7 +12,7 @@ data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'align_data'+sep+'missing_data' # Create the data pipe. -self._execute_uf(uf_name='pipe.create', pipe_name='missing_data_test', pipe_type='N-state') +self._execute_uf(uf_name='pipe.create', pipe_name='orig', pipe_type='frame order') # Load the structure. self._execute_uf(uf_name='structure.read_pdb', file='LE_trunc.pdb', dir=str_path, set_mol_name='LE') @@ -51,17 +51,36 @@ # The frequency. self._execute_uf(uf_name='frq.set', id=align_list[i], frq=799.75376122 * 1e6) + # Initialise an alignment tensor. + self._execute_uf(uf_name='align_tensor.init', tensor=align_list[i], align_id=align_list[i], params=(0, 0, 0, 0, 0)) + # Set the paramagnetic centre. self._execute_uf(uf_name='paramag.centre', pos=[1, 2, -30]) + +# Create a new data pipe by copying the old, and switch to it. +self._execute_uf(uf_name='pipe.copy', pipe_to='copy') +self._execute_uf(uf_name='pipe.switch', pipe_name='copy') + +# Change the data pipe type. +self._execute_uf(uf_name='pipe.change_type', pipe_type='N-state') + +# Delete all the alignment data. +self._execute_uf(uf_name='rdc.delete') +self._execute_uf(uf_name='pcs.delete') +self._execute_uf(uf_name='align_tensor.delete') + +# Copy the tensor back. +self._execute_uf(uf_name='align_tensor.copy', pipe_from='orig', tensor_from='Dy') + +# Copy the alignment data. +self._execute_uf(uf_name='rdc.copy', pipe_from='orig', align_id='Dy') +self._execute_uf(uf_name='pcs.copy', pipe_from='orig', align_id='Dy') # Set up the model. self._execute_uf(uf_name='n_state_model.select_model', model='fixed') # Minimisation. -self._execute_uf(uf_name='minimise', min_algor='bfgs', constraints=True) +self._execute_uf(uf_name='minimise', min_algor='newton', constraints=True) # Write out a results file. self._execute_uf(uf_name='results.write', file='devnull', force=True) - -# Show the tensors. -self._execute_uf(uf_name='align_tensor.display')