Author: bugman Date: Mon Oct 24 12:11:07 2011 New Revision: 14893 URL: http://svn.gna.org/viewcvs/relax?rev=14893&view=rev Log: Created the Frame_order.test_cam_rigid system test and optimisation script. Added: 1.3/test_suite/system_tests/scripts/frame_order/cam/ 1.3/test_suite/system_tests/scripts/frame_order/cam/rigid.py Modified: 1.3/test_suite/system_tests/frame_order.py Modified: 1.3/test_suite/system_tests/frame_order.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/frame_order.py?rev=14893&r1=14892&r2=14893&view=diff ============================================================================== --- 1.3/test_suite/system_tests/frame_order.py (original) +++ 1.3/test_suite/system_tests/frame_order.py Mon Oct 24 12:11:07 2011 @@ -157,6 +157,21 @@ setattr(cdp, param, curr) + def test_cam_rigid(self): + """Test the rigid frame order model of CaM.""" + + # Execute the script. + self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'cam'+sep+'rigid.py') + + # Check the average structure atomic positions (to only one decimal point as the PDB file accuracy isn't great). + ave_pos = ds['ave pos'].structure.structural_data[0].mol[0] + orig_pos = ds['orig pos'].structure.structural_data[0].mol[0] + for i in range(len(ave_pos.atom_name)): + self.assertAlmostEqual(ave_pos.x[i], orig_pos.x[i], 1) + self.assertAlmostEqual(ave_pos.y[i], orig_pos.y[i], 1) + self.assertAlmostEqual(ave_pos.z[i], orig_pos.z[i], 1) + + def test_model_free_rotor(self): """Test the free rotor frame order model.""" Added: 1.3/test_suite/system_tests/scripts/frame_order/cam/rigid.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/frame_order/cam/rigid.py?rev=14893&view=auto ============================================================================== --- 1.3/test_suite/system_tests/scripts/frame_order/cam/rigid.py (added) +++ 1.3/test_suite/system_tests/scripts/frame_order/cam/rigid.py Mon Oct 24 12:11:07 2011 @@ -1,0 +1,100 @@ +# Script for optimising the rigid frame order test model of CaM. + +# Python module imports. +from numpy import array, float64, transpose, zeros +from os import sep + +# relax module imports. +from maths_fns.rotation_matrix import euler_to_R_zyz +from status import Status; status = Status() + + +# Some variables. +DATA_PATH = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep + + +class Analysis: + def __init__(self): + """Execute the frame order analysis.""" + + # Optimise. + self.optimisation() + + # The rotation matrix. + R = zeros((3, 3), float64) + euler_to_R_zyz(cdp.ave_pos_alpha, cdp.ave_pos_beta, cdp.ave_pos_gamma, R) + print("Rotation matrix:\n%s\n" % R) + R = transpose(R) + print("Inverted rotation:\n%s\n" % R) + + # Load the original structure. + self.original_structure() + + # Domain transformation. + self.transform(R, array([ 37.254, 0.5, 16.7465])) + + + def optimisation(self): + """Optimise the frame order model.""" + + # The file paths. + PATH_N_DOM = DATA_PATH + PATH_C_DOM = PATH_N_DOM+sep+'rigid'+sep + + # Create the data pipe. + pipe.create(pipe_name='frame order', pipe_type='frame order') + + # Load the tensors. + script(PATH_N_DOM + 'tensors.py') + script(PATH_C_DOM + 'tensors.py') + + # The tensor domains and reductions. + full = ['Dy N-dom', 'Tb N-dom', 'Tm N-dom', 'Er N-dom'] + red = ['Dy C-dom', 'Tb C-dom', 'Tm C-dom', 'Er C-dom'] + for i in range(len(full)): + align_tensor.set_domain(tensor=full[i], domain='N') + align_tensor.set_domain(tensor=red[i], domain='C') + align_tensor.reduction(full_tensor=full[i], red_tensor=red[i]) + + # Select the model. + frame_order.select_model('rigid') + + # Set the reference domain. + frame_order.ref_domain('N') + + # Optimise. + grid_search(inc=3) + minimise('simplex', constraints=False) + + # Write the results. + results.write('devnull', dir=None, force=True) + + + def original_structure(self): + """Load the original structure into a dedicated data pipe.""" + + # Create a special data pipe for the original rigid body position. + pipe.create(pipe_name='orig pos', pipe_type='frame order') + + # Load the structure. + structure.read_pdb(DATA_PATH+'1J7P_1st_NH.pdb') + + + def transform(self, R, pivot): + """Transform the domain to the average position.""" + + # Create a special data pipe for the average rigid body position. + pipe.create(pipe_name='ave pos', pipe_type='frame order') + + # Load the structure. + structure.read_pdb(DATA_PATH+'1J7P_1st_NH_rot.pdb') + + # Rotate all atoms. + structure.rotate(R=R, origin=pivot) + + # Write out the new PDB. + structure.write_pdb('devnull') + + +# Execute the analysis. +Analysis()