Package test_suite :: Package system_tests :: Module frame_order
[hide private]
[frames] | no frames]

Source Code for Module test_suite.system_tests.frame_order

   1  ############################################################################### 
   2  #                                                                             # 
   3  # Copyright (C) 2009-2015,2018-2019,2024 Edward d'Auvergne                    # 
   4  #                                                                             # 
   5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
   6  #                                                                             # 
   7  # This program is free software: you can redistribute it and/or modify        # 
   8  # it under the terms of the GNU General Public License as published by        # 
   9  # the Free Software Foundation, either version 3 of the License, or           # 
  10  # (at your option) any later version.                                         # 
  11  #                                                                             # 
  12  # This program is distributed in the hope that it will be useful,             # 
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
  15  # GNU General Public License for more details.                                # 
  16  #                                                                             # 
  17  # You should have received a copy of the GNU General Public License           # 
  18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
  19  #                                                                             # 
  20  ############################################################################### 
  21   
  22  # Python module imports. 
  23  from math import cos, pi, sin, sqrt 
  24  import platform 
  25  import numpy 
  26  from numpy import array, dot, eye, float64, transpose, zeros 
  27  from os import sep 
  28  from tempfile import mkdtemp 
  29   
  30  # relax module imports. 
  31  from data_store import Relax_data_store; ds = Relax_data_store() 
  32  import dep_check 
  33  from lib.compat import linux_distribution 
  34  from lib.frame_order.conversions import create_rotor_axis_alpha, create_rotor_axis_spherical 
  35  from lib.frame_order.variables import MODEL_DOUBLE_ROTOR, MODEL_FREE_ROTOR, MODEL_ISO_CONE, MODEL_ISO_CONE_FREE_ROTOR, MODEL_ISO_CONE_TORSIONLESS, MODEL_PSEUDO_ELLIPSE, MODEL_PSEUDO_ELLIPSE_TORSIONLESS, MODEL_RIGID, MODEL_ROTOR 
  36  from lib.geometry.coord_transform import cartesian_to_spherical 
  37  from lib.geometry.rotations import axis_angle_to_R, euler_to_R_zyz, R_to_euler_zyz 
  38  from status import Status; status = Status() 
  39  from test_suite.system_tests.base_classes import SystemTestCase 
  40   
  41   
  42  # Get the platform information. 
  43  SYSTEM = platform.system() 
  44  RELEASE = platform.release() 
  45  VERSION = platform.version() 
  46  WIN32_VER = platform.win32_ver() 
  47  DIST = linux_distribution() 
  48  ARCH = platform.architecture() 
  49  MACH = platform.machine() 
  50  PROC = platform.processor() 
  51  PY_VER = platform.python_version() 
  52  NUMPY_VER = numpy.__version__ 
  53  LIBC_VER = platform.libc_ver() 
  54   
  55  # Windows system name pain. 
  56  if SYSTEM == 'Windows' or SYSTEM == 'Microsoft': 
  57      # Set the system to 'Windows' no matter what. 
  58      SYSTEM = 'Windows' 
  59   
  60   
  61  # Some vectors. 
  62  x_axis = array([1, 0, 0], float64) 
  63  y_axis = array([0, 1, 0], float64) 
  64  z_axis = array([0, 0, 1], float64) 
  65  origin = array([0, 0, 0], float64) 
  66   
  67   
