mailr12268 - in /1.3/test_suite/system_tests: model_free.py scripts/model_free/opt_tm0_grid.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on January 12, 2011 - 21:55:
Author: bugman
Date: Wed Jan 12 21:55:48 2011
New Revision: 12268

URL: http://svn.gna.org/viewcvs/relax?rev=12268&view=rev
Log:
Added a system test for the optimisation of the tm0 model-free parameter grid.


Added:
    1.3/test_suite/system_tests/scripts/model_free/opt_tm0_grid.py
      - copied, changed from r12261, 
1.3/test_suite/system_tests/scripts/model_free/opt_tm2_grid.py
Modified:
    1.3/test_suite/system_tests/model_free.py

Modified: 1.3/test_suite/system_tests/model_free.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/model_free.py?rev=12268&r1=12267&r2=12268&view=diff
==============================================================================
--- 1.3/test_suite/system_tests/model_free.py (original)
+++ 1.3/test_suite/system_tests/model_free.py Wed Jan 12 21:55:48 2011
@@ -2091,6 +2091,17 @@
         self.assertEqual(cdp.mol[0].res[1].spin[0].r, NH_BOND_LENGTH)
 
 
+    def test_tm0_grid(self):
+        """Test the optimisation of the tm0 model-free parameter grid."""
+
+        # Initialise.
+        cdp._model = 'tm0'
+        cdp._value_test = self.value_test
+
+        # Setup the data pipe for optimisation.
+        self.interpreter.run(script_file=status.install_path + 
sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
+
+
     def test_tm2_grid(self):
         """Test the optimisation of the tm2 model-free parameter grid."""
 

Copied: 1.3/test_suite/system_tests/scripts/model_free/opt_tm0_grid.py (from 
r12261, 1.3/test_suite/system_tests/scripts/model_free/opt_tm2_grid.py)
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/model_free/opt_tm0_grid.py?p2=1.3/test_suite/system_tests/scripts/model_free/opt_tm0_grid.py&p1=1.3/test_suite/system_tests/scripts/model_free/opt_tm2_grid.py&r1=12261&r2=12268&rev=12268&view=diff
==============================================================================
--- 1.3/test_suite/system_tests/scripts/model_free/opt_tm2_grid.py (original)
+++ 1.3/test_suite/system_tests/scripts/model_free/opt_tm0_grid.py Wed Jan 12 
21:55:48 2011
@@ -2,17 +2,21 @@
 
 # Python module imports.
 from os import sep
+from re import search
 
 # relax module imports.
 from status import Status; status = Status()
 
 
+# The model-free parameters.
+tm = [2e-9, 10e-9, 80e-9]
+
 # Path of the files.
-path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'tm2_grid'
+path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'tm0_grid'
 
 # Create the sequence.
 molecule.create(mol_name='Polycarbonate')
-for i in range(3*3*3):
+for i in range(len(tm)):
     spin.create(spin_num=1, spin_name='C1', res_num=i+1, 
res_name='Bisphenol_A', mol_name='Polycarbonate')
 
 # The proton frequencies in MHz.
@@ -25,18 +29,13 @@
     relax_data.read('R2',  frq[i], float(frq[i])*1e6, 'r2.%s.out' % frq[i],  
dir=path, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, 
spin_name_col=5, data_col=6, error_col=7)
 
 # Setup other values.
-value.set(1.20 * 1e-10, 'bond_length')
-value.set(200 * 1e-6, 'csa')
-value.set('13C', 'heteronucleus')
+value.set(1.04 * 1e-10, 'bond_length')
+value.set(-160 * 1e-6, 'csa')
+value.set('15N', 'heteronucleus')
 value.set('1H', 'proton')
 
 # Select the model-free model.
 model_free.select_model(model=cdp._model)
-
-# The model-free parameters.
-tm = [2e-9, 10e-9, 21e-9]
-s2 = [0.2, 0.8, 0.95]
-te = [2e-12, 40e-12, 1e-9]
 
 # Deselect all spins.
 deselect.spin()
@@ -44,45 +43,41 @@
 # Residue index.
 res_index = 0
 
-# Loop over te.
-for te_index in range(3):
-    # Loop over s2.
-    for s2_index in range(3):
-        # Loop over tm.
-        for tm_index in range(3):
-            # Alias the relevent spin container.
-            spin = cdp.mol[0].res[res_index].spin[0]
+# Loop over tm.
+for tm_index in range(len(tm)):
+    # Alias the relevent spin container.
+    spin = cdp.mol[0].res[res_index].spin[0]
 
-            # Select the spin.
-            spin.select = True
+    # Select the spin.
+    spin.select = True
 
-            # Set up the diffusion tensor.
-            if cdp._model in ['m2', 'm4']:
-                if res_index:
-                    diffusion_tensor.delete()
-                diffusion_tensor.init(tm[tm_index])
+    # Set up the diffusion tensor.
+    if search('^m', cdp._model):
+        if res_index:
+            diffusion_tensor.delete()
+        diffusion_tensor.init(tm[tm_index])
 
-            # Set up the initial model-free parameter values (bypass the 
grid search for speed).
-            if cdp._model in ['tm2']:
-                spin.local_tm = tm[tm_index] + 1e-11
-            if cdp._model in ['tm2', 'm2', 'm4']:
-                spin.s2 = s2[s2_index] - 0.01
-            if cdp._model in ['tm2', 'm2', 'm4']:
-                spin.te = te[te_index] + 1e-12
-            if cdp._model in ['m4']:
-                spin.rex = 0.1 / (2.0 * pi * spin.frq[0])**2
+    # Set up the initial model-free parameter values (bypass the grid search 
for speed).
+    if search('^t', cdp._model):
+        spin.local_tm = tm[tm_index] + 1e-11
+    if cdp._model in ['tm2', 'm2']:
+        spin.s2 = 0.98
+    if cdp._model in ['tm2', 'm2']:
+        spin.te = 1e-12
+    if cdp._model in ['m3']:
+        spin.rex = 0.1 / (2.0 * pi * spin.frq[0])**2
 
-            # Minimise.
-            minimise('newton', 'gmw', 'back', constraints=False)
+    # Minimise.
+    minimise('newton', 'gmw', 'back', constraints=False)
 
-            # Check the values.
-            if cdp._model == 'm2':
-                cdp._value_test(spin, s2=s2[s2_index], te=te[te_index]*1e12, 
chi2=0.0)
-            elif cdp._model == 'm4':
-                cdp._value_test(spin, s2=s2[s2_index], te=te[te_index]*1e12, 
rex=0.0, chi2=0.0)
-            elif cdp._model == 'tm2':
-                cdp._value_test(spin, local_tm=tm[tm_index]*1e9, 
s2=s2[s2_index], te=te[te_index]*1e12, chi2=0.0)
+    # Check the values.
+    if cdp._model == 'm2':
+        cdp._value_test(spin, s2=s2[s2_index], te=te[te_index]*1e12, 
chi2=0.0)
+    elif cdp._model == 'm4':
+        cdp._value_test(spin, s2=s2[s2_index], te=te[te_index]*1e12, 
rex=0.0, chi2=0.0)
+    elif cdp._model == 'tm2':
+        cdp._value_test(spin, local_tm=tm[tm_index]*1e9, s2=s2[s2_index], 
te=te[te_index]*1e12, chi2=0.0)
 
-            # Increment the residue index and deselect the spin.
-            res_index += 1
-            spin.select = False
+    # Increment the residue index and deselect the spin.
+    res_index += 1
+    spin.select = False




Related Messages


Powered by MHonArc, Updated Wed Jan 12 22:00:02 2011