Author: bugman Date: Fri Jun 14 19:13:56 2013 New Revision: 20136 URL: http://svn.gna.org/viewcvs/relax?rev=20136&view=rev Log: Created the N_state_model.test_absolute_T system test. This is for checking the optimisation of absolute T=J+D values to find alignment tensors. Added: trunk/test_suite/shared_data/align_data/one_bond_RDC_data_strychnine.txt (with props) trunk/test_suite/system_tests/scripts/n_state_model/absolute_T.py Modified: trunk/test_suite/system_tests/n_state_model.py Added: trunk/test_suite/shared_data/align_data/one_bond_RDC_data_strychnine.txt URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/align_data/one_bond_RDC_data_strychnine.txt?rev=20136&view=auto ============================================================================== --- trunk/test_suite/shared_data/align_data/one_bond_RDC_data_strychnine.txt (added) +++ trunk/test_suite/shared_data/align_data/one_bond_RDC_data_strychnine.txt Fri Jun 14 19:13:56 2013 @@ -1,0 +1,23 @@ +# Spin_ID1 Spin_ID2 T=J+D error J error Sign of J distan + + @14 @35 195.2 0.27 158.2 0.12 1 1.083939 + @11 @32 205.9 0.17 168.1 0.04 1 1.078456 + @23 @45 109.4 1.64 149.4 0.11 1 1.096979 + @8 @30 113.8 0.32 124.8 0.06 1 1.096844 + @9 @31 127.4 0.21 144.9 0.007 1 1.091030 + @21 @42 156.0 0.36 158.8 0.01 1 1.086156 + @7 @29 92.1 3.16 130.8 0.08 1 1.096312 + @5 @26 173.2 0.17 148.1 0.12 1 1.094863 + @13 @34 183.0 0.16 160.2 0.12 1 1.083164 + @12 @33 174.3 0.11 158.6 0.14 1 1.083601 + @24 @46 152.2 0.27 135.3 0.05 1 1.087948 + @24 @47 97.3 1.99 125.6 0.14 1 1.094413 + @6 @27 136.0 1.44 129.7 0.14 1 1.091609 + @6 @28 129.2 0.83 130.8 0.24 1 1.092415 + @18 @38 145.5 0.31 148.2 0.28 1 1.093127 + @18 @39 156.0 0.24 130.5 0.39 1 1.098294 + @19 @40 121.6 0.39 130.4 0.03 1 1.090714 + @19 @41 128.0 3.17 138.2 0.07 1 1.094526 + @22 @44 154.5 0.18 145.5 0.02 1 1.090005 + @22 @43 94.2 0.35 136.8 0.05 1 1.098353 + Propchange: trunk/test_suite/shared_data/align_data/one_bond_RDC_data_strychnine.txt ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/test_suite/system_tests/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/n_state_model.py?rev=20136&r1=20135&r2=20136&view=diff ============================================================================== --- trunk/test_suite/system_tests/n_state_model.py (original) +++ trunk/test_suite/system_tests/n_state_model.py Fri Jun 14 19:13:56 2013 @@ -213,6 +213,65 @@ self.assertAlmostEqual(cdp.q_rdc_norm2, 0.81262759306400001) + def test_absolute_T(self): + """Test the fitting of signless T values (J+D).""" + + # Execute the script. + self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'absolute_T.py') + + # Test the optimised values. + self.assertAlmostEqual(cdp.align_tensors[0].Axx, -1.436586299657e-04) + self.assertAlmostEqual(cdp.align_tensors[0].Ayy, -5.004443735044e-04) + self.assertAlmostEqual(cdp.align_tensors[0].Axy, -5.017832275009e-05) + self.assertAlmostEqual(cdp.align_tensors[0].Axz, 1.366097786433e-04) + self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -1.614772175671e-04) + self.assertAlmostEqual(cdp.chi2, 311.70348701353225) + self.assertAlmostEqual(cdp.q_rdc, 0.0) + self.assertAlmostEqual(cdp.q_rdc_norm2, 0.086891848854541404) + + # The signless T data. + T = [195.2, 205.9, 109.4, 113.8, 127.4, 156.0, 92.1, 173.2, 183.0, 174.3, 152.2, 97.3, 136.0, 129.2, 145.5, 156.0, 121.6, 128.0, 154.5, 94.2] + T_bc = [ + 195.009353539915281, + 205.456622836526037, + 112.285085032859712, + 113.628896345578610, + 127.440986667041187, + 155.505017063790831, + 94.332271833299316, + 172.408496922639102, + 181.972859458051403, + 173.655640981746103, + 153.402585241137388, + 92.115389822570464, + 139.743303992644570, + 131.399101601878243, + 146.219317894376132, + 153.945261372587538, + 119.541444938794172, + 126.620471670822312, + 155.940753902549545, + 90.813638474619523 + ] + + # Back calc. + self.interpreter.rdc.back_calc('Gel') + + # Check the spin data. + i = 0 + for interatom in interatomic_loop(): + # No PCS. + if not hasattr(interatom, 'rdc'): + continue + + # Check the loaded and back-calculated absolute values. + self.assertAlmostEqual(interatom.rdc['Gel'], T[i]) + self.assertAlmostEqual(interatom.rdc_bc['Gel'], T_bc[i]) + + # Increment the spin index. + i += 1 + + def test_align_fit(self): """Test the use of RDCs and PCSs to find the alignment tensor.""" Added: trunk/test_suite/system_tests/scripts/n_state_model/absolute_T.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/scripts/n_state_model/absolute_T.py?rev=20136&view=auto ============================================================================== --- trunk/test_suite/system_tests/scripts/n_state_model/absolute_T.py (added) +++ trunk/test_suite/system_tests/scripts/n_state_model/absolute_T.py Fri Jun 14 19:13:56 2013 @@ -1,0 +1,51 @@ +"""Script for testing the fitting of signless T data (J+D).""" + +# Python module imports. +from os import sep + +# relax module imports. +from status import Status; status = Status() + + + +# Path of the alignment data and structure. +DATA_PATH = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'align_data' +STRUCT_PATH = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' + +# Create the data pipe. +self._execute_uf(uf_name='pipe.create', pipe_name='1J RDCs', pipe_type='N-state') + +# Load the structure. +self._execute_uf(uf_name='structure.read_xyz', file='strychnine.xyz', dir=STRUCT_PATH) + +# Set up the 13C and 1H spins information. +self._execute_uf(uf_name='structure.load_spins', spin_id='@C*', ave_pos=False) +self._execute_uf(uf_name='structure.load_spins', spin_id='@H*', ave_pos=False) + +# Define the nuclear isotopes of all spins. +self._execute_uf(uf_name='spin.isotope', isotope='13C', spin_id='@C*') +self._execute_uf(uf_name='spin.isotope', isotope='1H', spin_id='@H*') + +# Define the magnetic dipole-dipole relaxation interaction. +self._execute_uf(uf_name='interatom.read_dist', file='one_bond_RDC_data_strychnine.txt', dir=DATA_PATH, unit='Angstrom', spin_id1_col=1, spin_id2_col=2, data_col=8) +self._execute_uf(uf_name='interatom.unit_vectors', ave=False) + +# Load the J and J+D data. +self._execute_uf(uf_name='rdc.read', align_id='Gel', file='one_bond_RDC_data_strychnine.txt', dir=DATA_PATH, data_type='T', spin_id1_col=1, spin_id2_col=2, data_col=3, error_col=4, absolute=True) +self._execute_uf(uf_name='j_coupling.read', file='one_bond_RDC_data_strychnine.txt', dir=DATA_PATH, spin_id1_col=1, spin_id2_col=2, data_col=5, error_col=6, sign_col=7) + +# Set up the model. +self._execute_uf(uf_name='n_state_model.select_model', model='fixed') + +# Minimisation. +self._execute_uf(uf_name='grid_search', inc=3) +self._execute_uf(uf_name='minimise', min_algor='simplex') + +# Show the tensors. +self._execute_uf(uf_name='align_tensor.display') + +# Create a correlation plot. +self._execute_uf(uf_name='rdc.corr_plot', file='devnull', force=True) + +# Print out. +print(cdp)