68 -class Frame_order(SystemTestCase):
69 """TestCase class for the functional tests of the frame order theories.""" 70
71 - def __init__(self, methodName='runTest'):
72 """Skip the tests if scipy is not installed. 73 74 @keyword methodName: The name of the test. 75 @type methodName: str 76 """ 77 78 # Execute the base class method. 79 super(Frame_order, self).__init__(methodName) 80 81 # Tests to skip. 82 blacklist = [ 83 'test_cam_qr_int_free_rotor_pcs', 84 'test_cam_qr_int_free_rotor_rdc', 85 'test_cam_qr_int_free_rotor2_pcs', 86 'test_cam_qr_int_free_rotor2_rdc', 87 'test_cam_qr_int_iso_cone_pcs', 88 'test_cam_qr_int_iso_cone_rdc', 89 'test_cam_qr_int_iso_cone_free_rotor_pcs', 90 'test_cam_qr_int_iso_cone_free_rotor_rdc', 91 'test_cam_qr_int_iso_cone_free_rotor2_pcs', 92 'test_cam_qr_int_iso_cone_free_rotor2_rdc', 93 'test_cam_qr_int_iso_cone_torsionless_pcs', 94 'test_cam_qr_int_iso_cone_torsionless_rdc', 95 'test_cam_qr_int_pseudo_ellipse2_pcs', 96 'test_cam_qr_int_pseudo_ellipse2_rdc', 97 'test_cam_qr_int_pseudo_ellipse_free_rotor_pcs', 98 'test_cam_qr_int_pseudo_ellipse_free_rotor_rdc', 99 'test_cam_qr_int_pseudo_ellipse_torsionless_pcs', 100 'test_cam_qr_int_pseudo_ellipse_torsionless_rdc', 101 'test_cam_qr_int_rigid_pcs', 102 'test_cam_qr_int_rigid_rdc', 103 'test_cam_qr_int_rotor_pcs', 104 'test_cam_qr_int_rotor_rdc', 105 'test_cam_qr_int_rotor_2_state_pcs', 106 'test_cam_qr_int_rotor_2_state_rdc', 107 'test_cam_qr_int_rotor2_pcs', 108 'test_cam_qr_int_rotor2_rdc', 109 'test_cam_quad_int_free_rotor_pcs', 110 'test_cam_quad_int_free_rotor_rdc', 111 'test_cam_quad_int_free_rotor2_pcs', 112 'test_cam_quad_int_free_rotor2_rdc', 113 'test_cam_quad_int_iso_cone_pcs', 114 'test_cam_quad_int_iso_cone_rdc', 115 'test_cam_quad_int_iso_cone_free_rotor_pcs', 116 'test_cam_quad_int_iso_cone_free_rotor_rdc', 117 'test_cam_quad_int_iso_cone_free_rotor2_pcs', 118 'test_cam_quad_int_iso_cone_free_rotor2_rdc', 119 'test_cam_quad_int_iso_cone_torsionless_pcs', 120 'test_cam_quad_int_iso_cone_torsionless_rdc', 121 'test_cam_quad_int_pseudo_ellipse2_pcs', 122 'test_cam_quad_int_pseudo_ellipse2_rdc', 123 'test_cam_quad_int_pseudo_ellipse_free_rotor_pcs', 124 'test_cam_quad_int_pseudo_ellipse_free_rotor_rdc', 125 'test_cam_quad_int_pseudo_ellipse_torsionless_pcs', 126 'test_cam_quad_int_pseudo_ellipse_torsionless_rdc', 127 'test_cam_quad_int_rigid_pcs', 128 'test_cam_quad_int_rigid_rdc', 129 'test_cam_quad_int_rotor_pcs', 130 'test_cam_quad_int_rotor_rdc', 131 'test_cam_quad_int_rotor_2_state_pcs', 132 'test_cam_quad_int_rotor_2_state_rdc', 133 'test_cam_quad_int_rotor2_pcs', 134 'test_cam_quad_int_rotor2_rdc' 135 ] 136 137 # Skip the blacklisted tests. 138 if methodName in blacklist: 139 status.skipped_tests.append([methodName, None, self._skip_type]) 140 141 # Missing module. 142 if not dep_check.scipy_module: 143 # Store in the status object. 144 status.skipped_tests.append([methodName, 'Scipy', self._skip_type])
145 146
147 - def setUp(self):
148 """Set up for all the functional tests.""" 149 150 # The path to the CaM scripts. 151 self.cam_path = status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'cam'+sep 152 153 # Create a temporary directory for dumping files. 154 ds.tmpdir = mkdtemp()
155 156
157 - def tearDown(self):
158 """Clean up after the tests.""" 159 160 # Call the base class tearDown() method to remove the temporary directory. 161 super(Frame_order, self).tearDown() 162 163 # Remove flags from the status object. 164 if hasattr(status, 'flag_rdc'): 165 del status.flag_rdc 166 if hasattr(status, 'flag_pcs'): 167 del status.flag_pcs
168 169
170 - def check_chi2(self, chi2=0.0, places=4):
171 """Check the function evaluation.""" 172 173 # Switch back to the original pipe. 174 self.interpreter.pipe.switch('frame order') 175 176 # Test the operation of the statistics.model user function. 177 self.interpreter.statistics.model() 178 179 # Get the debugging message. 180 mesg = self.mesg_opt_debug() 181 182 # Check the chi2 value. 183 self.assertAlmostEqual(cdp.chi2, chi2, places, msg=mesg)
184 185
186 - def check_pdb_model_representation(self, data=None, files=None):
187 """Check the PDB model representation atom and residue names and numbers and coordinates. 188 189 Propeller blade atoms with the name 'BLD' are skipped, as well as the cone interior residues with the name 'CON'. 190 191 192 @keyword data: The list of data to check. The first dimension is for the representation, and the second for each atom. The lists of each atom consist of the residue number, residue name, atom number, atom name, and the 3D position. 193 @type data: list of list of lists 194 @keyword files: The list of files for each representation. 195 @type files: list of str 196 """ 197 198 # Loop over the representations. 199 for i in range(len(data)): 200 # Delete all structural data. 201 self.interpreter.structure.delete() 202 203 # Read the contents of the file. 204 self.interpreter.structure.read_pdb(file=files[i], dir=ds.tmpdir) 205 206 # Check the atomic coordinates. 207 selection = cdp.structure.selection() 208 index = 0 209 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 210 # Skip the propeller blades. 211 if atom_name == 'BLD': 212 continue 213 214 # Skip the cone interior (checking the edge will be sufficient). 215 if res_name == 'CON': 216 continue 217 218 # Checks. 219 print("Checking residue %s %s, atom %s %s, at position %s." % (data[i][index][0], data[i][index][1], data[i][index][2], data[i][index][3], data[i][index][4])) 220 print(" to residue %s %s, atom %s %s, at position %s." % (res_num, res_name, atom_num, atom_name, pos[0])) 221 self.assertEqual(data[i][index][0], res_num) 222 self.assertEqual(data[i][index][1], res_name) 223 self.assertEqual(data[i][index][2], atom_num) 224 self.assertEqual(data[i][index][3], atom_name) 225 self.assertAlmostEqual(data[i][index][4][0], pos[0][0], 3) 226 self.assertAlmostEqual(data[i][index][4][1], pos[0][1], 3) 227 self.assertAlmostEqual(data[i][index][4][2], pos[0][2], 3) 228 229 # Increment the index. 230 index += 1
231 232
233 - def flags(self, rdc=True, pcs=True, opt=False, quad_int=False):
234 """Set a number of flags for the scripts.""" 235 236 # Store the flags. 237 status.flag_rdc = rdc 238 status.flag_pcs = pcs 239 status.flag_opt = opt 240 status.flag_quad_int = quad_int
241 242
243 - def mesg_opt_debug(self):
244 """Method for returning a string to help debug the minimisation. 245 246 @return: The debugging string. 247 @rtype: str 248 """ 249 250 # Initialise the string. 251 string = 'Optimisation failure.\n\n' 252 253 # Create the string. 254 string = string + "%-18s%-25s\n" % ("System: ", SYSTEM) 255 string = string + "%-18s%-25s\n" % ("Release: ", RELEASE) 256 string = string + "%-18s%-25s\n" % ("Version: ", VERSION) 257 string = string + "%-18s%-25s\n" % ("Win32 version: ", (WIN32_VER[0] + " " + WIN32_VER[1] + " " + WIN32_VER[2] + " " + WIN32_VER[3])) 258 string = string + "%-18s%-25s\n" % ("Distribution: ", (DIST[0] + " " + DIST[1] + " " + DIST[2])) 259 string = string + "%-18s%-25s\n" % ("Architecture: ", (ARCH[0] + " " + ARCH[1])) 260 string = string + "%-18s%-25s\n" % ("Machine: ", MACH) 261 string = string + "%-18s%-25s\n" % ("Processor: ", PROC) 262 string = string + "%-18s%-25s\n" % ("Python version: ", PY_VER) 263 string = string + "%-18s%-25s\n" % ("Numpy version: ", NUMPY_VER) 264 string = string + "%-18s%-25s\n" % ("Libc version: ", (LIBC_VER[0] + " " + LIBC_VER[1])) 265 266 267 # Minimisation info. 268 string = string + "\n" 269 for param in ['ave_pos_x', 'ave_pos_y', 'ave_pos_z', 'ave_pos_alpha', 'ave_pos_beta', 'ave_pos_gamma', 'eigen_alpha', 'eigen_beta', 'eigen_gamma', 'axis_theta', 'axis_phi', 'cone_theta_x', 'cone_theta_y', 'cone_theta', 'cone_sigma_max', 'cone_sigma_max_2']: 270 if hasattr(cdp, param): 271 obj = getattr(cdp, param) 272 string = string + "%-15s %30.17g\n" % (param, obj) 273 274 string = string + "%-15s %30.17g\n" % ('chi2:', cdp.chi2) 275 if hasattr(cdp, 'sobol_max_points'): 276 string = string + "%-15s %30i\n" % ('sobol_max_points:', cdp.sobol_max_points) 277 if hasattr(cdp, 'iter') and cdp.iter != None: 278 string = string + "%-15s %30i\n" % ('iter:', cdp.iter) 279 if hasattr(cdp, 'f_count') and cdp.f_count != None: 280 string = string + "%-15s %30i\n" % ('f_count:', cdp.f_count) 281 if hasattr(cdp, 'g_count') and cdp.g_count != None: 282 string = string + "%-15s %30i\n" % ('g_count:', cdp.g_count) 283 if hasattr(cdp, 'h_count') and cdp.h_count != None: 284 string = string + "%-15s %30i\n" % ('h_count:', cdp.h_count) 285 if hasattr(cdp, 'warning'): 286 string = string + "%-15s %30s\n" % ('warning:', cdp.warning) 287 288 # Return the string. 289 return string
290 291
292 - def rotate_from_Z(self, origin=origin, length=0.0, angle=0.0, axis=x_axis, R=None, neg=False):
293 """Rotate a vector along Z-axis around the origin. 294 295 @keyword origin: The origin of the final vector. 296 @type origin: numpy 3D, rank-1 array 297 @keyword length: The length of the Z-vector to rotate. 298 @type length: float 299 @keyword angle: The angle in rad to rotate by. 300 @type angle: float 301 @keyword axis: The direction in the xy-plane to rotate the vector along. 302 @type axis: numpy 3D, rank-1 array 303 @keyword R: A rotation matrix to be used before adding the origin. 304 @type R: numpy 3D, rank-2 array 305 @keyword neg: A flag which if True causes the negative Z-axis to be used. 306 @type neg: bool 307 @return: The final rotated vector shifted by the origin. 308 @rtype: numpy 3D, rank-1 array 309 """ 310 311 # The final point. 312 point = zeros(3, float64) 313 314 # Z-axis reduction. 315 point[2] = cos(angle) 316 317 # The X and Y-axis increases. 318 point[0] = axis[0]*sin(angle) 319 point[1] = axis[1]*sin(angle) 320 321 # Inversion. 322 if neg: 323 for i in range(3): 324 point[i] = -point[i] 325 326 # Rotation. 327 if R is not None: 328 point = dot(R, point) 329 330 # Extend the length and add the origin. 331 for i in range(3): 332 point[i] = point[i]*length + origin[i] 333 334 # Return the point. 335 return point
336 337
338 - def setup_model(self, pipe_name='model', model=None, pivot=None, ave_pos_x=None, ave_pos_y=None, ave_pos_z=None, ave_pos_alpha=None, ave_pos_beta=None, ave_pos_gamma=None, pivot_disp=None, axis_alpha=None, axis_theta=None, axis_phi=None, eigen_alpha=None, eigen_beta=None, eigen_gamma=None, cone_theta=None, cone_theta_x=None, cone_theta_y=None, cone_sigma_max=None, cone_sigma_max_2=None):
339 """Set up for the given frame order model. 340 341 This will execute the following user functions: 342 343 - pipe.create to set up a data pipe for the model. 344 - frame_order.select_model. 345 - value.set for all given parameters. 346 - frame_order.pivot to define the pivot point. 347 348 349 @keyword pipe_name: The name of the new data pipe. 350 @type pipe_name: str 351 @keyword model: The frame order model to setup. 352 @type model: str 353 @keyword pivot: The pivot to setup. 354 @type pivot: list of float 355 @keyword ave_pos_x: The average domain position X coordinate. 356 @type ave_pos_x: None or float 357 @keyword ave_pos_y: The average domain position Y coordinate. 358 @type ave_pos_y: None or float 359 @keyword ave_pos_z: The average domain position Z coordinate. 360 @type ave_pos_z: None or float 361 @keyword ave_pos_alpha: The average domain position alpha Euler rotation angle. 362 @type ave_pos_alpha: None or float 363 @keyword ave_pos_beta: The average domain position beta Euler rotation angle. 364 @type ave_pos_beta: None or float 365 @keyword ave_pos_gamma: The average domain position gamma Euler rotation angle. 366 @type ave_pos_gamma: None or float 367 @keyword pivot_disp: The pivot displacement parameter. 368 @type pivot_disp: None or float 369 @keyword axis_alpha: The motional eigenframe axis alpha angle. 370 @type axis_alpha: None or float 371 @keyword axis_theta: The motional eigenframe axis theta spherical angle. 372 @type axis_theta: None or float 373 @keyword axis_phi: The motional eigenframe axis phi spherical angle. 374 @type axis_phi: None or float 375 @keyword eigen_alpha: The motional eigenframe alpha Euler rotation angle. 376 @type eigen_alpha: None or float 377 @keyword eigen_beta: The motional eigenframe beta Euler rotation angle. 378 @type eigen_beta: None or float 379 @keyword eigen_gamma: The motional eigenframe gamma Euler rotation angle. 380 @type eigen_gamma: None or float 381 @keyword cone_theta: The isotropic cone opening half angle. 382 @type cone_theta: None or float 383 @keyword cone_theta_x: The x-axis half cone angle. 384 @type cone_theta_x: None or float 385 @keyword cone_theta_y: The y-axis half cone angle. 386 @type cone_theta_y: None or float 387 @keyword cone_sigma_max: The maximum torsion angle. 388 @type cone_sigma_max: None or float 389 @keyword cone_sigma_max_2: The second maximum torsion angle. 390 @type cone_sigma_max_2: None or float 391 """ 392 393 # Create a data pipe. 394 self.interpreter.pipe.create(pipe_name='PDB model', pipe_type='frame order') 395 396 # Create a 8 atom structure with the CoM at [0, 0, 0]. 397 atom_pos = 100.0 * eye(3) 398 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='X', res_num=1, pos=atom_pos[0], element='N') 399 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='Y', res_num=2, pos=atom_pos[1], element='N') 400 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='Z', res_num=3, pos=atom_pos[2], element='N') 401 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='nX', res_num=4, pos=-atom_pos[0], element='N') 402 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='nY', res_num=5, pos=-atom_pos[1], element='N') 403 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='nZ', res_num=6, pos=-atom_pos[2], element='N') 404 self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='C', res_num=7, pos=[0.0, 0.0, 0.0], element='N') 405 self.interpreter.structure.add_atom(mol_name='axes', atom_name='Ti', res_name='O', res_num=8, pos=[0.0, 0.0, 0.0], element='Ti') 406 407 # Set up the domains. 408 self.interpreter.domain(id='moving', spin_id=':1-7') 409 self.interpreter.domain(id='origin', spin_id=':8') 410 self.interpreter.frame_order.ref_domain('origin') 411 412 # Select the model. 413 self.interpreter.frame_order.select_model(model) 414 415 # Set the average domain position translation parameters. 416 if ave_pos_x != None: 417 self.interpreter.value.set(param='ave_pos_x', val=ave_pos_x) 418 if ave_pos_y != None: 419 self.interpreter.value.set(param='ave_pos_y', val=ave_pos_y) 420 if ave_pos_z != None: 421 self.interpreter.value.set(param='ave_pos_z', val=ave_pos_z) 422 if ave_pos_alpha != None: 423 self.interpreter.value.set(param='ave_pos_alpha', val=ave_pos_alpha) 424 if ave_pos_beta != None: 425 self.interpreter.value.set(param='ave_pos_beta', val=ave_pos_beta) 426 if ave_pos_gamma != None: 427 self.interpreter.value.set(param='ave_pos_gamma', val=ave_pos_gamma) 428 if pivot_disp != None: 429 self.interpreter.value.set(param='pivot_disp', val=pivot_disp) 430 if axis_alpha != None: 431 self.interpreter.value.set(param='axis_alpha', val=axis_alpha) 432 if axis_theta != None: 433 self.interpreter.value.set(param='axis_theta', val=axis_theta) 434 if axis_phi != None: 435 self.interpreter.value.set(param='axis_phi', val=axis_phi) 436 if eigen_alpha != None: 437 self.interpreter.value.set(param='eigen_alpha', val=eigen_alpha) 438 if eigen_beta != None: 439 self.interpreter.value.set(param='eigen_beta', val=eigen_beta) 440 if eigen_gamma != None: 441 self.interpreter.value.set(param='eigen_gamma', val=eigen_gamma) 442 if cone_theta != None: 443 self.interpreter.value.set(param='cone_theta', val=cone_theta) 444 if cone_theta_x != None: 445 self.interpreter.value.set(param='cone_theta_x', val=cone_theta_x) 446 if cone_theta_y != None: 447 self.interpreter.value.set(param='cone_theta_y', val=cone_theta_y) 448 if cone_sigma_max != None: 449 self.interpreter.value.set(param='cone_sigma_max', val=cone_sigma_max) 450 if cone_sigma_max_2 != None: 451 self.interpreter.value.set(param='cone_sigma_max_2', val=cone_sigma_max_2) 452 453 # Set the pivot. 454 self.interpreter.frame_order.pivot(pivot=pivot, fix=True)
455 456
457 - def space_probe(self, ref_chi2=None, params=None, delta=3.0 / 360.0 * 2.0 * pi):
458 """Probe the space around the supposed minimum.""" 459 460 # No function intros. 461 self.interpreter.intro_off() 462 463 # Check the minimum. 464 self.interpreter.minimise.calculate() 465 print("%-20s %10.5f" % ("chi2 minimum", cdp.chi2)) 466 self.assertAlmostEqual(cdp.chi2, ref_chi2) 467 468 # Test around the minimum using small deviations. 469 for param in params: 470 print("\n\nParam: %s" % param) 471 print("%-20s %10.5f" % ("chi2 orig", ref_chi2)) 472 473 # Get the current value. 474 curr = getattr(cdp, param) 475 476 # Deviate upwards. 477 setattr(cdp, param, curr+delta) 478 self.interpreter.minimise.calculate() 479 print("%-20s %10.5f" % ("chi2 up", cdp.chi2)) 480 self.assertTrue(cdp.chi2 > ref_chi2) 481 482 # Deviate downwards. 483 setattr(cdp, param, curr-delta) 484 self.interpreter.minimise.calculate() 485 print("%-20s %10.5f" % ("chi2 down", cdp.chi2)) 486 self.assertTrue(cdp.chi2 > ref_chi2) 487 488 # Reset. 489 setattr(cdp, param, curr)
490 491
492 - def test_auto_analysis(self):
493 """Test the frame order auto-analysis using the rigid CaM test data.""" 494 495 # Execute the script. 496 self.interpreter.run(script_file=self.cam_path+'auto_analysis_to_rigid.py')
497 498
500 """Test the operation of the frame_order.permute_axes user function for permutation 'A' when x <= y <= z.""" 501 502 # Reset. 503 self.interpreter.reset() 504 505 # Load the state file. 506 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' 507 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') 508 509 # Change the original parameters. 510 cdp.cone_theta_x = orig_cone_theta_x = 1.0 511 cdp.cone_theta_y = orig_cone_theta_y = 2.0 512 cdp.cone_sigma_max = orig_cone_sigma_max = 3.0 513 514 # Store the original parameters. 515 orig_eigen_alpha = cdp.eigen_alpha 516 orig_eigen_beta = cdp.eigen_beta 517 orig_eigen_gamma = cdp.eigen_gamma 518 519 # Permute the axes. 520 self.interpreter.frame_order.permute_axes('A') 521 522 # Checks of the cone opening angle permutations. 523 self.assertEqual(cdp.cone_theta_x, 1.0) 524 self.assertEqual(cdp.cone_theta_y, 3.0) 525 self.assertEqual(cdp.cone_sigma_max, 2.0) 526 527 # The optimised Eigenframe. 528 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], 529 [ 0.62357991685585, -0.505348769456744, 0.596465177946379], 530 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) 531 532 # Manually permute the frame, and then obtain the Euler angles. 533 frame_new = transpose(array([-frame[:, 2], frame[:, 1], frame[:, 0]], float64)) 534 alpha, beta, gamma = R_to_euler_zyz(frame_new) 535 536 # Check the Eigenframe Euler angles. 537 self.assertAlmostEqual(cdp.eigen_alpha, alpha) 538 self.assertAlmostEqual(cdp.eigen_beta, beta) 539 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
540 541
543 """Test the operation of the frame_order.permute_axes user function for permutation 'B' when x <= y <= z.""" 544 545 # Reset. 546 self.interpreter.reset() 547 548 # Load the state file. 549 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' 550 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') 551 552 # Change the original parameters. 553 cdp.cone_theta_x = orig_cone_theta_x = 1.0 554 cdp.cone_theta_y = orig_cone_theta_y = 2.0 555 cdp.cone_sigma_max = orig_cone_sigma_max = 3.0 556 557 # Store the original parameters. 558 orig_eigen_alpha = cdp.eigen_alpha 559 orig_eigen_beta = cdp.eigen_beta 560 orig_eigen_gamma = cdp.eigen_gamma 561 562 # Permute the axes. 563 self.interpreter.frame_order.permute_axes('B') 564 565 # Checks of the cone opening angle permutations. 566 self.assertEqual(cdp.cone_theta_x, 2.0) 567 self.assertEqual(cdp.cone_theta_y, 3.0) 568 self.assertEqual(cdp.cone_sigma_max, 1.0) 569 570 # The optimised Eigenframe. 571 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], 572 [ 0.62357991685585, -0.505348769456744, 0.596465177946379], 573 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) 574 575 # Manually permute the frame, and then obtain the Euler angles. 576 frame_new = transpose(array([frame[:, 2], frame[:, 0], frame[:, 1]], float64)) 577 alpha, beta, gamma = R_to_euler_zyz(frame_new) 578 579 # Check the Eigenframe Euler angles. 580 self.assertAlmostEqual(cdp.eigen_alpha, alpha) 581 self.assertAlmostEqual(cdp.eigen_beta, beta) 582 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
583 584
586 """Test the operation of the frame_order.permute_axes user function for permutation 'A' when x <= z <= y.""" 587 588 # Reset. 589 self.interpreter.reset() 590 591 # Load the state file. 592 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' 593 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') 594 595 # Change the original parameters. 596 cdp.cone_theta_x = orig_cone_theta_x = 1.0 597 cdp.cone_theta_y = orig_cone_theta_y = 3.0 598 cdp.cone_sigma_max = orig_cone_sigma_max = 2.0 599 600 # Store the original parameters. 601 orig_eigen_alpha = cdp.eigen_alpha 602 orig_eigen_beta = cdp.eigen_beta 603 orig_eigen_gamma = cdp.eigen_gamma 604 605 # Permute the axes. 606 self.interpreter.frame_order.permute_axes('A') 607 608 # Checks of the cone opening angle permutations. 609 self.assertEqual(cdp.cone_theta_x, 1.0) 610 self.assertEqual(cdp.cone_theta_y, 2.0) 611 self.assertEqual(cdp.cone_sigma_max, 3.0) 612 613 # The optimised Eigenframe. 614 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], 615 [ 0.62357991685585, -0.505348769456744, 0.596465177946379], 616 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) 617 618 # Manually permute the frame, and then obtain the Euler angles. 619 frame_new = transpose(array([-frame[:, 2], frame[:, 1], frame[:, 0]], float64)) 620 alpha, beta, gamma = R_to_euler_zyz(frame_new) 621 622 # Check the Eigenframe Euler angles. 623 self.assertAlmostEqual(cdp.eigen_alpha, alpha) 624 self.assertAlmostEqual(cdp.eigen_beta, beta) 625 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
626 627
629 """Test the operation of the frame_order.permute_axes user function for permutation 'B' when x <= z <= y.""" 630 631 # Reset. 632 self.interpreter.reset() 633 634 # Load the state file. 635 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' 636 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') 637 638 # Change the original parameters. 639 cdp.cone_theta_x = orig_cone_theta_x = 1.0 640 cdp.cone_theta_y = orig_cone_theta_y = 3.0 641 cdp.cone_sigma_max = orig_cone_sigma_max = 2.0 642 643 # Store the original parameters. 644 orig_eigen_alpha = cdp.eigen_alpha 645 orig_eigen_beta = cdp.eigen_beta 646 orig_eigen_gamma = cdp.eigen_gamma 647 648 # Permute the axes. 649 self.interpreter.frame_order.permute_axes('B') 650 651 # Checks of the cone opening angle permutations. 652 self.assertEqual(cdp.cone_theta_x, 2.0) 653 self.assertEqual(cdp.cone_theta_y, 3.0) 654 self.assertEqual(cdp.cone_sigma_max, 1.0) 655 656 # The optimised Eigenframe. 657 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], 658 [ 0.62357991685585, -0.505348769456744, 0.596465177946379], 659 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) 660 661 # Manually permute the frame, and then obtain the Euler angles. 662 frame_new = transpose(array([frame[:, 0], -frame[:, 2], frame[:, 1]], float64)) 663 alpha, beta, gamma = R_to_euler_zyz(frame_new) 664 665 # Check the Eigenframe Euler angles. 666 self.assertAlmostEqual(cdp.eigen_alpha, alpha) 667 self.assertAlmostEqual(cdp.eigen_beta, beta) 668 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
669 670
672 """Test the operation of the frame_order.permute_axes user function for permutation 'A' when z <= x <= y.""" 673 674 # Reset. 675 self.interpreter.reset() 676 677 # Load the state file. 678 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' 679 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') 680 681 # Store the original parameters. 682 orig_cone_theta_x = cdp.cone_theta_x 683 orig_cone_theta_y = cdp.cone_theta_y 684 orig_cone_sigma_max = cdp.cone_sigma_max 685 orig_eigen_alpha = cdp.eigen_alpha 686 orig_eigen_beta = cdp.eigen_beta 687 orig_eigen_gamma = cdp.eigen_gamma 688 689 # Permute the axes. 690 self.interpreter.frame_order.permute_axes('A') 691 692 # Checks of the cone opening angle permutations. 693 self.assertEqual(cdp.cone_theta_x, 0.53277077276728502) 694 self.assertEqual(cdp.cone_theta_y, 0.8097621930390525) 695 self.assertEqual(cdp.cone_sigma_max, 1.2119285953475074) 696 697 # The optimised Eigenframe. 698 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], 699 [ 0.62357991685585, -0.505348769456744, 0.596465177946379], 700 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) 701 702 # Manually permute the frame, and then obtain the Euler angles. 703 frame_new = transpose(array([frame[:, 1], frame[:, 2], frame[:, 0]], float64)) 704 alpha, beta, gamma = R_to_euler_zyz(frame_new) 705 706 # Check the Eigenframe Euler angles. 707 self.assertAlmostEqual(cdp.eigen_alpha, alpha) 708 self.assertAlmostEqual(cdp.eigen_beta, beta) 709 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
710 711
713 """Test the operation of the frame_order.permute_axes user function for permutation 'B' when z <= x <= y.""" 714 715 # Reset. 716 self.interpreter.reset() 717 718 # Load the state file. 719 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' 720 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') 721 722 # Store the original parameters. 723 orig_cone_theta_x = cdp.cone_theta_x 724 orig_cone_theta_y = cdp.cone_theta_y 725 orig_cone_sigma_max = cdp.cone_sigma_max 726 orig_eigen_alpha = cdp.eigen_alpha 727 orig_eigen_beta = cdp.eigen_beta 728 orig_eigen_gamma = cdp.eigen_gamma 729 730 # Permute the axes. 731 self.interpreter.frame_order.permute_axes('B') 732 733 # Checks of the cone opening angle permutations. 734 self.assertEqual(cdp.cone_theta_x, 0.53277077276728502) 735 self.assertEqual(cdp.cone_theta_y, 1.2119285953475074) 736 self.assertEqual(cdp.cone_sigma_max, 0.8097621930390525) 737 738 # The optimised Eigenframe. 739 frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], 740 [ 0.62357991685585, -0.505348769456744, 0.596465177946379], 741 [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) 742 743 # Manually permute the frame, and then obtain the Euler angles. 744 frame_new = transpose(array([frame[:, 0], -frame[:, 2], frame[:, 1]], float64)) 745 alpha, beta, gamma = R_to_euler_zyz(frame_new) 746 747 # Check the Eigenframe Euler angles. 748 self.assertAlmostEqual(cdp.eigen_alpha, alpha) 749 self.assertAlmostEqual(cdp.eigen_beta, beta) 750 self.assertAlmostEqual(cdp.eigen_gamma, gamma)
751 752
754 """Test the double rotor frame order model of CaM.""" 755 756 # The flags, execute the script, and then check the chi2 value. 757 self.flags() 758 self.interpreter.run(script_file=self.cam_path+'double_rotor.py') 759 self.check_chi2(0.080146041009531946)
760 761
763 """Test the double rotor frame order model of CaM (with only PCS data).""" 764 765 # The flags, execute the script, and then check the chi2 value. 766 self.flags(rdc=False) 767 self.interpreter.run(script_file=self.cam_path+'double_rotor.py') 768 self.check_chi2(0.00033425735965255754)
769 770
772 """Test the double rotor frame order model of CaM (with only RDC data).""" 773 774 # The flags, execute the script, and then check the chi2 value. 775 self.flags(pcs=False) 776 self.interpreter.run(script_file=self.cam_path+'double_rotor.py') 777 self.check_chi2(0.079814053829495801)
778 779
781 """Test the double rotor frame order model of CaM.""" 782 783 # The flags, execute the script, and then check the chi2 value. 784 self.flags() 785 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py') 786 self.check_chi2(0.046993590502437441)
787 788
790 """Test the double rotor frame order model of CaM (with only PCS data).""" 791 792 # The flags, execute the script, and then check the chi2 value. 793 self.flags(rdc=False) 794 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py') 795 self.check_chi2(0.0030482390409642141)
796 797
799 """Test the double rotor frame order model of CaM (with only RDC data).""" 800 801 # The flags, execute the script, and then check the chi2 value. 802 self.flags(pcs=False) 803 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py') 804 self.check_chi2(0.043946055085127944)
805 806
807 - def test_cam_qr_int_free_rotor(self):
808 """Test the free rotor frame order model of CaM.""" 809 810 # The flags, execute the script, and then check the chi2 value. 811 self.flags(opt=True) 812 self.interpreter.run(script_file=self.cam_path+'free_rotor.py') 813 self.check_chi2(0.049488502147038226)
814 815
817 """Test the free rotor frame order model of CaM.""" 818 819 # The flags, execute the script, and then check the chi2 value. 820 self.flags() 821 self.interpreter.run(script_file=self.cam_path+'free_rotor_missing_data.py') 822 self.check_chi2(0.038106832800436169)
823 824
826 """Test the free rotor frame order model of CaM (with only PCS data).""" 827 828 # The flags, execute the script, and then check the chi2 value. 829 self.flags(rdc=False) 830 self.interpreter.run(script_file=self.cam_path+'free_rotor.py') 831 self.check_chi2(0.00049268587082683434)
832 833
835 """Test the free rotor frame order model of CaM (with only RDC data).""" 836 837 # The flags, execute the script, and then check the chi2 value. 838 self.flags(pcs=False) 839 self.interpreter.run(script_file=self.cam_path+'free_rotor.py') 840 self.check_chi2(0.04899130610303442)
841 842
844 """Test the second free rotor frame order model of CaM.""" 845 846 # The flags, execute the script, and then check the chi2 value. 847 self.flags() 848 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py') 849 self.check_chi2(0.069952611688108693)
850 851
853 """Test the second free rotor frame order model of CaM (with only PCS data).""" 854 855 # The flags, execute the script, and then check the chi2 value. 856 self.flags(rdc=False) 857 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py') 858 self.check_chi2(0.013207545726879745)
859 860
862 """Test the second free rotor frame order model of CaM (with only RDC data).""" 863 864 # The flags, execute the script, and then check the chi2 value. 865 self.flags(pcs=False) 866 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py') 867 self.check_chi2(0.056744492444430819)
868 869
870 - def test_cam_qr_int_iso_cone(self):
871 """Test the isotropic cone, free rotor frame order model of CaM.""" 872 873 # The flags, execute the script, and then check the chi2 value. 874 self.flags(opt=True) 875 self.interpreter.run(script_file=self.cam_path+'iso_cone.py') 876 self.check_chi2(0.046263256206108584)
877 878
880 """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 881 882 # The flags, execute the script, and then check the chi2 value. 883 self.flags(rdc=False) 884 self.interpreter.run(script_file=self.cam_path+'iso_cone.py') 885 self.check_chi2(0.010223404689484922)
886 887
889 """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 890 891 # The flags, execute the script, and then check the chi2 value. 892 self.flags(pcs=False) 893 self.interpreter.run(script_file=self.cam_path+'iso_cone.py') 894 self.check_chi2(0.041428474106863025)
895 896
898 """Test the isotropic cone, free rotor frame order model of CaM.""" 899 900 # The flags, execute the script, and then check the chi2 value. 901 self.flags() 902 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py') 903 self.check_chi2(0.013068834561396353)
904 905
907 """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 908 909 # The flags, execute the script, and then check the chi2 value. 910 self.flags(rdc=False) 911 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py') 912 self.check_chi2(0.0020824314952301057)
913 914
916 """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 917 918 # The flags, execute the script, and then check the chi2 value. 919 self.flags(pcs=False) 920 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py') 921 self.check_chi2(0.010986403066166248)
922 923
925 """Test the second isotropic cone, free rotor frame order model of CaM.""" 926 927 # The flags, execute the script, and then check the chi2 value. 928 self.flags() 929 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py') 930 self.check_chi2(0.13135988423081582)
931 932
934 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 935 936 # The flags, execute the script, and then check the chi2 value. 937 self.flags(rdc=False) 938 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py') 939 self.check_chi2(0.12580093734874642)
940 941
943 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 944 945 # The flags, execute the script, and then check the chi2 value. 946 self.flags(pcs=False) 947 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py') 948 self.check_chi2(0.0055589468820694179)
949 950
952 """Test the second isotropic cone, free rotor frame order model of CaM.""" 953 954 # The flags, execute the script, and then check the chi2 value. 955 self.flags() 956 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py') 957 self.check_chi2(0.058320273132310863)
958 959
961 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 962 963 # The flags, execute the script, and then check the chi2 value. 964 self.flags(rdc=False) 965 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py') 966 self.check_chi2(0.0095766977930929302)
967 968
970 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 971 972 # The flags, execute the script, and then check the chi2 value. 973 self.flags(pcs=False) 974 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py') 975 self.check_chi2(0.048749202219945678)
976 977
979 """Test the second isotropic cone, free rotor frame order model of CaM.""" 980 981 # The flags, execute the script, and then check the chi2 value. 982 self.flags(opt=True) 983 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py') 984 self.check_chi2(0.052923535071890106)
985 986
988 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 989 990 # The flags, execute the script, and then check the chi2 value. 991 self.flags(rdc=False) 992 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py') 993 self.check_chi2(0.025487205467282097)
994 995
997 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 998 999 # The flags, execute the script, and then check the chi2 value. 1000 self.flags(pcs=False) 1001 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py') 1002 self.check_chi2(0.03300256897164619)
1003 1004
1006 """Test the second isotropic cone, free rotor frame order model of CaM.""" 1007 1008 # The flags, execute the script, and then check the chi2 value. 1009 self.flags() 1010 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py') 1011 self.check_chi2(0.041445854907868764)
1012 1013
1015 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1016 1017 # The flags, execute the script, and then check the chi2 value. 1018 self.flags(rdc=False) 1019 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py') 1020 self.check_chi2(0.02331739779637744)
1021 1022
1024 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1025 1026 # The flags, execute the script, and then check the chi2 value. 1027 self.flags(pcs=False) 1028 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py') 1029 self.check_chi2(0.018129612955648935)
1030 1031
1033 """Test the second isotropic cone, free rotor frame order model of CaM.""" 1034 1035 # The flags, execute the script, and then check the chi2 value. 1036 self.flags() 1037 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py') 1038 self.check_chi2(0.07886558371162268)
1039 1040
1042 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1043 1044 # The flags, execute the script, and then check the chi2 value. 1045 self.flags(rdc=False) 1046 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py') 1047 self.check_chi2(0.038891355121051734)
1048 1049
1051 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1052 1053 # The flags, execute the script, and then check the chi2 value. 1054 self.flags(pcs=False) 1055 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py') 1056 self.check_chi2(0.039974228590570947)
1057 1058
1060 """Test the second isotropic cone, free rotor frame order model of CaM.""" 1061 1062 # The flags, execute the script, and then check the chi2 value. 1063 self.flags() 1064 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py') 1065 self.check_chi2(0.018922576784401186)
1066 1067
1069 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1070 1071 # The flags, execute the script, and then check the chi2 value. 1072 self.flags(rdc=False) 1073 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py') 1074 self.check_chi2(0.003977725835776093)
1075 1076
1078 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1079 1080 # The flags, execute the script, and then check the chi2 value. 1081 self.flags(pcs=False) 1082 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py') 1083 self.check_chi2(0.014947617377424345)
1084 1085
1086 - def test_cam_qr_int_rigid(self):
1087 """Test the rigid frame order model of CaM.""" 1088 1089 # The flags, execute the script, and then check the chi2 value. 1090 self.flags(opt=True) 1091 self.interpreter.run(script_file=self.cam_path+'rigid.py') 1092 self.check_chi2(0.081171019382935666)
1093 1094
1095 - def test_cam_qr_int_rigid_pcs(self):
1096 """Test the rigid frame order model of CaM (with only PCS data).""" 1097 1098 # The flags, execute the script, and then check the chi2 value. 1099 self.flags(rdc=False) 1100 self.interpreter.run(script_file=self.cam_path+'rigid.py') 1101 self.check_chi2(6.1557756577162843e-09)
1102 1103
1104 - def test_cam_qr_int_rigid_rdc(self):
1105 """Test the rigid frame order model of CaM (with only RDC data).""" 1106 1107 # The flags, execute the script, and then check the chi2 value. 1108 self.flags(pcs=False) 1109 self.interpreter.run(script_file=self.cam_path+'rigid.py') 1110 self.check_chi2(0.081171013227160013)
1111 1112
1113 - def test_cam_qr_int_rotor(self):
1114 """Test the rotor frame order model of CaM.""" 1115 1116 # The flags, execute the script, and then check the chi2 value. 1117 self.flags() 1118 self.interpreter.run(script_file=self.cam_path+'rotor.py') 1119 self.check_chi2(0.075072773007664212)
1120 1121
1122 - def test_cam_qr_int_rotor_pcs(self):
1123 """Test the rotor frame order model of CaM (with only PCS data).""" 1124 1125 # The flags, execute the script, and then check the chi2 value. 1126 self.flags(rdc=False) 1127 self.interpreter.run(script_file=self.cam_path+'rotor.py') 1128 self.check_chi2(1.139566998206629e-06)
1129 1130
1131 - def test_cam_qr_int_rotor_rdc(self):
1132 """Test the rotor frame order model of CaM (with only RDC data).""" 1133 1134 # The flags, execute the script, and then check the chi2 value. 1135 self.flags(pcs=False) 1136 self.interpreter.run(script_file=self.cam_path+'rotor.py') 1137 self.check_chi2(0.075071633440666002)
1138 1139
1141 """Test the 2-state rotor frame order model of CaM.""" 1142 1143 # The flags, execute the script, and then check the chi2 value. 1144 self.flags() 1145 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py') 1146 self.check_chi2(0.98321958150473276)
1147 1148
1150 """Test the 2-state rotor frame order model of CaM (with only PCS data).""" 1151 1152 # The flags, execute the script, and then check the chi2 value. 1153 self.flags(rdc=False) 1154 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py') 1155 self.check_chi2(2.9152704264897967e-05)
1156 1157
1159 """Test the 2-state rotor frame order model of CaM (with only RDC data).""" 1160 1161 # The flags, execute the script, and then check the chi2 value. 1162 self.flags(pcs=False) 1163 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py') 1164 self.check_chi2(0.98319606148815675)
1165 1166
1167 - def test_cam_qr_int_rotor2(self):
1168 """Test the second rotor frame order model of CaM.""" 1169 1170 # The flags, execute the script, and then check the chi2 value. 1171 self.flags(opt=True) 1172 self.interpreter.run(script_file=self.cam_path+'rotor2.py') 1173 self.check_chi2(0.075040490418167072)
1174 1175
1176 - def test_cam_qr_int_rotor2_pcs(self):
1177 """Test the second rotor frame order model of CaM (with only PCS data).""" 1178 1179 # The flags, execute the script, and then check the chi2 value. 1180 self.flags(rdc=False) 1181 self.interpreter.run(script_file=self.cam_path+'rotor2.py') 1182 self.check_chi2(1.5787105392036996e-06)
1183 1184
1185 - def test_cam_qr_int_rotor2_rdc(self):
1186 """Test the second rotor frame order model of CaM (with only RDC data).""" 1187 1188 # The flags, execute the script, and then check the chi2 value. 1189 self.flags(pcs=False) 1190 self.interpreter.run(script_file=self.cam_path+'rotor2.py') 1191 self.check_chi2(0.075038911707627859)
1192 1193
1195 """Test the double rotor frame order model of CaM.""" 1196 1197 # The flags, execute the script, and then check the chi2 value. 1198 self.flags(quad_int=True) 1199 self.interpreter.run(script_file=self.cam_path+'double_rotor.py') 1200 self.check_chi2(0.079828365857374614)
1201 1202
1204 """Test the double rotor frame order model of CaM (with only PCS data).""" 1205 1206 # The flags, execute the script, and then check the chi2 value. 1207 self.flags(rdc=False, quad_int=True) 1208 self.interpreter.run(script_file=self.cam_path+'double_rotor.py') 1209 self.check_chi2(1.6582207495230563e-05)
1210 1211
1213 """Test the double rotor frame order model of CaM (with only RDC data).""" 1214 1215 # The flags, execute the script, and then check the chi2 value. 1216 self.flags(pcs=False, quad_int=True) 1217 self.interpreter.run(script_file=self.cam_path+'double_rotor.py') 1218 self.check_chi2(0.079814053829495801)
1219 1220
1222 """Test the double rotor frame order model of CaM.""" 1223 1224 # The flags, execute the script, and then check the chi2 value. 1225 self.flags(quad_int=True) 1226 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py') 1227 self.check_chi2(0.57126501230322546)
1228 1229
1231 """Test the double rotor frame order model of CaM (with only PCS data).""" 1232 1233 # The flags, execute the script, and then check the chi2 value. 1234 self.flags(rdc=False, quad_int=True) 1235 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py') 1236 self.check_chi2(0.5273196608417523)
1237 1238
1240 """Test the double rotor frame order model of CaM (with only RDC data).""" 1241 1242 # The flags, execute the script, and then check the chi2 value. 1243 self.flags(pcs=False, quad_int=True) 1244 self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py') 1245 self.check_chi2(0.043946055085127944)
1246 1247
1249 """Test the free rotor frame order model of CaM.""" 1250 1251 # The flags, execute the script, and then check the chi2 value. 1252 self.flags(quad_int=True) 1253 self.interpreter.run(script_file=self.cam_path+'free_rotor.py') 1254 self.check_chi2(0.04899586148178818)
1255 1256
1258 """Test the free rotor frame order model of CaM.""" 1259 1260 # The flags, execute the script, and then check the chi2 value. 1261 self.flags(quad_int=True) 1262 self.interpreter.run(script_file=self.cam_path+'free_rotor_missing_data.py') 1263 self.check_chi2(0.037726306126177556)
1264 1265
1267 """Test the free rotor frame order model of CaM (with only PCS data).""" 1268 1269 # The flags, execute the script, and then check the chi2 value. 1270 self.flags(rdc=False, quad_int=True) 1271 self.interpreter.run(script_file=self.cam_path+'free_rotor.py') 1272 self.check_chi2(4.5205576772581238e-08)
1273 1274
1276 """Test the free rotor frame order model of CaM (with only RDC data).""" 1277 1278 # The flags, execute the script, and then check the chi2 value. 1279 self.flags(pcs=False, quad_int=True) 1280 self.interpreter.run(script_file=self.cam_path+'free_rotor.py') 1281 self.check_chi2(0.04899130610303442)
1282 1283
1285 """Test the second free rotor frame order model of CaM.""" 1286 1287 # The flags, execute the script, and then check the chi2 value. 1288 self.flags(quad_int=True) 1289 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py') 1290 self.check_chi2(0.06748978555251639)
1291 1292
1294 """Test the second free rotor frame order model of CaM (with only PCS data).""" 1295 1296 # The flags, execute the script, and then check the chi2 value. 1297 self.flags(rdc=False, quad_int=True) 1298 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py') 1299 self.check_chi2(0.010744719591287448)
1300 1301
1303 """Test the second free rotor frame order model of CaM (with only RDC data).""" 1304 1305 # The flags, execute the script, and then check the chi2 value. 1306 self.flags(pcs=False, quad_int=True) 1307 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py') 1308 self.check_chi2(0.056744492444430819)
1309 1310
1311 - def test_cam_quad_int_iso_cone(self):
1312 """Test the isotropic cone, free rotor frame order model of CaM.""" 1313 1314 # The flags, execute the script, and then check the chi2 value. 1315 self.flags(quad_int=True) 1316 self.interpreter.run(script_file=self.cam_path+'iso_cone.py') 1317 self.check_chi2(0.041430522432421318)
1318 1319
1321 """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1322 1323 # The flags, execute the script, and then check the chi2 value. 1324 self.flags(rdc=False, quad_int=True) 1325 self.interpreter.run(script_file=self.cam_path+'iso_cone.py') 1326 self.check_chi2(4.8409613144085089e-08)
1327 1328
1330 """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1331 1332 # The flags, execute the script, and then check the chi2 value. 1333 self.flags(pcs=False, quad_int=True) 1334 self.interpreter.run(script_file=self.cam_path+'iso_cone.py') 1335 self.check_chi2(0.041428474106863025)
1336 1337
1339 """Test the isotropic cone, free rotor frame order model of CaM.""" 1340 1341 # The flags, execute the script, and then check the chi2 value. 1342 self.flags(quad_int=True) 1343 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py') 1344 self.check_chi2(0.01098760442625833)
1345 1346
1348 """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1349 1350 # The flags, execute the script, and then check the chi2 value. 1351 self.flags(rdc=False, quad_int=True) 1352 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py') 1353 self.check_chi2(1.20136009208203e-06)
1354 1355
1357 """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1358 1359 # The flags, execute the script, and then check the chi2 value. 1360 self.flags(pcs=False, quad_int=True) 1361 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py') 1362 self.check_chi2(0.010986403066166248)
1363 1364
1366 """Test the second isotropic cone, free rotor frame order model of CaM.""" 1367 1368 # The flags, execute the script, and then check the chi2 value. 1369 self.flags(quad_int=True) 1370 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py') 1371 self.check_chi2(0.027527295381115289)
1372 1373
1375 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1376 1377 # The flags, execute the script, and then check the chi2 value. 1378 self.flags(rdc=False, quad_int=True) 1379 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py') 1380 self.check_chi2(0.021968348499045869)
1381 1382
1384 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1385 1386 # The flags, execute the script, and then check the chi2 value. 1387 self.flags(pcs=False, quad_int=True) 1388 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py') 1389 self.check_chi2(0.0055589468820694179)
1390 1391
1393 """Test the second isotropic cone, free rotor frame order model of CaM.""" 1394 1395 # The flags, execute the script, and then check the chi2 value. 1396 self.flags(quad_int=True) 1397 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py') 1398 self.check_chi2(0.048766438238093554)
1399 1400
1402 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1403 1404 # The flags, execute the script, and then check the chi2 value. 1405 self.flags(rdc=False, quad_int=True) 1406 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py') 1407 self.check_chi2(2.2862898875626613e-05)
1408 1409
1411 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1412 1413 # The flags, execute the script, and then check the chi2 value. 1414 self.flags(pcs=False, quad_int=True) 1415 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py') 1416 self.check_chi2(0.048749202219945678)
1417 1418
1420 """Test the second isotropic cone, free rotor frame order model of CaM.""" 1421 1422 # The flags, execute the script, and then check the chi2 value. 1423 self.flags(quad_int=True) 1424 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py') 1425 self.check_chi2(0.033007827805689761)
1426 1427
1429 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1430 1431 # The flags, execute the script, and then check the chi2 value. 1432 self.flags(rdc=False, quad_int=True) 1433 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py') 1434 self.check_chi2(1.534188648468986e-07)
1435 1436
1438 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1439 1440 # The flags, execute the script, and then check the chi2 value. 1441 self.flags(pcs=False, quad_int=True) 1442 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py') 1443 self.check_chi2(0.03300256897164619)
1444 1445
1447 """Test the second isotropic cone, free rotor frame order model of CaM.""" 1448 1449 # The flags, execute the script, and then check the chi2 value. 1450 self.flags(quad_int=True) 1451 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py') 1452 self.check_chi2(0.018129059824815268)
1453 1454
1456 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1457 1458 # The flags, execute the script, and then check the chi2 value. 1459 self.flags(rdc=False, quad_int=True) 1460 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py') 1461 self.check_chi2(6.0271332394266001e-07)
1462 1463
1465 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1466 1467 # The flags, execute the script, and then check the chi2 value. 1468 self.flags(pcs=False, quad_int=True) 1469 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py') 1470 self.check_chi2(0.018129612955648935)
1471 1472
1474 """Test the second isotropic cone, free rotor frame order model of CaM.""" 1475 1476 # The flags, execute the script, and then check the chi2 value. 1477 self.flags(quad_int=True) 1478 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py') 1479 self.check_chi2(0.039974493838723132)
1480 1481
1483 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1484 1485 # The flags, execute the script, and then check the chi2 value. 1486 self.flags(rdc=False, quad_int=True) 1487 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py') 1488 self.check_chi2(2.6524815218336224e-07)
1489 1490
1492 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1493 1494 # The flags, execute the script, and then check the chi2 value. 1495 self.flags(pcs=False, quad_int=True) 1496 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py') 1497 self.check_chi2(0.039974228590570947)
1498 1499
1501 """Test the second isotropic cone, free rotor frame order model of CaM.""" 1502 1503 # The flags, execute the script, and then check the chi2 value. 1504 self.flags(quad_int=True) 1505 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py') 1506 self.check_chi2(0.014945243556224312)
1507 1508
1510 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data).""" 1511 1512 # The flags, execute the script, and then check the chi2 value. 1513 self.flags(rdc=False, quad_int=True) 1514 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py') 1515 self.check_chi2(3.9260759922047933e-07)
1516 1517
1519 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data).""" 1520 1521 # The flags, execute the script, and then check the chi2 value. 1522 self.flags(pcs=False, quad_int=True) 1523 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py') 1524 self.check_chi2(0.014947617377424345)
1525 1526
1527 - def test_cam_quad_int_rigid(self):
1528 """Test the rigid frame order model of CaM.""" 1529 1530 # The flags, execute the script, and then check the chi2 value. 1531 self.flags(quad_int=True) 1532 self.interpreter.run(script_file=self.cam_path+'rigid.py') 1533 self.check_chi2(0.081171019382935666)
1534 1535
1537 """Test the rigid frame order model of CaM (with only PCS data).""" 1538 1539 # The flags, execute the script, and then check the chi2 value. 1540 self.flags(rdc=False, quad_int=True) 1541 self.interpreter.run(script_file=self.cam_path+'rigid.py') 1542 self.check_chi2(6.1557756577162843e-09)
1543 1544
1546 """Test the rigid frame order model of CaM (with only RDC data).""" 1547 1548 # The flags, execute the script, and then check the chi2 value. 1549 self.flags(pcs=False, quad_int=True) 1550 self.interpreter.run(script_file=self.cam_path+'rigid.py') 1551 self.check_chi2(0.081171013227160013)
1552 1553
1554 - def test_cam_quad_int_rotor(self):
1555 """Test the rotor frame order model of CaM.""" 1556 1557 # The flags, execute the script, and then check the chi2 value. 1558 self.flags(quad_int=True) 1559 self.interpreter.run(script_file=self.cam_path+'rotor.py') 1560 self.check_chi2(0.075072773007664212)
1561 1562
1564 """Test the rotor frame order model of CaM (with only PCS data).""" 1565 1566 # The flags, execute the script, and then check the chi2 value. 1567 self.flags(rdc=False, quad_int=True) 1568 self.interpreter.run(script_file=self.cam_path+'rotor.py') 1569 self.check_chi2(1.139566998206629e-06)
1570 1571
1573 """Test the rotor frame order model of CaM (with only RDC data).""" 1574 1575 # The flags, execute the script, and then check the chi2 value. 1576 self.flags(pcs=False, quad_int=True) 1577 self.interpreter.run(script_file=self.cam_path+'rotor.py') 1578 self.check_chi2(0.075071633440666002)
1579 1580
1582 """Test the 2-state rotor frame order model of CaM.""" 1583 1584 # The flags, execute the script, and then check the chi2 value. 1585 self.flags(quad_int=True) 1586 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py') 1587 self.check_chi2(0.98321958150473276)
1588 1589
1591 """Test the 2-state rotor frame order model of CaM (with only PCS data).""" 1592 1593 # The flags, execute the script, and then check the chi2 value. 1594 self.flags(rdc=False, quad_int=True) 1595 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py') 1596 self.check_chi2(2.9152704264897967e-05)
1597 1598
1600 """Test the 2-state rotor frame order model of CaM (with only RDC data).""" 1601 1602 # The flags, execute the script, and then check the chi2 value. 1603 self.flags(pcs=False, quad_int=True) 1604 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py') 1605 self.check_chi2(0.98319606148815675)
1606 1607
1608 - def test_cam_quad_int_rotor2(self):
1609 """Test the second rotor frame order model of CaM.""" 1610 1611 # The flags, execute the script, and then check the chi2 value. 1612 self.flags(quad_int=True) 1613 self.interpreter.run(script_file=self.cam_path+'rotor2.py') 1614 self.check_chi2(0.075040490418167072)
1615 1616
1618 """Test the second rotor frame order model of CaM (with only PCS data).""" 1619 1620 # The flags, execute the script, and then check the chi2 value. 1621 self.flags(rdc=False, quad_int=True) 1622 self.interpreter.run(script_file=self.cam_path+'rotor2.py') 1623 self.check_chi2(1.5787105392036996e-06)
1624 1625
1627 """Test the second rotor frame order model of CaM (with only RDC data).""" 1628 1629 # The flags, execute the script, and then check the chi2 value. 1630 self.flags(pcs=False, quad_int=True) 1631 self.interpreter.run(script_file=self.cam_path+'rotor2.py') 1632 self.check_chi2(0.075038911707627859)
1633 1634
1635 - def test_count_sobol_points(self):
1636 """Test the ability of the frame_order.sobol_setup user function to be able to count the number of Sobol' points used for the current parameter values.""" 1637 1638 # Reset. 1639 self.interpreter.reset() 1640 1641 # Load the state file. 1642 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' 1643 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') 1644 1645 # Set the number of integration points, and see if they can be counted. 1646 self.interpreter.frame_order.sobol_setup(20) 1647 1648 # Check the count. 1649 self.assertEqual(cdp.sobol_points_used, 20)
1650 1651
1652 - def test_count_sobol_points2(self):
1653 """Test the frame_order.count_sobol_points user function.""" 1654 1655 # Reset. 1656 self.interpreter.reset() 1657 1658 # Load the state file. 1659 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' 1660 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') 1661 1662 # Call the user function. 1663 self.interpreter.frame_order.count_sobol_points() 1664 1665 # Check the count. 1666 self.assertEqual(cdp.sobol_points_used, 20)
1667 1668
1670 """Test the frame_order.count_sobol_points user function for the free-rotor model.""" 1671 1672 # Reset. 1673 self.interpreter.reset() 1674 1675 # Load the state file. 1676 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep+'free_rotor' 1677 self.interpreter.state.load(data_path+sep+'frame_order') 1678 1679 # Reset the number of points. 1680 self.interpreter.frame_order.sobol_setup(20) 1681 1682 # Call the user function. 1683 self.interpreter.frame_order.count_sobol_points() 1684 1685 # Check the count. 1686 self.assertEqual(cdp.sobol_points_used, 20)
1687 1688
1690 """Test the frame_order.count_sobol_points user function for the free-rotor isotropic cone model.""" 1691 1692 # Reset. 1693 self.interpreter.reset() 1694 1695 # Load the state file. 1696 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep+'iso_cone_free_rotor' 1697 self.interpreter.state.load(data_path+sep+'frame_order') 1698 1699 # Reset the number of points. 1700 self.interpreter.frame_order.sobol_setup(20) 1701 1702 # Call the user function. 1703 self.interpreter.frame_order.count_sobol_points() 1704 1705 # Check the count. 1706 self.assertEqual(cdp.sobol_points_used, 20)
1707 1708
1710 """Test the frame_order.count_sobol_points user function for the rigid model.""" 1711 1712 # Reset. 1713 self.interpreter.reset() 1714 1715 # Load the state file. 1716 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep+'rigid' 1717 self.interpreter.state.load(data_path+sep+'frame_order') 1718 1719 # Call the user function. 1720 self.interpreter.frame_order.count_sobol_points() 1721 1722 # Check the count. 1723 self.assertTrue(not hasattr(cdp, 'sobol_points_used'))
1724 1725
1727 """Test the frame_order.count_sobol_points user function for the rotor model.""" 1728 1729 # Reset. 1730 self.interpreter.reset() 1731 1732 # Load the state file. 1733 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep+'rotor' 1734 self.interpreter.state.load(data_path+sep+'frame_order') 1735 1736 # Reset the number of points. 1737 self.interpreter.frame_order.sobol_setup(20) 1738 1739 # Call the user function. 1740 self.interpreter.frame_order.count_sobol_points() 1741 1742 # Check the count. 1743 self.assertEqual(cdp.sobol_points_used, 20)
1744 1745
1747 """Check the frame_order.decompose user function PDB file for the free rotor model along the z-axis.""" 1748 1749 # Call the equivalent frame_order.simulate user function system test to do everything. 1750 self.test_simulate_free_rotor_z_axis(type='decomp')
1751 1752
1754 """Check the frame_order.decompose user function PDB file for the isotropic cone model along the z-axis.""" 1755 1756 # Call the equivalent frame_order.simulate user function system test to do everything. 1757 self.test_simulate_iso_cone_z_axis(type='decomp')
1758 1759
1761 """Check the frame_order.decompose user function PDB file for the isotropic cone model with a xz-plane tilt.""" 1762 1763 # Call the equivalent frame_order.simulate user function system test to do everything. 1764 self.test_simulate_iso_cone_xz_plane_tilt(type='decomp')
1765 1766
1768 """Check the frame_order.decompose user function PDB file for the free rotor isotropic cone model along the z-axis.""" 1769 1770 # Call the equivalent frame_order.simulate user function system test to do everything. 1771 self.test_simulate_iso_cone_free_rotor_z_axis(type='decomp')
1772 1773
1775 """Check the frame_order.decompose user function PDB file for the torsionless isotropic cone model along the z-axis.""" 1776 1777 # Call the equivalent frame_order.simulate user function system test to do everything. 1778 self.test_simulate_iso_cone_torsionless_z_axis(type='decomp')
1779 1780
1782 """Check the frame_order.decompose user function PDB file for the pseudo-ellipse model with a xz-plane tilt.""" 1783 1784 # Call the equivalent frame_order.simulate user function system test to do everything. 1785 self.test_simulate_pseudo_ellipse_xz_plane_tilt(type='decomp')
1786 1787
1789 """Check the frame_order.decompose user function PDB file for the pseudo-ellipse model along the z-axis.""" 1790 1791 # Call the equivalent frame_order.simulate user function system test to do everything. 1792 self.test_simulate_pseudo_ellipse_z_axis(type='decomp')
1793 1794
1796 """Check the frame_order.decompose user function PDB file for the free rotor pseudo-ellipse model along the z-axis.""" 1797 1798 # Call the equivalent frame_order.simulate user function system test to do everything. 1799 self.test_simulate_pseudo_ellipse_free_rotor_z_axis(type='decomp')
1800 1801
1803 """Check the frame_order.decompose user function PDB file for the torsionless pseudo-ellipse model along the z-axis.""" 1804 1805 # Call the equivalent frame_order.simulate user function system test to do everything. 1806 self.test_simulate_pseudo_ellipse_torsionless_z_axis(type='decomp')
1807 1808
1810 """Check the frame_order.decompose user function PDB file for the rotor model along the z-axis.""" 1811 1812 # Call the equivalent frame_order.simulate user function system test to do everything. 1813 self.test_simulate_rotor_z_axis(type='decomp')
1814 1815
1817 """Check the frame_order.decompose user function PDB file for the free rotor model along the z-axis.""" 1818 1819 # Call the equivalent frame_order.simulate user function system test to do everything. 1820 self.test_simulate_free_rotor_z_axis(type='decomp2')
1821 1822
1824 """Check the frame_order.decompose user function PDB file for the isotropic cone model along the z-axis.""" 1825 1826 # Call the equivalent frame_order.simulate user function system test to do everything. 1827 self.test_simulate_iso_cone_z_axis(type='decomp2')
1828 1829
1831 """Check the frame_order.decompose user function PDB file for the isotropic cone model with a xz-plane tilt.""" 1832 1833 # Call the equivalent frame_order.simulate user function system test to do everything. 1834 self.test_simulate_iso_cone_xz_plane_tilt(type='decomp2')
1835 1836
1838 """Check the frame_order.decompose user function PDB file for the free rotor isotropic cone model along the z-axis.""" 1839 1840 # Call the equivalent frame_order.simulate user function system test to do everything. 1841 self.test_simulate_iso_cone_free_rotor_z_axis(type='decomp2')
1842 1843
1845 """Check the frame_order.decompose user function PDB file for the torsionless isotropic cone model along the z-axis.""" 1846 1847 # Call the equivalent frame_order.simulate user function system test to do everything. 1848 self.test_simulate_iso_cone_torsionless_z_axis(type='decomp2')
1849 1850
1852 """Check the frame_order.decompose user function PDB file for the pseudo-ellipse model with a xz-plane tilt.""" 1853 1854 # Call the equivalent frame_order.simulate user function system test to do everything. 1855 self.test_simulate_pseudo_ellipse_xz_plane_tilt(type='decomp2')
1856 1857
1859 """Check the frame_order.decompose user function PDB file for the pseudo-ellipse model along the z-axis.""" 1860 1861 # Call the equivalent frame_order.simulate user function system test to do everything. 1862 self.test_simulate_pseudo_ellipse_z_axis(type='decomp2')
1863 1864
1866 """Check the frame_order.decompose user function PDB file for the free rotor pseudo-ellipse model along the z-axis.""" 1867 1868 # Call the equivalent frame_order.simulate user function system test to do everything. 1869 self.test_simulate_pseudo_ellipse_free_rotor_z_axis(type='decomp2')
1870 1871
1873 """Check the frame_order.decompose user function PDB file for the torsionless pseudo-ellipse model along the z-axis.""" 1874 1875 # Call the equivalent frame_order.simulate user function system test to do everything. 1876 self.test_simulate_pseudo_ellipse_torsionless_z_axis(type='decomp2')
1877 1878
1880 """Check the frame_order.decompose user function PDB file for the rotor model along the z-axis.""" 1881 1882 # Call the equivalent frame_order.simulate user function system test to do everything. 1883 self.test_simulate_rotor_z_axis(type='decomp2')
1884 1885
1887 """Check the frame_order.distribute user function PDB file for the free rotor model along the z-axis.""" 1888 1889 # Call the equivalent frame_order.simulate user function system test to do everything. 1890 self.test_simulate_free_rotor_z_axis(type='dist')
1891 1892
1894 """Check the frame_order.distribute user function PDB file for the isotropic cone model along the z-axis.""" 1895 1896 # Call the equivalent frame_order.simulate user function system test to do everything. 1897 self.test_simulate_iso_cone_z_axis(type='dist')
1898 1899
1901 """Check the frame_order.distribute user function PDB file for the isotropic cone model with a xz-plane tilt.""" 1902 1903 # Call the equivalent frame_order.simulate user function system test to do everything. 1904 self.test_simulate_iso_cone_xz_plane_tilt(type='dist')
1905 1906
1908 """Check the frame_order.distribute user function PDB file for the torsionless isotropic cone model along the z-axis.""" 1909 1910 # Call the equivalent frame_order.simulate user function system test to do everything. 1911 self.test_simulate_iso_cone_torsionless_z_axis(type='dist')
1912 1913
1915 """Check the frame_order.distribute user function PDB file for the pseudo-ellipse model with a xz-plane tilt.""" 1916 1917 # Call the equivalent frame_order.simulate user function system test to do everything. 1918 self.test_simulate_pseudo_ellipse_xz_plane_tilt(type='dist')
1919 1920
1922 """Check the frame_order.distribute user function PDB file for the pseudo-ellipse model along the z-axis.""" 1923 1924 # Call the equivalent frame_order.simulate user function system test to do everything. 1925 self.test_simulate_pseudo_ellipse_z_axis(type='dist')
1926 1927
1929 """Check the frame_order.distribute user function PDB file for the free rotor pseudo-ellipse model along the z-axis.""" 1930 1931 # Call the equivalent frame_order.simulate user function system test to do everything. 1932 self.test_simulate_pseudo_ellipse_free_rotor_z_axis(type='dist')
1933 1934
1936 """Check the frame_order.distribute user function PDB file for the torsionless pseudo-ellipse model along the z-axis.""" 1937 1938 # Call the equivalent frame_order.simulate user function system test to do everything. 1939 self.test_simulate_pseudo_ellipse_torsionless_z_axis(type='dist')
1940 1941
1943 """Check the frame_order.distribute user function PDB file for the rotor model along the z-axis.""" 1944 1945 # Call the equivalent frame_order.simulate user function system test to do everything. 1946 self.test_simulate_rotor_z_axis(type='dist')
1947 1948
1950 """Test the operation of the frame_order.pdb_model user function when an ensemble of structures are loaded.""" 1951 1952 # Create a data pipe. 1953 self.interpreter.pipe.create('frame_order.pdb_model ensemble failure', 'frame order') 1954 1955 # Load some lactose structures to create an ensemble. 1956 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 1957 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=data_path, set_model_num=1, set_mol_name='lactose') 1958 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=data_path, set_model_num=2, set_mol_name='lactose') 1959 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_3.pdb', dir=data_path, set_model_num=3, set_mol_name='lactose') 1960 1961 # Set the pivot point. 1962 self.interpreter.frame_order.pivot([0, 0, 0], fix=True) 1963 1964 # Select a frame order model. 1965 self.interpreter.frame_order.select_model('rotor') 1966 1967 # Define the moving part. 1968 self.interpreter.domain(id='lactose', spin_id=':UNK') 1969 self.interpreter.frame_order.ref_domain('lactose') 1970 1971 # Set up the system. 1972 self.interpreter.value.set(param='ave_pos_x', val=0.0) 1973 self.interpreter.value.set(param='ave_pos_y', val=0.0) 1974 self.interpreter.value.set(param='ave_pos_z', val=0.0) 1975 self.interpreter.value.set(param='ave_pos_alpha', val=0.0) 1976 self.interpreter.value.set(param='ave_pos_beta', val=0.0) 1977 self.interpreter.value.set(param='ave_pos_gamma', val=0.0) 1978 self.interpreter.value.set(param='axis_alpha', val=0.5) 1979 self.interpreter.value.set(param='cone_sigma_max', val=0.1) 1980 1981 # Set up Monte Carlo data structures. 1982 self.interpreter.monte_carlo.setup(10) 1983 self.interpreter.monte_carlo.initial_values() 1984 1985 # Create the PDB model. 1986 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir)
1987 1988
1990 """Test the operation of the frame_order.pdb_model user function when the pivot is outside of the PDB limits.""" 1991 1992 # Create a data pipe. 1993 self.interpreter.pipe.create('frame_order.pdb_model ensemble failure', 'frame order') 1994 1995 # Load one lactose structure. 1996 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' 1997 self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=data_path, set_mol_name='lactose') 1998 1999 # Set the pivot point. 2000 self.interpreter.frame_order.pivot([-995, 0, 0], fix=True) 2001 2002 # Select a frame order model. 2003 self.interpreter.frame_order.select_model('rotor') 2004 2005 # Define the moving part. 2006 self.interpreter.domain(id='lactose', spin_id=':UNK') 2007 self.interpreter.frame_order.ref_domain('lactose') 2008 2009 # Set up the system. 2010 self.interpreter.value.set(param='ave_pos_x', val=0.0) 2011 self.interpreter.value.set(param='ave_pos_y', val=0.0) 2012 self.interpreter.value.set(param='ave_pos_z', val=0.0) 2013 self.interpreter.value.set(param='ave_pos_alpha', val=0.0) 2014 self.interpreter.value.set(param='ave_pos_beta', val=0.0) 2015 self.interpreter.value.set(param='ave_pos_gamma', val=0.0) 2016 self.interpreter.value.set(param='axis_alpha', val=0.5) 2017 self.interpreter.value.set(param='cone_sigma_max', val=0.1) 2018 2019 # Set up Monte Carlo data structures. 2020 self.interpreter.monte_carlo.setup(10) 2021 self.interpreter.monte_carlo.initial_values() 2022 2023 # Create the PDB model. 2024 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir)
2025 2026
2028 """Generate the rotor2 distribution of CaM.""" 2029 2030 # Execute the script. 2031 self.interpreter.run(script_file=self.cam_path+'generate_rotor2_distribution.py')
2032 2033
2034 - def test_opendx_map(self):
2035 """Test the mapping of the Euler angle parameters for OpenDx viewing.""" 2036 2037 # Execute the script. 2038 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'opendx_euler_angle_map.py')
2039 2040
2042 """Check the frame_order.pdb_model user function PDB file for the rotor model along the z-axis.""" 2043 2044 # Init. 2045 pivot2 = array([1, 0, 0], float64) 2046 pivot_disp = 100 2047 pivot1 = pivot2 + (z_axis-x_axis)/sqrt(2.0)*pivot_disp 2048 l = 20.0 2049 2050 # The axis parameters, and printout. 2051 eigen_beta = -pi/4.0 2052 R = zeros((3, 3), float64) 2053 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 2054 print("Motional eigenframe:\n%s" % R) 2055 2056 # Set up. 2057 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot2, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=0.0, cone_sigma_max_2=0.0) 2058 2059 # Create the PDB. 2060 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l) 2061 2062 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2063 data = [ 2064 # The pivots. 2065 [ 1, 'PIV', 1, 'Piv1', pivot1], 2066 [ 1, 'PIV', 2, 'Piv2', pivot2], 2067 2068 # The x-axis rotor. 2069 [ 1, 'RTX', 3, 'CTR', pivot2], 2070 [ 2, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta)], 2071 [ 3, 'RTX', 5, 'PRP', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta, neg=True)], 2072 [ 4, 'RTB', 6, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta)], 2073 [ 5, 'RTB', 188, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta)], 2074 [ 6, 'RTB', 370, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta)], 2075 [ 7, 'RTB', 552, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta)], 2076 [ 8, 'RTB', 734, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta, neg=True)], 2077 [ 9, 'RTB', 916, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta, neg=True)], 2078 [10, 'RTB', 1098, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta, neg=True)], 2079 [11, 'RTB', 1280, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta, neg=True)], 2080 [12, 'RTL', 1462, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0+eigen_beta)], 2081 [12, 'RTL', 1463, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0+eigen_beta, neg=True)], 2082 2083 # The y-axis rotor. 2084 [ 1, 'RTX', 1464, 'CTR', pivot1], 2085 [ 2, 'RTX', 1465, 'PRP', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)], 2086 [ 3, 'RTX', 1466, 'PRP', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)], 2087 [ 4, 'RTB', 1467, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)], 2088 [ 5, 'RTB', 1649, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)], 2089 [ 6, 'RTB', 1831, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)], 2090 [ 7, 'RTB', 2013, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)], 2091 [ 8, 'RTB', 2195, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)], 2092 [ 9, 'RTB', 2377, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)], 2093 [10, 'RTB', 2559, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)], 2094 [11, 'RTB', 2741, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)], 2095 [12, 'RTL', 2923, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis)], 2096 [12, 'RTL', 2924, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis, neg=True)], 2097 2098 # The z-axis. 2099 [ 1, 'AXE', 2925, 'R', pivot2], 2100 [ 1, 'AXE', 2926, 'z-ax', pivot1], 2101 [ 1, 'AXE', 2927, 'z-ax', (pivot1-pivot2)*1.1+pivot2], 2102 ] 2103 2104 # Check the data. 2105 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
2106 2107
2109 """Check the frame_order.pdb_model user function PDB file for the rotor model along the z-axis.""" 2110 2111 # Init. 2112 pivot2 = array([1, 0, 0], float64) 2113 pivot_disp = 100 2114 pivot1 = pivot2 + z_axis*pivot_disp 2115 l = 30.0 2116 2117 # The axis parameters, and printout. 2118 eigen_beta = 0.0 2119 R = zeros((3, 3), float64) 2120 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 2121 print("Motional eigenframe:\n%s" % R) 2122 2123 # Set up. 2124 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot2, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=0.0, cone_sigma_max_2=0.0) 2125 2126 # Create the PDB. 2127 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l) 2128 2129 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2130 data = [ 2131 # The pivots. 2132 [ 1, 'PIV', 1, 'Piv1', pivot1], 2133 [ 1, 'PIV', 2, 'Piv2', pivot2], 2134 2135 # The x-axis rotor. 2136 [ 1, 'RTX', 3, 'CTR', pivot2], 2137 [ 2, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0)], 2138 [ 3, 'RTX', 5, 'PRP', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0, neg=True)], 2139 [ 4, 'RTB', 6, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0)], 2140 [ 5, 'RTB', 188, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0)], 2141 [ 6, 'RTB', 370, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0)], 2142 [ 7, 'RTB', 552, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0)], 2143 [ 8, 'RTB', 734, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0, neg=True)], 2144 [ 9, 'RTB', 916, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0, neg=True)], 2145 [10, 'RTB', 1098, 'BLO', self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0, neg=True)], 2146 [11, 'RTB', 1280, 'BLO', self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0, neg=True)], 2147 [12, 'RTL', 1462, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0)], 2148 [12, 'RTL', 1463, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0, neg=True)], 2149 2150 # The y-axis rotor. 2151 [ 1, 'RTX', 1464, 'CTR', pivot1], 2152 [ 2, 'RTX', 1465, 'PRP', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)], 2153 [ 3, 'RTX', 1466, 'PRP', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)], 2154 [ 4, 'RTB', 1467, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)], 2155 [ 5, 'RTB', 1649, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)], 2156 [ 6, 'RTB', 1831, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)], 2157 [ 7, 'RTB', 2013, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)], 2158 [ 8, 'RTB', 2195, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)], 2159 [ 9, 'RTB', 2377, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)], 2160 [10, 'RTB', 2559, 'BLO', self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)], 2161 [11, 'RTB', 2741, 'BLO', self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)], 2162 [12, 'RTL', 2923, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis)], 2163 [12, 'RTL', 2924, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis, neg=True)], 2164 2165 # The z-axis. 2166 [ 1, 'AXE', 2925, 'R', pivot2], 2167 [ 1, 'AXE', 2926, 'z-ax', pivot1], 2168 [ 1, 'AXE', 2927, 'z-ax', self.rotate_from_Z(origin=pivot2, length=pivot_disp*1.1, angle=0.0)], 2169 ] 2170 2171 # Check the data. 2172 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
2173 2174
2176 """Check the frame_order.pdb_model user function PDB file for the rotor model with a xz-plane tilt.""" 2177 2178 # Init. 2179 pivot = array([1, 0, 1], float64) 2180 l = 100.0 2181 2182 # The axis alpha parameter, and printout. 2183 axis_alpha = pi / 2.0 2184 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64)) 2185 print("\nRotor axis:\n %s" % axis) 2186 print("Rotor apex (100*axis + [1, 0, 1]):\n %s" % (l*axis + pivot)) 2187 2188 # Set up. 2189 self.setup_model(pipe_name='PDB model', model='free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha) 2190 2191 # Create the PDB. 2192 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=100.0) 2193 2194 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2195 data = [ 2196 [ 1, 'PIV', 1, 'Piv', pivot], 2197 [ 1, 'RTX', 2, 'CTR', pivot], 2198 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)], 2199 [ 3, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)], 2200 [ 4, 'RTB', 5, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)], 2201 [ 5, 'RTB', 187, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)], 2202 [ 6, 'RTB', 369, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)], 2203 [ 7, 'RTB', 551, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)], 2204 [ 8, 'RTB', 733, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)], 2205 [ 9, 'RTB', 915, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)], 2206 [10, 'RTB', 1097, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)], 2207 [11, 'RTB', 1279, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)], 2208 [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0)], 2209 [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0, neg=True)] 2210 ] 2211 2212 # Check the data. 2213 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
2214 2215
2217 """Check the frame_order.pdb_model user function PDB file for the free rotor model along the z-axis.""" 2218 2219 # Init. 2220 pivot = array([1, 0, 0], float64) 2221 l = 30.0 2222 2223 # The axis alpha parameter, and printout. 2224 axis_alpha = pi / 2.0 2225 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64)) 2226 print("\nRotor axis: %s" % axis) 2227 print("Rotor apex (100*axis + [1, 0, 0]):\n %s" % (l*axis + pivot)) 2228 2229 # Set up. 2230 self.setup_model(pipe_name='PDB model', model='free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha) 2231 2232 # Create the PDB. 2233 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l) 2234 2235 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2236 data = [ 2237 [ 1, 'PIV', 1, 'Piv', pivot], 2238 [ 1, 'RTX', 2, 'CTR', pivot], 2239 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)], 2240 [ 3, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)], 2241 [ 4, 'RTB', 5, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)], 2242 [ 5, 'RTB', 187, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)], 2243 [ 6, 'RTB', 369, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)], 2244 [ 7, 'RTB', 551, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)], 2245 [ 8, 'RTB', 733, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)], 2246 [ 9, 'RTB', 915, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)], 2247 [10, 'RTB', 1097, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)], 2248 [11, 'RTB', 1279, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)], 2249 [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0)], 2250 [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0, neg=True)] 2251 ] 2252 2253 # Check the data. 2254 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
2255 2256
2258 """Check the frame_order.pdb_model user function PDB file for the isotropic cone model with a xz-plane tilt.""" 2259 2260 # Init. 2261 theta = 2.0 2262 pivot = array([1, 1, 1], float64) 2263 l = 45.0 2264 l_rotor = l + 5.0 2265 2266 # The axis parameters, and printout. 2267 axis_theta = -pi/4.0 2268 axis = create_rotor_axis_spherical(axis_theta, 0.0) 2269 print("Rotor axis: %s" % axis) 2270 R = zeros((3, 3), float64) 2271 axis_angle_to_R([0, 1, 0], axis_theta, R) 2272 2273 # Set up. 2274 self.setup_model(pipe_name='PDB model', model='iso cone', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta, cone_sigma_max=0.0) 2275 2276 # Create the PDB. 2277 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 2278 2279 # The xy-plane vectors. 2280 inc = 2.0 * pi / 10.0 2281 vectors = zeros((10, 3), float64) 2282 for i in range(10): 2283 # The angle phi. 2284 phi = inc * i 2285 2286 # The xy-plane, starting along the x-axis. 2287 vectors[i, 0] = cos(phi) 2288 vectors[i, 1] = sin(phi) 2289 2290 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2291 neg = [False, True] 2292 tle = ['a', 'b'] 2293 data = [] 2294 for i in range(2): 2295 data.append([ 2296 # The pivot. 2297 [ 1, 'PIV', 1, 'Piv', pivot], 2298 2299 # The rotor. 2300 [ 1, 'RTX', 2, 'CTR', pivot], 2301 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2302 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2303 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])], 2304 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2305 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])], 2306 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])], 2307 2308 # The cone edge. 2309 [ 3, 'CNE', 733, 'APX', pivot], 2310 [ 3, 'CNE', 734, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], R=R, neg=neg[i])], 2311 [ 3, 'CNE', 735, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], R=R, neg=neg[i])], 2312 [ 3, 'CNE', 736, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], R=R, neg=neg[i])], 2313 [ 3, 'CNE', 737, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], R=R, neg=neg[i])], 2314 [ 3, 'CNE', 738, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], R=R, neg=neg[i])], 2315 [ 3, 'CNE', 739, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], R=R, neg=neg[i])], 2316 [ 3, 'CNE', 740, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], R=R, neg=neg[i])], 2317 [ 3, 'CNE', 741, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], R=R, neg=neg[i])], 2318 [ 3, 'CNE', 742, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], R=R, neg=neg[i])], 2319 [ 3, 'CNE', 743, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], R=R, neg=neg[i])], 2320 2321 # Titles. 2322 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])] 2323 ]) 2324 2325 # Check the data. 2326 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2327 2328
2330 """Check the frame_order.pdb_model user function PDB file for the isotropic cone model along the z-axis.""" 2331 2332 # Init. 2333 theta = 2.0 2334 pivot = array([1, 0, -2], float64) 2335 l = 25.0 2336 l_rotor = l + 5.0 2337 2338 # The axis parameters, and printout. 2339 axis_theta = 0.0 2340 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, 0.0)) 2341 2342 # Set up. 2343 self.setup_model(pipe_name='PDB model', model='iso cone', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta, cone_sigma_max=0.0) 2344 2345 # Create the PDB. 2346 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 2347 2348 # The xy-plane vectors. 2349 inc = 2.0 * pi / 10.0 2350 vectors = zeros((10, 3), float64) 2351 for i in range(10): 2352 # The angle phi. 2353 phi = inc * i 2354 2355 # The xy-plane, starting along the x-axis. 2356 vectors[i, 0] = cos(phi) 2357 vectors[i, 1] = sin(phi) 2358 2359 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2360 neg = [False, True] 2361 tle = ['a', 'b'] 2362 data = [] 2363 for i in range(2): 2364 data.append([ 2365 # The pivot. 2366 [ 1, 'PIV', 1, 'Piv', pivot], 2367 2368 # The rotor. 2369 [ 1, 'RTX', 2, 'CTR', pivot], 2370 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2371 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2372 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])], 2373 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2374 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])], 2375 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])], 2376 2377 # The cone edge. 2378 [ 3, 'CNE', 733, 'APX', pivot], 2379 [ 3, 'CNE', 734, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], neg=neg[i])], 2380 [ 3, 'CNE', 735, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], neg=neg[i])], 2381 [ 3, 'CNE', 736, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], neg=neg[i])], 2382 [ 3, 'CNE', 737, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], neg=neg[i])], 2383 [ 3, 'CNE', 738, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], neg=neg[i])], 2384 [ 3, 'CNE', 739, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], neg=neg[i])], 2385 [ 3, 'CNE', 740, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], neg=neg[i])], 2386 [ 3, 'CNE', 741, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], neg=neg[i])], 2387 [ 3, 'CNE', 742, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], neg=neg[i])], 2388 [ 3, 'CNE', 743, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], neg=neg[i])], 2389 2390 # Titles. 2391 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])] 2392 ]) 2393 2394 # Check the data. 2395 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2396 2397
2399 """Check the frame_order.pdb_model user function PDB file for the free rotor isotropic cone model with a xz-plane tilt.""" 2400 2401 # Init. 2402 theta = 2.0 2403 pivot = array([1, 1, 1], float64) 2404 l = 40.0 2405 l_rotor = l + 5.0 2406 2407 # The axis parameters, and printout. 2408 axis_theta = -pi/4.0 2409 axis = create_rotor_axis_spherical(axis_theta, 0.0) 2410 print("Rotor axis: %s" % axis) 2411 R = zeros((3, 3), float64) 2412 axis_angle_to_R([0, 1, 0], axis_theta, R) 2413 2414 # Set up. 2415 self.setup_model(pipe_name='PDB model', model='iso cone, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta) 2416 2417 # Create the PDB. 2418 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 2419 2420 # The xy-plane vectors. 2421 inc = 2.0 * pi / 10.0 2422 vectors = zeros((10, 3), float64) 2423 for i in range(10): 2424 # The angle phi. 2425 phi = inc * i 2426 2427 # The xy-plane, starting along the x-axis. 2428 vectors[i, 0] = cos(phi) 2429 vectors[i, 1] = sin(phi) 2430 2431 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2432 neg = [False, True] 2433 tle = ['a', 'b'] 2434 data = [] 2435 for i in range(2): 2436 data.append([ 2437 # The pivot. 2438 [ 1, 'PIV', 1, 'Piv', pivot], 2439 2440 # The rotor. 2441 [ 1, 'RTX', 2, 'CTR', pivot], 2442 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2443 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2444 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2445 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2446 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2447 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])], 2448 2449 # The cone edge. 2450 [ 3, 'CNE', 733, 'APX', pivot], 2451 [ 3, 'CNE', 734, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], R=R, neg=neg[i])], 2452 [ 3, 'CNE', 735, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], R=R, neg=neg[i])], 2453 [ 3, 'CNE', 736, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], R=R, neg=neg[i])], 2454 [ 3, 'CNE', 737, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], R=R, neg=neg[i])], 2455 [ 3, 'CNE', 738, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], R=R, neg=neg[i])], 2456 [ 3, 'CNE', 739, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], R=R, neg=neg[i])], 2457 [ 3, 'CNE', 740, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], R=R, neg=neg[i])], 2458 [ 3, 'CNE', 741, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], R=R, neg=neg[i])], 2459 [ 3, 'CNE', 742, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], R=R, neg=neg[i])], 2460 [ 3, 'CNE', 743, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], R=R, neg=neg[i])], 2461 2462 # Titles. 2463 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])] 2464 ]) 2465 2466 # Check the data. 2467 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2468 2469
2471 """Check the frame_order.pdb_model user function PDB file for the free rotor isotropic cone model along the z-axis.""" 2472 2473 # Init. 2474 theta = 2.0 2475 pivot = array([1, 0, -2], float64) 2476 l = 25.0 2477 l_rotor = l + 5.0 2478 2479 # The axis parameters, and printout. 2480 axis_theta = 0.0 2481 axis_phi = 0.0 2482 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, axis_phi)) 2483 2484 # Set up. 2485 self.setup_model(pipe_name='PDB model', model='iso cone, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta) 2486 2487 # Create the PDB. 2488 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 2489 2490 # The xy-plane vectors. 2491 inc = 2.0 * pi / 10.0 2492 vectors = zeros((10, 3), float64) 2493 for i in range(10): 2494 # The angle phi. 2495 phi = inc * i 2496 2497 # The xy-plane, starting along the x-axis. 2498 vectors[i, 0] = cos(phi) 2499 vectors[i, 1] = sin(phi) 2500 2501 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2502 neg = [False, True] 2503 tle = ['a', 'b'] 2504 data = [] 2505 for i in range(2): 2506 data.append([ 2507 # The pivot. 2508 [ 1, 'PIV', 1, 'Piv', pivot], 2509 2510 # The rotor. 2511 [ 1, 'RTX', 2, 'CTR', pivot], 2512 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2513 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2514 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2515 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2516 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])], 2517 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])], 2518 2519 # The cone edge. 2520 [ 3, 'CNE', 733, 'APX', pivot], 2521 [ 3, 'CNE', 734, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], neg=neg[i])], 2522 [ 3, 'CNE', 735, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], neg=neg[i])], 2523 [ 3, 'CNE', 736, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], neg=neg[i])], 2524 [ 3, 'CNE', 737, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], neg=neg[i])], 2525 [ 3, 'CNE', 738, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], neg=neg[i])], 2526 [ 3, 'CNE', 739, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], neg=neg[i])], 2527 [ 3, 'CNE', 740, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], neg=neg[i])], 2528 [ 3, 'CNE', 741, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], neg=neg[i])], 2529 [ 3, 'CNE', 742, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], neg=neg[i])], 2530 [ 3, 'CNE', 743, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], neg=neg[i])], 2531 2532 # Titles. 2533 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])] 2534 ]) 2535 2536 # Check the data. 2537 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2538 2539
2541 """Check the frame_order.pdb_model user function PDB file for the torsionless isotropic cone model with a xz-plane tilt.""" 2542 2543 # Init. 2544 theta = 2.0 2545 pivot = array([1, 1, 1], float64) 2546 l = 40.0 2547 l_rotor = l + 5.0 2548 2549 # The axis parameters, and printout. 2550 axis_theta = -pi/4.0 2551 axis = create_rotor_axis_spherical(axis_theta, 0.0) 2552 print("Rotor axis: %s" % axis) 2553 R = zeros((3, 3), float64) 2554 axis_angle_to_R([0, 1, 0], axis_theta, R) 2555 2556 # Set up. 2557 self.setup_model(pipe_name='PDB model', model='iso cone, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta) 2558 2559 # Create the PDB. 2560 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 2561 2562 # The xy-plane vectors. 2563 inc = 2.0 * pi / 10.0 2564 vectors = zeros((10, 3), float64) 2565 for i in range(10): 2566 # The angle phi. 2567 phi = inc * i 2568 2569 # The xy-plane, starting along the x-axis. 2570 vectors[i, 0] = cos(phi) 2571 vectors[i, 1] = sin(phi) 2572 2573 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2574 neg = [False, True] 2575 tle = ['a', 'b'] 2576 data = [] 2577 for i in range(2): 2578 data.append([ 2579 # The pivot. 2580 [ 1, 'PIV', 1, 'Piv', pivot], 2581 2582 # The axis system. 2583 [ 2, 'AXE', 2, 'R', pivot], 2584 [ 2, 'AXE', 3, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=axis_theta, neg=neg[i])], 2585 [ 2, 'AXE', 4, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=axis_theta, neg=neg[i])], 2586 2587 # The cone edge. 2588 [ 3, 'CNE', 5, 'APX', pivot], 2589 [ 3, 'CNE', 6, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], R=R, neg=neg[i])], 2590 [ 3, 'CNE', 7, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], R=R, neg=neg[i])], 2591 [ 3, 'CNE', 8, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], R=R, neg=neg[i])], 2592 [ 3, 'CNE', 9, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], R=R, neg=neg[i])], 2593 [ 3, 'CNE', 10, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], R=R, neg=neg[i])], 2594 [ 3, 'CNE', 11, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], R=R, neg=neg[i])], 2595 [ 3, 'CNE', 12, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], R=R, neg=neg[i])], 2596 [ 3, 'CNE', 13, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], R=R, neg=neg[i])], 2597 [ 3, 'CNE', 14, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], R=R, neg=neg[i])], 2598 [ 3, 'CNE', 15, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], R=R, neg=neg[i])], 2599 2600 # Titles. 2601 [ 1, 'TLE', 76, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])] 2602 ]) 2603 2604 # Check the data. 2605 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2606 2607
2609 """Check the frame_order.pdb_model user function PDB file for the torsionless isotropic cone model along the z-axis.""" 2610 2611 # Init. 2612 theta = 2.0 2613 pivot = array([1, 0, -2], float64) 2614 l = 25.0 2615 l_rotor = l + 5.0 2616 2617 # The axis parameters, and printout. 2618 axis_theta = 0.0 2619 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, 0.0)) 2620 2621 # Set up. 2622 self.setup_model(pipe_name='PDB model', model='iso cone, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta) 2623 2624 # Create the PDB. 2625 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 2626 2627 # The xy-plane vectors. 2628 inc = 2.0 * pi / 10.0 2629 vectors = zeros((10, 3), float64) 2630 for i in range(10): 2631 # The angle phi. 2632 phi = inc * i 2633 2634 # The xy-plane, starting along the x-axis. 2635 vectors[i, 0] = cos(phi) 2636 vectors[i, 1] = sin(phi) 2637 2638 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2639 neg = [False, True] 2640 tle = ['a', 'b'] 2641 data = [] 2642 for i in range(2): 2643 data.append([ 2644 # The pivot. 2645 [ 1, 'PIV', 1, 'Piv', pivot], 2646 2647 # The axis system. 2648 [ 2, 'AXE', 2, 'R', pivot], 2649 [ 2, 'AXE', 3, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=axis_theta, neg=neg[i])], 2650 [ 2, 'AXE', 4, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=axis_theta, neg=neg[i])], 2651 2652 # The cone edge. 2653 [ 3, 'CNE', 5, 'APX', pivot], 2654 [ 3, 'CNE', 6, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], neg=neg[i])], 2655 [ 3, 'CNE', 7, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], neg=neg[i])], 2656 [ 3, 'CNE', 8, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], neg=neg[i])], 2657 [ 3, 'CNE', 9, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], neg=neg[i])], 2658 [ 3, 'CNE', 10, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], neg=neg[i])], 2659 [ 3, 'CNE', 11, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], neg=neg[i])], 2660 [ 3, 'CNE', 12, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], neg=neg[i])], 2661 [ 3, 'CNE', 13, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], neg=neg[i])], 2662 [ 3, 'CNE', 14, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], neg=neg[i])], 2663 [ 3, 'CNE', 15, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], neg=neg[i])], 2664 2665 # Titles. 2666 [ 1, 'TLE', 76, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])] 2667 ]) 2668 2669 # Check the data. 2670 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2671 2672
2674 """Check the frame_order.pdb_model user function PDB file for the pseudo-ellipse model with a xz-plane tilt.""" 2675 2676 # Init. 2677 theta_x = 2.0 2678 theta_y = 0.1 2679 pivot = array([1, -2, 1.1], float64) 2680 l = 50.0 2681 l_rotor = l + 5.0 2682 2683 # The axis parameters, and printout. 2684 eigen_beta = -pi/2.0 2685 R = zeros((3, 3), float64) 2686 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 2687 print("Motional eigenframe:\n%s" % R) 2688 2689 # Set up. 2690 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y, cone_sigma_max=0.0) 2691 2692 # Create the PDB. 2693 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 2694 2695 # The xy-plane vectors and angles. 2696 inc = 2.0 * pi / 10.0 2697 vectors = zeros((10, 3), float64) 2698 theta_max = zeros(10, float64) 2699 for i in range(10): 2700 # The angle phi. 2701 phi = inc * i 2702 2703 # The xy-plane, starting along the x-axis. 2704 vectors[i, 0] = cos(phi) 2705 vectors[i, 1] = sin(phi) 2706 2707 # The cone opening angle. 2708 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2) 2709 2710 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2711 neg = [False, True] 2712 tle = ['a', 'b'] 2713 data = [] 2714 for i in range(2): 2715 data.append([ 2716 # The pivot. 2717 [ 1, 'PIV', 1, 'Piv', pivot], 2718 2719 # The rotor. 2720 [ 1, 'RTX', 2, 'CTR', pivot], 2721 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])], 2722 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])], 2723 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=eigen_beta, neg=neg[i])], 2724 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])], 2725 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=eigen_beta, neg=neg[i])], 2726 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=eigen_beta, neg=neg[i])], 2727 2728 # The axis system. 2729 [ 1, 'AXE', 733, 'R', pivot], 2730 [ 2, 'AXE', 734, 'R', pivot], 2731 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0+eigen_beta, neg=neg[i])], 2732 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0+eigen_beta, neg=neg[i])], 2733 [ 2, 'AXE', 737, 'R', pivot], 2734 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])], 2735 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])], 2736 2737 # The cone edge. 2738 [ 3, 'CNE', 740, 'APX', pivot], 2739 [ 3, 'CNE', 741, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], R=R, neg=neg[i])], 2740 [ 3, 'CNE', 742, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], R=R, neg=neg[i])], 2741 [ 3, 'CNE', 743, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], R=R, neg=neg[i])], 2742 [ 3, 'CNE', 744, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], R=R, neg=neg[i])], 2743 [ 3, 'CNE', 745, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], R=R, neg=neg[i])], 2744 [ 3, 'CNE', 746, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], R=R, neg=neg[i])], 2745 [ 3, 'CNE', 747, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], R=R, neg=neg[i])], 2746 [ 3, 'CNE', 748, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], R=R, neg=neg[i])], 2747 [ 3, 'CNE', 749, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], R=R, neg=neg[i])], 2748 [ 3, 'CNE', 750, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], R=R, neg=neg[i])], 2749 2750 # Titles. 2751 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=eigen_beta, neg=neg[i])] 2752 ]) 2753 2754 # Check the data. 2755 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2756 2757
2759 """Check the frame_order.pdb_model user function PDB file for the pseudo-ellipse model along the z-axis.""" 2760 2761 # Init. 2762 theta_x = 2.0 2763 theta_y = 0.1 2764 pivot = array([1, 1, 1], float64) 2765 l = 40.0 2766 l_rotor = l + 5.0 2767 2768 # The axis parameters, and printout. 2769 eigen_beta = 0.0 2770 R = zeros((3, 3), float64) 2771 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 2772 print("Motional eigenframe:\n%s" % R) 2773 2774 # Set up. 2775 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y, cone_sigma_max=0.0) 2776 2777 # Create the PDB. 2778 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 2779 2780 # The xy-plane vectors and angles. 2781 inc = 2.0 * pi / 10.0 2782 vectors = zeros((10, 3), float64) 2783 theta_max = zeros(10, float64) 2784 for i in range(10): 2785 # The angle phi. 2786 phi = inc * i 2787 2788 # The xy-plane, starting along the x-axis. 2789 vectors[i, 0] = cos(phi) 2790 vectors[i, 1] = sin(phi) 2791 2792 # The cone opening angle. 2793 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2) 2794 2795 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2796 neg = [False, True] 2797 tle = ['a', 'b'] 2798 data = [] 2799 for i in range(2): 2800 data.append([ 2801 # The pivot. 2802 [ 1, 'PIV', 1, 'Piv', pivot], 2803 2804 # The rotor. 2805 [ 1, 'RTX', 2, 'CTR', pivot], 2806 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])], 2807 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])], 2808 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=0.0, neg=neg[i])], 2809 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])], 2810 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=0.0, neg=neg[i])], 2811 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=0.0, neg=neg[i])], 2812 2813 # The axis system. 2814 [ 1, 'AXE', 733, 'R', pivot], 2815 [ 2, 'AXE', 734, 'R', pivot], 2816 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, neg=neg[i])], 2817 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, neg=neg[i])], 2818 [ 2, 'AXE', 737, 'R', pivot], 2819 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])], 2820 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])], 2821 2822 # The cone edge. 2823 [ 3, 'CNE', 740, 'APX', pivot], 2824 [ 3, 'CNE', 741, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], neg=neg[i])], 2825 [ 3, 'CNE', 742, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], neg=neg[i])], 2826 [ 3, 'CNE', 743, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], neg=neg[i])], 2827 [ 3, 'CNE', 744, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], neg=neg[i])], 2828 [ 3, 'CNE', 745, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], neg=neg[i])], 2829 [ 3, 'CNE', 746, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], neg=neg[i])], 2830 [ 3, 'CNE', 747, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], neg=neg[i])], 2831 [ 3, 'CNE', 748, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], neg=neg[i])], 2832 [ 3, 'CNE', 749, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], neg=neg[i])], 2833 [ 3, 'CNE', 750, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], neg=neg[i])], 2834 2835 # Titles. 2836 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=0.0, neg=neg[i])] 2837 ]) 2838 2839 # Check the data. 2840 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2841 2842
2844 """Check the frame_order.pdb_model user function PDB file for the free rotor pseudo-ellipse model with a xz-plane tilt.""" 2845 2846 # Init. 2847 theta_x = 2.0 2848 theta_y = 0.1 2849 pivot = array([1, -2, 1.1], float64) 2850 l = 50.0 2851 l_rotor = l + 5.0 2852 2853 # The axis parameters, and printout. 2854 eigen_beta = -pi/2.0 2855 R = zeros((3, 3), float64) 2856 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 2857 print("Motional eigenframe:\n%s" % R) 2858 2859 # Set up. 2860 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y) 2861 2862 # Create the PDB. 2863 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 2864 2865 # The xy-plane vectors and angles. 2866 inc = 2.0 * pi / 10.0 2867 vectors = zeros((10, 3), float64) 2868 theta_max = zeros(10, float64) 2869 for i in range(10): 2870 # The angle phi. 2871 phi = inc * i 2872 2873 # The xy-plane, starting along the x-axis. 2874 vectors[i, 0] = cos(phi) 2875 vectors[i, 1] = sin(phi) 2876 2877 # The cone opening angle. 2878 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2) 2879 2880 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2881 neg = [False, True] 2882 tle = ['a', 'b'] 2883 data = [] 2884 for i in range(2): 2885 data.append([ 2886 # The pivot. 2887 [ 1, 'PIV', 1, 'Piv', pivot], 2888 2889 # The rotor. 2890 [ 1, 'RTX', 2, 'CTR', pivot], 2891 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])], 2892 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])], 2893 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])], 2894 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])], 2895 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])], 2896 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=eigen_beta, neg=neg[i])], 2897 2898 # The axis system. 2899 [ 1, 'AXE', 733, 'R', pivot], 2900 [ 2, 'AXE', 734, 'R', pivot], 2901 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0+eigen_beta, neg=neg[i])], 2902 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0+eigen_beta, neg=neg[i])], 2903 [ 2, 'AXE', 737, 'R', pivot], 2904 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])], 2905 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])], 2906 2907 # The cone edge. 2908 [ 3, 'CNE', 740, 'APX', pivot], 2909 [ 3, 'CNE', 741, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], R=R, neg=neg[i])], 2910 [ 3, 'CNE', 742, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], R=R, neg=neg[i])], 2911 [ 3, 'CNE', 743, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], R=R, neg=neg[i])], 2912 [ 3, 'CNE', 744, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], R=R, neg=neg[i])], 2913 [ 3, 'CNE', 745, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], R=R, neg=neg[i])], 2914 [ 3, 'CNE', 746, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], R=R, neg=neg[i])], 2915 [ 3, 'CNE', 747, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], R=R, neg=neg[i])], 2916 [ 3, 'CNE', 748, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], R=R, neg=neg[i])], 2917 [ 3, 'CNE', 749, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], R=R, neg=neg[i])], 2918 [ 3, 'CNE', 750, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], R=R, neg=neg[i])], 2919 2920 # Titles. 2921 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=eigen_beta, neg=neg[i])] 2922 ]) 2923 2924 # Check the data. 2925 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
2926 2927
2929 """Check the frame_order.pdb_model user function PDB file for the free rotor pseudo-ellipse model along the z-axis.""" 2930 2931 # Init. 2932 theta_x = 2.0 2933 theta_y = 0.1 2934 pivot = array([1, 1, 1], float64) 2935 l = 40.0 2936 l_rotor = l + 5.0 2937 2938 # The axis parameters, and printout. 2939 eigen_beta = 0.0 2940 R = zeros((3, 3), float64) 2941 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 2942 print("Motional eigenframe:\n%s" % R) 2943 2944 # Set up. 2945 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y) 2946 2947 # Create the PDB. 2948 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 2949 2950 # The xy-plane vectors and angles. 2951 inc = 2.0 * pi / 10.0 2952 vectors = zeros((10, 3), float64) 2953 theta_max = zeros(10, float64) 2954 for i in range(10): 2955 # The angle phi. 2956 phi = inc * i 2957 2958 # The xy-plane, starting along the x-axis. 2959 vectors[i, 0] = cos(phi) 2960 vectors[i, 1] = sin(phi) 2961 2962 # The cone opening angle. 2963 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2) 2964 2965 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 2966 neg = [False, True] 2967 tle = ['a', 'b'] 2968 data = [] 2969 for i in range(2): 2970 data.append([ 2971 # The pivot. 2972 [ 1, 'PIV', 1, 'Piv', pivot], 2973 2974 # The rotor. 2975 [ 1, 'RTX', 2, 'CTR', pivot], 2976 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])], 2977 [ 3, 'RTB', 4, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])], 2978 [ 4, 'RTB', 186, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])], 2979 [ 5, 'RTB', 368, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])], 2980 [ 6, 'RTB', 550, 'BLO', self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])], 2981 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=0.0, neg=neg[i])], 2982 2983 # The axis system. 2984 [ 1, 'AXE', 733, 'R', pivot], 2985 [ 2, 'AXE', 734, 'R', pivot], 2986 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, neg=neg[i])], 2987 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, neg=neg[i])], 2988 [ 2, 'AXE', 737, 'R', pivot], 2989 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])], 2990 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])], 2991 2992 # The cone edge. 2993 [ 3, 'CNE', 740, 'APX', pivot], 2994 [ 3, 'CNE', 741, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], neg=neg[i])], 2995 [ 3, 'CNE', 742, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], neg=neg[i])], 2996 [ 3, 'CNE', 743, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], neg=neg[i])], 2997 [ 3, 'CNE', 744, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], neg=neg[i])], 2998 [ 3, 'CNE', 745, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], neg=neg[i])], 2999 [ 3, 'CNE', 746, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], neg=neg[i])], 3000 [ 3, 'CNE', 747, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], neg=neg[i])], 3001 [ 3, 'CNE', 748, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], neg=neg[i])], 3002 [ 3, 'CNE', 749, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], neg=neg[i])], 3003 [ 3, 'CNE', 750, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], neg=neg[i])], 3004 3005 # Titles. 3006 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=0.0, neg=neg[i])] 3007 ]) 3008 3009 # Check the data. 3010 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
3011 3012
3014 """Check the frame_order.pdb_model user function PDB file for the torsionless pseudo-ellipse model with a xz-plane tilt.""" 3015 3016 # Init. 3017 theta_x = 2.0 3018 theta_y = 0.1 3019 pivot = array([1, -2, 1.1], float64) 3020 l = 50.0 3021 l_rotor = l + 5.0 3022 3023 # The axis parameters, and printout. 3024 eigen_beta = -pi/2.0 3025 R = zeros((3, 3), float64) 3026 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 3027 print("Motional eigenframe:\n%s" % R) 3028 3029 # Set up. 3030 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y) 3031 3032 # Create the PDB. 3033 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 3034 3035 # The xy-plane vectors and angles. 3036 inc = 2.0 * pi / 10.0 3037 vectors = zeros((10, 3), float64) 3038 theta_max = zeros(10, float64) 3039 for i in range(10): 3040 # The angle phi. 3041 phi = inc * i 3042 3043 # The xy-plane, starting along the x-axis. 3044 vectors[i, 0] = cos(phi) 3045 vectors[i, 1] = sin(phi) 3046 3047 # The cone opening angle. 3048 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2) 3049 3050 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 3051 neg = [False, True] 3052 tle = ['a', 'b'] 3053 data = [] 3054 for i in range(2): 3055 data.append([ 3056 # The pivot. 3057 [ 1, 'PIV', 1, 'Piv', pivot], 3058 3059 # The axis system. 3060 [ 1, 'AXE', 2, 'R', pivot], 3061 [ 2, 'AXE', 3, 'R', pivot], 3062 [ 2, 'AXE', 4, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, R=R, neg=neg[i])], 3063 [ 2, 'AXE', 5, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, R=R, neg=neg[i])], 3064 [ 2, 'AXE', 6, 'R', pivot], 3065 [ 2, 'AXE', 7, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, R=R, neg=neg[i])], 3066 [ 2, 'AXE', 8, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, R=R, neg=neg[i])], 3067 [ 2, 'AXE', 9, 'R', pivot], 3068 [ 2, 'AXE', 10, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, R=R, neg=neg[i])], 3069 [ 2, 'AXE', 11, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=0.0, R=R, neg=neg[i])], 3070 3071 # The cone edge. 3072 [ 3, 'CNE', 12, 'APX', pivot], 3073 [ 3, 'CNE', 13, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], R=R, neg=neg[i])], 3074 [ 3, 'CNE', 14, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], R=R, neg=neg[i])], 3075 [ 3, 'CNE', 15, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], R=R, neg=neg[i])], 3076 [ 3, 'CNE', 16, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], R=R, neg=neg[i])], 3077 [ 3, 'CNE', 17, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], R=R, neg=neg[i])], 3078 [ 3, 'CNE', 18, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], R=R, neg=neg[i])], 3079 [ 3, 'CNE', 19, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], R=R, neg=neg[i])], 3080 [ 3, 'CNE', 20, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], R=R, neg=neg[i])], 3081 [ 3, 'CNE', 21, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], R=R, neg=neg[i])], 3082 [ 3, 'CNE', 22, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], R=R, neg=neg[i])], 3083 3084 # Titles. 3085 [ 1, 'TLE', 83, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=eigen_beta, neg=neg[i])] 3086 ]) 3087 3088 # Check the data. 3089 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
3090 3091
3093 """Check the frame_order.pdb_model user function PDB file for the torsionless pseudo-ellipse model along the z-axis.""" 3094 3095 # Init. 3096 theta_x = 2.0 3097 theta_y = 0.1 3098 pivot = array([1, 1, 1], float64) 3099 l = 40.0 3100 l_rotor = l + 5.0 3101 3102 # The axis parameters, and printout. 3103 eigen_beta = 0.0 3104 R = zeros((3, 3), float64) 3105 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 3106 print("Motional eigenframe:\n%s" % R) 3107 3108 # Set up. 3109 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y) 3110 3111 # Create the PDB. 3112 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l) 3113 3114 # The xy-plane vectors and angles. 3115 inc = 2.0 * pi / 10.0 3116 vectors = zeros((10, 3), float64) 3117 theta_max = zeros(10, float64) 3118 for i in range(10): 3119 # The angle phi. 3120 phi = inc * i 3121 3122 # The xy-plane, starting along the x-axis. 3123 vectors[i, 0] = cos(phi) 3124 vectors[i, 1] = sin(phi) 3125 3126 # The cone opening angle. 3127 theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2) 3128 3129 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 3130 neg = [False, True] 3131 tle = ['a', 'b'] 3132 data = [] 3133 for i in range(2): 3134 data.append([ 3135 # The pivot. 3136 [ 1, 'PIV', 1, 'Piv', pivot], 3137 3138 # The axis system. 3139 [ 1, 'AXE', 2, 'R', pivot], 3140 [ 2, 'AXE', 3, 'R', pivot], 3141 [ 2, 'AXE', 4, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, neg=neg[i])], 3142 [ 2, 'AXE', 5, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, neg=neg[i])], 3143 [ 2, 'AXE', 6, 'R', pivot], 3144 [ 2, 'AXE', 7, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])], 3145 [ 2, 'AXE', 8, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])], 3146 [ 2, 'AXE', 9, 'R', pivot], 3147 [ 2, 'AXE', 10, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=neg[i])], 3148 [ 2, 'AXE', 11, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=0.0, neg=neg[i])], 3149 3150 # The cone edge. 3151 [ 3, 'CNE', 12, 'APX', pivot], 3152 [ 3, 'CNE', 13, 'H2', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], neg=neg[i])], 3153 [ 3, 'CNE', 14, 'H3', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], neg=neg[i])], 3154 [ 3, 'CNE', 15, 'H4', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], neg=neg[i])], 3155 [ 3, 'CNE', 16, 'H5', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], neg=neg[i])], 3156 [ 3, 'CNE', 17, 'H6', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], neg=neg[i])], 3157 [ 3, 'CNE', 18, 'H7', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], neg=neg[i])], 3158 [ 3, 'CNE', 19, 'H8', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], neg=neg[i])], 3159 [ 3, 'CNE', 20, 'H9', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], neg=neg[i])], 3160 [ 3, 'CNE', 21, 'H10', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], neg=neg[i])], 3161 [ 3, 'CNE', 22, 'H11', self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], neg=neg[i])], 3162 3163 # Titles. 3164 [ 1, 'TLE', 83, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=0.0, neg=neg[i])] 3165 ]) 3166 3167 # Check the data. 3168 self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
3169 3170
3172 """Check the frame_order.pdb_model user function PDB file for the rotor model with a xz-plane tilt.""" 3173 3174 # Init. 3175 pivot = array([1, 0, 1], float64) 3176 l = 100.0 3177 3178 # The axis alpha parameter, and printout. 3179 axis_alpha = pi / 2.0 3180 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64)) 3181 print("\nRotor axis:\n %s" % axis) 3182 print("Rotor apex (100*axis + [1, 0, 1]):\n %s" % (l*axis + pivot)) 3183 3184 # Set up. 3185 self.setup_model(pipe_name='PDB model', model='rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha, cone_sigma_max=0.0) 3186 3187 # Create the PDB. 3188 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=100.0) 3189 3190 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 3191 data = [ 3192 [ 1, 'PIV', 1, 'Piv', pivot], 3193 [ 1, 'RTX', 2, 'CTR', pivot], 3194 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)], 3195 [ 3, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)], 3196 [ 4, 'RTB', 5, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)], 3197 [ 5, 'RTB', 187, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0)], 3198 [ 6, 'RTB', 369, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)], 3199 [ 7, 'RTB', 551, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0)], 3200 [ 8, 'RTB', 733, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)], 3201 [ 9, 'RTB', 915, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0, neg=True)], 3202 [10, 'RTB', 1097, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)], 3203 [11, 'RTB', 1279, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0, neg=True)], 3204 [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0)], 3205 [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0, neg=True)] 3206 ] 3207 3208 # Check the data. 3209 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
3210 3211
3213 """Check the frame_order.pdb_model user function PDB file for the rotor model along the z-axis.""" 3214 3215 # Init. 3216 pivot = array([1, 0, 0], float64) 3217 l = 30.0 3218 3219 # The axis alpha parameter, and printout. 3220 axis_alpha = pi / 2.0 3221 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64)) 3222 print("\nRotor axis: %s" % axis) 3223 print("Rotor apex (100*axis + [1, 0, 0]):\n %s" % (l*axis + pivot)) 3224 3225 # Set up. 3226 self.setup_model(pipe_name='PDB model', model='rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha, cone_sigma_max=0.0) 3227 3228 # Create the PDB. 3229 self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l) 3230 3231 # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. 3232 data = [ 3233 [ 1, 'PIV', 1, 'Piv', pivot], 3234 [ 1, 'RTX', 2, 'CTR', pivot], 3235 [ 2, 'RTX', 3, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)], 3236 [ 3, 'RTX', 4, 'PRP', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)], 3237 [ 4, 'RTB', 5, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)], 3238 [ 5, 'RTB', 187, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0)], 3239 [ 6, 'RTB', 369, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0)], 3240 [ 7, 'RTB', 551, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0)], 3241 [ 8, 'RTB', 733, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)], 3242 [ 9, 'RTB', 915, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0, neg=True)], 3243 [10, 'RTB', 1097, 'BLO', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)], 3244 [11, 'RTB', 1279, 'BLO', self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0, neg=True)], 3245 [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0)], 3246 [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0, neg=True)] 3247 ] 3248 3249 # Check the data. 3250 self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
3251 3252
3254 """Catch for a bug in optimisation when the cone_theta_x is set to zero in the pseudo-ellipse models.""" 3255 3256 # Reset. 3257 self.interpreter.reset() 3258 3259 # Load the state file. 3260 data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' 3261 self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') 3262 3263 # Change the original parameters. 3264 cdp.cone_theta_x = 0.0 3265 cdp.cone_theta_y = 2.0 3266 3267 # Optimisation. 3268 self.interpreter.minimise.execute('simplex', max_iter=2)
3269 3270
3272 """Test the double rotor target function for the data from a rigid test molecule.""" 3273 3274 # Set the model. 3275 ds.model = MODEL_DOUBLE_ROTOR 3276 3277 # Execute the script. 3278 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py') 3279 3280 # Check the chi2 value. 3281 self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
3282 3283
3285 """Test the free rotor target function for the data from a rigid test molecule.""" 3286 3287 # Set the model. 3288 ds.model = MODEL_FREE_ROTOR 3289 3290 # Execute the script. 3291 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py') 3292 3293 # Check the chi2 value. 3294 self.assertAlmostEqual(cdp.chi2, 212124.83317383687)
3295 3296
3298 """Test the iso cone, free rotor target function for the data from a rigid test molecule.""" 3299 3300 # Set the model. 3301 ds.model = MODEL_ISO_CONE_FREE_ROTOR 3302 3303 # Execute the script. 3304 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py') 3305 3306 # Check the chi2 value. 3307 self.assertAlmostEqual(cdp.chi2, 22295.500553417492)
3308 3309
3311 """Test the iso cone target function for the data from a rigid test molecule.""" 3312 3313 # Set the model. 3314 ds.model = MODEL_ISO_CONE 3315 3316 # Execute the script. 3317 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py') 3318 3319 # Check the chi2 value. 3320 self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
3321 3322
3324 """Test the iso cone, torsionless target function for the data from a rigid test molecule.""" 3325 3326 # Set the model. 3327 ds.model = MODEL_ISO_CONE_TORSIONLESS 3328 3329 # Execute the script. 3330 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py') 3331 3332 # Check the chi2 value. 3333 self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
3334 3335
3337 """Test the pseudo-ellipse target function for the data from a rigid test molecule.""" 3338 3339 # Set the model. 3340 ds.model = MODEL_PSEUDO_ELLIPSE 3341 3342 # Execute the script. 3343 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py') 3344 3345 # Check the chi2 value. 3346 self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
3347 3348
3350 """Test the pseudo-ellipse, torsionless target function for the data from a rigid test molecule.""" 3351 3352 # Set the model. 3353 ds.model = MODEL_PSEUDO_ELLIPSE_TORSIONLESS 3354 3355 # Execute the script. 3356 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py') 3357 3358 # Check the chi2 value. 3359 self.assertAlmostEqual(cdp.chi2, 0.011377491600681364)
3360 3361
3363 """Test the rigid target function for the data from a rigid test molecule.""" 3364 3365 # Set the model. 3366 ds.model = MODEL_RIGID 3367 3368 # Execute the script. 3369 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py') 3370 3371 # Check the chi2 value. 3372 self.assertAlmostEqual(cdp.chi2, 0.0113763520134, 5)
3373 3374
3376 """Test the rotor target function for the data from a rigid test molecule.""" 3377 3378 # Set the model. 3379 ds.model = MODEL_ROTOR 3380 3381 # Execute the script. 3382 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py') 3383 3384 # Check the chi2 value. 3385 self.assertAlmostEqual(cdp.chi2, 0.011377487066752203, 5)
3386 3387
3389 """Check the frame_order.simulate user function PDB file for the double rotor model with a xz-plane tilt for the first rotation mode.""" 3390 3391 # Init. 3392 cone_sigma_max = pi / 2.0 3393 cone_sigma_max_2 = 0.0 3394 pivot = array([20, 20, -20], float64) 3395 l = 100.0 3396 sim_num = 500 3397 pivot_disp = 100.0 3398 3399 # The eigenframe. 3400 eigen_beta = -pi/4.0 3401 R = zeros((3, 3), float64) 3402 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 3403 print("Motional eigenframe:\n%s" % R) 3404 3405 # Set up. 3406 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2) 3407 3408 # Create the PDB. 3409 files = [] 3410 if type == 'sim': 3411 file = 'simulation.pdb' 3412 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 3413 files.append(file) 3414 elif type == 'dist': 3415 file = 'distribution.pdb' 3416 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 3417 files.append(file) 3418 elif type == 'decomp': 3419 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 3420 files.append('decompose_mode1.pdb') 3421 files.append('decompose_mode2.pdb') 3422 elif type == 'decomp2': 3423 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 3424 files.append('decompose_mode1.pdb') 3425 files.append('decompose_mode2.pdb') 3426 3427 # Check each PDB. 3428 for file in files: 3429 # Delete all structural data. 3430 self.interpreter.structure.delete() 3431 3432 # Read the contents of the file. 3433 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 3434 3435 # X vector maxima. 3436 X_theta_min = cartesian_to_spherical([100, 0, 200])[1] 3437 X_theta_max = cartesian_to_spherical([-100, 0, 0])[1] + pi 3438 print("X vector theta range of [%.5f, %.5f]" % (X_theta_min, X_theta_max)) 3439 3440 # Check the atomic coordinates. 3441 selection = cdp.structure.selection() 3442 num_pos = cdp.structure.num_models() 3443 epsilon = 1e-3 3444 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 3445 # Loop over all positions. 3446 for i in range(num_pos): 3447 # Shift the position back to the origin, and decompose into spherical coordinates. 3448 new_pos = pos[i] - pivot 3449 r, theta, phi = cartesian_to_spherical(dot(transpose(R), new_pos)) 3450 3451 # Printout. 3452 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi])) 3453 3454 # Check the X and nX vectors. 3455 if res_name in ['X', 'nX']: 3456 self.assertTrue(theta >= X_theta_min - epsilon) 3457 self.assertTrue(theta <= X_theta_max + epsilon) 3458 if phi < 0.1: 3459 self.assertAlmostEqual(phi, 0.0, 3) 3460 else: 3461 self.assertAlmostEqual(phi, pi, 3) 3462 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3463 3464 # Check the Y vector. 3465 elif res_name == 'Y': 3466 self.assertTrue(r/100.0 >= 1.0 - epsilon) 3467 self.assertTrue(theta >= pi/4.0 - epsilon) 3468 self.assertTrue(theta <= 2.0*pi - pi/4.0 + epsilon) 3469 self.assertAlmostEqual(new_pos[1], 100.0, 3) 3470 3471 # Check the Z vector (should not move). 3472 elif res_name == 'Z': 3473 self.assertTrue(r/100.0 >= 1.0 - epsilon) 3474 self.assertAlmostEqual(new_pos[0], -70.711, 3) 3475 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3476 self.assertAlmostEqual(new_pos[2], 70.711, 3) 3477 3478 # Check the nY vector. 3479 elif res_name == 'nY': 3480 self.assertTrue(r/100.0 >= 1.0 - epsilon) 3481 self.assertTrue(theta >= pi/4.0 - epsilon) 3482 self.assertTrue(theta <= 2.0*pi - pi/4.0 + epsilon) 3483 self.assertAlmostEqual(new_pos[1], -100.0, 3) 3484 3485 # Check the nZ vector (should not move). 3486 elif res_name == 'nZ': 3487 self.assertTrue(r/100.0 >= 1.0 - epsilon) 3488 self.assertTrue(theta >= pi/4.0 - epsilon) 3489 self.assertTrue(theta <= 2.0*pi - pi/4.0 + epsilon) 3490 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3491 3492 # Check the centre. 3493 elif res_name == 'C': 3494 self.assertTrue(r/100.0 <= 1.4142135623730951 + epsilon) 3495 if not (new_pos[0] == 0.0 and new_pos[1] == 0.0 and new_pos[2] == 0.0): 3496 self.assertTrue(theta >= pi/4.0 - epsilon) 3497 self.assertTrue(theta <= 2.0*pi - pi/4.0 + epsilon) 3498 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3499 3500 # Check the origin. 3501 elif res_name == '0': 3502 self.assertAlmostEqual(r, 34.641016151377549, 4) 3503 self.assertAlmostEqual(pos[0], 0.0, 3) 3504 self.assertAlmostEqual(pos[1], 0.0, 3) 3505 self.assertAlmostEqual(pos[2], 0.0, 3) 3506 3507 # Check the number of structures. 3508 if type == 'decomp2': 3509 self.assertEqual(num_pos, 21)
3510 3511
3512 - def test_simulate_double_rotor_mode1_z_axis(self, type='sim'):
3513 """Check the frame_order.simulate user function PDB file for the double rotor model along the z-axis for the first rotation mode.""" 3514 3515 # Init. 3516 cone_sigma_max = pi / 2.0 3517 cone_sigma_max_2 = 0.0 3518 pivot = array([20, 20, -20], float64) 3519 l = 100.0 3520 sim_num = 500 3521 pivot_disp = 100.0 3522 3523 # The eigenframe. 3524 eigen_beta = 0.0 3525 R = zeros((3, 3), float64) 3526 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 3527 print("Motional eigenframe:\n%s" % R) 3528 3529 # Set up. 3530 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2) 3531 3532 # Create the PDB. 3533 files = [] 3534 if type == 'sim': 3535 file = 'simulation.pdb' 3536 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 3537 files.append(file) 3538 elif type == 'dist': 3539 file = 'distribution.pdb' 3540 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 3541 files.append(file) 3542 elif type == 'decomp': 3543 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 3544 files.append('decompose_mode1.pdb') 3545 files.append('decompose_mode2.pdb') 3546 elif type == 'decomp2': 3547 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 3548 files.append('decompose_mode1.pdb') 3549 files.append('decompose_mode2.pdb') 3550 3551 # Check each PDB. 3552 for file in files: 3553 # Delete all structural data. 3554 self.interpreter.structure.delete() 3555 3556 # Read the contents of the file. 3557 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 3558 3559 # X vector maxima. 3560 X_theta_min = cartesian_to_spherical([100, 0, 200])[1] 3561 X_theta_max = cartesian_to_spherical([-100, 0, 0])[1] + pi 3562 print("X vector theta range of [%.5f, %.5f]" % (X_theta_min, X_theta_max)) 3563 3564 # Check the atomic coordinates. 3565 selection = cdp.structure.selection() 3566 num_pos = cdp.structure.num_models() 3567 epsilon = 1e-3 3568 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 3569 # Loop over all positions. 3570 for i in range(num_pos): 3571 # Shift the position back to the origin, and decompose into spherical coordinates. 3572 new_pos = pos[i] - pivot 3573 r, theta, phi = cartesian_to_spherical(new_pos) 3574 3575 # Printout. 3576 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi])) 3577 3578 # Check the X and nX vectors. 3579 if res_name in ['X', 'nX']: 3580 self.assertTrue(theta >= X_theta_min - epsilon) 3581 self.assertTrue(theta <= X_theta_max + epsilon) 3582 if phi < 0.1: 3583 self.assertAlmostEqual(phi, 0.0, 3) 3584 else: 3585 self.assertAlmostEqual(phi, pi, 3) 3586 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3587 3588 # Check the Y vector. 3589 elif res_name == 'Y': 3590 self.assertTrue(r/100.0 >= 1.0 - epsilon) 3591 self.assertTrue(theta >= pi/4.0 - epsilon) 3592 self.assertTrue(theta <= 2.0*pi - pi/4.0 + epsilon) 3593 self.assertAlmostEqual(new_pos[1], 100.0, 3) 3594 3595 # Check the Z vector (should not move). 3596 elif res_name == 'Z': 3597 self.assertTrue(r/100.0 >= 1.0 - epsilon) 3598 self.assertAlmostEqual(new_pos[0], 0.0, 3) 3599 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3600 self.assertAlmostEqual(new_pos[2], 100.0, 3) 3601 3602 # Check the nY vector. 3603 elif res_name == 'nY': 3604 self.assertTrue(r/100.0 >= 1.0 - epsilon) 3605 self.assertTrue(theta >= pi/4.0 - epsilon) 3606 self.assertTrue(theta <= 2.0*pi - pi/4.0 + epsilon) 3607 self.assertAlmostEqual(new_pos[1], -100.0, 3) 3608 3609 # Check the nZ vector (should not move). 3610 elif res_name == 'nZ': 3611 self.assertTrue(r/100.0 >= 1.0 - epsilon) 3612 self.assertTrue(theta >= pi/4.0 - epsilon) 3613 self.assertTrue(theta <= 2.0*pi - pi/4.0 + epsilon) 3614 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3615 3616 # Check the centre. 3617 elif res_name == 'C': 3618 self.assertTrue(r/100.0 <= 1.4142135623730951 + epsilon) 3619 if not (new_pos[0] == 0.0 and new_pos[1] == 0.0 and new_pos[2] == 0.0): 3620 self.assertTrue(theta >= pi/4.0 - epsilon) 3621 self.assertTrue(theta <= 2.0*pi - pi/4.0 + epsilon) 3622 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3623 3624 # Check the origin. 3625 elif res_name == '0': 3626 self.assertAlmostEqual(r, 34.641016151377549, 4) 3627 self.assertAlmostEqual(pos[0], 0.0, 3) 3628 self.assertAlmostEqual(pos[1], 0.0, 3) 3629 self.assertAlmostEqual(pos[2], 0.0, 3) 3630 3631 # Check the number of structures. 3632 if type == 'decomp2': 3633 self.assertEqual(num_pos, 21)
3634 3635
3637 """Check the frame_order.simulate user function PDB file for the double rotor model with a xz-plane tilt for the second rotation mode.""" 3638 3639 # Init. 3640 cone_sigma_max = 0.0 3641 cone_sigma_max_2 = pi / 2.0 3642 pivot = array([20, 20, -20], float64) 3643 l = 100.0 3644 sim_num = 500 3645 pivot_disp = 100.0 3646 3647 # The eigenframe. 3648 eigen_beta = -pi/4.0 3649 R = zeros((3, 3), float64) 3650 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 3651 print("Motional eigenframe:\n%s" % R) 3652 3653 # Set up. 3654 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2) 3655 3656 # Create the PDB. 3657 files = [] 3658 if type == 'sim': 3659 file = 'simulation.pdb' 3660 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 3661 files.append(file) 3662 elif type == 'dist': 3663 file = 'distribution.pdb' 3664 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 3665 files.append(file) 3666 elif type == 'decomp': 3667 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 3668 files.append('decompose_mode1.pdb') 3669 files.append('decompose_mode2.pdb') 3670 elif type == 'decomp2': 3671 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 3672 files.append('decompose_mode1.pdb') 3673 files.append('decompose_mode2.pdb') 3674 3675 # Check each PDB. 3676 for file in files: 3677 # Delete all structural data. 3678 self.interpreter.structure.delete() 3679 3680 # Read the contents of the file. 3681 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 3682 3683 # Check the atomic coordinates. 3684 selection = cdp.structure.selection() 3685 num_pos = cdp.structure.num_models() 3686 epsilon = 1e-3 3687 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 3688 # Loop over all positions. 3689 for i in range(num_pos): 3690 # Shift the position back to the origin, and decompose into spherical coordinates. 3691 new_pos = pos[i] - pivot 3692 r, theta, phi = cartesian_to_spherical(dot(transpose(R), new_pos)) 3693 3694 # Printout. 3695 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi])) 3696 3697 # Check the X vector. 3698 if res_name == 'X': 3699 self.assertAlmostEqual(new_pos[0], 70.711, 3) 3700 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3701 self.assertAlmostEqual(new_pos[2], 70.711, 3) 3702 3703 # Check the Y vector. 3704 elif res_name == 'Y': 3705 self.assertAlmostEqual(r/100.0, 1.0, 3) 3706 self.assertTrue(new_pos[0] >= -70.711 - epsilon) 3707 self.assertTrue(new_pos[0] <= 70.711 + epsilon) 3708 self.assertTrue(new_pos[1] >= 0.0 - epsilon) 3709 self.assertTrue(new_pos[1] <= 100.0 + epsilon) 3710 self.assertTrue(new_pos[2] >= -70.711 - epsilon) 3711 self.assertTrue(new_pos[2] <= 70.711 + epsilon) 3712 3713 # Check the Z vector (should not move). 3714 elif res_name == 'Z': 3715 self.assertAlmostEqual(r/100.0, 1.0, 3) 3716 self.assertTrue(new_pos[0] >= -70.711 - epsilon) 3717 self.assertTrue(new_pos[0] <= 0.0 + epsilon) 3718 self.assertTrue(new_pos[1] >= -100.0 - epsilon) 3719 self.assertTrue(new_pos[1] <= 100.0 + epsilon) 3720 self.assertTrue(new_pos[2] >= 0.0 - epsilon) 3721 self.assertTrue(new_pos[2] <= 70.711 + epsilon) 3722 3723 # Check the nX vector. 3724 elif res_name == 'nX': 3725 self.assertAlmostEqual(new_pos[0], -70.711, 3) 3726 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3727 self.assertAlmostEqual(new_pos[2], -70.711, 3) 3728 3729 # Check the nY vector. 3730 elif res_name == 'nY': 3731 self.assertAlmostEqual(r/100.0, 1.0, 3) 3732 self.assertTrue(new_pos[0] >= -70.711 - epsilon) 3733 self.assertTrue(new_pos[0] <= 70.711 + epsilon) 3734 self.assertTrue(new_pos[1] >= -100.0 - epsilon) 3735 self.assertTrue(new_pos[1] <= 0.0 + epsilon) 3736 self.assertTrue(new_pos[2] >= -70.711 - epsilon) 3737 self.assertTrue(new_pos[2] <= 70.711 + epsilon) 3738 3739 # Check the nZ vector (should not move). 3740 elif res_name == 'nZ': 3741 self.assertAlmostEqual(r/100.0, 1.0, 3) 3742 self.assertTrue(new_pos[0] >= 0.0 - epsilon) 3743 self.assertTrue(new_pos[0] <= 70.711 + epsilon) 3744 self.assertTrue(new_pos[1] >= -100.0 - epsilon) 3745 self.assertTrue(new_pos[1] <= 100.0 + epsilon) 3746 self.assertTrue(new_pos[2] >= -70.711 - epsilon) 3747 self.assertTrue(new_pos[2] <= 0.0 + epsilon) 3748 3749 # Check the centre. 3750 elif res_name == 'C': 3751 self.assertAlmostEqual(r, 0.0, 3) 3752 self.assertAlmostEqual(new_pos[0], 0.0, 3) 3753 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3754 self.assertAlmostEqual(new_pos[2], 0.0, 3) 3755 3756 # Check the origin. 3757 elif res_name == '0': 3758 self.assertAlmostEqual(pos[0], 20.0, 3) 3759 self.assertAlmostEqual(pos[1], 20.0, 3) 3760 self.assertAlmostEqual(pos[2], -20.0, 3) 3761 3762 # Check the number of structures. 3763 if type == 'decomp2': 3764 self.assertEqual(num_pos, 21)
3765 3766
3767 - def test_simulate_double_rotor_mode2_z_axis(self, type='sim'):
3768 """Check the frame_order.simulate user function PDB file for the double rotor model along the z-axis for the second rotation mode.""" 3769 3770 # Init. 3771 cone_sigma_max = 0.0 3772 cone_sigma_max_2 = pi / 2.0 3773 pivot = array([20, 20, -20], float64) 3774 l = 100.0 3775 sim_num = 500 3776 pivot_disp = 100.0 3777 3778 # The eigenframe. 3779 eigen_beta = 0.0 3780 R = zeros((3, 3), float64) 3781 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 3782 print("Motional eigenframe:\n%s" % R) 3783 3784 # Set up. 3785 self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2) 3786 3787 # Create the PDB. 3788 files = [] 3789 if type == 'sim': 3790 file = 'simulation.pdb' 3791 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 3792 files.append(file) 3793 elif type == 'dist': 3794 file = 'distribution.pdb' 3795 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 3796 files.append(file) 3797 elif type == 'decomp': 3798 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 3799 files.append('decompose_mode1.pdb') 3800 files.append('decompose_mode2.pdb') 3801 elif type == 'decomp2': 3802 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 3803 files.append('decompose_mode1.pdb') 3804 files.append('decompose_mode2.pdb') 3805 3806 # Check each PDB. 3807 for file in files: 3808 # Delete all structural data. 3809 self.interpreter.structure.delete() 3810 3811 # Read the contents of the file. 3812 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 3813 3814 # Check the atomic coordinates. 3815 selection = cdp.structure.selection() 3816 num_pos = cdp.structure.num_models() 3817 epsilon = 1e-3 3818 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 3819 # Loop over all positions. 3820 for i in range(num_pos): 3821 # Shift the position back to the origin, and decompose into spherical coordinates. 3822 new_pos = pos[i] - pivot 3823 r, theta, phi = cartesian_to_spherical(new_pos) 3824 3825 # Printout. 3826 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi])) 3827 3828 # Check the X and nX vectors. 3829 if res_name == 'X': 3830 self.assertAlmostEqual(new_pos[0], 100.0, 3) 3831 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3832 self.assertAlmostEqual(new_pos[2], 0.0, 3) 3833 3834 # Check the Y vector. 3835 elif res_name == 'Y': 3836 self.assertAlmostEqual(r/100.0, 1.0, 3) 3837 self.assertAlmostEqual(new_pos[0], 0.0, 3) 3838 self.assertTrue(new_pos[1] >= 0.0 - epsilon) 3839 self.assertTrue(new_pos[1] <= 100.0 + epsilon) 3840 self.assertTrue(new_pos[2] >= -100.0 - epsilon) 3841 self.assertTrue(new_pos[2] <= 100.0 + epsilon) 3842 3843 # Check the Z vector (should not move). 3844 elif res_name == 'Z': 3845 self.assertAlmostEqual(r/100.0, 1.0, 3) 3846 self.assertAlmostEqual(new_pos[0], 0.0, 3) 3847 self.assertTrue(new_pos[1] >= -100.0 - epsilon) 3848 self.assertTrue(new_pos[1] <= 100.0 + epsilon) 3849 self.assertTrue(new_pos[2] >= 0.0 - epsilon) 3850 self.assertTrue(new_pos[2] <= 100.0 + epsilon) 3851 3852 # Check the X and nX vectors. 3853 elif res_name == 'nX': 3854 self.assertAlmostEqual(new_pos[0], -100.0, 3) 3855 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3856 self.assertAlmostEqual(new_pos[2], 0.0, 3) 3857 3858 # Check the nY vector. 3859 elif res_name == 'nY': 3860 self.assertAlmostEqual(r/100.0, 1.0, 3) 3861 self.assertAlmostEqual(new_pos[0], 0.0, 3) 3862 self.assertTrue(new_pos[1] >= -100.0 - epsilon) 3863 self.assertTrue(new_pos[1] <= 0.0 + epsilon) 3864 self.assertTrue(new_pos[2] >= -100.0 - epsilon) 3865 self.assertTrue(new_pos[2] <= 100.0 + epsilon) 3866 3867 # Check the nZ vector (should not move). 3868 elif res_name == 'nZ': 3869 self.assertAlmostEqual(r/100.0, 1.0, 3) 3870 self.assertAlmostEqual(new_pos[0], 0.0, 3) 3871 self.assertTrue(new_pos[1] >= -100.0 - epsilon) 3872 self.assertTrue(new_pos[1] <= 100.0 + epsilon) 3873 self.assertTrue(new_pos[2] >= -100.0 - epsilon) 3874 self.assertTrue(new_pos[2] <= 0.0 + epsilon) 3875 3876 # Check the centre. 3877 elif res_name == 'C': 3878 self.assertAlmostEqual(r, 0.0, 3) 3879 self.assertAlmostEqual(new_pos[0], 0.0, 3) 3880 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3881 self.assertAlmostEqual(new_pos[2], 0.0, 3) 3882 3883 # Check the origin. 3884 elif res_name == '0': 3885 self.assertAlmostEqual(pos[0], 20.0, 3) 3886 self.assertAlmostEqual(pos[1], 20.0, 3) 3887 self.assertAlmostEqual(pos[2], -20.0, 3) 3888 3889 # Check the number of structures. 3890 if type == 'decomp2': 3891 self.assertEqual(num_pos, 21)
3892 3893
3894 - def test_simulate_free_rotor_z_axis(self, type='sim'):
3895 """Check the frame_order.simulate user function PDB file for the free rotor model along the z-axis.""" 3896 3897 # Init. 3898 pivot = array([1, 0, 0], float64) 3899 l = 10.0 3900 sim_num = 500 3901 3902 # The axis alpha parameter, and printout. 3903 axis_alpha = pi / 2.0 3904 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64)) 3905 print("\nRotor axis: %s" % axis) 3906 print("Rotor apex (100*axis + [1, 0, 0]):\n %s" % (l*axis + pivot)) 3907 3908 # Set up. 3909 self.setup_model(pipe_name='PDB model', model='free rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha) 3910 3911 # Create the PDB. 3912 files = [] 3913 if type == 'sim': 3914 file = 'simulation.pdb' 3915 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 3916 files.append(file) 3917 elif type == 'dist': 3918 file = 'distribution.pdb' 3919 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 3920 files.append(file) 3921 elif type == 'decomp': 3922 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 3923 files.append('decompose_mode1.pdb') 3924 elif type == 'decomp2': 3925 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 3926 files.append('decompose_mode1.pdb') 3927 3928 # Check each PDB. 3929 for file in files: 3930 # Delete all structural data. 3931 self.interpreter.structure.delete() 3932 3933 # Read the contents of the file. 3934 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 3935 3936 # Check the atomic coordinates. 3937 selection = cdp.structure.selection() 3938 num_pos = cdp.structure.num_models() 3939 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 3940 # Loop over all positions. 3941 for i in range(num_pos): 3942 # Shift the position back to the origin, and decompose into spherical coordinates. 3943 new_pos = pos[i] - pivot 3944 r, theta, phi = cartesian_to_spherical(new_pos) 3945 3946 # Printout. 3947 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi])) 3948 3949 # The vector lengths. 3950 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']: 3951 self.assertAlmostEqual(r/100.0, 1.0, 4) 3952 elif res_name == 'C': 3953 self.assertAlmostEqual(r, 0.0, 4) 3954 3955 # Check the X vector. 3956 if res_name == 'X': 3957 self.assertAlmostEqual(theta, pi/2.0, 3) 3958 self.assertAlmostEqual(new_pos[2], 0.0, 3) 3959 3960 # Check the Y vector. 3961 elif res_name == 'Y': 3962 self.assertAlmostEqual(theta, pi/2.0, 3) 3963 self.assertAlmostEqual(new_pos[2], 0.0, 3) 3964 3965 # Check the Z vector (should not move). 3966 elif res_name == 'Z': 3967 self.assertAlmostEqual(new_pos[0], 0.0, 3) 3968 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3969 self.assertAlmostEqual(new_pos[2], 100.0, 3) 3970 3971 # Check the centre. 3972 elif res_name == 'C': 3973 self.assertAlmostEqual(new_pos[0], 0.0, 3) 3974 self.assertAlmostEqual(new_pos[1], 0.0, 3) 3975 self.assertAlmostEqual(new_pos[2], 0.0, 3) 3976 3977 # Check the origin. 3978 elif res_name == 'C': 3979 self.assertAlmostEqual(pos[0], 0.0, 3) 3980 self.assertAlmostEqual(pos[1], 0.0, 3) 3981 self.assertAlmostEqual(pos[2], 0.0, 3) 3982 3983 # Check the number of structures. 3984 if type == 'decomp2': 3985 self.assertEqual(num_pos, 21)
3986 3987
3988 - def test_simulate_iso_cone_z_axis(self, type='sim'):
3989 """Check the frame_order.simulate user function PDB file for the isotropic cone model along the z-axis.""" 3990 3991 # Init. 3992 cone_theta = 0.5 3993 cone_sigma_max = 0.3 3994 pivot = array([1, 0, -2], float64) 3995 l = 24.0 3996 sim_num = 500 3997 3998 # The axis parameters, and printout. 3999 axis_theta = 0.0 4000 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, 0.0)) 4001 4002 # Set up. 4003 self.setup_model(pipe_name='PDB model', model='iso cone', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=cone_theta, cone_sigma_max=cone_sigma_max) 4004 4005 # Create the PDB. 4006 files = [] 4007 if type == 'sim': 4008 file = 'simulation.pdb' 4009 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 4010 files.append(file) 4011 elif type == 'dist': 4012 file = 'distribution.pdb' 4013 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 4014 files.append(file) 4015 elif type == 'decomp': 4016 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 4017 files.append('decompose_mode1.pdb') 4018 files.append('decompose_mode2.pdb') 4019 files.append('decompose_mode3.pdb') 4020 elif type == 'decomp2': 4021 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 4022 files.append('decompose_mode1.pdb') 4023 files.append('decompose_mode2.pdb') 4024 files.append('decompose_mode3.pdb') 4025 4026 # Check each PDB. 4027 for file in files: 4028 # Delete all structural data. 4029 self.interpreter.structure.delete() 4030 4031 # Read the contents of the file. 4032 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 4033 4034 # Check the atomic coordinates. 4035 selection = cdp.structure.selection() 4036 num_pos = cdp.structure.num_models() 4037 epsilon = 1e-3 4038 max_phi = 0.0 4039 lateral_slide = 0.07 4040 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 4041 # Loop over all positions. 4042 for i in range(num_pos): 4043 # Shift the position back to the origin, and decompose into spherical coordinates. 4044 new_pos = pos[i] - pivot 4045 r, theta, phi = cartesian_to_spherical(new_pos) 4046 4047 # Printout. 4048 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi])) 4049 4050 # The vector lengths. 4051 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']: 4052 self.assertAlmostEqual(r/100.0, 1.0, 4) 4053 elif res_name == 'C': 4054 self.assertAlmostEqual(r, 0.0, 4) 4055 4056 # Check the X vector. 4057 if res_name == 'X': 4058 if abs(phi) > max_phi: 4059 max_phi = abs(phi) 4060 self.assertTrue(theta >= pi/2.0 - cone_theta - epsilon) 4061 self.assertTrue(theta <= pi/2.0 + cone_theta + epsilon) 4062 self.assertTrue(phi >= -cone_sigma_max - lateral_slide) 4063 self.assertTrue(phi <= cone_sigma_max + lateral_slide) 4064 4065 # Check the Y vector. 4066 elif res_name == 'Y': 4067 self.assertTrue(theta >= pi/2.0 - cone_theta - epsilon) 4068 self.assertTrue(theta <= pi/2.0 + cone_theta + epsilon) 4069 self.assertTrue(phi-pi/2.0 >= -cone_sigma_max - lateral_slide) 4070 self.assertTrue(phi-pi/2.0 <= cone_sigma_max + lateral_slide) 4071 4072 # Check the Z vector (should be in the cone defined by theta). 4073 elif res_name == 'Z': 4074 self.assertTrue(theta <= cone_theta + epsilon) 4075 4076 # Check the centre. 4077 elif res_name == 'C': 4078 self.assertAlmostEqual(new_pos[0], 0.0, 3) 4079 self.assertAlmostEqual(new_pos[1], 0.0, 3) 4080 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4081 4082 # Check the origin. 4083 elif res_name == 'C': 4084 self.assertAlmostEqual(pos[0], 0.0, 3) 4085 self.assertAlmostEqual(pos[1], 0.0, 3) 4086 self.assertAlmostEqual(pos[2], 0.0, 3) 4087 4088 # Print out the maximum phi value. 4089 print("Maximum phi for X and Y: %s" % max_phi) 4090 4091 # Check the number of structures. 4092 if type == 'decomp2': 4093 self.assertEqual(num_pos, 21)
4094 4095
4096 - def test_simulate_iso_cone_xz_plane_tilt(self, type='sim'):
4097 """Check the frame_order.simulate user function PDB file for the isotropic cone model with a xz-plane tilt.""" 4098 4099 # Init. 4100 cone_theta = 0.5 4101 cone_sigma_max = 0.3 4102 pivot = array([1, 0, -2], float64) 4103 l = 24.0 4104 sim_num = 500 4105 4106 # The axis parameters, and printout. 4107 axis_theta = -pi/4.0 4108 axis = create_rotor_axis_spherical(axis_theta, 0.0) 4109 print("Rotor axis: %s" % axis) 4110 R = zeros((3, 3), float64) 4111 axis_angle_to_R([0, 1, 0], axis_theta, R) 4112 4113 # Set up. 4114 self.setup_model(pipe_name='PDB model', model='iso cone', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=axis_theta, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=cone_theta, cone_sigma_max=cone_sigma_max) 4115 4116 # Create the PDB. 4117 files = [] 4118 if type == 'sim': 4119 file = 'simulation.pdb' 4120 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 4121 files.append(file) 4122 elif type == 'dist': 4123 file = 'distribution.pdb' 4124 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 4125 files.append(file) 4126 elif type == 'decomp': 4127 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 4128 files.append('decompose_mode1.pdb') 4129 files.append('decompose_mode2.pdb') 4130 files.append('decompose_mode3.pdb') 4131 elif type == 'decomp2': 4132 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 4133 files.append('decompose_mode1.pdb') 4134 files.append('decompose_mode2.pdb') 4135 files.append('decompose_mode3.pdb') 4136 4137 # Check each PDB. 4138 for file in files: 4139 # Delete all structural data. 4140 self.interpreter.structure.delete() 4141 4142 # Read the contents of the file. 4143 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 4144 4145 # Check the atomic coordinates. 4146 selection = cdp.structure.selection() 4147 num_pos = cdp.structure.num_models() 4148 epsilon = 1e-3 4149 max_phi = 0.0 4150 lateral_slide = 0.07 4151 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 4152 # Loop over all positions. 4153 for i in range(num_pos): 4154 # Shift the position back to the origin, and decompose into spherical coordinates. 4155 new_pos = pos[i] - pivot 4156 r, theta, phi = cartesian_to_spherical(dot(transpose(R), new_pos)) 4157 4158 # Printout. 4159 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi])) 4160 4161 # The vector lengths. 4162 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']: 4163 self.assertAlmostEqual(r/100.0, 1.0, 4) 4164 elif res_name == 'C': 4165 self.assertAlmostEqual(r, 0.0, 4) 4166 4167 # Check the X vector. 4168 if res_name == 'X': 4169 if abs(phi) > max_phi: 4170 max_phi = abs(phi) 4171 self.assertTrue(theta >= pi/2.0 - cone_theta - epsilon) 4172 self.assertTrue(theta <= pi/2.0 + cone_theta + epsilon) 4173 self.assertTrue(phi >= -cone_sigma_max - lateral_slide) 4174 self.assertTrue(phi <= cone_sigma_max + lateral_slide) 4175 4176 # Check the Y vector. 4177 elif res_name == 'Y': 4178 self.assertTrue(theta >= pi/2.0 - cone_theta - epsilon) 4179 self.assertTrue(theta <= pi/2.0 + cone_theta + epsilon) 4180 self.assertTrue(phi-pi/2.0 >= -cone_sigma_max - lateral_slide) 4181 self.assertTrue(phi-pi/2.0 <= cone_sigma_max + lateral_slide) 4182 4183 # Check the Z vector (should be in the cone defined by theta). 4184 elif res_name == 'Z': 4185 self.assertTrue(theta <= cone_theta + epsilon) 4186 4187 # Check the centre. 4188 elif res_name == 'C': 4189 self.assertAlmostEqual(new_pos[0], 0.0, 3) 4190 self.assertAlmostEqual(new_pos[1], 0.0, 3) 4191 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4192 4193 # Check the origin. 4194 elif res_name == 'C': 4195 self.assertAlmostEqual(pos[0], 0.0, 3) 4196 self.assertAlmostEqual(pos[1], 0.0, 3) 4197 self.assertAlmostEqual(pos[2], 0.0, 3) 4198 4199 # Print out the maximum phi value. 4200 print("Maximum phi for X and Y: %s" % max_phi) 4201 4202 # Check the number of structures. 4203 if type == 'decomp2': 4204 self.assertEqual(num_pos, 21)
4205 4206
4207 - def test_simulate_iso_cone_free_rotor_z_axis(self, type='sim'):
4208 """Check the frame_order.simulate user function PDB file for the free rotor isotropic cone model along the z-axis.""" 4209 4210 # Init. 4211 cone_theta = 0.5 4212 pivot = array([1, 0, -2], float64) 4213 l = 24.0 4214 sim_num = 500 4215 4216 # The axis parameters, and printout. 4217 axis_theta = 0.0 4218 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, 0.0)) 4219 4220 # Set up. 4221 self.setup_model(pipe_name='PDB model', model='iso cone, free rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=cone_theta) 4222 4223 # Create the PDB. 4224 files = [] 4225 if type == 'sim': 4226 file = 'simulation.pdb' 4227 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 4228 files.append(file) 4229 elif type == 'dist': 4230 file = 'distribution.pdb' 4231 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 4232 files.append(file) 4233 elif type == 'decomp': 4234 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 4235 files.append('decompose_mode1.pdb') 4236 files.append('decompose_mode2.pdb') 4237 files.append('decompose_mode3.pdb') 4238 elif type == 'decomp2': 4239 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 4240 files.append('decompose_mode1.pdb') 4241 files.append('decompose_mode2.pdb') 4242 files.append('decompose_mode3.pdb') 4243 4244 # Check each PDB. 4245 for file in files: 4246 # Delete all structural data. 4247 self.interpreter.structure.delete() 4248 4249 # Read the contents of the file. 4250 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 4251 4252 # Check the atomic coordinates. 4253 selection = cdp.structure.selection() 4254 num_pos = cdp.structure.num_models() 4255 epsilon = 1e-3 4256 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 4257 # Loop over all positions. 4258 for i in range(num_pos): 4259 # Shift the position back to the origin, and decompose into spherical coordinates. 4260 new_pos = pos[i] - pivot 4261 r, theta, phi = cartesian_to_spherical(new_pos) 4262 4263 # Printout. 4264 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi])) 4265 4266 # The vector lengths. 4267 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']: 4268 self.assertAlmostEqual(r/100.0, 1.0, 4) 4269 elif res_name == 'C': 4270 self.assertAlmostEqual(r, 0.0, 4) 4271 4272 # Check the X vector. 4273 if res_name == 'X': 4274 self.assertTrue(theta >= pi/2.0 - cone_theta - epsilon) 4275 self.assertTrue(theta <= pi/2.0 + cone_theta + epsilon) 4276 4277 # Check the Y vector. 4278 elif res_name == 'Y': 4279 self.assertTrue(theta >= pi/2.0 - cone_theta - epsilon) 4280 self.assertTrue(theta <= pi/2.0 + cone_theta + epsilon) 4281 4282 # Check the Z vector (should be in the cone defined by theta). 4283 elif res_name == 'Z': 4284 self.assertTrue(theta <= cone_theta + epsilon) 4285 4286 # Check the centre. 4287 elif res_name == 'C': 4288 self.assertAlmostEqual(new_pos[0], 0.0, 3) 4289 self.assertAlmostEqual(new_pos[1], 0.0, 3) 4290 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4291 4292 # Check the origin. 4293 elif res_name == 'C': 4294 self.assertAlmostEqual(pos[0], 0.0, 3) 4295 self.assertAlmostEqual(pos[1], 0.0, 3) 4296 self.assertAlmostEqual(pos[2], 0.0, 3) 4297 4298 # Check the number of structures. 4299 if type == 'decomp2': 4300 self.assertEqual(num_pos, 21)
4301 4302
4303 - def test_simulate_iso_cone_torsionless_z_axis(self, type='sim'):
4304 """Check the frame_order.simulate user function PDB file for the torsionless isotropic cone model along the z-axis.""" 4305 4306 # Init. 4307 cone_theta = 0.5 4308 pivot = array([1, 0, -2], float64) 4309 l = 24.0 4310 sim_num = 500 4311 4312 # The axis parameters, and printout. 4313 axis_theta = 0.0 4314 print("Rotor axis: %s" % create_rotor_axis_spherical(axis_theta, 0.0)) 4315 4316 # Set up. 4317 self.setup_model(pipe_name='PDB model', model='iso cone, torsionless', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=cone_theta) 4318 4319 # Create the PDB. 4320 files = [] 4321 if type == 'sim': 4322 file = 'simulation.pdb' 4323 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 4324 files.append(file) 4325 elif type == 'dist': 4326 file = 'distribution.pdb' 4327 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 4328 files.append(file) 4329 elif type == 'decomp': 4330 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 4331 files.append('decompose_mode1.pdb') 4332 files.append('decompose_mode2.pdb') 4333 elif type == 'decomp2': 4334 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 4335 files.append('decompose_mode1.pdb') 4336 files.append('decompose_mode2.pdb') 4337 4338 # Check each PDB. 4339 for file in files: 4340 # Delete all structural data. 4341 self.interpreter.structure.delete() 4342 4343 # Read the contents of the file. 4344 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 4345 4346 # Check the atomic coordinates. 4347 selection = cdp.structure.selection() 4348 num_pos = cdp.structure.num_models() 4349 epsilon = 1e-3 4350 max_phi = 0.0 4351 lateral_slide = 0.07 4352 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 4353 # Loop over all positions. 4354 for i in range(num_pos): 4355 # Shift the position back to the origin, and decompose into spherical coordinates. 4356 new_pos = pos[i] - pivot 4357 r, theta, phi = cartesian_to_spherical(new_pos) 4358 4359 # Printout. 4360 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi])) 4361 4362 # The vector lengths. 4363 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']: 4364 self.assertAlmostEqual(r/100.0, 1.0, 4) 4365 elif res_name == 'C': 4366 self.assertAlmostEqual(r, 0.0, 4) 4367 4368 # Check the X vector. 4369 if res_name == 'X': 4370 if abs(phi) > max_phi: 4371 max_phi = abs(phi) 4372 self.assertTrue(theta >= pi/2.0 - cone_theta - epsilon) 4373 self.assertTrue(theta <= pi/2.0 + cone_theta + epsilon) 4374 self.assertTrue(phi >= -lateral_slide) 4375 self.assertTrue(phi <= lateral_slide) 4376 4377 # Check the Y vector. 4378 elif res_name == 'Y': 4379 self.assertTrue(theta >= pi/2.0 - cone_theta - epsilon) 4380 self.assertTrue(theta <= pi/2.0 + cone_theta + epsilon) 4381 self.assertTrue(phi-pi/2.0 >= -lateral_slide) 4382 self.assertTrue(phi-pi/2.0 <= lateral_slide) 4383 4384 # Check the Z vector (should be in the cone defined by theta). 4385 elif res_name == 'Z': 4386 self.assertTrue(theta <= cone_theta + epsilon) 4387 4388 # Check the centre. 4389 elif res_name == 'C': 4390 self.assertAlmostEqual(new_pos[0], 0.0, 3) 4391 self.assertAlmostEqual(new_pos[1], 0.0, 3) 4392 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4393 4394 # Check the origin. 4395 elif res_name == 'C': 4396 self.assertAlmostEqual(pos[0], 0.0, 3) 4397 self.assertAlmostEqual(pos[1], 0.0, 3) 4398 self.assertAlmostEqual(pos[2], 0.0, 3) 4399 4400 # Print out the maximum phi value. 4401 print("Maximum phi for X and Y: %s" % max_phi) 4402 4403 # Check the number of structures. 4404 if type == 'decomp2': 4405 self.assertEqual(num_pos, 21)
4406 4407
4408 - def test_simulate_pseudo_ellipse_xz_plane_tilt(self, type='sim'):
4409 """Check the frame_order.simulate user function PDB file for the pseudo-ellipse model with a xz-plane tilt.""" 4410 4411 # Init. 4412 cone_theta_x = 0.5 4413 cone_theta_y = 0.2 4414 cone_sigma_max = 0.1 4415 pivot = array([1, 0, -2], float64) 4416 l = 50.0 4417 sim_num = 500 4418 4419 # The axis parameters. 4420 eigen_beta = -pi/4.0 4421 R = zeros((3, 3), float64) 4422 euler_to_R_zyz(0.0, eigen_beta, 0.0, R) 4423 print("Motional eigenframe:\n%s" % R) 4424 4425 # Set up. 4426 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=cone_theta_x, cone_theta_y=cone_theta_y, cone_sigma_max=cone_sigma_max) 4427 4428 # Create the PDB. 4429 files = [] 4430 if type == 'sim': 4431 file = 'simulation.pdb' 4432 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 4433 files.append(file) 4434 elif type == 'dist': 4435 file = 'distribution.pdb' 4436 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 4437 files.append(file) 4438 elif type == 'decomp': 4439 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 4440 files.append('decompose_mode1.pdb') 4441 files.append('decompose_mode2.pdb') 4442 files.append('decompose_mode3.pdb') 4443 elif type == 'decomp2': 4444 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 4445 files.append('decompose_mode1.pdb') 4446 files.append('decompose_mode2.pdb') 4447 files.append('decompose_mode3.pdb') 4448 4449 # Check each PDB. 4450 for file in files: 4451 # Delete all structural data. 4452 self.interpreter.structure.delete() 4453 4454 # Read the contents of the file. 4455 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 4456 4457 # Check the atomic coordinates. 4458 selection = cdp.structure.selection() 4459 num_pos = cdp.structure.num_models() 4460 epsilon = 1e-3 4461 max_phi = 0.0 4462 lateral_slide = 0.17 4463 vertical_slide = 0.02 4464 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 4465 # Loop over all positions. 4466 for i in range(num_pos): 4467 # Shift the position back to the origin, and decompose into spherical coordinates. 4468 new_pos = pos[i] - pivot 4469 r, theta, phi = cartesian_to_spherical(dot(transpose(R), new_pos)) 4470 4471 # Printout. 4472 print("Checking residue %s %s, atom %s %s, at shifted position [%8.3f, %8.3f, %8.3f], with spherical coordinates [%8.3f, %8.3f, %8.3f]." % (res_num, res_name, atom_num, atom_name, new_pos[0], new_pos[1], new_pos[2], r, theta, phi)) 4473 4474 # The vector lengths. 4475 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']: 4476 self.assertAlmostEqual(r/100.0, 1.0, 4) 4477 elif res_name == 'C': 4478 self.assertAlmostEqual(r, 0.0, 4) 4479 4480 # Check the X vector. 4481 if res_name == 'X': 4482 self.assertTrue(theta >= pi/2.0 - cone_theta_x - epsilon) 4483 self.assertTrue(theta <= pi/2.0 + cone_theta_x + epsilon) 4484 4485 # Check the Y vector. 4486 elif res_name == 'Y': 4487 if abs(phi-pi/2.0) > max_phi: 4488 max_phi = abs(phi-pi/2.0) 4489 self.assertTrue(theta >= pi/2.0 - cone_theta_y - vertical_slide) 4490 self.assertTrue(theta <= pi/2.0 + cone_theta_y + vertical_slide) 4491 self.assertTrue(phi-pi/2.0 >= -cone_sigma_max - lateral_slide) 4492 self.assertTrue(phi-pi/2.0 <= cone_sigma_max + lateral_slide) 4493 4494 # Check the Z vector (should be in the cone defined by theta). 4495 elif res_name == 'Z': 4496 theta_max = cone_theta_x * cone_theta_y / sqrt((cos(phi)*cone_theta_y)**2 + (sin(phi)*cone_theta_x)**2) 4497 self.assertTrue(theta <= theta_max + epsilon) 4498 4499 # Check the centre. 4500 elif res_name == 'C': 4501 self.assertAlmostEqual(new_pos[0], 0.0, 3) 4502 self.assertAlmostEqual(new_pos[1], 0.0, 3) 4503 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4504 4505 # Check the origin. 4506 elif res_name == 'C': 4507 self.assertAlmostEqual(pos[0], 0.0, 3) 4508 self.assertAlmostEqual(pos[1], 0.0, 3) 4509 self.assertAlmostEqual(pos[2], 0.0, 3) 4510 4511 # Print out the maximum phi value. 4512 print("Maximum phi-pi/2.0 for Y: %s" % max_phi) 4513 4514 # Check the number of structures. 4515 if type == 'decomp2': 4516 self.assertEqual(num_pos, 21)
4517 4518
4519 - def test_simulate_pseudo_ellipse_z_axis(self, type='sim'):
4520 """Check the frame_order.simulate user function PDB file for the pseudo-ellipse model along the z-axis.""" 4521 4522 # Init. 4523 cone_theta_x = 2.0 4524 cone_theta_y = 0.5 4525 cone_sigma_max = 0.1 4526 pivot = array([1, 0, -2], float64) 4527 l = 50.0 4528 sim_num = 500 4529 4530 # The axis parameters. 4531 eigen_beta = 0.0 4532 4533 # Set up. 4534 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=cone_theta_x, cone_theta_y=cone_theta_y, cone_sigma_max=cone_sigma_max) 4535 4536 # Create the PDB. 4537 files = [] 4538 if type == 'sim': 4539 file = 'simulation.pdb' 4540 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 4541 files.append(file) 4542 elif type == 'dist': 4543 file = 'distribution.pdb' 4544 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 4545 files.append(file) 4546 elif type == 'decomp': 4547 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 4548 files.append('decompose_mode1.pdb') 4549 files.append('decompose_mode2.pdb') 4550 files.append('decompose_mode3.pdb') 4551 elif type == 'decomp2': 4552 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 4553 files.append('decompose_mode1.pdb') 4554 files.append('decompose_mode2.pdb') 4555 files.append('decompose_mode3.pdb') 4556 4557 # Check each PDB. 4558 for file in files: 4559 # Delete all structural data. 4560 self.interpreter.structure.delete() 4561 4562 # Read the contents of the file. 4563 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 4564 4565 # Check the atomic coordinates. 4566 selection = cdp.structure.selection() 4567 num_pos = cdp.structure.num_models() 4568 epsilon = 1e-3 4569 max_phi = 0.0 4570 lateral_slide = 0.17 4571 vertical_slide = 0.02 4572 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 4573 # Loop over all positions. 4574 for i in range(num_pos): 4575 # Shift the position back to the origin, and decompose into spherical coordinates. 4576 new_pos = pos[i] - pivot 4577 r, theta, phi = cartesian_to_spherical(new_pos) 4578 4579 # Printout. 4580 print("Checking residue %s %s, atom %s %s, at shifted position [%8.3f, %8.3f, %8.3f], with spherical coordinates [%8.3f, %8.3f, %8.3f]." % (res_num, res_name, atom_num, atom_name, new_pos[0], new_pos[1], new_pos[2], r, theta, phi)) 4581 4582 # The vector lengths. 4583 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']: 4584 self.assertAlmostEqual(r/100.0, 1.0, 4) 4585 elif res_name == 'C': 4586 self.assertAlmostEqual(r, 0.0, 4) 4587 4588 # Check the X vector. 4589 if res_name == 'X': 4590 self.assertTrue(theta >= pi/2.0 - cone_theta_x - epsilon) 4591 self.assertTrue(theta <= pi/2.0 + cone_theta_x + epsilon) 4592 4593 # Check the Y vector. 4594 elif res_name == 'Y': 4595 if abs(phi-pi/2.0) > max_phi: 4596 max_phi = abs(phi-pi/2.0) 4597 self.assertTrue(theta >= pi/2.0 - cone_theta_y - vertical_slide) 4598 self.assertTrue(theta <= pi/2.0 + cone_theta_y + vertical_slide) 4599 self.assertTrue(phi-pi/2.0 >= -cone_sigma_max - lateral_slide) 4600 self.assertTrue(phi-pi/2.0 <= cone_sigma_max + lateral_slide) 4601 4602 # Check the Z vector (should be in the cone defined by theta). 4603 elif res_name == 'Z': 4604 theta_max = cone_theta_x * cone_theta_y / sqrt((cos(phi)*cone_theta_y)**2 + (sin(phi)*cone_theta_x)**2) 4605 self.assertTrue(theta <= theta_max + epsilon) 4606 4607 # Check the centre. 4608 elif res_name == 'C': 4609 self.assertAlmostEqual(new_pos[0], 0.0, 3) 4610 self.assertAlmostEqual(new_pos[1], 0.0, 3) 4611 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4612 4613 # Check the origin. 4614 elif res_name == 'C': 4615 self.assertAlmostEqual(pos[0], 0.0, 3) 4616 self.assertAlmostEqual(pos[1], 0.0, 3) 4617 self.assertAlmostEqual(pos[2], 0.0, 3) 4618 4619 # Print out the maximum phi value. 4620 print("Maximum phi-pi/2.0 for Y: %s" % max_phi) 4621 4622 # Check the number of structures. 4623 if type == 'decomp2': 4624 self.assertEqual(num_pos, 21)
4625 4626
4628 """Check the frame_order.simulate user function PDB file for the free rotor pseudo-ellipse model along the z-axis.""" 4629 4630 # Init. 4631 cone_theta_x = 0.5 4632 cone_theta_y = 0.2 4633 pivot = array([1, 0, -2], float64) 4634 l = 50.0 4635 sim_num = 500 4636 4637 # The axis parameters. 4638 eigen_beta = 0.0 4639 4640 # Set up. 4641 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, free rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=cone_theta_x, cone_theta_y=cone_theta_y) 4642 4643 # Create the PDB. 4644 files = [] 4645 if type == 'sim': 4646 file = 'simulation.pdb' 4647 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 4648 files.append(file) 4649 elif type == 'dist': 4650 file = 'distribution.pdb' 4651 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 4652 files.append(file) 4653 elif type == 'decomp': 4654 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 4655 files.append('decompose_mode1.pdb') 4656 files.append('decompose_mode2.pdb') 4657 files.append('decompose_mode3.pdb') 4658 elif type == 'decomp2': 4659 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 4660 files.append('decompose_mode1.pdb') 4661 files.append('decompose_mode2.pdb') 4662 files.append('decompose_mode3.pdb') 4663 4664 # Check each PDB. 4665 for file in files: 4666 # Delete all structural data. 4667 self.interpreter.structure.delete() 4668 4669 # Read the contents of the file. 4670 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 4671 4672 # Check the atomic coordinates. 4673 selection = cdp.structure.selection() 4674 num_pos = cdp.structure.num_models() 4675 epsilon = 1e-3 4676 max_phi = 0.0 4677 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 4678 # Loop over all positions. 4679 for i in range(num_pos): 4680 # Shift the position back to the origin, and decompose into spherical coordinates. 4681 new_pos = pos[i] - pivot 4682 r, theta, phi = cartesian_to_spherical(new_pos) 4683 4684 # Printout. 4685 print("Checking residue %s %s, atom %s %s, at shifted position [%8.3f, %8.3f, %8.3f], with spherical coordinates [%8.3f, %8.3f, %8.3f]." % (res_num, res_name, atom_num, atom_name, new_pos[0], new_pos[1], new_pos[2], r, theta, phi)) 4686 4687 # The vector lengths. 4688 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']: 4689 self.assertAlmostEqual(r/100.0, 1.0, 4) 4690 elif res_name == 'C': 4691 self.assertAlmostEqual(r, 0.0, 4) 4692 4693 # Check the X and Y vectors. 4694 if res_name in ['X', 'Y']: 4695 self.assertTrue(theta >= pi/2.0 - cone_theta_x - epsilon) 4696 self.assertTrue(theta <= pi/2.0 + cone_theta_x + epsilon) 4697 4698 # Check the Z vector (should be in the cone defined by theta). 4699 elif res_name == 'Z': 4700 theta_max = cone_theta_x * cone_theta_y / sqrt((cos(phi)*cone_theta_y)**2 + (sin(phi)*cone_theta_x)**2) 4701 self.assertTrue(theta <= theta_max + epsilon) 4702 4703 # Check the centre. 4704 elif res_name == 'C': 4705 self.assertAlmostEqual(new_pos[0], 0.0, 3) 4706 self.assertAlmostEqual(new_pos[1], 0.0, 3) 4707 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4708 4709 # Check the origin. 4710 elif res_name == 'C': 4711 self.assertAlmostEqual(pos[0], 0.0, 3) 4712 self.assertAlmostEqual(pos[1], 0.0, 3) 4713 self.assertAlmostEqual(pos[2], 0.0, 3) 4714 4715 # Print out the maximum phi value. 4716 print("Maximum phi-pi/2.0 for Y: %s" % max_phi) 4717 4718 # Check the number of structures. 4719 if type == 'decomp2': 4720 self.assertEqual(num_pos, 21)
4721 4722
4724 """Check the frame_order.simulate user function PDB file for the torsionless pseudo-ellipse model along the z-axis.""" 4725 4726 # Init. 4727 cone_theta_x = 2.0 4728 cone_theta_y = 0.5 4729 pivot = array([1, 0, -2], float64) 4730 l = 50.0 4731 sim_num = 500 4732 4733 # The axis parameters. 4734 eigen_beta = 0.0 4735 4736 # Set up. 4737 self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, torsionless', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=cone_theta_x, cone_theta_y=cone_theta_y) 4738 4739 # Create the PDB. 4740 files = [] 4741 if type == 'sim': 4742 file = 'simulation.pdb' 4743 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 4744 files.append(file) 4745 elif type == 'dist': 4746 file = 'distribution.pdb' 4747 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 4748 files.append(file) 4749 elif type == 'decomp': 4750 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 4751 files.append('decompose_mode1.pdb') 4752 files.append('decompose_mode2.pdb') 4753 elif type == 'decomp2': 4754 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 4755 files.append('decompose_mode1.pdb') 4756 files.append('decompose_mode2.pdb') 4757 4758 # Check each PDB. 4759 for file in files: 4760 # Delete all structural data. 4761 self.interpreter.structure.delete() 4762 4763 # Read the contents of the file. 4764 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 4765 4766 # Check the atomic coordinates. 4767 selection = cdp.structure.selection() 4768 num_pos = cdp.structure.num_models() 4769 epsilon = 1e-3 4770 max_phi = 0.0 4771 lateral_slide = 0.23 4772 vertical_slide = 0.02 4773 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 4774 # Loop over all positions. 4775 for i in range(num_pos): 4776 # Shift the position back to the origin, and decompose into spherical coordinates. 4777 new_pos = pos[i] - pivot 4778 r, theta, phi = cartesian_to_spherical(new_pos) 4779 4780 # Printout. 4781 print("Checking residue %s %s, atom %s %s, at shifted position [%8.3f, %8.3f, %8.3f], with spherical coordinates [%8.3f, %8.3f, %8.3f]." % (res_num, res_name, atom_num, atom_name, new_pos[0], new_pos[1], new_pos[2], r, theta, phi)) 4782 4783 # The vector lengths. 4784 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']: 4785 self.assertAlmostEqual(r/100.0, 1.0, 4) 4786 elif res_name == 'C': 4787 self.assertAlmostEqual(r, 0.0, 4) 4788 4789 # Check the X vector. 4790 if res_name == 'X': 4791 self.assertTrue(theta >= pi/2.0 - cone_theta_x - epsilon) 4792 self.assertTrue(theta <= pi/2.0 + cone_theta_x + epsilon) 4793 4794 # Check the Y vector. 4795 elif res_name == 'Y': 4796 if abs(phi-pi/2.0) > max_phi: 4797 max_phi = abs(phi-pi/2.0) 4798 self.assertTrue(theta >= pi/2.0 - cone_theta_y - vertical_slide) 4799 self.assertTrue(theta <= pi/2.0 + cone_theta_y + vertical_slide) 4800 self.assertTrue(phi-pi/2.0 >= -lateral_slide) 4801 self.assertTrue(phi-pi/2.0 <= lateral_slide) 4802 4803 # Check the Z vector (should be in the cone defined by theta). 4804 elif res_name == 'Z': 4805 theta_max = cone_theta_x * cone_theta_y / sqrt((cos(phi)*cone_theta_y)**2 + (sin(phi)*cone_theta_x)**2) 4806 self.assertTrue(theta <= theta_max + epsilon) 4807 4808 # Check the centre. 4809 elif res_name == 'C': 4810 self.assertAlmostEqual(new_pos[0], 0.0, 3) 4811 self.assertAlmostEqual(new_pos[1], 0.0, 3) 4812 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4813 4814 # Check the origin. 4815 elif res_name == 'C': 4816 self.assertAlmostEqual(pos[0], 0.0, 3) 4817 self.assertAlmostEqual(pos[1], 0.0, 3) 4818 self.assertAlmostEqual(pos[2], 0.0, 3) 4819 4820 # Print out the maximum phi value. 4821 print("Maximum phi-pi/2.0 for Y: %s" % max_phi) 4822 4823 # Check the number of structures. 4824 if type == 'decomp2': 4825 self.assertEqual(num_pos, 21)
4826 4827
4828 - def test_simulate_rotor_z_axis(self, type='sim'):
4829 """Check the frame_order.simulate user function PDB file for the rotor model along the z-axis.""" 4830 4831 # Init. 4832 cone_sigma_max = 0.3 4833 pivot = array([1, 0, 0], float64) 4834 l = 30.0 4835 sim_num = 500 4836 4837 # The axis alpha parameter, and printout. 4838 axis_alpha = pi / 2.0 4839 axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64)) 4840 print("\nRotor axis: %s" % axis) 4841 print("Rotor apex (100*axis + [1, 0, 0]):\n %s" % (l*axis + pivot)) 4842 4843 # Set up. 4844 self.setup_model(pipe_name='PDB model', model='rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha, cone_sigma_max=cone_sigma_max) 4845 4846 # Create the PDB. 4847 files = [] 4848 if type == 'sim': 4849 file = 'simulation.pdb' 4850 self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num) 4851 files.append(file) 4852 elif type == 'dist': 4853 file = 'distribution.pdb' 4854 self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num) 4855 files.append(file) 4856 elif type == 'decomp': 4857 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir) 4858 files.append('decompose_mode1.pdb') 4859 elif type == 'decomp2': 4860 self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True) 4861 files.append('decompose_mode1.pdb') 4862 4863 # Check each PDB. 4864 for file in files: 4865 # Delete all structural data. 4866 self.interpreter.structure.delete() 4867 4868 # Read the contents of the file. 4869 self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir) 4870 4871 # Check the atomic coordinates. 4872 selection = cdp.structure.selection() 4873 num_pos = cdp.structure.num_models() 4874 for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): 4875 # Loop over all positions. 4876 for i in range(num_pos): 4877 # Shift the position back to the origin, and decompose into spherical coordinates. 4878 new_pos = pos[i] - pivot 4879 r, theta, phi = cartesian_to_spherical(new_pos) 4880 4881 # Printout. 4882 print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi])) 4883 4884 # The vector lengths. 4885 if res_name in ['X', 'Y', 'Z', 'Xn', 'Yn', 'Zn']: 4886 self.assertAlmostEqual(r/100.0, 1.0, 4) 4887 elif res_name == 'C': 4888 self.assertAlmostEqual(r, 0.0, 4) 4889 4890 # Check the X vector. 4891 if res_name == 'X': 4892 self.assertAlmostEqual(theta, pi/2.0, 3) 4893 self.assertTrue(phi >= -cone_sigma_max) 4894 self.assertTrue(phi <= cone_sigma_max) 4895 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4896 4897 # Check the Y vector. 4898 elif res_name == 'Y': 4899 self.assertAlmostEqual(theta, pi/2.0, 3) 4900 self.assertTrue(phi-pi/2.0 >= -cone_sigma_max) 4901 self.assertTrue(phi-pi/2.0 <= cone_sigma_max) 4902 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4903 4904 # Check the Z vector (should not move). 4905 elif res_name == 'Z': 4906 self.assertAlmostEqual(new_pos[0], 0.0, 3) 4907 self.assertAlmostEqual(new_pos[1], 0.0, 3) 4908 self.assertAlmostEqual(new_pos[2], 100.0, 3) 4909 4910 # Check the centre. 4911 elif res_name == 'C': 4912 self.assertAlmostEqual(new_pos[0], 0.0, 3) 4913 self.assertAlmostEqual(new_pos[1], 0.0, 3) 4914 self.assertAlmostEqual(new_pos[2], 0.0, 3) 4915 4916 # Check the origin. 4917 elif res_name == 'C': 4918 self.assertAlmostEqual(pos[0], 0.0, 3) 4919 self.assertAlmostEqual(pos[1], 0.0, 3) 4920 self.assertAlmostEqual(pos[2], 0.0, 3) 4921 4922 # Check the number of structures. 4923 if type == 'decomp2': 4924 self.assertEqual(num_pos, 21)
4925 4926
4927 - def test_sobol_setup(self):
4928 """Check the basic operation of the frame_order.sobol_setup user function.""" 4929 4930 # Create a data pipe. 4931 self.interpreter.pipe.create('test', 'frame order') 4932 4933 # Set a number of points. 4934 self.interpreter.frame_order.sobol_setup(200)
4935 4936
4937 - def test_sobol_setup2(self):
4938 """Check the operation of the frame_order.sobol_setup user function with just the model specified.""" 4939 4940 # Create a data pipe. 4941 self.interpreter.pipe.create('test', 'frame order') 4942 4943 # Set the model. 4944 self.interpreter.frame_order.select_model('iso cone') 4945 4946 # Set a number of points. 4947 self.interpreter.frame_order.sobol_setup(200)
4948 4949
4950 - def test_sobol_setup3(self):
4951 """Check the operation of the frame_order.sobol_setup user function with the model and parameters set up.""" 4952 4953 # Create a data pipe. 4954 self.interpreter.pipe.create('test', 'frame order') 4955 4956 # Set the model. 4957 self.interpreter.frame_order.select_model('iso cone') 4958 4959 # Set up the system. 4960 self.interpreter.value.set(param='ave_pos_x', val=0.0) 4961 self.interpreter.value.set(param='ave_pos_y', val=0.0) 4962 self.interpreter.value.set(param='ave_pos_z', val=0.0) 4963 self.interpreter.value.set(param='ave_pos_alpha', val=0.0) 4964 self.interpreter.value.set(param='ave_pos_beta', val=0.0) 4965 self.interpreter.value.set(param='ave_pos_gamma', val=0.0) 4966 self.interpreter.value.set(param='axis_theta', val=0.5) 4967 self.interpreter.value.set(param='axis_phi', val=0.1) 4968 self.interpreter.value.set(param='cone_theta', val=0.1) 4969 self.interpreter.value.set(param='cone_sigma_max', val=0.1) 4970 4971 # Set a number of points. 4972 self.interpreter.frame_order.sobol_setup(200)
4973