mailr14904 - in /1.3/test_suite/system_tests: frame_order.py scripts/frame_order/cam/free_rotor.py


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

Header


Content

Posted by edward on October 24, 2011 - 16:35:
Author: bugman
Date: Mon Oct 24 16:35:42 2011
New Revision: 14904

URL: http://svn.gna.org/viewcvs/relax?rev=14904&view=rev
Log:
Created the Frame_order.test_cam_free_rotor system test for the CaM synthetic 
data.


Added:
    1.3/test_suite/system_tests/scripts/frame_order/cam/free_rotor.py
      - copied, changed from r14893, 
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=14904&r1=14903&r2=14904&view=diff
==============================================================================
--- 1.3/test_suite/system_tests/frame_order.py (original)
+++ 1.3/test_suite/system_tests/frame_order.py Mon Oct 24 16:35:42 2011
@@ -21,9 +21,11 @@
 
###############################################################################
 
 # Python module imports.
-from math import pi
+from math import acos, pi
 import platform
 import numpy
+from numpy import array, dot, float64, zeros
+from numpy.linalg import norm
 from re import search
 from os import sep
 import sys
@@ -32,6 +34,7 @@
 from base_classes import SystemTestCase
 from data import Relax_data_store; ds = Relax_data_store()
 import dep_check
+from maths_fns.coord_transform import spherical_to_cartesian
 from physical_constants import N15_CSA, NH_BOND_LENGTH
 from relax_io import DummyFileObject, open_read_file
 from status import Status; status = Status()
@@ -155,6 +158,41 @@
 
             # Reset.
             setattr(cdp, param, curr)
+
+
+    def test_cam_free_rotor(self):
+        """Test the free rotor 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+'free_rotor.py')
+
+        # Check the average structure CoM matches that of the original 
position (the average structure is not defined along the rotation axis).
+        for i in range(3):
+            self.assertAlmostEqual(ds['ave pos'].CoM[i], ds['orig 
pos'].CoM[i], 0)
+
+        # The rotation axis.
+        self.interpreter.pipe.switch('frame order')
+        spherical_vect = zeros(3, float64)
+        spherical_vect[0] = 1.0
+        spherical_vect[1] = cdp.axis_theta
+        spherical_vect[2] = cdp.axis_phi
+        cart_vect = zeros(3, float64)
+        spherical_to_cartesian(spherical_vect, cart_vect)
+
+        # The original rotation axis.
+        pivot = array([ 37.254, 0.5, 16.7465])
+        com = array([ 26.83678091, -12.37906417,  28.34154128])
+        axis = pivot - com
+        axis = axis / norm(axis)
+
+        # The dot product.
+        angle = acos(dot(cart_vect, axis))
+
+        # Check the angle.
+        if angle > 3 and angle < 4:
+            self.assertAlmostEqual(angle, pi, 1)
+        else:
+            self.assertAlmostEqual(angle, 0.0, 1)
 
 
     def test_cam_rigid(self):

Copied: 1.3/test_suite/system_tests/scripts/frame_order/cam/free_rotor.py 
(from r14893, 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/free_rotor.py?p2=1.3/test_suite/system_tests/scripts/frame_order/cam/free_rotor.py&p1=1.3/test_suite/system_tests/scripts/frame_order/cam/rigid.py&r1=14893&r2=14904&rev=14904&view=diff
==============================================================================
--- 1.3/test_suite/system_tests/scripts/frame_order/cam/rigid.py (original)
+++ 1.3/test_suite/system_tests/scripts/frame_order/cam/free_rotor.py Mon Oct 
24 16:35:42 2011
@@ -1,10 +1,11 @@
-# Script for optimising the rigid frame order test model of CaM.
+# Script for optimising the free rotor frame order test model of CaM.
 
 # Python module imports.
 from numpy import array, float64, transpose, zeros
 from os import sep
 
 # relax module imports.
+from generic_fns.structure.mass import centre_of_mass
 from maths_fns.rotation_matrix import euler_to_R_zyz
 from status import Status; status = Status()
 
@@ -39,7 +40,7 @@
 
         # The file paths.
         PATH_N_DOM = DATA_PATH
-        PATH_C_DOM = PATH_N_DOM+sep+'rigid'+sep
+        PATH_C_DOM = PATH_N_DOM+sep+'free_rotor'+sep
 
         # Create the data pipe.
         pipe.create(pipe_name='frame order', pipe_type='frame order')
@@ -57,13 +58,13 @@
             align_tensor.reduction(full_tensor=full[i], red_tensor=red[i])
 
         # Select the model.
-        frame_order.select_model('rigid')
+        frame_order.select_model('free rotor')
 
         # Set the reference domain.
         frame_order.ref_domain('N')
 
         # Optimise.
-        grid_search(inc=3)
+        grid_search(inc=11)
         minimise('simplex', constraints=False)
 
         # Write the results.
@@ -78,6 +79,9 @@
 
         # Load the structure.
         structure.read_pdb(DATA_PATH+'1J7P_1st_NH.pdb')
+
+        # Store the centre of mass.
+        cdp.CoM = centre_of_mass()
 
 
     def transform(self, R, pivot):
@@ -95,6 +99,9 @@
         # 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 Mon Oct 24 18:00:02 2011