Author: bugman Date: Fri Mar 19 14:48:22 2010 New Revision: 11038 URL: http://svn.gna.org/viewcvs/relax?rev=11038&view=rev Log: Created the sphere and spheroid diffusion tensor optimisation system tests. Added: 1.3/test_suite/system_tests/scripts/diff_tensor/tensor_opt.py - copied, changed from r11033, 1.3/test_suite/system_tests/scripts/diff_tensor/ellipsoid_opt.py Removed: 1.3/test_suite/system_tests/scripts/diff_tensor/ellipsoid_opt.py Modified: 1.3/test_suite/system_tests/diffusion_tensor.py Modified: 1.3/test_suite/system_tests/diffusion_tensor.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/diffusion_tensor.py?rev=11038&r1=11037&r2=11038&view=diff ============================================================================== --- 1.3/test_suite/system_tests/diffusion_tensor.py (original) +++ 1.3/test_suite/system_tests/diffusion_tensor.py Fri Mar 19 14:48:22 2010 @@ -436,5 +436,34 @@ # Reset the relax data storage object. ds.__reset__() + # The diffusion type (used by the script). + ds.diff_type = 'ellipsoid' + # Execute the script. - self.interpreter.run(script_file=__main__.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'diff_tensor'+sep+'ellipsoid_opt.py') + self.interpreter.run(script_file=__main__.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'diff_tensor'+sep+'tensor_opt.py') + + + def test_opt_sphere(self): + """Check that the sphere diffusion tensor optimisation functions correctly.""" + + # Reset the relax data storage object. + ds.__reset__() + + # The diffusion type (used by the script). + ds.diff_type = 'sphere' + + # Execute the script. + self.interpreter.run(script_file=__main__.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'diff_tensor'+sep+'tensor_opt.py') + + + def test_opt_spheroid(self): + """Check that the spheroid diffusion tensor optimisation functions correctly.""" + + # Reset the relax data storage object. + ds.__reset__() + + # The diffusion type (used by the script). + ds.diff_type = 'spheroid' + + # Execute the script. + self.interpreter.run(script_file=__main__.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'diff_tensor'+sep+'tensor_opt.py') Removed: 1.3/test_suite/system_tests/scripts/diff_tensor/ellipsoid_opt.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/diff_tensor/ellipsoid_opt.py?rev=11037&view=auto ============================================================================== --- 1.3/test_suite/system_tests/scripts/diff_tensor/ellipsoid_opt.py (original) +++ 1.3/test_suite/system_tests/scripts/diff_tensor/ellipsoid_opt.py (removed) @@ -1,44 +1,0 @@ -"""Script for testing diffusion tensor optimisation.""" - -# Python module imports. -import __main__ -from numpy import array, float64 -from os import sep -import sys - - -# A data pipe. -pipe.create('diff_opt', 'mf') - -# Path of the files. -path = __main__.install_path + sep+'test_suite'+sep+'shared_data'+sep+'diffusion_tensor'+sep+'ellipsoid' - -# Load the sequence. -sequence.read('NOE.500.out', dir=path, res_num_col=1) - -# Load a PDB file. -structure.read_pdb('uniform.pdb', dir=path) - -# Set the spin name and then load the NH vectors. -spin.name(name='N') -structure.vectors(spin_id='@N', attached='H*', ave=False) - -# Load the relaxation data. -frq = array([500, 600, 700, 800], float64) -for i in range(len(frq)): - relax_data.read('R1', str(int(frq[i])), frq[i] * 1e6, 'R1.%s.out'%str(int(frq[i])), dir=path, res_num_col=1, data_col=2, error_col=3) - relax_data.read('R2', str(int(frq[i])), frq[i] * 1e6, 'R2.%s.out'%str(int(frq[i])), dir=path, res_num_col=1, data_col=2, error_col=3) - relax_data.read('NOE', str(int(frq[i])), frq[i] * 1e6, 'NOE.%s.out'%str(int(frq[i])), dir=path, res_num_col=1, data_col=2, error_col=3) - -# Setup other values. -diffusion_tensor.init((8.3333333333333335e-09, 15000000.0, 0.33333333333333331, 1.0, 2.0, 0.5), fixed=False) -value.set(1.02 * 1e-10, 'bond_length') -value.set(-172 * 1e-6, 'csa') -value.set('15N', 'heteronucleus') -value.set('1H', 'proton') - -# Select the model-free model. -model_free.select_model(model='m0') - -# Optimisation. -minimise('newton') Copied: 1.3/test_suite/system_tests/scripts/diff_tensor/tensor_opt.py (from r11033, 1.3/test_suite/system_tests/scripts/diff_tensor/ellipsoid_opt.py) URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/diff_tensor/tensor_opt.py?p2=1.3/test_suite/system_tests/scripts/diff_tensor/tensor_opt.py&p1=1.3/test_suite/system_tests/scripts/diff_tensor/ellipsoid_opt.py&r1=11033&r2=11038&rev=11038&view=diff ============================================================================== --- 1.3/test_suite/system_tests/scripts/diff_tensor/ellipsoid_opt.py (original) +++ 1.3/test_suite/system_tests/scripts/diff_tensor/tensor_opt.py Fri Mar 19 14:48:22 2010 @@ -6,12 +6,15 @@ from os import sep import sys +# relax module imports. +from data import Relax_data_store; ds = Relax_data_store() + # A data pipe. pipe.create('diff_opt', 'mf') # Path of the files. -path = __main__.install_path + sep+'test_suite'+sep+'shared_data'+sep+'diffusion_tensor'+sep+'ellipsoid' +path = __main__.install_path + sep+'test_suite'+sep+'shared_data'+sep+'diffusion_tensor'+sep+ds.diff_type # Load the sequence. sequence.read('NOE.500.out', dir=path, res_num_col=1) @@ -30,8 +33,17 @@ relax_data.read('R2', str(int(frq[i])), frq[i] * 1e6, 'R2.%s.out'%str(int(frq[i])), dir=path, res_num_col=1, data_col=2, error_col=3) relax_data.read('NOE', str(int(frq[i])), frq[i] * 1e6, 'NOE.%s.out'%str(int(frq[i])), dir=path, res_num_col=1, data_col=2, error_col=3) +# Initialise the diffusion tensors. +if ds.diff_type == 'sphere': + diffusion_tensor.init(1.0/(6.0*2e7), fixed=False) +elif ds.diff_type == 'spheroid': + diffusion_tensor.init((1.0/(6.0*5e7/3.0), -1e7, 2.0, 0.5), fixed=False) +elif ds.diff_type == 'ellipsoid': + diffusion_tensor.init((8.3333333333333335e-09, 15000000.0, 0.33333333333333331, 1.0, 2.0, 0.5), fixed=False) +else: + raise RelaxError, "The diffusion type '%s' is unknown." % ds.diff_type + # Setup other values. -diffusion_tensor.init((8.3333333333333335e-09, 15000000.0, 0.33333333333333331, 1.0, 2.0, 0.5), fixed=False) value.set(1.02 * 1e-10, 'bond_length') value.set(-172 * 1e-6, 'csa') value.set('15N', 'heteronucleus')