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