Author: bugman Date: Tue Jul 3 23:20:26 2012 New Revision: 17171 URL: http://svn.gna.org/viewcvs/relax?rev=17171&view=rev Log: Converted the Dasha system test to the interatomic data design. Modified: branches/interatomic/test_suite/system_tests/dasha.py branches/interatomic/test_suite/system_tests/scripts/dasha.py Modified: branches/interatomic/test_suite/system_tests/dasha.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/test_suite/system_tests/dasha.py?rev=17171&r1=17170&r2=17171&view=diff ============================================================================== --- branches/interatomic/test_suite/system_tests/dasha.py (original) +++ branches/interatomic/test_suite/system_tests/dasha.py Tue Jul 3 23:20:26 2012 @@ -22,6 +22,7 @@ ############################################################################### # Python module imports. +from math import pi from os import sep import sys from tempfile import mkdtemp @@ -29,6 +30,7 @@ # relax module imports. from base_classes import SystemTestCase from data import Relax_data_store; ds = Relax_data_store() +from generic_fns.interatomic import interatomic_loop from generic_fns.mol_res_spin import spin_loop from relax_io import test_binary from status import Status; status = Status() @@ -69,14 +71,11 @@ # The spin data. select = [True, True, False, False] - fixed = [None, None, None, None] - proton_type = [None, None, None, None] - heteronuc_type = ['15N', '15N', '15N', '15N'] - attached_proton = [None, None, None, None] + fixed = [False, False, False, False] + isotope = ['15N', '15N', '15N', '15N'] model = ['m3', 'm3', 'm3', 'm3'] equation = ['mf_orig', 'mf_orig', 'mf_orig', 'mf_orig'] params = [['s2', 'rex'], ['s2', 'rex'], ['s2', 'rex'], ['s2', 'rex']] - xh_vect = [None, None, None, None] s2 = [0.71510, 0.64359, None, None] s2f = [None, None, None, None] s2s = [None, None, None, None] @@ -84,8 +83,8 @@ te = [None, None, None, None] tf = [None, None, None, None] ts = [None, None, None, None] - rex = [4.32701, 4.29432, None, None] - r = [1.02e-10, 1.02e-10, 1.02e-10, 1.02e-10] + rex_scale = 1.0 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]]) ** 2 + rex = [4.32701*rex_scale, 4.29432*rex_scale, None, None] csa = [-172e-6, -172e-6, -172e-6, -172e-6] chi2 = [1.9657, 0.63673, None, None] ri_data = [{'R1_600': 1.0, 'R2_600': 15.0, 'NOE_600': 0.9}, @@ -100,16 +99,19 @@ # Check the spin data. i = 0 for spin in spin_loop(): + # Protons. + if spin.isotope == '1H': + self.assertEqual(spin.select, False) + continue + # Check the data. + print spin self.assertEqual(spin.select, select[i]) self.assertEqual(spin.fixed, fixed[i]) - self.assertEqual(spin.proton_type, proton_type[i]) - self.assertEqual(spin.heteronuc_type, heteronuc_type[i]) - self.assertEqual(spin.attached_proton, attached_proton[i]) + self.assertEqual(spin.isotope, isotope[i]) self.assertEqual(spin.model, model[i]) self.assertEqual(spin.equation, equation[i]) self.assertEqual(spin.params, params[i]) - self.assertEqual(spin.xh_vect, xh_vect[i]) self.assertEqual(spin.s2, s2[i]) self.assertEqual(spin.s2f, s2f[i]) self.assertEqual(spin.s2s, s2s[i]) @@ -118,7 +120,6 @@ self.assertEqual(spin.tf, tf[i]) self.assertEqual(spin.ts, ts[i]) self.assertEqual(spin.rex, rex[i]) - self.assertAlmostEqual(spin.r, r[i]) self.assertAlmostEqual(spin.csa, csa[i]) self.assertEqual(spin.chi2, chi2[i]) for ri_id in cdp.ri_ids: @@ -127,3 +128,10 @@ # Increment the spin index. i += 1 + + # Check the interatomic data. + r = [1.02e-10, 1.02e-10, 1.02e-10, 1.02e-10] + i = 0 + for interatom in interatomic_loop(): + self.assertAlmostEqual(interatom.r, r[i]) + i += 1 Modified: branches/interatomic/test_suite/system_tests/scripts/dasha.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/test_suite/system_tests/scripts/dasha.py?rev=17171&r1=17170&r2=17171&view=diff ============================================================================== --- branches/interatomic/test_suite/system_tests/scripts/dasha.py (original) +++ branches/interatomic/test_suite/system_tests/scripts/dasha.py Tue Jul 3 23:20:26 2012 @@ -32,11 +32,25 @@ relax_data.read(ri_id='R2_600', ri_type='R2', frq=600.0*1e6, file=status.install_path+sep+'test_suite'+sep+'shared_data'+sep+'jw_mapping'+sep+'R2.dat', res_num_col=1, res_name_col=2, data_col=3, error_col=4) relax_data.read(ri_id='NOE_600', ri_type='NOE', frq=600.0*1e6, file=status.install_path+sep+'test_suite'+sep+'shared_data'+sep+'jw_mapping'+sep+'noe.dat', res_num_col=1, res_name_col=2, data_col=3, error_col=4) + # Name the spins, then attach some protons. + spin.name('N') + sequence.attach_protons() + # Setup other values. diffusion_tensor.init(1e-8, fixed=True) - value.set('15N', 'heteronuc_type') - value.set(1.02 * 1e-10, 'r') - value.set(-172 * 1e-6, 'csa') + + # Define the magnetic dipole-dipole relaxation interaction. + spin.element(element='N', spin_id='@N') + spin.element(element='H', spin_id='@H') + dipole_pair.define(spin_id1='@N', spin_id2='@H', direct_bond=True) + dipole_pair.set_dist(spin_id1='@N', spin_id2='@H', ave_dist=1.02 * 1e-10) + + # Define the chemical shift relaxation interaction. + value.set(-172 * 1e-6, 'csa', spin_id='@N') + + # Set the nuclear isotope type. + spin.isotope('15N', spin_id='@N') + spin.isotope('1H', spin_id='@H') # Select the model-free model. model_free.select_model(model=name)