mailr15275 - /branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/rigid.py


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

Header


Content

Posted by edward on January 27, 2012 - 11:40:
Author: bugman
Date: Fri Jan 27 11:40:15 2012
New Revision: 15275

URL: http://svn.gna.org/viewcvs/relax?rev=15275&view=rev
Log:
Updated the rigid frame order model system test script.

This now matches the 
/test_suite/shared_data/frame_order/cam/rigid/frame_order.py script.


Modified:
    
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/rigid.py

Modified: 
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/rigid.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/rigid.py?rev=15275&r1=15274&r2=15275&view=diff
==============================================================================
--- 
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/rigid.py
 (original)
+++ 
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/rigid.py
 Fri Jan 27 11:40:15 2012
@@ -5,13 +5,14 @@
 from os import sep
 
 # relax module imports.
-from generic_fns.structure.mass import centre_of_mass
+from data import Relax_data_store; ds = Relax_data_store()
 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
+BASE_PATH = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep
+DATA_PATH = BASE_PATH + 'rigid'
 
 
 class Analysis:
@@ -21,40 +22,75 @@
         # 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]))
+        self.transform()
+
+        # Display in pymol.
+        self.pymol_display()
+
+        # Save the state.
+        state.save('devnull', force=True)
 
 
     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')
+        # Read the structures.
+        structure.read_pdb('1J7O_1st_NH.pdb', dir=BASE_PATH, 
set_mol_name='N-dom')
+        structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=BASE_PATH, 
set_mol_name='C-dom')
+
+        # Load the spins.
+        structure.load_spins('@N')
+        structure.load_spins('@H')
+
+        # Load the NH vectors.
+        structure.vectors(spin_id='@N', attached='H', ave=False)
+
+        # Set the values needed to calculate the dipolar constant.
+        value.set(1.041 * 1e-10, 'r', spin_id="@N")
+        value.set('15N', 'heteronuc_type', spin_id="@N")
+        value.set('1H', 'proton_type', spin_id="@N")
+
+        # Loop over the alignments.
+        ln = ['dy', 'tb', 'tm', 'er']
+        for i in range(len(ln)):
+            # Load the RDCs.
+            if ds.flag_rdc:
+                rdc.read(align_id=ln[i], file='rdc_%s.txt'%ln[i], 
dir=DATA_PATH, res_num_col=2, spin_name_col=5, data_col=6, error_col=7)
+
+            # The PCS.
+            if ds.flag_pcs:
+                pcs.read(align_id=ln[i], file='pcs_%s.txt'%ln[i], 
dir=DATA_PATH, res_num_col=2, spin_name_col=5, data_col=6, error_col=7)
+
+            # The temperature and field strength.
+            temperature(id=ln[i], temp=303)
+            frq.set(id=ln[i], frq=900e6)
+
+        # Load the N-domain tensors (the full tensors).
+        script(BASE_PATH + 'tensors.py')
+
+        # Define the domains.
+        domain(id='N', spin_id=":1-78")
+        domain(id='C', spin_id=":80-148")
 
         # 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)):
+            # Initialise the reduced tensor.
+            align_tensor.init(tensor=red[i], params=(0,0,0,0,0))
+
+            # Set the domain info.
             align_tensor.set_domain(tensor=full[i], domain='N')
             align_tensor.set_domain(tensor=red[i], domain='C')
+
+            # Specify which tensor is reduced.
             align_tensor.reduction(full_tensor=full[i], red_tensor=red[i])
 
         # Select the model.
@@ -63,17 +99,32 @@
         # Set the reference domain.
         frame_order.ref_domain('N')
 
+        # Set the initial pivot point.
+        pivot = array([ 37.254, 0.5, 16.7465])
+        frame_order.pivot(pivot, fix=True)
+
+        # Set the paramagnetic centre.
+        paramag.centre(pos=[35.934, 12.194, -4.206])
+
+        # Check the minimum.
+        value.set(val=4.3434999280669997, param='ave_pos_alpha')
+        value.set(val=0.43544332764249905, param='ave_pos_beta')
+        value.set(val=3.8013235235956007, param='ave_pos_gamma')
+        calc()
+        print("\nchi2: %s" % cdp.chi2)
+
         # Optimise.
-        grid_search(inc=3)
-        minimise('simplex', constraints=False)
+        if ds.flag_opt:
+            grid_search(inc=11)
+            minimise('simplex', constraints=False)
 
-         # Test Monte Carlo simulations.
-        monte_carlo.setup(number=3)
-        monte_carlo.create_data()
-        monte_carlo.initial_values()
-        minimise('simplex', constraints=False)
-        eliminate()
-        monte_carlo.error_analysis()
+            # Test Monte Carlo simulations.
+            monte_carlo.setup(number=3)
+            monte_carlo.create_data()
+            monte_carlo.initial_values()
+            minimise('simplex', constraints=False)
+            eliminate()
+            monte_carlo.error_analysis()
 
         # Write the results.
         results.write('devnull', dir=None, force=True)
@@ -86,20 +137,47 @@
         pipe.create(pipe_name='orig pos', pipe_type='frame order')
 
         # Load the structure.
-        structure.read_pdb(DATA_PATH+'1J7P_1st_NH.pdb')
-
-        # Store the centre of mass.
-        cdp.CoM = centre_of_mass()
+        structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=BASE_PATH)
 
 
-    def transform(self, R, pivot):
+    def pymol_display(self):
+        """Display the results in PyMOL."""
+
+        # Switch back to the main data pipe.
+        pipe.switch('frame order')
+
+        # Load the PDBs of the 2 domains.
+        structure.read_pdb('1J7O_1st_NH.pdb', dir='..')
+        structure.read_pdb('1J7P_1st_NH_rot.pdb', dir='..')
+
+        # Create the cone PDB file.
+        #frame_order.cone_pdb(file='cone.pdb', force=True)
+
+        # Set the domains.
+        frame_order.domain_to_pdb(domain='N', pdb='1J7O_1st_NH.pdb')
+        frame_order.domain_to_pdb(domain='C', pdb='1J7P_1st_NH_rot.pdb')
+
+
+
+    def transform(self):
         """Transform the domain to the average position."""
+
+        # Switch back to the main data pipe.
+        pipe.switch('frame order')
+
+        # 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)
+        pivot = cdp.pivot
 
         # 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')
+        structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=BASE_PATH)
 
         # Rotate all atoms.
         structure.rotate(R=R, origin=pivot)
@@ -107,9 +185,6 @@
         # Write out the new PDB.
         structure.write_pdb('devnull')
 
-        # Store the centre of mass.
-        cdp.CoM = centre_of_mass()
-
 
 # Execute the analysis.
 Analysis()




Related Messages


Powered by MHonArc, Updated Fri Jan 27 12:00:03 2012