"Fossies" - the Fresh Open Source Software Archive

Member "relax-5.0.0/test_suite/system_tests/frame_order.py" (2 Dec 2019, 240556 Bytes) of package /linux/privat/relax-5.0.0.src.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "frame_order.py": 4.1.3_vs_5.0.0.

    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.compat import linux_distribution
   34 from lib.frame_order.conversions import create_rotor_axis_alpha, create_rotor_axis_spherical
   35 from lib.frame_order.variables import MODEL_DOUBLE_ROTOR, MODEL_FREE_ROTOR, MODEL_ISO_CONE, MODEL_ISO_CONE_FREE_ROTOR, MODEL_ISO_CONE_TORSIONLESS, MODEL_PSEUDO_ELLIPSE, MODEL_PSEUDO_ELLIPSE_TORSIONLESS, MODEL_RIGID, MODEL_ROTOR
   36 from lib.geometry.coord_transform import cartesian_to_spherical
   37 from lib.geometry.rotations import axis_angle_to_R, euler_to_R_zyz, R_to_euler_zyz
   38 from status import Status; status = Status()
   39 from test_suite.system_tests.base_classes import SystemTestCase
   40 
   41 
   42 # Get the platform information.
   43 SYSTEM = platform.system()
   44 RELEASE = platform.release()
   45 VERSION = platform.version()
   46 WIN32_VER = platform.win32_ver()
   47 DIST = linux_distribution()
   48 ARCH = platform.architecture()
   49 MACH = platform.machine()
   50 PROC = platform.processor()
   51 PY_VER = platform.python_version()
   52 NUMPY_VER = numpy.__version__
   53 LIBC_VER = platform.libc_ver()
   54 
   55 # Windows system name pain.
   56 if SYSTEM == 'Windows' or SYSTEM == 'Microsoft':
   57     # Set the system to 'Windows' no matter what.
   58     SYSTEM = 'Windows'
   59 
   60 
   61 # Some vectors.
   62 x_axis = array([1, 0, 0], float64)
   63 y_axis = array([0, 1, 0], float64)
   64 z_axis = array([0, 0, 1], float64)
   65 origin = array([0, 0, 0], float64)
   66 
   67 
   68 class Frame_order(SystemTestCase):
   69     """TestCase class for the functional tests of the frame order theories."""
   70 
   71     def __init__(self, methodName='runTest'):
   72         """Skip the tests if scipy is not installed.
   73 
   74         @keyword methodName:    The name of the test.
   75         @type methodName:       str
   76         """
   77 
   78         # Execute the base class method.
   79         super(Frame_order, self).__init__(methodName)
   80 
   81         # Tests to skip.
   82         blacklist = [
   83             'test_cam_qr_int_free_rotor_pcs',
   84             'test_cam_qr_int_free_rotor_rdc',
   85             'test_cam_qr_int_free_rotor2_pcs',
   86             'test_cam_qr_int_free_rotor2_rdc',
   87             'test_cam_qr_int_iso_cone_pcs',
   88             'test_cam_qr_int_iso_cone_rdc',
   89             'test_cam_qr_int_iso_cone_free_rotor_pcs',
   90             'test_cam_qr_int_iso_cone_free_rotor_rdc',
   91             'test_cam_qr_int_iso_cone_free_rotor2_pcs',
   92             'test_cam_qr_int_iso_cone_free_rotor2_rdc',
   93             'test_cam_qr_int_iso_cone_torsionless_pcs',
   94             'test_cam_qr_int_iso_cone_torsionless_rdc',
   95             'test_cam_qr_int_pseudo_ellipse2_pcs',
   96             'test_cam_qr_int_pseudo_ellipse2_rdc',
   97             'test_cam_qr_int_pseudo_ellipse_free_rotor_pcs',
   98             'test_cam_qr_int_pseudo_ellipse_free_rotor_rdc',
   99             'test_cam_qr_int_pseudo_ellipse_torsionless_pcs',
  100             'test_cam_qr_int_pseudo_ellipse_torsionless_rdc',
  101             'test_cam_qr_int_rigid_pcs',
  102             'test_cam_qr_int_rigid_rdc',
  103             'test_cam_qr_int_rotor_pcs',
  104             'test_cam_qr_int_rotor_rdc',
  105             'test_cam_qr_int_rotor_2_state_pcs',
  106             'test_cam_qr_int_rotor_2_state_rdc',
  107             'test_cam_qr_int_rotor2_pcs',
  108             'test_cam_qr_int_rotor2_rdc',
  109             'test_cam_quad_int_free_rotor_pcs',
  110             'test_cam_quad_int_free_rotor_rdc',
  111             'test_cam_quad_int_free_rotor2_pcs',
  112             'test_cam_quad_int_free_rotor2_rdc',
  113             'test_cam_quad_int_iso_cone_pcs',
  114             'test_cam_quad_int_iso_cone_rdc',
  115             'test_cam_quad_int_iso_cone_free_rotor_pcs',
  116             'test_cam_quad_int_iso_cone_free_rotor_rdc',
  117             'test_cam_quad_int_iso_cone_free_rotor2_pcs',
  118             'test_cam_quad_int_iso_cone_free_rotor2_rdc',
  119             'test_cam_quad_int_iso_cone_torsionless_pcs',
  120             'test_cam_quad_int_iso_cone_torsionless_rdc',
  121             'test_cam_quad_int_pseudo_ellipse2_pcs',
  122             'test_cam_quad_int_pseudo_ellipse2_rdc',
  123             'test_cam_quad_int_pseudo_ellipse_free_rotor_pcs',
  124             'test_cam_quad_int_pseudo_ellipse_free_rotor_rdc',
  125             'test_cam_quad_int_pseudo_ellipse_torsionless_pcs',
  126             'test_cam_quad_int_pseudo_ellipse_torsionless_rdc',
  127             'test_cam_quad_int_rigid_pcs',
  128             'test_cam_quad_int_rigid_rdc',
  129             'test_cam_quad_int_rotor_pcs',
  130             'test_cam_quad_int_rotor_rdc',
  131             'test_cam_quad_int_rotor_2_state_pcs',
  132             'test_cam_quad_int_rotor_2_state_rdc',
  133             'test_cam_quad_int_rotor2_pcs',
  134             'test_cam_quad_int_rotor2_rdc'
  135         ]
  136 
  137         # Skip the blacklisted tests.
  138         if methodName in blacklist:
  139             status.skipped_tests.append([methodName, None, self._skip_type])
  140 
  141         # Missing module.
  142         if not dep_check.scipy_module:
  143             # Store in the status object. 
  144             status.skipped_tests.append([methodName, 'Scipy', self._skip_type])
  145 
  146 
  147     def setUp(self):
  148         """Set up for all the functional tests."""
  149 
  150         # The path to the CaM scripts.
  151         self.cam_path = status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'cam'+sep
  152 
  153         # Create a temporary directory for dumping files.
  154         ds.tmpdir = mkdtemp()
  155 
  156 
  157     def tearDown(self):
  158         """Clean up after the tests."""
  159 
  160         # Call the base class tearDown() method to remove the temporary directory.
  161         super(Frame_order, self).tearDown()
  162 
  163         # Remove flags from the status object.
  164         if hasattr(status, 'flag_rdc'):
  165             del status.flag_rdc
  166         if hasattr(status, 'flag_pcs'):
  167             del status.flag_pcs
  168 
  169 
  170     def check_chi2(self, chi2=0.0, places=4):
  171         """Check the function evaluation."""
  172 
  173         # Switch back to the original pipe.
  174         self.interpreter.pipe.switch('frame order')
  175 
  176         # Test the operation of the statistics.model user function.
  177         self.interpreter.statistics.model()
  178 
  179         # Get the debugging message.
  180         mesg = self.mesg_opt_debug()
  181 
  182         # Check the chi2 value.
  183         self.assertAlmostEqual(cdp.chi2, chi2, places, msg=mesg)
  184 
  185 
  186     def check_pdb_model_representation(self, data=None, files=None):
  187         """Check the PDB model representation atom and residue names and numbers and coordinates.
  188 
  189         Propeller blade atoms with the name 'BLD' are skipped, as well as the cone interior residues with the name 'CON'.
  190 
  191 
  192         @keyword data:  The list of data to check.  The first dimension is for the representation, and the second for each atom.  The lists of each atom consist of the residue number, residue name, atom number, atom name, and the 3D position.
  193         @type data:     list of list of lists
  194         @keyword files: The list of files for each representation.
  195         @type files:    list of str
  196         """
  197 
  198         # Loop over the representations.
  199         for i in range(len(data)):
  200             # Delete all structural data.
  201             self.interpreter.structure.delete()
  202 
  203             # Read the contents of the file.
  204             self.interpreter.structure.read_pdb(file=files[i], dir=ds.tmpdir)
  205 
  206             # Check the atomic coordinates.
  207             selection = cdp.structure.selection()
  208             index = 0
  209             for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
  210                 # Skip the propeller blades.
  211                 if atom_name == 'BLD':
  212                     continue
  213 
  214                 # Skip the cone interior (checking the edge will be sufficient).
  215                 if res_name == 'CON':
  216                     continue
  217 
  218                 # Checks.
  219                 print("Checking residue %s %s, atom %s %s, at position %s." % (data[i][index][0], data[i][index][1], data[i][index][2], data[i][index][3], data[i][index][4]))
  220                 print("      to residue %s %s, atom %s %s, at position %s." % (res_num, res_name, atom_num, atom_name, pos[0]))
  221                 self.assertEqual(data[i][index][0], res_num)
  222                 self.assertEqual(data[i][index][1], res_name)
  223                 self.assertEqual(data[i][index][2], atom_num)
  224                 self.assertEqual(data[i][index][3], atom_name)
  225                 self.assertAlmostEqual(data[i][index][4][0], pos[0][0], 3)
  226                 self.assertAlmostEqual(data[i][index][4][1], pos[0][1], 3)
  227                 self.assertAlmostEqual(data[i][index][4][2], pos[0][2], 3)
  228 
  229                 # Increment the index.
  230                 index += 1
  231 
  232 
  233     def flags(self, rdc=True, pcs=True, opt=False, quad_int=False):
  234         """Set a number of flags for the scripts."""
  235 
  236         # Store the flags.
  237         status.flag_rdc = rdc
  238         status.flag_pcs = pcs
  239         status.flag_opt = opt
  240         status.flag_quad_int = quad_int
  241 
  242 
  243     def mesg_opt_debug(self):
  244         """Method for returning a string to help debug the minimisation.
  245 
  246         @return:        The debugging string.
  247         @rtype:         str
  248         """
  249 
  250         # Initialise the string.
  251         string = 'Optimisation failure.\n\n'
  252 
  253         # Create the string.
  254         string = string + "%-18s%-25s\n" % ("System: ", SYSTEM)
  255         string = string + "%-18s%-25s\n" % ("Release: ", RELEASE)
  256         string = string + "%-18s%-25s\n" % ("Version: ", VERSION)
  257         string = string + "%-18s%-25s\n" % ("Win32 version: ", (WIN32_VER[0] + " " + WIN32_VER[1] + " " + WIN32_VER[2] + " " + WIN32_VER[3]))
  258         string = string + "%-18s%-25s\n" % ("Distribution: ", (DIST[0] + " " + DIST[1] + " " + DIST[2]))
  259         string = string + "%-18s%-25s\n" % ("Architecture: ", (ARCH[0] + " " + ARCH[1]))
  260         string = string + "%-18s%-25s\n" % ("Machine: ", MACH)
  261         string = string + "%-18s%-25s\n" % ("Processor: ", PROC)
  262         string = string + "%-18s%-25s\n" % ("Python version: ", PY_VER)
  263         string = string + "%-18s%-25s\n" % ("Numpy version: ", NUMPY_VER)
  264         string = string + "%-18s%-25s\n" % ("Libc version: ", (LIBC_VER[0] + " " + LIBC_VER[1]))
  265 
  266 
  267         # Minimisation info.
  268         string = string + "\n"
  269         for param in ['ave_pos_x', 'ave_pos_y', 'ave_pos_z', 'ave_pos_alpha', 'ave_pos_beta', 'ave_pos_gamma', 'eigen_alpha', 'eigen_beta', 'eigen_gamma', 'axis_theta', 'axis_phi', 'cone_theta_x', 'cone_theta_y', 'cone_theta', 'cone_sigma_max', 'cone_sigma_max_2']:
  270             if hasattr(cdp, param):
  271                 obj = getattr(cdp, param)
  272                 string = string + "%-15s %30.17g\n" % (param, obj)
  273 
  274         string = string +   "%-15s %30.17g\n" % ('chi2:', cdp.chi2)
  275         if hasattr(cdp, 'sobol_max_points'):
  276             string = string +   "%-15s %30i\n" % ('sobol_max_points:', cdp.sobol_max_points)
  277         if hasattr(cdp, 'iter') and cdp.iter != None:
  278             string = string +   "%-15s %30i\n" % ('iter:', cdp.iter)
  279         if hasattr(cdp, 'f_count') and cdp.f_count != None:
  280             string = string +   "%-15s %30i\n" % ('f_count:', cdp.f_count)
  281         if hasattr(cdp, 'g_count') and cdp.g_count != None:
  282             string = string +   "%-15s %30i\n" % ('g_count:', cdp.g_count)
  283         if hasattr(cdp, 'h_count') and cdp.h_count != None:
  284             string = string +   "%-15s %30i\n" % ('h_count:', cdp.h_count)
  285         if hasattr(cdp, 'warning'):
  286             string = string +   "%-15s %30s\n" % ('warning:', cdp.warning)
  287 
  288         # Return the string.
  289         return string
  290 
  291 
  292     def rotate_from_Z(self, origin=origin, length=0.0, angle=0.0, axis=x_axis, R=None, neg=False):
  293         """Rotate a vector along Z-axis around the origin.
  294 
  295         @keyword origin:    The origin of the final vector.
  296         @type origin:       numpy 3D, rank-1 array
  297         @keyword length:    The length of the Z-vector to rotate.
  298         @type length:       float
  299         @keyword angle:     The angle in rad to rotate by.
  300         @type angle:        float
  301         @keyword axis:      The direction in the xy-plane to rotate the vector along.
  302         @type axis:         numpy 3D, rank-1 array
  303         @keyword R:         A rotation matrix to be used before adding the origin.
  304         @type R:            numpy 3D, rank-2 array
  305         @keyword neg:       A flag which if True causes the negative Z-axis to be used.
  306         @type neg:          bool
  307         @return:            The final rotated vector shifted by the origin.
  308         @rtype:             numpy 3D, rank-1 array
  309         """
  310 
  311         # The final point.
  312         point = zeros(3, float64)
  313 
  314         # Z-axis reduction.
  315         point[2] = cos(angle)
  316 
  317         # The X and Y-axis increases.
  318         point[0] = axis[0]*sin(angle)
  319         point[1] = axis[1]*sin(angle)
  320 
  321         # Inversion.
  322         if neg:
  323             for i in range(3):
  324                 point[i] = -point[i]
  325 
  326         # Rotation.
  327         if R is not None:
  328             point = dot(R, point)
  329 
  330         # Extend the length and add the origin.
  331         for i in range(3):
  332             point[i] = point[i]*length + origin[i]
  333 
  334         # Return the point.
  335         return point
  336 
  337 
  338     def setup_model(self, pipe_name='model', model=None, pivot=None, ave_pos_x=None, ave_pos_y=None, ave_pos_z=None, ave_pos_alpha=None, ave_pos_beta=None, ave_pos_gamma=None, pivot_disp=None, axis_alpha=None, axis_theta=None, axis_phi=None, eigen_alpha=None, eigen_beta=None, eigen_gamma=None, cone_theta=None, cone_theta_x=None, cone_theta_y=None, cone_sigma_max=None, cone_sigma_max_2=None):
  339         """Set up for the given frame order model.
  340 
  341         This will execute the following user functions:
  342 
  343             - pipe.create to set up a data pipe for the model.
  344             - frame_order.select_model.
  345             - value.set for all given parameters.
  346             - frame_order.pivot to define the pivot point.
  347 
  348 
  349         @keyword pipe_name:         The name of the new data pipe.
  350         @type pipe_name:            str
  351         @keyword model:             The frame order model to setup.
  352         @type model:                str
  353         @keyword pivot:             The pivot to setup.
  354         @type pivot:                list of float
  355         @keyword ave_pos_x:         The average domain position X coordinate.
  356         @type ave_pos_x:            None or float
  357         @keyword ave_pos_y:         The average domain position Y coordinate.
  358         @type ave_pos_y:            None or float
  359         @keyword ave_pos_z:         The average domain position Z coordinate.
  360         @type ave_pos_z:            None or float
  361         @keyword ave_pos_alpha:     The average domain position alpha Euler rotation angle.
  362         @type ave_pos_alpha:        None or float
  363         @keyword ave_pos_beta:      The average domain position beta Euler rotation angle.
  364         @type ave_pos_beta:         None or float
  365         @keyword ave_pos_gamma:     The average domain position gamma Euler rotation angle.
  366         @type ave_pos_gamma:        None or float
  367         @keyword pivot_disp:        The pivot displacement parameter.
  368         @type pivot_disp:           None or float
  369         @keyword axis_alpha:        The motional eigenframe axis alpha angle.
  370         @type axis_alpha:           None or float
  371         @keyword axis_theta:        The motional eigenframe axis theta spherical angle.
  372         @type axis_theta:           None or float
  373         @keyword axis_phi:          The motional eigenframe axis phi spherical angle.
  374         @type axis_phi:             None or float
  375         @keyword eigen_alpha:       The motional eigenframe alpha Euler rotation angle.
  376         @type eigen_alpha:          None or float
  377         @keyword eigen_beta:        The motional eigenframe beta Euler rotation angle.
  378         @type eigen_beta:           None or float
  379         @keyword eigen_gamma:       The motional eigenframe gamma Euler rotation angle.
  380         @type eigen_gamma:          None or float
  381         @keyword cone_theta:        The isotropic cone opening half angle.
  382         @type cone_theta:           None or float
  383         @keyword cone_theta_x:      The x-axis half cone angle.
  384         @type cone_theta_x:         None or float
  385         @keyword cone_theta_y:      The y-axis half cone angle.
  386         @type cone_theta_y:         None or float
  387         @keyword cone_sigma_max:    The maximum torsion angle.
  388         @type cone_sigma_max:       None or float
  389         @keyword cone_sigma_max_2:  The second maximum torsion angle.
  390         @type cone_sigma_max_2:     None or float
  391         """
  392 
  393         # Create a data pipe.
  394         self.interpreter.pipe.create(pipe_name='PDB model', pipe_type='frame order')
  395 
  396         # Create a 8 atom structure with the CoM at [0, 0, 0].
  397         atom_pos = 100.0 * eye(3)
  398         self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='X', res_num=1, pos=atom_pos[0], element='N')
  399         self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='Y', res_num=2, pos=atom_pos[1], element='N')
  400         self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='Z', res_num=3, pos=atom_pos[2], element='N')
  401         self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='nX', res_num=4, pos=-atom_pos[0], element='N')
  402         self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='nY', res_num=5, pos=-atom_pos[1], element='N')
  403         self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='nZ', res_num=6, pos=-atom_pos[2], element='N')
  404         self.interpreter.structure.add_atom(mol_name='axes', atom_name='N', res_name='C', res_num=7, pos=[0.0, 0.0, 0.0], element='N')
  405         self.interpreter.structure.add_atom(mol_name='axes', atom_name='Ti', res_name='O', res_num=8, pos=[0.0, 0.0, 0.0], element='Ti')
  406 
  407         # Set up the domains.
  408         self.interpreter.domain(id='moving', spin_id=':1-7')
  409         self.interpreter.domain(id='origin', spin_id=':8')
  410         self.interpreter.frame_order.ref_domain('origin')
  411 
  412         # Select the model.
  413         self.interpreter.frame_order.select_model(model)
  414 
  415         # Set the average domain position translation parameters.
  416         if ave_pos_x != None:
  417             self.interpreter.value.set(param='ave_pos_x', val=ave_pos_x)
  418         if ave_pos_y != None:
  419             self.interpreter.value.set(param='ave_pos_y', val=ave_pos_y)
  420         if ave_pos_z != None:
  421             self.interpreter.value.set(param='ave_pos_z', val=ave_pos_z)
  422         if ave_pos_alpha != None:
  423             self.interpreter.value.set(param='ave_pos_alpha', val=ave_pos_alpha)
  424         if ave_pos_beta != None:
  425             self.interpreter.value.set(param='ave_pos_beta', val=ave_pos_beta)
  426         if ave_pos_gamma != None:
  427             self.interpreter.value.set(param='ave_pos_gamma', val=ave_pos_gamma)
  428         if pivot_disp != None:
  429             self.interpreter.value.set(param='pivot_disp', val=pivot_disp)
  430         if axis_alpha != None:
  431             self.interpreter.value.set(param='axis_alpha', val=axis_alpha)
  432         if axis_theta != None:
  433             self.interpreter.value.set(param='axis_theta', val=axis_theta)
  434         if axis_phi != None:
  435             self.interpreter.value.set(param='axis_phi', val=axis_phi)
  436         if eigen_alpha != None:
  437             self.interpreter.value.set(param='eigen_alpha', val=eigen_alpha)
  438         if eigen_beta != None:
  439             self.interpreter.value.set(param='eigen_beta', val=eigen_beta)
  440         if eigen_gamma != None:
  441             self.interpreter.value.set(param='eigen_gamma', val=eigen_gamma)
  442         if cone_theta != None:
  443             self.interpreter.value.set(param='cone_theta', val=cone_theta)
  444         if cone_theta_x != None:
  445             self.interpreter.value.set(param='cone_theta_x', val=cone_theta_x)
  446         if cone_theta_y != None:
  447             self.interpreter.value.set(param='cone_theta_y', val=cone_theta_y)
  448         if cone_sigma_max != None:
  449             self.interpreter.value.set(param='cone_sigma_max', val=cone_sigma_max)
  450         if cone_sigma_max_2 != None:
  451             self.interpreter.value.set(param='cone_sigma_max_2', val=cone_sigma_max_2)
  452 
  453         # Set the pivot.
  454         self.interpreter.frame_order.pivot(pivot=pivot, fix=True)
  455 
  456 
  457     def space_probe(self, ref_chi2=None, params=None, delta=3.0 / 360.0 * 2.0 * pi):
  458         """Probe the space around the supposed minimum."""
  459 
  460         # No function intros.
  461         self.interpreter.intro_off()
  462 
  463         # Check the minimum.
  464         self.interpreter.minimise.calculate()
  465         print("%-20s %10.5f" % ("chi2 minimum", cdp.chi2))
  466         self.assertAlmostEqual(cdp.chi2, ref_chi2)
  467 
  468         # Test around the minimum using small deviations.
  469         for param in params:
  470             print("\n\nParam: %s" % param)
  471             print("%-20s %10.5f" % ("chi2 orig", ref_chi2))
  472 
  473             # Get the current value.
  474             curr = getattr(cdp, param)
  475 
  476             # Deviate upwards.
  477             setattr(cdp, param, curr+delta)
  478             self.interpreter.minimise.calculate()
  479             print("%-20s %10.5f" % ("chi2 up", cdp.chi2))
  480             self.assert_(cdp.chi2 > ref_chi2)
  481 
  482             # Deviate downwards.
  483             setattr(cdp, param, curr-delta)
  484             self.interpreter.minimise.calculate()
  485             print("%-20s %10.5f" % ("chi2 down", cdp.chi2))
  486             self.assert_(cdp.chi2 > ref_chi2)
  487 
  488             # Reset.
  489             setattr(cdp, param, curr)
  490 
  491 
  492     def test_auto_analysis(self):
  493         """Test the frame order auto-analysis using the rigid CaM test data."""
  494 
  495         # Execute the script.
  496         self.interpreter.run(script_file=self.cam_path+'auto_analysis_to_rigid.py')
  497 
  498 
  499     def test_axis_perm_x_le_y_le_z_permA(self):
  500         """Test the operation of the frame_order.permute_axes user function for permutation 'A' when x <= y <= z."""
  501 
  502         # Reset.
  503         self.interpreter.reset()
  504 
  505         # Load the state file.
  506         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
  507         self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
  508 
  509         # Change the original parameters.
  510         cdp.cone_theta_x = orig_cone_theta_x = 1.0
  511         cdp.cone_theta_y = orig_cone_theta_y = 2.0
  512         cdp.cone_sigma_max = orig_cone_sigma_max = 3.0
  513 
  514         # Store the original parameters.
  515         orig_eigen_alpha = cdp.eigen_alpha
  516         orig_eigen_beta = cdp.eigen_beta
  517         orig_eigen_gamma = cdp.eigen_gamma
  518 
  519         # Permute the axes.
  520         self.interpreter.frame_order.permute_axes('A')
  521 
  522         # Checks of the cone opening angle permutations.
  523         self.assertEqual(cdp.cone_theta_x, 1.0)
  524         self.assertEqual(cdp.cone_theta_y, 3.0)
  525         self.assertEqual(cdp.cone_sigma_max, 2.0)
  526 
  527         # The optimised Eigenframe.
  528         frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
  529                        [ 0.62357991685585, -0.505348769456744,  0.596465177946379],
  530                        [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
  531 
  532         # Manually permute the frame, and then obtain the Euler angles.
  533         frame_new = transpose(array([-frame[:, 2], frame[:, 1], frame[:, 0]], float64))
  534         alpha, beta, gamma = R_to_euler_zyz(frame_new)
  535 
  536         # Check the Eigenframe Euler angles.
  537         self.assertAlmostEqual(cdp.eigen_alpha, alpha)
  538         self.assertAlmostEqual(cdp.eigen_beta, beta)
  539         self.assertAlmostEqual(cdp.eigen_gamma, gamma)
  540 
  541 
  542     def test_axis_perm_x_le_y_le_z_permB(self):
  543         """Test the operation of the frame_order.permute_axes user function for permutation 'B' when x <= y <= z."""
  544 
  545         # Reset.
  546         self.interpreter.reset()
  547 
  548         # Load the state file.
  549         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
  550         self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
  551 
  552         # Change the original parameters.
  553         cdp.cone_theta_x = orig_cone_theta_x = 1.0
  554         cdp.cone_theta_y = orig_cone_theta_y = 2.0
  555         cdp.cone_sigma_max = orig_cone_sigma_max = 3.0
  556 
  557         # Store the original parameters.
  558         orig_eigen_alpha = cdp.eigen_alpha
  559         orig_eigen_beta = cdp.eigen_beta
  560         orig_eigen_gamma = cdp.eigen_gamma
  561 
  562         # Permute the axes.
  563         self.interpreter.frame_order.permute_axes('B')
  564 
  565         # Checks of the cone opening angle permutations.
  566         self.assertEqual(cdp.cone_theta_x, 2.0)
  567         self.assertEqual(cdp.cone_theta_y, 3.0)
  568         self.assertEqual(cdp.cone_sigma_max, 1.0)
  569 
  570         # The optimised Eigenframe.
  571         frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
  572                        [ 0.62357991685585, -0.505348769456744,  0.596465177946379],
  573                        [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
  574 
  575         # Manually permute the frame, and then obtain the Euler angles.
  576         frame_new = transpose(array([frame[:, 2], frame[:, 0], frame[:, 1]], float64))
  577         alpha, beta, gamma = R_to_euler_zyz(frame_new)
  578 
  579         # Check the Eigenframe Euler angles.
  580         self.assertAlmostEqual(cdp.eigen_alpha, alpha)
  581         self.assertAlmostEqual(cdp.eigen_beta, beta)
  582         self.assertAlmostEqual(cdp.eigen_gamma, gamma)
  583 
  584 
  585     def test_axis_perm_x_le_z_le_y_permA(self):
  586         """Test the operation of the frame_order.permute_axes user function for permutation 'A' when x <= z <= y."""
  587 
  588         # Reset.
  589         self.interpreter.reset()
  590 
  591         # Load the state file.
  592         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
  593         self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
  594 
  595         # Change the original parameters.
  596         cdp.cone_theta_x = orig_cone_theta_x = 1.0
  597         cdp.cone_theta_y = orig_cone_theta_y = 3.0
  598         cdp.cone_sigma_max = orig_cone_sigma_max = 2.0
  599 
  600         # Store the original parameters.
  601         orig_eigen_alpha = cdp.eigen_alpha
  602         orig_eigen_beta = cdp.eigen_beta
  603         orig_eigen_gamma = cdp.eigen_gamma
  604 
  605         # Permute the axes.
  606         self.interpreter.frame_order.permute_axes('A')
  607 
  608         # Checks of the cone opening angle permutations.
  609         self.assertEqual(cdp.cone_theta_x, 1.0)
  610         self.assertEqual(cdp.cone_theta_y, 2.0)
  611         self.assertEqual(cdp.cone_sigma_max, 3.0)
  612 
  613         # The optimised Eigenframe.
  614         frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
  615                        [ 0.62357991685585, -0.505348769456744,  0.596465177946379],
  616                        [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
  617 
  618         # Manually permute the frame, and then obtain the Euler angles.
  619         frame_new = transpose(array([-frame[:, 2], frame[:, 1], frame[:, 0]], float64))
  620         alpha, beta, gamma = R_to_euler_zyz(frame_new)
  621 
  622         # Check the Eigenframe Euler angles.
  623         self.assertAlmostEqual(cdp.eigen_alpha, alpha)
  624         self.assertAlmostEqual(cdp.eigen_beta, beta)
  625         self.assertAlmostEqual(cdp.eigen_gamma, gamma)
  626 
  627 
  628     def test_axis_perm_x_le_z_le_y_permB(self):
  629         """Test the operation of the frame_order.permute_axes user function for permutation 'B' when x <= z <= y."""
  630 
  631         # Reset.
  632         self.interpreter.reset()
  633 
  634         # Load the state file.
  635         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
  636         self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
  637 
  638         # Change the original parameters.
  639         cdp.cone_theta_x = orig_cone_theta_x = 1.0
  640         cdp.cone_theta_y = orig_cone_theta_y = 3.0
  641         cdp.cone_sigma_max = orig_cone_sigma_max = 2.0
  642 
  643         # Store the original parameters.
  644         orig_eigen_alpha = cdp.eigen_alpha
  645         orig_eigen_beta = cdp.eigen_beta
  646         orig_eigen_gamma = cdp.eigen_gamma
  647 
  648         # Permute the axes.
  649         self.interpreter.frame_order.permute_axes('B')
  650 
  651         # Checks of the cone opening angle permutations.
  652         self.assertEqual(cdp.cone_theta_x, 2.0)
  653         self.assertEqual(cdp.cone_theta_y, 3.0)
  654         self.assertEqual(cdp.cone_sigma_max, 1.0)
  655 
  656         # The optimised Eigenframe.
  657         frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
  658                        [ 0.62357991685585, -0.505348769456744,  0.596465177946379],
  659                        [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
  660 
  661         # Manually permute the frame, and then obtain the Euler angles.
  662         frame_new = transpose(array([frame[:, 0], -frame[:, 2], frame[:, 1]], float64))
  663         alpha, beta, gamma = R_to_euler_zyz(frame_new)
  664 
  665         # Check the Eigenframe Euler angles.
  666         self.assertAlmostEqual(cdp.eigen_alpha, alpha)
  667         self.assertAlmostEqual(cdp.eigen_beta, beta)
  668         self.assertAlmostEqual(cdp.eigen_gamma, gamma)
  669 
  670 
  671     def test_axis_perm_z_le_x_le_y_permA(self):
  672         """Test the operation of the frame_order.permute_axes user function for permutation 'A' when z <= x <= y."""
  673 
  674         # Reset.
  675         self.interpreter.reset()
  676 
  677         # Load the state file.
  678         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
  679         self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
  680 
  681         # Store the original parameters.
  682         orig_cone_theta_x = cdp.cone_theta_x
  683         orig_cone_theta_y = cdp.cone_theta_y
  684         orig_cone_sigma_max = cdp.cone_sigma_max
  685         orig_eigen_alpha = cdp.eigen_alpha
  686         orig_eigen_beta = cdp.eigen_beta
  687         orig_eigen_gamma = cdp.eigen_gamma
  688 
  689         # Permute the axes.
  690         self.interpreter.frame_order.permute_axes('A')
  691 
  692         # Checks of the cone opening angle permutations.
  693         self.assertEqual(cdp.cone_theta_x, 0.53277077276728502)
  694         self.assertEqual(cdp.cone_theta_y, 0.8097621930390525)
  695         self.assertEqual(cdp.cone_sigma_max, 1.2119285953475074)
  696 
  697         # The optimised Eigenframe.
  698         frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
  699                        [ 0.62357991685585, -0.505348769456744,  0.596465177946379],
  700                        [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
  701 
  702         # Manually permute the frame, and then obtain the Euler angles.
  703         frame_new = transpose(array([frame[:, 1], frame[:, 2], frame[:, 0]], float64))
  704         alpha, beta, gamma = R_to_euler_zyz(frame_new)
  705 
  706         # Check the Eigenframe Euler angles.
  707         self.assertAlmostEqual(cdp.eigen_alpha, alpha)
  708         self.assertAlmostEqual(cdp.eigen_beta, beta)
  709         self.assertAlmostEqual(cdp.eigen_gamma, gamma)
  710 
  711 
  712     def test_axis_perm_z_le_x_le_y_permB(self):
  713         """Test the operation of the frame_order.permute_axes user function for permutation 'B' when z <= x <= y."""
  714 
  715         # Reset.
  716         self.interpreter.reset()
  717 
  718         # Load the state file.
  719         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
  720         self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
  721 
  722         # Store the original parameters.
  723         orig_cone_theta_x = cdp.cone_theta_x
  724         orig_cone_theta_y = cdp.cone_theta_y
  725         orig_cone_sigma_max = cdp.cone_sigma_max
  726         orig_eigen_alpha = cdp.eigen_alpha
  727         orig_eigen_beta = cdp.eigen_beta
  728         orig_eigen_gamma = cdp.eigen_gamma
  729 
  730         # Permute the axes.
  731         self.interpreter.frame_order.permute_axes('B')
  732 
  733         # Checks of the cone opening angle permutations.
  734         self.assertEqual(cdp.cone_theta_x, 0.53277077276728502)
  735         self.assertEqual(cdp.cone_theta_y, 1.2119285953475074)
  736         self.assertEqual(cdp.cone_sigma_max, 0.8097621930390525)
  737 
  738         # The optimised Eigenframe.
  739         frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676],
  740                        [ 0.62357991685585, -0.505348769456744,  0.596465177946379],
  741                        [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64)
  742 
  743         # Manually permute the frame, and then obtain the Euler angles.
  744         frame_new = transpose(array([frame[:, 0], -frame[:, 2], frame[:, 1]], float64))
  745         alpha, beta, gamma = R_to_euler_zyz(frame_new)
  746 
  747         # Check the Eigenframe Euler angles.
  748         self.assertAlmostEqual(cdp.eigen_alpha, alpha)
  749         self.assertAlmostEqual(cdp.eigen_beta, beta)
  750         self.assertAlmostEqual(cdp.eigen_gamma, gamma)
  751 
  752 
  753     def test_cam_qr_int_double_rotor(self):
  754         """Test the double rotor frame order model of CaM."""
  755 
  756         # The flags, execute the script, and then check the chi2 value.
  757         self.flags()
  758         self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
  759         self.check_chi2(0.080146041009531946)
  760 
  761 
  762     def test_cam_qr_int_double_rotor_pcs(self):
  763         """Test the double rotor frame order model of CaM (with only PCS data)."""
  764 
  765         # The flags, execute the script, and then check the chi2 value.
  766         self.flags(rdc=False)
  767         self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
  768         self.check_chi2(0.00033425735965255754)
  769 
  770 
  771     def test_cam_qr_int_double_rotor_rdc(self):
  772         """Test the double rotor frame order model of CaM (with only RDC data)."""
  773 
  774         # The flags, execute the script, and then check the chi2 value.
  775         self.flags(pcs=False)
  776         self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
  777         self.check_chi2(0.079814053829495801)
  778 
  779 
  780     def test_cam_qr_int_double_rotor_large_angle(self):
  781         """Test the double rotor frame order model of CaM."""
  782 
  783         # The flags, execute the script, and then check the chi2 value.
  784         self.flags()
  785         self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
  786         self.check_chi2(0.046993590502437441)
  787 
  788 
  789     def test_cam_qr_int_double_rotor_large_angle_pcs(self):
  790         """Test the double rotor frame order model of CaM (with only PCS data)."""
  791 
  792         # The flags, execute the script, and then check the chi2 value.
  793         self.flags(rdc=False)
  794         self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
  795         self.check_chi2(0.0030482390409642141)
  796 
  797 
  798     def test_cam_qr_int_double_rotor_large_angle_rdc(self):
  799         """Test the double rotor frame order model of CaM (with only RDC data)."""
  800 
  801         # The flags, execute the script, and then check the chi2 value.
  802         self.flags(pcs=False)
  803         self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
  804         self.check_chi2(0.043946055085127944)
  805 
  806 
  807     def test_cam_qr_int_free_rotor(self):
  808         """Test the free rotor frame order model of CaM."""
  809 
  810         # The flags, execute the script, and then check the chi2 value.
  811         self.flags(opt=True)
  812         self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
  813         self.check_chi2(0.049488502147038226)
  814 
  815 
  816     def test_cam_qr_int_free_rotor_missing_data(self):
  817         """Test the free rotor frame order model of CaM."""
  818 
  819         # The flags, execute the script, and then check the chi2 value.
  820         self.flags()
  821         self.interpreter.run(script_file=self.cam_path+'free_rotor_missing_data.py')
  822         self.check_chi2(0.038106832800436169)
  823 
  824 
  825     def test_cam_qr_int_free_rotor_pcs(self):
  826         """Test the free rotor frame order model of CaM (with only PCS data)."""
  827 
  828         # The flags, execute the script, and then check the chi2 value.
  829         self.flags(rdc=False)
  830         self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
  831         self.check_chi2(0.00049268587082683434)
  832 
  833 
  834     def test_cam_qr_int_free_rotor_rdc(self):
  835         """Test the free rotor frame order model of CaM (with only RDC data)."""
  836 
  837         # The flags, execute the script, and then check the chi2 value.
  838         self.flags(pcs=False)
  839         self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
  840         self.check_chi2(0.04899130610303442)
  841 
  842 
  843     def test_cam_qr_int_free_rotor2(self):
  844         """Test the second free rotor frame order model of CaM."""
  845 
  846         # The flags, execute the script, and then check the chi2 value.
  847         self.flags()
  848         self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
  849         self.check_chi2(0.069952611688108693)
  850 
  851 
  852     def test_cam_qr_int_free_rotor2_pcs(self):
  853         """Test the second free rotor frame order model of CaM (with only PCS data)."""
  854 
  855         # The flags, execute the script, and then check the chi2 value.
  856         self.flags(rdc=False)
  857         self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
  858         self.check_chi2(0.013207545726879745)
  859 
  860 
  861     def test_cam_qr_int_free_rotor2_rdc(self):
  862         """Test the second free rotor frame order model of CaM (with only RDC data)."""
  863 
  864         # The flags, execute the script, and then check the chi2 value.
  865         self.flags(pcs=False)
  866         self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
  867         self.check_chi2(0.056744492444430819)
  868 
  869 
  870     def test_cam_qr_int_iso_cone(self):
  871         """Test the isotropic cone, free rotor frame order model of CaM."""
  872 
  873         # The flags, execute the script, and then check the chi2 value.
  874         self.flags(opt=True)
  875         self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
  876         self.check_chi2(0.046263256206108584)
  877 
  878 
  879     def test_cam_qr_int_iso_cone_pcs(self):
  880         """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
  881 
  882         # The flags, execute the script, and then check the chi2 value.
  883         self.flags(rdc=False)
  884         self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
  885         self.check_chi2(0.010223404689484922)
  886 
  887 
  888     def test_cam_qr_int_iso_cone_rdc(self):
  889         """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
  890 
  891         # The flags, execute the script, and then check the chi2 value.
  892         self.flags(pcs=False)
  893         self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
  894         self.check_chi2(0.041428474106863025)
  895 
  896 
  897     def test_cam_qr_int_iso_cone_free_rotor(self):
  898         """Test the isotropic cone, free rotor frame order model of CaM."""
  899 
  900         # The flags, execute the script, and then check the chi2 value.
  901         self.flags()
  902         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
  903         self.check_chi2(0.013068834561396353)
  904 
  905 
  906     def test_cam_qr_int_iso_cone_free_rotor_pcs(self):
  907         """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
  908 
  909         # The flags, execute the script, and then check the chi2 value.
  910         self.flags(rdc=False)
  911         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
  912         self.check_chi2(0.0020824314952301057)
  913 
  914 
  915     def test_cam_qr_int_iso_cone_free_rotor_rdc(self):
  916         """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
  917 
  918         # The flags, execute the script, and then check the chi2 value.
  919         self.flags(pcs=False)
  920         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
  921         self.check_chi2(0.010986403066166248)
  922 
  923 
  924     def test_cam_qr_int_iso_cone_free_rotor2(self):
  925         """Test the second isotropic cone, free rotor frame order model of CaM."""
  926 
  927         # The flags, execute the script, and then check the chi2 value.
  928         self.flags()
  929         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
  930         self.check_chi2(0.13135988423081582)
  931 
  932 
  933     def test_cam_qr_int_iso_cone_free_rotor2_pcs(self):
  934         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
  935 
  936         # The flags, execute the script, and then check the chi2 value.
  937         self.flags(rdc=False)
  938         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
  939         self.check_chi2(0.12580093734874642)
  940 
  941 
  942     def test_cam_qr_int_iso_cone_free_rotor2_rdc(self):
  943         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
  944 
  945         # The flags, execute the script, and then check the chi2 value.
  946         self.flags(pcs=False)
  947         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
  948         self.check_chi2(0.0055589468820694179)
  949 
  950 
  951     def test_cam_qr_int_iso_cone_torsionless(self):
  952         """Test the second isotropic cone, free rotor frame order model of CaM."""
  953 
  954         # The flags, execute the script, and then check the chi2 value.
  955         self.flags()
  956         self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
  957         self.check_chi2(0.058320273132310863)
  958 
  959 
  960     def test_cam_qr_int_iso_cone_torsionless_pcs(self):
  961         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
  962 
  963         # The flags, execute the script, and then check the chi2 value.
  964         self.flags(rdc=False)
  965         self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
  966         self.check_chi2(0.0095766977930929302)
  967 
  968 
  969     def test_cam_qr_int_iso_cone_torsionless_rdc(self):
  970         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
  971 
  972         # The flags, execute the script, and then check the chi2 value.
  973         self.flags(pcs=False)
  974         self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
  975         self.check_chi2(0.048749202219945678)
  976 
  977 
  978     def test_cam_qr_int_pseudo_ellipse(self):
  979         """Test the second isotropic cone, free rotor frame order model of CaM."""
  980 
  981         # The flags, execute the script, and then check the chi2 value.
  982         self.flags(opt=True)
  983         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
  984         self.check_chi2(0.052923535071890106)
  985 
  986 
  987     def test_cam_qr_int_pseudo_ellipse_pcs(self):
  988         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
  989 
  990         # The flags, execute the script, and then check the chi2 value.
  991         self.flags(rdc=False)
  992         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
  993         self.check_chi2(0.025487205467282097)
  994 
  995 
  996     def test_cam_qr_int_pseudo_ellipse_rdc(self):
  997         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
  998 
  999         # The flags, execute the script, and then check the chi2 value.
 1000         self.flags(pcs=False)
 1001         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
 1002         self.check_chi2(0.03300256897164619)
 1003 
 1004 
 1005     def test_cam_qr_int_pseudo_ellipse2(self):
 1006         """Test the second isotropic cone, free rotor frame order model of CaM."""
 1007 
 1008         # The flags, execute the script, and then check the chi2 value.
 1009         self.flags()
 1010         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
 1011         self.check_chi2(0.041445854907868764)
 1012 
 1013 
 1014     def test_cam_qr_int_pseudo_ellipse2_pcs(self):
 1015         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1016 
 1017         # The flags, execute the script, and then check the chi2 value.
 1018         self.flags(rdc=False)
 1019         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
 1020         self.check_chi2(0.02331739779637744)
 1021 
 1022 
 1023     def test_cam_qr_int_pseudo_ellipse2_rdc(self):
 1024         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1025 
 1026         # The flags, execute the script, and then check the chi2 value.
 1027         self.flags(pcs=False)
 1028         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
 1029         self.check_chi2(0.018129612955648935)
 1030 
 1031 
 1032     def test_cam_qr_int_pseudo_ellipse_free_rotor(self):
 1033         """Test the second isotropic cone, free rotor frame order model of CaM."""
 1034 
 1035         # The flags, execute the script, and then check the chi2 value.
 1036         self.flags()
 1037         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
 1038         self.check_chi2(0.07886558371162268)
 1039 
 1040 
 1041     def test_cam_qr_int_pseudo_ellipse_free_rotor_pcs(self):
 1042         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1043 
 1044         # The flags, execute the script, and then check the chi2 value.
 1045         self.flags(rdc=False)
 1046         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
 1047         self.check_chi2(0.038891355121051734)
 1048 
 1049 
 1050     def test_cam_qr_int_pseudo_ellipse_free_rotor_rdc(self):
 1051         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1052 
 1053         # The flags, execute the script, and then check the chi2 value.
 1054         self.flags(pcs=False)
 1055         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
 1056         self.check_chi2(0.039974228590570947)
 1057 
 1058 
 1059     def test_cam_qr_int_pseudo_ellipse_torsionless(self):
 1060         """Test the second isotropic cone, free rotor frame order model of CaM."""
 1061 
 1062         # The flags, execute the script, and then check the chi2 value.
 1063         self.flags()
 1064         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
 1065         self.check_chi2(0.018922576784401186)
 1066 
 1067 
 1068     def test_cam_qr_int_pseudo_ellipse_torsionless_pcs(self):
 1069         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1070 
 1071         # The flags, execute the script, and then check the chi2 value.
 1072         self.flags(rdc=False)
 1073         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
 1074         self.check_chi2(0.003977725835776093)
 1075 
 1076 
 1077     def test_cam_qr_int_pseudo_ellipse_torsionless_rdc(self):
 1078         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1079 
 1080         # The flags, execute the script, and then check the chi2 value.
 1081         self.flags(pcs=False)
 1082         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
 1083         self.check_chi2(0.014947617377424345)
 1084 
 1085 
 1086     def test_cam_qr_int_rigid(self):
 1087         """Test the rigid frame order model of CaM."""
 1088 
 1089         # The flags, execute the script, and then check the chi2 value.
 1090         self.flags(opt=True)
 1091         self.interpreter.run(script_file=self.cam_path+'rigid.py')
 1092         self.check_chi2(0.081171019382935666)
 1093 
 1094 
 1095     def test_cam_qr_int_rigid_pcs(self):
 1096         """Test the rigid frame order model of CaM (with only PCS data)."""
 1097 
 1098         # The flags, execute the script, and then check the chi2 value.
 1099         self.flags(rdc=False)
 1100         self.interpreter.run(script_file=self.cam_path+'rigid.py')
 1101         self.check_chi2(6.1557756577162843e-09)
 1102 
 1103 
 1104     def test_cam_qr_int_rigid_rdc(self):
 1105         """Test the rigid frame order model of CaM (with only RDC data)."""
 1106 
 1107         # The flags, execute the script, and then check the chi2 value.
 1108         self.flags(pcs=False)
 1109         self.interpreter.run(script_file=self.cam_path+'rigid.py')
 1110         self.check_chi2(0.081171013227160013)
 1111 
 1112 
 1113     def test_cam_qr_int_rotor(self):
 1114         """Test the rotor frame order model of CaM."""
 1115 
 1116         # The flags, execute the script, and then check the chi2 value.
 1117         self.flags()
 1118         self.interpreter.run(script_file=self.cam_path+'rotor.py')
 1119         self.check_chi2(0.075072773007664212)
 1120 
 1121 
 1122     def test_cam_qr_int_rotor_pcs(self):
 1123         """Test the rotor frame order model of CaM (with only PCS data)."""
 1124 
 1125         # The flags, execute the script, and then check the chi2 value.
 1126         self.flags(rdc=False)
 1127         self.interpreter.run(script_file=self.cam_path+'rotor.py')
 1128         self.check_chi2(1.139566998206629e-06)
 1129 
 1130 
 1131     def test_cam_qr_int_rotor_rdc(self):
 1132         """Test the rotor frame order model of CaM (with only RDC data)."""
 1133 
 1134         # The flags, execute the script, and then check the chi2 value.
 1135         self.flags(pcs=False)
 1136         self.interpreter.run(script_file=self.cam_path+'rotor.py')
 1137         self.check_chi2(0.075071633440666002)
 1138 
 1139 
 1140     def test_cam_qr_int_rotor_2_state(self):
 1141         """Test the 2-state rotor frame order model of CaM."""
 1142 
 1143         # The flags, execute the script, and then check the chi2 value.
 1144         self.flags()
 1145         self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
 1146         self.check_chi2(0.98321958150473276)
 1147 
 1148 
 1149     def test_cam_qr_int_rotor_2_state_pcs(self):
 1150         """Test the 2-state rotor frame order model of CaM (with only PCS data)."""
 1151 
 1152         # The flags, execute the script, and then check the chi2 value.
 1153         self.flags(rdc=False)
 1154         self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
 1155         self.check_chi2(2.9152704264897967e-05)
 1156 
 1157 
 1158     def test_cam_qr_int_rotor_2_state_rdc(self):
 1159         """Test the 2-state rotor frame order model of CaM (with only RDC data)."""
 1160 
 1161         # The flags, execute the script, and then check the chi2 value.
 1162         self.flags(pcs=False)
 1163         self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
 1164         self.check_chi2(0.98319606148815675)
 1165 
 1166 
 1167     def test_cam_qr_int_rotor2(self):
 1168         """Test the second rotor frame order model of CaM."""
 1169 
 1170         # The flags, execute the script, and then check the chi2 value.
 1171         self.flags(opt=True)
 1172         self.interpreter.run(script_file=self.cam_path+'rotor2.py')
 1173         self.check_chi2(0.075040490418167072)
 1174 
 1175 
 1176     def test_cam_qr_int_rotor2_pcs(self):
 1177         """Test the second rotor frame order model of CaM (with only PCS data)."""
 1178 
 1179         # The flags, execute the script, and then check the chi2 value.
 1180         self.flags(rdc=False)
 1181         self.interpreter.run(script_file=self.cam_path+'rotor2.py')
 1182         self.check_chi2(1.5787105392036996e-06)
 1183 
 1184 
 1185     def test_cam_qr_int_rotor2_rdc(self):
 1186         """Test the second rotor frame order model of CaM (with only RDC data)."""
 1187 
 1188         # The flags, execute the script, and then check the chi2 value.
 1189         self.flags(pcs=False)
 1190         self.interpreter.run(script_file=self.cam_path+'rotor2.py')
 1191         self.check_chi2(0.075038911707627859)
 1192 
 1193 
 1194     def test_cam_quad_int_double_rotor(self):
 1195         """Test the double rotor frame order model of CaM."""
 1196 
 1197         # The flags, execute the script, and then check the chi2 value.
 1198         self.flags(quad_int=True)
 1199         self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
 1200         self.check_chi2(0.079828365857374614)
 1201 
 1202 
 1203     def test_cam_quad_int_double_rotor_pcs(self):
 1204         """Test the double rotor frame order model of CaM (with only PCS data)."""
 1205 
 1206         # The flags, execute the script, and then check the chi2 value.
 1207         self.flags(rdc=False, quad_int=True)
 1208         self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
 1209         self.check_chi2(1.6582207495230563e-05)
 1210 
 1211 
 1212     def test_cam_quad_int_double_rotor_rdc(self):
 1213         """Test the double rotor frame order model of CaM (with only RDC data)."""
 1214 
 1215         # The flags, execute the script, and then check the chi2 value.
 1216         self.flags(pcs=False, quad_int=True)
 1217         self.interpreter.run(script_file=self.cam_path+'double_rotor.py')
 1218         self.check_chi2(0.079814053829495801)
 1219 
 1220 
 1221     def test_cam_quad_int_double_rotor_large_angle(self):
 1222         """Test the double rotor frame order model of CaM."""
 1223 
 1224         # The flags, execute the script, and then check the chi2 value.
 1225         self.flags(quad_int=True)
 1226         self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
 1227         self.check_chi2(0.57126501230322546)
 1228 
 1229 
 1230     def test_cam_quad_int_double_rotor_large_angle_pcs(self):
 1231         """Test the double rotor frame order model of CaM (with only PCS data)."""
 1232 
 1233         # The flags, execute the script, and then check the chi2 value.
 1234         self.flags(rdc=False, quad_int=True)
 1235         self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
 1236         self.check_chi2(0.5273196608417523)
 1237 
 1238 
 1239     def test_cam_quad_int_double_rotor_large_angle_rdc(self):
 1240         """Test the double rotor frame order model of CaM (with only RDC data)."""
 1241 
 1242         # The flags, execute the script, and then check the chi2 value.
 1243         self.flags(pcs=False, quad_int=True)
 1244         self.interpreter.run(script_file=self.cam_path+'double_rotor_large_angle.py')
 1245         self.check_chi2(0.043946055085127944)
 1246 
 1247 
 1248     def test_cam_quad_int_free_rotor(self):
 1249         """Test the free rotor frame order model of CaM."""
 1250 
 1251         # The flags, execute the script, and then check the chi2 value.
 1252         self.flags(quad_int=True)
 1253         self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
 1254         self.check_chi2(0.04899586148178818)
 1255 
 1256 
 1257     def test_cam_quad_int_free_rotor_missing_data(self):
 1258         """Test the free rotor frame order model of CaM."""
 1259 
 1260         # The flags, execute the script, and then check the chi2 value.
 1261         self.flags(quad_int=True)
 1262         self.interpreter.run(script_file=self.cam_path+'free_rotor_missing_data.py')
 1263         self.check_chi2(0.037726306126177556)
 1264 
 1265 
 1266     def test_cam_quad_int_free_rotor_pcs(self):
 1267         """Test the free rotor frame order model of CaM (with only PCS data)."""
 1268 
 1269         # The flags, execute the script, and then check the chi2 value.
 1270         self.flags(rdc=False, quad_int=True)
 1271         self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
 1272         self.check_chi2(4.5205576772581238e-08)
 1273 
 1274 
 1275     def test_cam_quad_int_free_rotor_rdc(self):
 1276         """Test the free rotor frame order model of CaM (with only RDC data)."""
 1277 
 1278         # The flags, execute the script, and then check the chi2 value.
 1279         self.flags(pcs=False, quad_int=True)
 1280         self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
 1281         self.check_chi2(0.04899130610303442)
 1282 
 1283 
 1284     def test_cam_quad_int_free_rotor2(self):
 1285         """Test the second free rotor frame order model of CaM."""
 1286 
 1287         # The flags, execute the script, and then check the chi2 value.
 1288         self.flags(quad_int=True)
 1289         self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
 1290         self.check_chi2(0.06748978555251639)
 1291 
 1292 
 1293     def test_cam_quad_int_free_rotor2_pcs(self):
 1294         """Test the second free rotor frame order model of CaM (with only PCS data)."""
 1295 
 1296         # The flags, execute the script, and then check the chi2 value.
 1297         self.flags(rdc=False, quad_int=True)
 1298         self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
 1299         self.check_chi2(0.010744719591287448)
 1300 
 1301 
 1302     def test_cam_quad_int_free_rotor2_rdc(self):
 1303         """Test the second free rotor frame order model of CaM (with only RDC data)."""
 1304 
 1305         # The flags, execute the script, and then check the chi2 value.
 1306         self.flags(pcs=False, quad_int=True)
 1307         self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
 1308         self.check_chi2(0.056744492444430819)
 1309 
 1310 
 1311     def test_cam_quad_int_iso_cone(self):
 1312         """Test the isotropic cone, free rotor frame order model of CaM."""
 1313 
 1314         # The flags, execute the script, and then check the chi2 value.
 1315         self.flags(quad_int=True)
 1316         self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
 1317         self.check_chi2(0.041430522432421318)
 1318 
 1319 
 1320     def test_cam_quad_int_iso_cone_pcs(self):
 1321         """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1322 
 1323         # The flags, execute the script, and then check the chi2 value.
 1324         self.flags(rdc=False, quad_int=True)
 1325         self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
 1326         self.check_chi2(4.8409613144085089e-08)
 1327 
 1328 
 1329     def test_cam_quad_int_iso_cone_rdc(self):
 1330         """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1331 
 1332         # The flags, execute the script, and then check the chi2 value.
 1333         self.flags(pcs=False, quad_int=True)
 1334         self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
 1335         self.check_chi2(0.041428474106863025)
 1336 
 1337 
 1338     def test_cam_quad_int_iso_cone_free_rotor(self):
 1339         """Test the isotropic cone, free rotor frame order model of CaM."""
 1340 
 1341         # The flags, execute the script, and then check the chi2 value.
 1342         self.flags(quad_int=True)
 1343         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
 1344         self.check_chi2(0.01098760442625833)
 1345 
 1346 
 1347     def test_cam_quad_int_iso_cone_free_rotor_pcs(self):
 1348         """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1349 
 1350         # The flags, execute the script, and then check the chi2 value.
 1351         self.flags(rdc=False, quad_int=True)
 1352         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
 1353         self.check_chi2(1.20136009208203e-06)
 1354 
 1355 
 1356     def test_cam_quad_int_iso_cone_free_rotor_rdc(self):
 1357         """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1358 
 1359         # The flags, execute the script, and then check the chi2 value.
 1360         self.flags(pcs=False, quad_int=True)
 1361         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
 1362         self.check_chi2(0.010986403066166248)
 1363 
 1364 
 1365     def test_cam_quad_int_iso_cone_free_rotor2(self):
 1366         """Test the second isotropic cone, free rotor frame order model of CaM."""
 1367 
 1368         # The flags, execute the script, and then check the chi2 value.
 1369         self.flags(quad_int=True)
 1370         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
 1371         self.check_chi2(0.027527295381115289)
 1372 
 1373 
 1374     def test_cam_quad_int_iso_cone_free_rotor2_pcs(self):
 1375         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1376 
 1377         # The flags, execute the script, and then check the chi2 value.
 1378         self.flags(rdc=False, quad_int=True)
 1379         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
 1380         self.check_chi2(0.021968348499045869)
 1381 
 1382 
 1383     def test_cam_quad_int_iso_cone_free_rotor2_rdc(self):
 1384         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1385 
 1386         # The flags, execute the script, and then check the chi2 value.
 1387         self.flags(pcs=False, quad_int=True)
 1388         self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
 1389         self.check_chi2(0.0055589468820694179)
 1390 
 1391 
 1392     def test_cam_quad_int_iso_cone_torsionless(self):
 1393         """Test the second isotropic cone, free rotor frame order model of CaM."""
 1394 
 1395         # The flags, execute the script, and then check the chi2 value.
 1396         self.flags(quad_int=True)
 1397         self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
 1398         self.check_chi2(0.048766438238093554)
 1399 
 1400 
 1401     def test_cam_quad_int_iso_cone_torsionless_pcs(self):
 1402         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1403 
 1404         # The flags, execute the script, and then check the chi2 value.
 1405         self.flags(rdc=False, quad_int=True)
 1406         self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
 1407         self.check_chi2(2.2862898875626613e-05)
 1408 
 1409 
 1410     def test_cam_quad_int_iso_cone_torsionless_rdc(self):
 1411         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1412 
 1413         # The flags, execute the script, and then check the chi2 value.
 1414         self.flags(pcs=False, quad_int=True)
 1415         self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
 1416         self.check_chi2(0.048749202219945678)
 1417 
 1418 
 1419     def test_cam_quad_int_pseudo_ellipse(self):
 1420         """Test the second isotropic cone, free rotor frame order model of CaM."""
 1421 
 1422         # The flags, execute the script, and then check the chi2 value.
 1423         self.flags(quad_int=True)
 1424         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
 1425         self.check_chi2(0.033007827805689761)
 1426 
 1427 
 1428     def test_cam_quad_int_pseudo_ellipse_pcs(self):
 1429         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1430 
 1431         # The flags, execute the script, and then check the chi2 value.
 1432         self.flags(rdc=False, quad_int=True)
 1433         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
 1434         self.check_chi2(1.534188648468986e-07)
 1435 
 1436 
 1437     def test_cam_quad_int_pseudo_ellipse_rdc(self):
 1438         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1439 
 1440         # The flags, execute the script, and then check the chi2 value.
 1441         self.flags(pcs=False, quad_int=True)
 1442         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
 1443         self.check_chi2(0.03300256897164619)
 1444 
 1445 
 1446     def test_cam_quad_int_pseudo_ellipse2(self):
 1447         """Test the second isotropic cone, free rotor frame order model of CaM."""
 1448 
 1449         # The flags, execute the script, and then check the chi2 value.
 1450         self.flags(quad_int=True)
 1451         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
 1452         self.check_chi2(0.018129059824815268)
 1453 
 1454 
 1455     def test_cam_quad_int_pseudo_ellipse2_pcs(self):
 1456         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1457 
 1458         # The flags, execute the script, and then check the chi2 value.
 1459         self.flags(rdc=False, quad_int=True)
 1460         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
 1461         self.check_chi2(6.0271332394266001e-07)
 1462 
 1463 
 1464     def test_cam_quad_int_pseudo_ellipse2_rdc(self):
 1465         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1466 
 1467         # The flags, execute the script, and then check the chi2 value.
 1468         self.flags(pcs=False, quad_int=True)
 1469         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
 1470         self.check_chi2(0.018129612955648935)
 1471 
 1472 
 1473     def test_cam_quad_int_pseudo_ellipse_free_rotor(self):
 1474         """Test the second isotropic cone, free rotor frame order model of CaM."""
 1475 
 1476         # The flags, execute the script, and then check the chi2 value.
 1477         self.flags(quad_int=True)
 1478         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
 1479         self.check_chi2(0.039974493838723132)
 1480 
 1481 
 1482     def test_cam_quad_int_pseudo_ellipse_free_rotor_pcs(self):
 1483         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1484 
 1485         # The flags, execute the script, and then check the chi2 value.
 1486         self.flags(rdc=False, quad_int=True)
 1487         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
 1488         self.check_chi2(2.6524815218336224e-07)
 1489 
 1490 
 1491     def test_cam_quad_int_pseudo_ellipse_free_rotor_rdc(self):
 1492         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1493 
 1494         # The flags, execute the script, and then check the chi2 value.
 1495         self.flags(pcs=False, quad_int=True)
 1496         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
 1497         self.check_chi2(0.039974228590570947)
 1498 
 1499 
 1500     def test_cam_quad_int_pseudo_ellipse_torsionless(self):
 1501         """Test the second isotropic cone, free rotor frame order model of CaM."""
 1502 
 1503         # The flags, execute the script, and then check the chi2 value.
 1504         self.flags(quad_int=True)
 1505         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
 1506         self.check_chi2(0.014945243556224312)
 1507 
 1508 
 1509     def test_cam_quad_int_pseudo_ellipse_torsionless_pcs(self):
 1510         """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
 1511 
 1512         # The flags, execute the script, and then check the chi2 value.
 1513         self.flags(rdc=False, quad_int=True)
 1514         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
 1515         self.check_chi2(3.9260759922047933e-07)
 1516 
 1517 
 1518     def test_cam_quad_int_pseudo_ellipse_torsionless_rdc(self):
 1519         """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
 1520 
 1521         # The flags, execute the script, and then check the chi2 value.
 1522         self.flags(pcs=False, quad_int=True)
 1523         self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
 1524         self.check_chi2(0.014947617377424345)
 1525 
 1526 
 1527     def test_cam_quad_int_rigid(self):
 1528         """Test the rigid frame order model of CaM."""
 1529 
 1530         # The flags, execute the script, and then check the chi2 value.
 1531         self.flags(quad_int=True)
 1532         self.interpreter.run(script_file=self.cam_path+'rigid.py')
 1533         self.check_chi2(0.081171019382935666)
 1534 
 1535 
 1536     def test_cam_quad_int_rigid_pcs(self):
 1537         """Test the rigid frame order model of CaM (with only PCS data)."""
 1538 
 1539         # The flags, execute the script, and then check the chi2 value.
 1540         self.flags(rdc=False, quad_int=True)
 1541         self.interpreter.run(script_file=self.cam_path+'rigid.py')
 1542         self.check_chi2(6.1557756577162843e-09)
 1543 
 1544 
 1545     def test_cam_quad_int_rigid_rdc(self):
 1546         """Test the rigid frame order model of CaM (with only RDC data)."""
 1547 
 1548         # The flags, execute the script, and then check the chi2 value.
 1549         self.flags(pcs=False, quad_int=True)
 1550         self.interpreter.run(script_file=self.cam_path+'rigid.py')
 1551         self.check_chi2(0.081171013227160013)
 1552 
 1553 
 1554     def test_cam_quad_int_rotor(self):
 1555         """Test the rotor frame order model of CaM."""
 1556 
 1557         # The flags, execute the script, and then check the chi2 value.
 1558         self.flags(quad_int=True)
 1559         self.interpreter.run(script_file=self.cam_path+'rotor.py')
 1560         self.check_chi2(0.075072773007664212)
 1561 
 1562 
 1563     def test_cam_quad_int_rotor_pcs(self):
 1564         """Test the rotor frame order model of CaM (with only PCS data)."""
 1565 
 1566         # The flags, execute the script, and then check the chi2 value.
 1567         self.flags(rdc=False, quad_int=True)
 1568         self.interpreter.run(script_file=self.cam_path+'rotor.py')
 1569         self.check_chi2(1.139566998206629e-06)
 1570 
 1571 
 1572     def test_cam_quad_int_rotor_rdc(self):
 1573         """Test the rotor frame order model of CaM (with only RDC data)."""
 1574 
 1575         # The flags, execute the script, and then check the chi2 value.
 1576         self.flags(pcs=False, quad_int=True)
 1577         self.interpreter.run(script_file=self.cam_path+'rotor.py')
 1578         self.check_chi2(0.075071633440666002)
 1579 
 1580 
 1581     def test_cam_quad_int_rotor_2_state(self):
 1582         """Test the 2-state rotor frame order model of CaM."""
 1583 
 1584         # The flags, execute the script, and then check the chi2 value.
 1585         self.flags(quad_int=True)
 1586         self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
 1587         self.check_chi2(0.98321958150473276)
 1588 
 1589 
 1590     def test_cam_quad_int_rotor_2_state_pcs(self):
 1591         """Test the 2-state rotor frame order model of CaM (with only PCS data)."""
 1592 
 1593         # The flags, execute the script, and then check the chi2 value.
 1594         self.flags(rdc=False, quad_int=True)
 1595         self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
 1596         self.check_chi2(2.9152704264897967e-05)
 1597 
 1598 
 1599     def test_cam_quad_int_rotor_2_state_rdc(self):
 1600         """Test the 2-state rotor frame order model of CaM (with only RDC data)."""
 1601 
 1602         # The flags, execute the script, and then check the chi2 value.
 1603         self.flags(pcs=False, quad_int=True)
 1604         self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
 1605         self.check_chi2(0.98319606148815675)
 1606 
 1607 
 1608     def test_cam_quad_int_rotor2(self):
 1609         """Test the second rotor frame order model of CaM."""
 1610 
 1611         # The flags, execute the script, and then check the chi2 value.
 1612         self.flags(quad_int=True)
 1613         self.interpreter.run(script_file=self.cam_path+'rotor2.py')
 1614         self.check_chi2(0.075040490418167072)
 1615 
 1616 
 1617     def test_cam_quad_int_rotor2_pcs(self):
 1618         """Test the second rotor frame order model of CaM (with only PCS data)."""
 1619 
 1620         # The flags, execute the script, and then check the chi2 value.
 1621         self.flags(rdc=False, quad_int=True)
 1622         self.interpreter.run(script_file=self.cam_path+'rotor2.py')
 1623         self.check_chi2(1.5787105392036996e-06)
 1624 
 1625 
 1626     def test_cam_quad_int_rotor2_rdc(self):
 1627         """Test the second rotor frame order model of CaM (with only RDC data)."""
 1628 
 1629         # The flags, execute the script, and then check the chi2 value.
 1630         self.flags(pcs=False, quad_int=True)
 1631         self.interpreter.run(script_file=self.cam_path+'rotor2.py')
 1632         self.check_chi2(0.075038911707627859)
 1633 
 1634 
 1635     def test_count_sobol_points(self):
 1636         """Test the ability of the frame_order.sobol_setup user function to be able to count the number of Sobol' points used for the current parameter values."""
 1637 
 1638         # Reset.
 1639         self.interpreter.reset()
 1640 
 1641         # Load the state file.
 1642         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
 1643         self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
 1644 
 1645         # Set the number of integration points, and see if they can be counted.
 1646         self.interpreter.frame_order.sobol_setup(20)
 1647 
 1648         # Check the count.
 1649         self.assertEqual(cdp.sobol_points_used, 20)
 1650 
 1651 
 1652     def test_count_sobol_points2(self):
 1653         """Test the frame_order.count_sobol_points user function."""
 1654 
 1655         # Reset.
 1656         self.interpreter.reset()
 1657 
 1658         # Load the state file.
 1659         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
 1660         self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
 1661 
 1662         # Call the user function.
 1663         self.interpreter.frame_order.count_sobol_points()
 1664 
 1665         # Check the count.
 1666         self.assertEqual(cdp.sobol_points_used, 20)
 1667 
 1668 
 1669     def test_count_sobol_points_free_rotor(self):
 1670         """Test the frame_order.count_sobol_points user function for the free-rotor model."""
 1671 
 1672         # Reset.
 1673         self.interpreter.reset()
 1674 
 1675         # Load the state file.
 1676         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep+'free_rotor'
 1677         self.interpreter.state.load(data_path+sep+'frame_order')
 1678 
 1679         # Reset the number of points.
 1680         self.interpreter.frame_order.sobol_setup(20)
 1681 
 1682         # Call the user function.
 1683         self.interpreter.frame_order.count_sobol_points()
 1684 
 1685         # Check the count.
 1686         self.assertEqual(cdp.sobol_points_used, 20)
 1687 
 1688 
 1689     def test_count_sobol_points_iso_cone_free_rotor(self):
 1690         """Test the frame_order.count_sobol_points user function for the free-rotor isotropic cone model."""
 1691 
 1692         # Reset.
 1693         self.interpreter.reset()
 1694 
 1695         # Load the state file.
 1696         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep+'iso_cone_free_rotor'
 1697         self.interpreter.state.load(data_path+sep+'frame_order')
 1698 
 1699         # Reset the number of points.
 1700         self.interpreter.frame_order.sobol_setup(20)
 1701 
 1702         # Call the user function.
 1703         self.interpreter.frame_order.count_sobol_points()
 1704 
 1705         # Check the count.
 1706         self.assertEqual(cdp.sobol_points_used, 20)
 1707 
 1708 
 1709     def test_count_sobol_points_rigid(self):
 1710         """Test the frame_order.count_sobol_points user function for the rigid model."""
 1711 
 1712         # Reset.
 1713         self.interpreter.reset()
 1714 
 1715         # Load the state file.
 1716         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep+'rigid'
 1717         self.interpreter.state.load(data_path+sep+'frame_order')
 1718 
 1719         # Call the user function.
 1720         self.interpreter.frame_order.count_sobol_points()
 1721 
 1722         # Check the count.
 1723         self.assert_(not hasattr(cdp, 'sobol_points_used'))
 1724 
 1725 
 1726     def test_count_sobol_points_rotor(self):
 1727         """Test the frame_order.count_sobol_points user function for the rotor model."""
 1728 
 1729         # Reset.
 1730         self.interpreter.reset()
 1731 
 1732         # Load the state file.
 1733         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep+'rotor'
 1734         self.interpreter.state.load(data_path+sep+'frame_order')
 1735 
 1736         # Reset the number of points.
 1737         self.interpreter.frame_order.sobol_setup(20)
 1738 
 1739         # Call the user function.
 1740         self.interpreter.frame_order.count_sobol_points()
 1741 
 1742         # Check the count.
 1743         self.assertEqual(cdp.sobol_points_used, 20)
 1744 
 1745 
 1746     def test_decompose_free_rotor_z_axis(self):
 1747         """Check the frame_order.decompose user function PDB file for the free rotor model along the z-axis."""
 1748 
 1749         # Call the equivalent frame_order.simulate user function system test to do everything.
 1750         self.test_simulate_free_rotor_z_axis(type='decomp')
 1751 
 1752 
 1753     def test_decompose_iso_cone_z_axis(self):
 1754         """Check the frame_order.decompose user function PDB file for the isotropic cone model along the z-axis."""
 1755 
 1756         # Call the equivalent frame_order.simulate user function system test to do everything.
 1757         self.test_simulate_iso_cone_z_axis(type='decomp')
 1758 
 1759 
 1760     def test_decompose_iso_cone_xz_plane_tilt(self):
 1761         """Check the frame_order.decompose user function PDB file for the isotropic cone model with a xz-plane tilt."""
 1762 
 1763         # Call the equivalent frame_order.simulate user function system test to do everything.
 1764         self.test_simulate_iso_cone_xz_plane_tilt(type='decomp')
 1765 
 1766 
 1767     def test_decompose_iso_cone_free_rotor_z_axis(self):
 1768         """Check the frame_order.decompose user function PDB file for the free rotor isotropic cone model along the z-axis."""
 1769 
 1770         # Call the equivalent frame_order.simulate user function system test to do everything.
 1771         self.test_simulate_iso_cone_free_rotor_z_axis(type='decomp')
 1772 
 1773 
 1774     def test_decompose_iso_cone_torsionless_z_axis(self):
 1775         """Check the frame_order.decompose user function PDB file for the torsionless isotropic cone model along the z-axis."""
 1776 
 1777         # Call the equivalent frame_order.simulate user function system test to do everything.
 1778         self.test_simulate_iso_cone_torsionless_z_axis(type='decomp')
 1779 
 1780 
 1781     def test_decompose_pseudo_ellipse_xz_plane_tilt(self):
 1782         """Check the frame_order.decompose user function PDB file for the pseudo-ellipse model with a xz-plane tilt."""
 1783 
 1784         # Call the equivalent frame_order.simulate user function system test to do everything.
 1785         self.test_simulate_pseudo_ellipse_xz_plane_tilt(type='decomp')
 1786 
 1787 
 1788     def test_decompose_pseudo_ellipse_z_axis(self):
 1789         """Check the frame_order.decompose user function PDB file for the pseudo-ellipse model along the z-axis."""
 1790 
 1791         # Call the equivalent frame_order.simulate user function system test to do everything.
 1792         self.test_simulate_pseudo_ellipse_z_axis(type='decomp')
 1793 
 1794 
 1795     def test_decompose_pseudo_ellipse_free_rotor_z_axis(self):
 1796         """Check the frame_order.decompose user function PDB file for the free rotor pseudo-ellipse model along the z-axis."""
 1797 
 1798         # Call the equivalent frame_order.simulate user function system test to do everything.
 1799         self.test_simulate_pseudo_ellipse_free_rotor_z_axis(type='decomp')
 1800 
 1801 
 1802     def test_decompose_pseudo_ellipse_torsionless_z_axis(self):
 1803         """Check the frame_order.decompose user function PDB file for the torsionless pseudo-ellipse model along the z-axis."""
 1804 
 1805         # Call the equivalent frame_order.simulate user function system test to do everything.
 1806         self.test_simulate_pseudo_ellipse_torsionless_z_axis(type='decomp')
 1807 
 1808 
 1809     def test_decompose_rotor_z_axis(self):
 1810         """Check the frame_order.decompose user function PDB file for the rotor model along the z-axis."""
 1811 
 1812         # Call the equivalent frame_order.simulate user function system test to do everything.
 1813         self.test_simulate_rotor_z_axis(type='decomp')
 1814 
 1815 
 1816     def test_decompose2_free_rotor_z_axis(self):
 1817         """Check the frame_order.decompose user function PDB file for the free rotor model along the z-axis."""
 1818 
 1819         # Call the equivalent frame_order.simulate user function system test to do everything.
 1820         self.test_simulate_free_rotor_z_axis(type='decomp2')
 1821 
 1822 
 1823     def test_decompose2_iso_cone_z_axis(self):
 1824         """Check the frame_order.decompose user function PDB file for the isotropic cone model along the z-axis."""
 1825 
 1826         # Call the equivalent frame_order.simulate user function system test to do everything.
 1827         self.test_simulate_iso_cone_z_axis(type='decomp2')
 1828 
 1829 
 1830     def test_decompose2_iso_cone_xz_plane_tilt(self):
 1831         """Check the frame_order.decompose user function PDB file for the isotropic cone model with a xz-plane tilt."""
 1832 
 1833         # Call the equivalent frame_order.simulate user function system test to do everything.
 1834         self.test_simulate_iso_cone_xz_plane_tilt(type='decomp2')
 1835 
 1836 
 1837     def test_decompose2_iso_cone_free_rotor_z_axis(self):
 1838         """Check the frame_order.decompose user function PDB file for the free rotor isotropic cone model along the z-axis."""
 1839 
 1840         # Call the equivalent frame_order.simulate user function system test to do everything.
 1841         self.test_simulate_iso_cone_free_rotor_z_axis(type='decomp2')
 1842 
 1843 
 1844     def test_decompose2_iso_cone_torsionless_z_axis(self):
 1845         """Check the frame_order.decompose user function PDB file for the torsionless isotropic cone model along the z-axis."""
 1846 
 1847         # Call the equivalent frame_order.simulate user function system test to do everything.
 1848         self.test_simulate_iso_cone_torsionless_z_axis(type='decomp2')
 1849 
 1850 
 1851     def test_decompose2_pseudo_ellipse_xz_plane_tilt(self):
 1852         """Check the frame_order.decompose user function PDB file for the pseudo-ellipse model with a xz-plane tilt."""
 1853 
 1854         # Call the equivalent frame_order.simulate user function system test to do everything.
 1855         self.test_simulate_pseudo_ellipse_xz_plane_tilt(type='decomp2')
 1856 
 1857 
 1858     def test_decompose2_pseudo_ellipse_z_axis(self):
 1859         """Check the frame_order.decompose user function PDB file for the pseudo-ellipse model along the z-axis."""
 1860 
 1861         # Call the equivalent frame_order.simulate user function system test to do everything.
 1862         self.test_simulate_pseudo_ellipse_z_axis(type='decomp2')
 1863 
 1864 
 1865     def test_decompose2_pseudo_ellipse_free_rotor_z_axis(self):
 1866         """Check the frame_order.decompose user function PDB file for the free rotor pseudo-ellipse model along the z-axis."""
 1867 
 1868         # Call the equivalent frame_order.simulate user function system test to do everything.
 1869         self.test_simulate_pseudo_ellipse_free_rotor_z_axis(type='decomp2')
 1870 
 1871 
 1872     def test_decompose2_pseudo_ellipse_torsionless_z_axis(self):
 1873         """Check the frame_order.decompose user function PDB file for the torsionless pseudo-ellipse model along the z-axis."""
 1874 
 1875         # Call the equivalent frame_order.simulate user function system test to do everything.
 1876         self.test_simulate_pseudo_ellipse_torsionless_z_axis(type='decomp2')
 1877 
 1878 
 1879     def test_decompose2_rotor_z_axis(self):
 1880         """Check the frame_order.decompose user function PDB file for the rotor model along the z-axis."""
 1881 
 1882         # Call the equivalent frame_order.simulate user function system test to do everything.
 1883         self.test_simulate_rotor_z_axis(type='decomp2')
 1884 
 1885 
 1886     def test_distribute_free_rotor_z_axis(self):
 1887         """Check the frame_order.distribute user function PDB file for the free rotor model along the z-axis."""
 1888 
 1889         # Call the equivalent frame_order.simulate user function system test to do everything.
 1890         self.test_simulate_free_rotor_z_axis(type='dist')
 1891 
 1892 
 1893     def test_distribute_iso_cone_z_axis(self):
 1894         """Check the frame_order.distribute user function PDB file for the isotropic cone model along the z-axis."""
 1895 
 1896         # Call the equivalent frame_order.simulate user function system test to do everything.
 1897         self.test_simulate_iso_cone_z_axis(type='dist')
 1898 
 1899 
 1900     def test_distribute_iso_cone_xz_plane_tilt(self):
 1901         """Check the frame_order.distribute user function PDB file for the isotropic cone model with a xz-plane tilt."""
 1902 
 1903         # Call the equivalent frame_order.simulate user function system test to do everything.
 1904         self.test_simulate_iso_cone_xz_plane_tilt(type='dist')
 1905 
 1906 
 1907     def test_distribute_iso_cone_torsionless_z_axis(self):
 1908         """Check the frame_order.distribute user function PDB file for the torsionless isotropic cone model along the z-axis."""
 1909 
 1910         # Call the equivalent frame_order.simulate user function system test to do everything.
 1911         self.test_simulate_iso_cone_torsionless_z_axis(type='dist')
 1912 
 1913 
 1914     def test_distribute_pseudo_ellipse_xz_plane_tilt(self):
 1915         """Check the frame_order.distribute user function PDB file for the pseudo-ellipse model with a xz-plane tilt."""
 1916 
 1917         # Call the equivalent frame_order.simulate user function system test to do everything.
 1918         self.test_simulate_pseudo_ellipse_xz_plane_tilt(type='dist')
 1919 
 1920 
 1921     def test_distribute_pseudo_ellipse_z_axis(self):
 1922         """Check the frame_order.distribute user function PDB file for the pseudo-ellipse model along the z-axis."""
 1923 
 1924         # Call the equivalent frame_order.simulate user function system test to do everything.
 1925         self.test_simulate_pseudo_ellipse_z_axis(type='dist')
 1926 
 1927 
 1928     def test_distribute_pseudo_ellipse_free_rotor_z_axis(self):
 1929         """Check the frame_order.distribute user function PDB file for the free rotor pseudo-ellipse model along the z-axis."""
 1930 
 1931         # Call the equivalent frame_order.simulate user function system test to do everything.
 1932         self.test_simulate_pseudo_ellipse_free_rotor_z_axis(type='dist')
 1933 
 1934 
 1935     def test_distribute_pseudo_ellipse_torsionless_z_axis(self):
 1936         """Check the frame_order.distribute user function PDB file for the torsionless pseudo-ellipse model along the z-axis."""
 1937 
 1938         # Call the equivalent frame_order.simulate user function system test to do everything.
 1939         self.test_simulate_pseudo_ellipse_torsionless_z_axis(type='dist')
 1940 
 1941 
 1942     def test_distribute_rotor_z_axis(self):
 1943         """Check the frame_order.distribute user function PDB file for the rotor model along the z-axis."""
 1944 
 1945         # Call the equivalent frame_order.simulate user function system test to do everything.
 1946         self.test_simulate_rotor_z_axis(type='dist')
 1947 
 1948 
 1949     def test_frame_order_pdb_model_ensemble(self):
 1950         """Test the operation of the frame_order.pdb_model user function when an ensemble of structures are loaded."""
 1951 
 1952         # Create a data pipe.
 1953         self.interpreter.pipe.create('frame_order.pdb_model ensemble failure', 'frame order')
 1954 
 1955         # Load some lactose structures to create an ensemble.
 1956         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose'
 1957         self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=data_path, set_model_num=1, set_mol_name='lactose')
 1958         self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=data_path, set_model_num=2, set_mol_name='lactose')
 1959         self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_3.pdb', dir=data_path, set_model_num=3, set_mol_name='lactose')
 1960 
 1961         # Set the pivot point.
 1962         self.interpreter.frame_order.pivot([0, 0, 0], fix=True)
 1963 
 1964         # Select a frame order model.
 1965         self.interpreter.frame_order.select_model('rotor')
 1966 
 1967         # Define the moving part.
 1968         self.interpreter.domain(id='lactose', spin_id=':UNK')
 1969         self.interpreter.frame_order.ref_domain('lactose')
 1970 
 1971         # Set up the system.
 1972         self.interpreter.value.set(param='ave_pos_x', val=0.0)
 1973         self.interpreter.value.set(param='ave_pos_y', val=0.0)
 1974         self.interpreter.value.set(param='ave_pos_z', val=0.0)
 1975         self.interpreter.value.set(param='ave_pos_alpha', val=0.0)
 1976         self.interpreter.value.set(param='ave_pos_beta', val=0.0)
 1977         self.interpreter.value.set(param='ave_pos_gamma', val=0.0)
 1978         self.interpreter.value.set(param='axis_alpha', val=0.5)
 1979         self.interpreter.value.set(param='cone_sigma_max', val=0.1)
 1980 
 1981         # Set up Monte Carlo data structures.
 1982         self.interpreter.monte_carlo.setup(10)
 1983         self.interpreter.monte_carlo.initial_values()
 1984 
 1985         # Create the PDB model.
 1986         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir)
 1987 
 1988 
 1989     def test_frame_order_pdb_model_failed_pivot(self):
 1990         """Test the operation of the frame_order.pdb_model user function when the pivot is outside of the PDB limits."""
 1991 
 1992         # Create a data pipe.
 1993         self.interpreter.pipe.create('frame_order.pdb_model ensemble failure', 'frame order')
 1994 
 1995         # Load one lactose structure.
 1996         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose'
 1997         self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=data_path, set_mol_name='lactose')
 1998 
 1999         # Set the pivot point.
 2000         self.interpreter.frame_order.pivot([-995, 0, 0], fix=True)
 2001 
 2002         # Select a frame order model.
 2003         self.interpreter.frame_order.select_model('rotor')
 2004 
 2005         # Define the moving part.
 2006         self.interpreter.domain(id='lactose', spin_id=':UNK')
 2007         self.interpreter.frame_order.ref_domain('lactose')
 2008 
 2009         # Set up the system.
 2010         self.interpreter.value.set(param='ave_pos_x', val=0.0)
 2011         self.interpreter.value.set(param='ave_pos_y', val=0.0)
 2012         self.interpreter.value.set(param='ave_pos_z', val=0.0)
 2013         self.interpreter.value.set(param='ave_pos_alpha', val=0.0)
 2014         self.interpreter.value.set(param='ave_pos_beta', val=0.0)
 2015         self.interpreter.value.set(param='ave_pos_gamma', val=0.0)
 2016         self.interpreter.value.set(param='axis_alpha', val=0.5)
 2017         self.interpreter.value.set(param='cone_sigma_max', val=0.1)
 2018 
 2019         # Set up Monte Carlo data structures.
 2020         self.interpreter.monte_carlo.setup(10)
 2021         self.interpreter.monte_carlo.initial_values()
 2022 
 2023         # Create the PDB model.
 2024         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir)
 2025 
 2026 
 2027     def test_generate_rotor2_distribution(self):
 2028         """Generate the rotor2 distribution of CaM."""
 2029 
 2030         # Execute the script.
 2031         self.interpreter.run(script_file=self.cam_path+'generate_rotor2_distribution.py')
 2032 
 2033 
 2034     def test_opendx_map(self):
 2035         """Test the mapping of the Euler angle parameters for OpenDx viewing."""
 2036 
 2037         # Execute the script.
 2038         self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'opendx_euler_angle_map.py')
 2039 
 2040 
 2041     def test_pdb_model_double_rotor_xz_plane_tilt(self):
 2042         """Check the frame_order.pdb_model user function PDB file for the rotor model along the z-axis."""
 2043 
 2044         # Init.
 2045         pivot2 = array([1, 0, 0], float64)
 2046         pivot_disp = 100
 2047         pivot1 = pivot2 + (z_axis-x_axis)/sqrt(2.0)*pivot_disp
 2048         l = 20.0
 2049 
 2050         # The axis parameters, and printout.
 2051         eigen_beta = -pi/4.0
 2052         R = zeros((3, 3), float64)
 2053         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 2054         print("Motional eigenframe:\n%s" % R)
 2055 
 2056         # Set up.
 2057         self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot2, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=0.0, cone_sigma_max_2=0.0)
 2058 
 2059         # Create the PDB.
 2060         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l)
 2061 
 2062         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2063         data = [
 2064             # The pivots.
 2065             [ 1, 'PIV',    1, 'Piv1',  pivot1],
 2066             [ 1, 'PIV',    2, 'Piv2',  pivot2],
 2067 
 2068             # The x-axis rotor.
 2069             [ 1, 'RTX',    3, 'CTR',  pivot2],
 2070             [ 2, 'RTX',    4, 'PRP',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta)],
 2071             [ 3, 'RTX',    5, 'PRP',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta, neg=True)],
 2072             [ 4, 'RTB',    6, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta)],
 2073             [ 5, 'RTB',  188, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta)],
 2074             [ 6, 'RTB',  370, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta)],
 2075             [ 7, 'RTB',  552, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta)],
 2076             [ 8, 'RTB',  734, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta, neg=True)],
 2077             [ 9, 'RTB',  916, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta, neg=True)],
 2078             [10, 'RTB', 1098, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0+eigen_beta, neg=True)],
 2079             [11, 'RTB', 1280, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0+eigen_beta, neg=True)],
 2080             [12, 'RTL', 1462, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0+eigen_beta)],
 2081             [12, 'RTL', 1463, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0+eigen_beta, neg=True)],
 2082 
 2083             # The y-axis rotor.
 2084             [ 1, 'RTX', 1464, 'CTR',  pivot1],
 2085             [ 2, 'RTX', 1465, 'PRP',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
 2086             [ 3, 'RTX', 1466, 'PRP',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
 2087             [ 4, 'RTB', 1467, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
 2088             [ 5, 'RTB', 1649, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)],
 2089             [ 6, 'RTB', 1831, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
 2090             [ 7, 'RTB', 2013, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)],
 2091             [ 8, 'RTB', 2195, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
 2092             [ 9, 'RTB', 2377, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)],
 2093             [10, 'RTB', 2559, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
 2094             [11, 'RTB', 2741, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)],
 2095             [12, 'RTL', 2923, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis)],
 2096             [12, 'RTL', 2924, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis, neg=True)],
 2097 
 2098             # The z-axis.
 2099             [ 1, 'AXE', 2925, 'R',  pivot2],
 2100             [ 1, 'AXE', 2926, 'z-ax', pivot1],
 2101             [ 1, 'AXE', 2927, 'z-ax', (pivot1-pivot2)*1.1+pivot2],
 2102         ]
 2103 
 2104         # Check the data. 
 2105         self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
 2106 
 2107 
 2108     def test_pdb_model_double_rotor_z_axis(self):
 2109         """Check the frame_order.pdb_model user function PDB file for the rotor model along the z-axis."""
 2110 
 2111         # Init.
 2112         pivot2 = array([1, 0, 0], float64)
 2113         pivot_disp = 100
 2114         pivot1 = pivot2 + z_axis*pivot_disp
 2115         l = 30.0
 2116 
 2117         # The axis parameters, and printout.
 2118         eigen_beta = 0.0
 2119         R = zeros((3, 3), float64)
 2120         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 2121         print("Motional eigenframe:\n%s" % R)
 2122 
 2123         # Set up.
 2124         self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot2, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=0.0, cone_sigma_max_2=0.0)
 2125 
 2126         # Create the PDB.
 2127         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l)
 2128 
 2129         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2130         data = [
 2131             # The pivots.
 2132             [ 1, 'PIV',    1, 'Piv1',  pivot1],
 2133             [ 1, 'PIV',    2, 'Piv2',  pivot2],
 2134 
 2135             # The x-axis rotor.
 2136             [ 1, 'RTX',    3, 'CTR',  pivot2],
 2137             [ 2, 'RTX',    4, 'PRP',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0)],
 2138             [ 3, 'RTX',    5, 'PRP',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0, neg=True)],
 2139             [ 4, 'RTB',    6, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0)],
 2140             [ 5, 'RTB',  188, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0)],
 2141             [ 6, 'RTB',  370, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0)],
 2142             [ 7, 'RTB',  552, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0)],
 2143             [ 8, 'RTB',  734, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0, neg=True)],
 2144             [ 9, 'RTB',  916, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0, neg=True)],
 2145             [10, 'RTB', 1098, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l, angle=pi/2.0, neg=True)],
 2146             [11, 'RTB', 1280, 'BLO',  self.rotate_from_Z(origin=pivot2, length=l-2.0, angle=pi/2.0, neg=True)],
 2147             [12, 'RTL', 1462, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0)],
 2148             [12, 'RTL', 1463, 'x-ax', self.rotate_from_Z(origin=pivot2, length=l+2.0, angle=pi/2.0, neg=True)],
 2149 
 2150             # The y-axis rotor.
 2151             [ 1, 'RTX', 1464, 'CTR',  pivot1],
 2152             [ 2, 'RTX', 1465, 'PRP',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
 2153             [ 3, 'RTX', 1466, 'PRP',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
 2154             [ 4, 'RTB', 1467, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
 2155             [ 5, 'RTB', 1649, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)],
 2156             [ 6, 'RTB', 1831, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis)],
 2157             [ 7, 'RTB', 2013, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis)],
 2158             [ 8, 'RTB', 2195, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
 2159             [ 9, 'RTB', 2377, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)],
 2160             [10, 'RTB', 2559, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l, angle=pi/2.0, axis=y_axis, neg=True)],
 2161             [11, 'RTB', 2741, 'BLO',  self.rotate_from_Z(origin=pivot1, length=l-2.0, angle=pi/2.0, axis=y_axis, neg=True)],
 2162             [12, 'RTL', 2923, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis)],
 2163             [12, 'RTL', 2924, 'y-ax', self.rotate_from_Z(origin=pivot1, length=l+2.0, angle=pi/2.0, axis=y_axis, neg=True)],
 2164 
 2165             # The z-axis.
 2166             [ 1, 'AXE', 2925, 'R',  pivot2],
 2167             [ 1, 'AXE', 2926, 'z-ax', pivot1],
 2168             [ 1, 'AXE', 2927, 'z-ax', self.rotate_from_Z(origin=pivot2, length=pivot_disp*1.1, angle=0.0)],
 2169         ]
 2170 
 2171         # Check the data. 
 2172         self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
 2173 
 2174 
 2175     def test_pdb_model_free_rotor_xz_plane_tilt(self):
 2176         """Check the frame_order.pdb_model user function PDB file for the rotor model with a xz-plane tilt."""
 2177 
 2178         # Init.
 2179         pivot = array([1, 0, 1], float64)
 2180         l = 100.0
 2181 
 2182         # The axis alpha parameter, and printout.
 2183         axis_alpha = pi / 2.0
 2184         axis =  create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64))
 2185         print("\nRotor axis:\n    %s" % axis)
 2186         print("Rotor apex (100*axis + [1, 0, 1]):\n    %s" % (l*axis + pivot))
 2187 
 2188         # Set up.
 2189         self.setup_model(pipe_name='PDB model', model='free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha)
 2190 
 2191         # Create the PDB.
 2192         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=100.0)
 2193 
 2194         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2195         data = [
 2196             [ 1, 'PIV',    1, 'Piv',  pivot],
 2197             [ 1, 'RTX',    2, 'CTR',  pivot],
 2198             [ 2, 'RTX',    3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
 2199             [ 3, 'RTX',    4, 'PRP',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
 2200             [ 4, 'RTB',    5, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
 2201             [ 5, 'RTB',  187, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
 2202             [ 6, 'RTB',  369, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
 2203             [ 7, 'RTB',  551, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
 2204             [ 8, 'RTB',  733, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
 2205             [ 9, 'RTB',  915, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
 2206             [10, 'RTB', 1097, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
 2207             [11, 'RTB', 1279, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
 2208             [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0)],
 2209             [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0, neg=True)]
 2210         ]
 2211 
 2212         # Check the data. 
 2213         self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
 2214 
 2215 
 2216     def test_pdb_model_free_rotor_z_axis(self):
 2217         """Check the frame_order.pdb_model user function PDB file for the free rotor model along the z-axis."""
 2218 
 2219         # Init.
 2220         pivot = array([1, 0, 0], float64)
 2221         l = 30.0
 2222 
 2223         # The axis alpha parameter, and printout.
 2224         axis_alpha = pi / 2.0
 2225         axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64))
 2226         print("\nRotor axis:  %s" % axis)
 2227         print("Rotor apex (100*axis + [1, 0, 0]):\n    %s" % (l*axis + pivot))
 2228 
 2229         # Set up.
 2230         self.setup_model(pipe_name='PDB model', model='free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha)
 2231 
 2232         # Create the PDB.
 2233         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l)
 2234 
 2235         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2236         data = [
 2237             [ 1, 'PIV',    1, 'Piv',  pivot],
 2238             [ 1, 'RTX',    2, 'CTR',  pivot],
 2239             [ 2, 'RTX',    3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
 2240             [ 3, 'RTX',    4, 'PRP',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
 2241             [ 4, 'RTB',    5, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
 2242             [ 5, 'RTB',  187, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
 2243             [ 6, 'RTB',  369, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
 2244             [ 7, 'RTB',  551, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
 2245             [ 8, 'RTB',  733, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
 2246             [ 9, 'RTB',  915, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
 2247             [10, 'RTB', 1097, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
 2248             [11, 'RTB', 1279, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
 2249             [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0)],
 2250             [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0, neg=True)]
 2251         ]
 2252 
 2253         # Check the data. 
 2254         self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
 2255 
 2256 
 2257     def test_pdb_model_iso_cone_xz_plane_tilt(self):
 2258         """Check the frame_order.pdb_model user function PDB file for the isotropic cone model with a xz-plane tilt."""
 2259 
 2260         # Init.
 2261         theta = 2.0
 2262         pivot = array([1, 1, 1], float64)
 2263         l = 45.0
 2264         l_rotor = l + 5.0
 2265 
 2266         # The axis parameters, and printout.
 2267         axis_theta = -pi/4.0
 2268         axis = create_rotor_axis_spherical(axis_theta, 0.0)
 2269         print("Rotor axis:  %s" % axis)
 2270         R = zeros((3, 3), float64)
 2271         axis_angle_to_R([0, 1, 0], axis_theta, R)
 2272 
 2273         # Set up.
 2274         self.setup_model(pipe_name='PDB model', model='iso cone', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta, cone_sigma_max=0.0)
 2275 
 2276         # Create the PDB.
 2277         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 2278 
 2279         # The xy-plane vectors.
 2280         inc = 2.0 * pi / 10.0
 2281         vectors = zeros((10, 3), float64)
 2282         for i in range(10):
 2283             # The angle phi.
 2284             phi = inc * i
 2285 
 2286             # The xy-plane, starting along the x-axis.
 2287             vectors[i, 0] = cos(phi)
 2288             vectors[i, 1] = sin(phi)
 2289 
 2290         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2291         neg = [False, True]
 2292         tle = ['a', 'b']
 2293         data = []
 2294         for i in range(2):
 2295             data.append([
 2296                 # The pivot.
 2297                 [ 1, 'PIV',   1, 'Piv',  pivot],
 2298 
 2299                 # The rotor.
 2300                 [ 1, 'RTX',   2, 'CTR',  pivot],
 2301                 [ 2, 'RTX',   3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2302                 [ 3, 'RTB',   4, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2303                 [ 4, 'RTB', 186, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])],
 2304                 [ 5, 'RTB', 368, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2305                 [ 6, 'RTB', 550, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])],
 2306                 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])],
 2307 
 2308                 # The cone edge.
 2309                 [ 3, 'CNE', 733, 'APX',  pivot],
 2310                 [ 3, 'CNE', 734, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], R=R, neg=neg[i])],
 2311                 [ 3, 'CNE', 735, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], R=R, neg=neg[i])],
 2312                 [ 3, 'CNE', 736, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], R=R, neg=neg[i])],
 2313                 [ 3, 'CNE', 737, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], R=R, neg=neg[i])],
 2314                 [ 3, 'CNE', 738, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], R=R, neg=neg[i])],
 2315                 [ 3, 'CNE', 739, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], R=R, neg=neg[i])],
 2316                 [ 3, 'CNE', 740, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], R=R, neg=neg[i])],
 2317                 [ 3, 'CNE', 741, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], R=R, neg=neg[i])],
 2318                 [ 3, 'CNE', 742, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], R=R, neg=neg[i])],
 2319                 [ 3, 'CNE', 743, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], R=R, neg=neg[i])],
 2320 
 2321                 # Titles.
 2322                 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
 2323             ])
 2324 
 2325         # Check the data. 
 2326         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 2327 
 2328 
 2329     def test_pdb_model_iso_cone_z_axis(self):
 2330         """Check the frame_order.pdb_model user function PDB file for the isotropic cone model along the z-axis."""
 2331 
 2332         # Init.
 2333         theta = 2.0
 2334         pivot = array([1, 0, -2], float64)
 2335         l = 25.0
 2336         l_rotor = l + 5.0
 2337 
 2338         # The axis parameters, and printout.
 2339         axis_theta = 0.0
 2340         print("Rotor axis:  %s" % create_rotor_axis_spherical(axis_theta, 0.0))
 2341 
 2342         # Set up.
 2343         self.setup_model(pipe_name='PDB model', model='iso cone', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta, cone_sigma_max=0.0)
 2344 
 2345         # Create the PDB.
 2346         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 2347 
 2348         # The xy-plane vectors.
 2349         inc = 2.0 * pi / 10.0
 2350         vectors = zeros((10, 3), float64)
 2351         for i in range(10):
 2352             # The angle phi.
 2353             phi = inc * i
 2354 
 2355             # The xy-plane, starting along the x-axis.
 2356             vectors[i, 0] = cos(phi)
 2357             vectors[i, 1] = sin(phi)
 2358 
 2359         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2360         neg = [False, True]
 2361         tle = ['a', 'b']
 2362         data = []
 2363         for i in range(2):
 2364             data.append([
 2365                 # The pivot.
 2366                 [ 1, 'PIV',   1, 'Piv',  pivot],
 2367 
 2368                 # The rotor.
 2369                 [ 1, 'RTX',   2, 'CTR',  pivot],
 2370                 [ 2, 'RTX',   3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2371                 [ 3, 'RTB',   4, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2372                 [ 4, 'RTB', 186, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])],
 2373                 [ 5, 'RTB', 368, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2374                 [ 6, 'RTB', 550, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=axis_theta, neg=neg[i])],
 2375                 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])],
 2376 
 2377                 # The cone edge.
 2378                 [ 3, 'CNE', 733, 'APX',  pivot],
 2379                 [ 3, 'CNE', 734, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], neg=neg[i])],
 2380                 [ 3, 'CNE', 735, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], neg=neg[i])],
 2381                 [ 3, 'CNE', 736, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], neg=neg[i])],
 2382                 [ 3, 'CNE', 737, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], neg=neg[i])],
 2383                 [ 3, 'CNE', 738, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], neg=neg[i])],
 2384                 [ 3, 'CNE', 739, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], neg=neg[i])],
 2385                 [ 3, 'CNE', 740, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], neg=neg[i])],
 2386                 [ 3, 'CNE', 741, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], neg=neg[i])],
 2387                 [ 3, 'CNE', 742, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], neg=neg[i])],
 2388                 [ 3, 'CNE', 743, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], neg=neg[i])],
 2389 
 2390                 # Titles.
 2391                 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
 2392             ])
 2393 
 2394         # Check the data. 
 2395         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 2396 
 2397 
 2398     def test_pdb_model_iso_cone_free_rotor_xz_plane_tilt(self):
 2399         """Check the frame_order.pdb_model user function PDB file for the free rotor isotropic cone model with a xz-plane tilt."""
 2400 
 2401         # Init.
 2402         theta = 2.0
 2403         pivot = array([1, 1, 1], float64)
 2404         l = 40.0
 2405         l_rotor = l + 5.0
 2406 
 2407         # The axis parameters, and printout.
 2408         axis_theta = -pi/4.0
 2409         axis = create_rotor_axis_spherical(axis_theta, 0.0)
 2410         print("Rotor axis:  %s" % axis)
 2411         R = zeros((3, 3), float64)
 2412         axis_angle_to_R([0, 1, 0], axis_theta, R)
 2413 
 2414         # Set up.
 2415         self.setup_model(pipe_name='PDB model', model='iso cone, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta)
 2416 
 2417         # Create the PDB.
 2418         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 2419 
 2420         # The xy-plane vectors.
 2421         inc = 2.0 * pi / 10.0
 2422         vectors = zeros((10, 3), float64)
 2423         for i in range(10):
 2424             # The angle phi.
 2425             phi = inc * i
 2426 
 2427             # The xy-plane, starting along the x-axis.
 2428             vectors[i, 0] = cos(phi)
 2429             vectors[i, 1] = sin(phi)
 2430 
 2431         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2432         neg = [False, True]
 2433         tle = ['a', 'b']
 2434         data = []
 2435         for i in range(2):
 2436             data.append([
 2437                 # The pivot.
 2438                 [ 1, 'PIV',   1, 'Piv',  pivot],
 2439 
 2440                 # The rotor.
 2441                 [ 1, 'RTX',   2, 'CTR',  pivot],
 2442                 [ 2, 'RTX',   3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2443                 [ 3, 'RTB',   4, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2444                 [ 4, 'RTB', 186, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2445                 [ 5, 'RTB', 368, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2446                 [ 6, 'RTB', 550, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2447                 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])],
 2448 
 2449                 # The cone edge.
 2450                 [ 3, 'CNE', 733, 'APX',  pivot],
 2451                 [ 3, 'CNE', 734, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], R=R, neg=neg[i])],
 2452                 [ 3, 'CNE', 735, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], R=R, neg=neg[i])],
 2453                 [ 3, 'CNE', 736, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], R=R, neg=neg[i])],
 2454                 [ 3, 'CNE', 737, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], R=R, neg=neg[i])],
 2455                 [ 3, 'CNE', 738, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], R=R, neg=neg[i])],
 2456                 [ 3, 'CNE', 739, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], R=R, neg=neg[i])],
 2457                 [ 3, 'CNE', 740, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], R=R, neg=neg[i])],
 2458                 [ 3, 'CNE', 741, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], R=R, neg=neg[i])],
 2459                 [ 3, 'CNE', 742, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], R=R, neg=neg[i])],
 2460                 [ 3, 'CNE', 743, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], R=R, neg=neg[i])],
 2461 
 2462                 # Titles.
 2463                 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
 2464             ])
 2465 
 2466         # Check the data. 
 2467         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 2468 
 2469 
 2470     def test_pdb_model_iso_cone_free_rotor_z_axis(self):
 2471         """Check the frame_order.pdb_model user function PDB file for the free rotor isotropic cone model along the z-axis."""
 2472 
 2473         # Init.
 2474         theta = 2.0
 2475         pivot = array([1, 0, -2], float64)
 2476         l = 25.0
 2477         l_rotor = l + 5.0
 2478 
 2479         # The axis parameters, and printout.
 2480         axis_theta = 0.0
 2481         axis_phi = 0.0
 2482         print("Rotor axis:  %s" % create_rotor_axis_spherical(axis_theta, axis_phi))
 2483 
 2484         # Set up.
 2485         self.setup_model(pipe_name='PDB model', model='iso cone, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta)
 2486 
 2487         # Create the PDB.
 2488         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 2489 
 2490         # The xy-plane vectors.
 2491         inc = 2.0 * pi / 10.0
 2492         vectors = zeros((10, 3), float64)
 2493         for i in range(10):
 2494             # The angle phi.
 2495             phi = inc * i
 2496 
 2497             # The xy-plane, starting along the x-axis.
 2498             vectors[i, 0] = cos(phi)
 2499             vectors[i, 1] = sin(phi)
 2500 
 2501         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2502         neg = [False, True]
 2503         tle = ['a', 'b']
 2504         data = []
 2505         for i in range(2):
 2506             data.append([
 2507                 # The pivot.
 2508                 [ 1, 'PIV',   1, 'Piv',  pivot],
 2509 
 2510                 # The rotor.
 2511                 [ 1, 'RTX',   2, 'CTR',  pivot],
 2512                 [ 2, 'RTX',   3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2513                 [ 3, 'RTB',   4, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2514                 [ 4, 'RTB', 186, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2515                 [ 5, 'RTB', 368, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2516                 [ 6, 'RTB', 550, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=axis_theta, neg=neg[i])],
 2517                 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=axis_theta, neg=neg[i])],
 2518 
 2519                 # The cone edge.
 2520                 [ 3, 'CNE', 733, 'APX',  pivot],
 2521                 [ 3, 'CNE', 734, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], neg=neg[i])],
 2522                 [ 3, 'CNE', 735, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], neg=neg[i])],
 2523                 [ 3, 'CNE', 736, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], neg=neg[i])],
 2524                 [ 3, 'CNE', 737, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], neg=neg[i])],
 2525                 [ 3, 'CNE', 738, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], neg=neg[i])],
 2526                 [ 3, 'CNE', 739, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], neg=neg[i])],
 2527                 [ 3, 'CNE', 740, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], neg=neg[i])],
 2528                 [ 3, 'CNE', 741, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], neg=neg[i])],
 2529                 [ 3, 'CNE', 742, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], neg=neg[i])],
 2530                 [ 3, 'CNE', 743, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], neg=neg[i])],
 2531 
 2532                 # Titles.
 2533                 [ 1, 'TLE', 804, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
 2534             ])
 2535 
 2536         # Check the data. 
 2537         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 2538 
 2539 
 2540     def test_pdb_model_iso_cone_torsionless_xz_plane_tilt(self):
 2541         """Check the frame_order.pdb_model user function PDB file for the torsionless isotropic cone model with a xz-plane tilt."""
 2542 
 2543         # Init.
 2544         theta = 2.0
 2545         pivot = array([1, 1, 1], float64)
 2546         l = 40.0
 2547         l_rotor = l + 5.0
 2548 
 2549         # The axis parameters, and printout.
 2550         axis_theta = -pi/4.0
 2551         axis = create_rotor_axis_spherical(axis_theta, 0.0)
 2552         print("Rotor axis:  %s" % axis)
 2553         R = zeros((3, 3), float64)
 2554         axis_angle_to_R([0, 1, 0], axis_theta, R)
 2555 
 2556         # Set up.
 2557         self.setup_model(pipe_name='PDB model', model='iso cone, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta)
 2558 
 2559         # Create the PDB.
 2560         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 2561 
 2562         # The xy-plane vectors.
 2563         inc = 2.0 * pi / 10.0
 2564         vectors = zeros((10, 3), float64)
 2565         for i in range(10):
 2566             # The angle phi.
 2567             phi = inc * i
 2568 
 2569             # The xy-plane, starting along the x-axis.
 2570             vectors[i, 0] = cos(phi)
 2571             vectors[i, 1] = sin(phi)
 2572 
 2573         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2574         neg = [False, True]
 2575         tle = ['a', 'b']
 2576         data = []
 2577         for i in range(2):
 2578             data.append([
 2579                 # The pivot.
 2580                 [ 1, 'PIV',   1, 'Piv',  pivot],
 2581 
 2582                 # The axis system.
 2583                 [ 2, 'AXE',   2, 'R',  pivot],
 2584                 [ 2, 'AXE',   3, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=axis_theta, neg=neg[i])],
 2585                 [ 2, 'AXE',   4, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=axis_theta, neg=neg[i])],
 2586 
 2587                 # The cone edge.
 2588                 [ 3, 'CNE',   5, 'APX',  pivot],
 2589                 [ 3, 'CNE',   6, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], R=R, neg=neg[i])],
 2590                 [ 3, 'CNE',   7, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], R=R, neg=neg[i])],
 2591                 [ 3, 'CNE',   8, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], R=R, neg=neg[i])],
 2592                 [ 3, 'CNE',   9, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], R=R, neg=neg[i])],
 2593                 [ 3, 'CNE',  10, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], R=R, neg=neg[i])],
 2594                 [ 3, 'CNE',  11, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], R=R, neg=neg[i])],
 2595                 [ 3, 'CNE',  12, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], R=R, neg=neg[i])],
 2596                 [ 3, 'CNE',  13, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], R=R, neg=neg[i])],
 2597                 [ 3, 'CNE',  14, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], R=R, neg=neg[i])],
 2598                 [ 3, 'CNE',  15, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], R=R, neg=neg[i])],
 2599 
 2600                 # Titles.
 2601                 [ 1, 'TLE',  76, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
 2602             ])
 2603 
 2604         # Check the data. 
 2605         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 2606 
 2607 
 2608     def test_pdb_model_iso_cone_torsionless_z_axis(self):
 2609         """Check the frame_order.pdb_model user function PDB file for the torsionless isotropic cone model along the z-axis."""
 2610 
 2611         # Init.
 2612         theta = 2.0
 2613         pivot = array([1, 0, -2], float64)
 2614         l = 25.0
 2615         l_rotor = l + 5.0
 2616 
 2617         # The axis parameters, and printout.
 2618         axis_theta = 0.0
 2619         print("Rotor axis:  %s" % create_rotor_axis_spherical(axis_theta, 0.0))
 2620 
 2621         # Set up.
 2622         self.setup_model(pipe_name='PDB model', model='iso cone, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_theta=axis_theta, axis_phi=0.0, cone_theta=theta)
 2623 
 2624         # Create the PDB.
 2625         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 2626 
 2627         # The xy-plane vectors.
 2628         inc = 2.0 * pi / 10.0
 2629         vectors = zeros((10, 3), float64)
 2630         for i in range(10):
 2631             # The angle phi.
 2632             phi = inc * i
 2633 
 2634             # The xy-plane, starting along the x-axis.
 2635             vectors[i, 0] = cos(phi)
 2636             vectors[i, 1] = sin(phi)
 2637 
 2638         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2639         neg = [False, True]
 2640         tle = ['a', 'b']
 2641         data = []
 2642         for i in range(2):
 2643             data.append([
 2644                 # The pivot.
 2645                 [ 1, 'PIV',   1, 'Piv',  pivot],
 2646 
 2647                 # The axis system.
 2648                 [ 2, 'AXE',   2, 'R',  pivot],
 2649                 [ 2, 'AXE',   3, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=axis_theta, neg=neg[i])],
 2650                 [ 2, 'AXE',   4, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=axis_theta, neg=neg[i])],
 2651 
 2652                 # The cone edge.
 2653                 [ 3, 'CNE',   5, 'APX',  pivot],
 2654                 [ 3, 'CNE',   6, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[0], neg=neg[i])],
 2655                 [ 3, 'CNE',   7, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[1], neg=neg[i])],
 2656                 [ 3, 'CNE',   8, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[2], neg=neg[i])],
 2657                 [ 3, 'CNE',   9, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[3], neg=neg[i])],
 2658                 [ 3, 'CNE',  10, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[4], neg=neg[i])],
 2659                 [ 3, 'CNE',  11, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[5], neg=neg[i])],
 2660                 [ 3, 'CNE',  12, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[6], neg=neg[i])],
 2661                 [ 3, 'CNE',  13, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[7], neg=neg[i])],
 2662                 [ 3, 'CNE',  14, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[8], neg=neg[i])],
 2663                 [ 3, 'CNE',  15, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta, axis=vectors[9], neg=neg[i])],
 2664 
 2665                 # Titles.
 2666                 [ 1, 'TLE',  76, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=axis_theta, neg=neg[i])]
 2667             ])
 2668 
 2669         # Check the data. 
 2670         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 2671 
 2672 
 2673     def test_pdb_model_pseudo_ellipse_xz_plane_tilt(self):
 2674         """Check the frame_order.pdb_model user function PDB file for the pseudo-ellipse model with a xz-plane tilt."""
 2675 
 2676         # Init.
 2677         theta_x = 2.0
 2678         theta_y = 0.1
 2679         pivot = array([1, -2, 1.1], float64)
 2680         l = 50.0
 2681         l_rotor = l + 5.0
 2682 
 2683         # The axis parameters, and printout.
 2684         eigen_beta = -pi/2.0
 2685         R = zeros((3, 3), float64)
 2686         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 2687         print("Motional eigenframe:\n%s" % R)
 2688 
 2689         # Set up.
 2690         self.setup_model(pipe_name='PDB model', model='pseudo-ellipse', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y, cone_sigma_max=0.0)
 2691 
 2692         # Create the PDB.
 2693         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 2694 
 2695         # The xy-plane vectors and angles.
 2696         inc = 2.0 * pi / 10.0
 2697         vectors = zeros((10, 3), float64)
 2698         theta_max = zeros(10, float64)
 2699         for i in range(10):
 2700             # The angle phi.
 2701             phi = inc * i
 2702 
 2703             # The xy-plane, starting along the x-axis.
 2704             vectors[i, 0] = cos(phi)
 2705             vectors[i, 1] = sin(phi)
 2706 
 2707             # The cone opening angle.
 2708             theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
 2709 
 2710         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2711         neg = [False, True]
 2712         tle = ['a', 'b']
 2713         data = []
 2714         for i in range(2):
 2715             data.append([
 2716                 # The pivot.
 2717                 [ 1, 'PIV',   1, 'Piv',  pivot],
 2718 
 2719                 # The rotor.
 2720                 [ 1, 'RTX',   2, 'CTR',  pivot],
 2721                 [ 2, 'RTX',   3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
 2722                 [ 3, 'RTB',   4, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
 2723                 [ 4, 'RTB', 186, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=eigen_beta, neg=neg[i])],
 2724                 [ 5, 'RTB', 368, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
 2725                 [ 6, 'RTB', 550, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=eigen_beta, neg=neg[i])],
 2726                 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=eigen_beta, neg=neg[i])],
 2727 
 2728                 # The axis system.
 2729                 [ 1, 'AXE', 733, 'R',  pivot],
 2730                 [ 2, 'AXE', 734, 'R',  pivot],
 2731                 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0+eigen_beta, neg=neg[i])],
 2732                 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0+eigen_beta, neg=neg[i])],
 2733                 [ 2, 'AXE', 737, 'R',  pivot],
 2734                 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])],
 2735                 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])],
 2736 
 2737                 # The cone edge.
 2738                 [ 3, 'CNE', 740, 'APX',  pivot],
 2739                 [ 3, 'CNE', 741, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], R=R, neg=neg[i])],
 2740                 [ 3, 'CNE', 742, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], R=R, neg=neg[i])],
 2741                 [ 3, 'CNE', 743, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], R=R, neg=neg[i])],
 2742                 [ 3, 'CNE', 744, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], R=R, neg=neg[i])],
 2743                 [ 3, 'CNE', 745, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], R=R, neg=neg[i])],
 2744                 [ 3, 'CNE', 746, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], R=R, neg=neg[i])],
 2745                 [ 3, 'CNE', 747, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], R=R, neg=neg[i])],
 2746                 [ 3, 'CNE', 748, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], R=R, neg=neg[i])],
 2747                 [ 3, 'CNE', 749, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], R=R, neg=neg[i])],
 2748                 [ 3, 'CNE', 750, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], R=R, neg=neg[i])],
 2749 
 2750                 # Titles.
 2751                 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=eigen_beta, neg=neg[i])]
 2752             ])
 2753 
 2754         # Check the data. 
 2755         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 2756 
 2757 
 2758     def test_pdb_model_pseudo_ellipse_z_axis(self):
 2759         """Check the frame_order.pdb_model user function PDB file for the pseudo-ellipse model along the z-axis."""
 2760 
 2761         # Init.
 2762         theta_x = 2.0
 2763         theta_y = 0.1
 2764         pivot = array([1, 1, 1], float64)
 2765         l = 40.0
 2766         l_rotor = l + 5.0
 2767 
 2768         # The axis parameters, and printout.
 2769         eigen_beta = 0.0
 2770         R = zeros((3, 3), float64)
 2771         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 2772         print("Motional eigenframe:\n%s" % R)
 2773 
 2774         # Set up.
 2775         self.setup_model(pipe_name='PDB model', model='pseudo-ellipse', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y, cone_sigma_max=0.0)
 2776 
 2777         # Create the PDB.
 2778         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 2779 
 2780         # The xy-plane vectors and angles.
 2781         inc = 2.0 * pi / 10.0
 2782         vectors = zeros((10, 3), float64)
 2783         theta_max = zeros(10, float64)
 2784         for i in range(10):
 2785             # The angle phi.
 2786             phi = inc * i
 2787 
 2788             # The xy-plane, starting along the x-axis.
 2789             vectors[i, 0] = cos(phi)
 2790             vectors[i, 1] = sin(phi)
 2791 
 2792             # The cone opening angle.
 2793             theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
 2794 
 2795         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2796         neg = [False, True]
 2797         tle = ['a', 'b']
 2798         data = []
 2799         for i in range(2):
 2800             data.append([
 2801                 # The pivot.
 2802                 [ 1, 'PIV',   1, 'Piv',  pivot],
 2803 
 2804                 # The rotor.
 2805                 [ 1, 'RTX',   2, 'CTR',  pivot],
 2806                 [ 2, 'RTX',   3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
 2807                 [ 3, 'RTB',   4, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
 2808                 [ 4, 'RTB', 186, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=0.0, neg=neg[i])],
 2809                 [ 5, 'RTB', 368, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
 2810                 [ 6, 'RTB', 550, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor-2.0, angle=0.0, neg=neg[i])],
 2811                 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=0.0, neg=neg[i])],
 2812 
 2813                 # The axis system.
 2814                 [ 1, 'AXE', 733, 'R',  pivot],
 2815                 [ 2, 'AXE', 734, 'R',  pivot],
 2816                 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, neg=neg[i])],
 2817                 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, neg=neg[i])],
 2818                 [ 2, 'AXE', 737, 'R',  pivot],
 2819                 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])],
 2820                 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])],
 2821 
 2822                 # The cone edge.
 2823                 [ 3, 'CNE', 740, 'APX',  pivot],
 2824                 [ 3, 'CNE', 741, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], neg=neg[i])],
 2825                 [ 3, 'CNE', 742, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], neg=neg[i])],
 2826                 [ 3, 'CNE', 743, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], neg=neg[i])],
 2827                 [ 3, 'CNE', 744, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], neg=neg[i])],
 2828                 [ 3, 'CNE', 745, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], neg=neg[i])],
 2829                 [ 3, 'CNE', 746, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], neg=neg[i])],
 2830                 [ 3, 'CNE', 747, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], neg=neg[i])],
 2831                 [ 3, 'CNE', 748, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], neg=neg[i])],
 2832                 [ 3, 'CNE', 749, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], neg=neg[i])],
 2833                 [ 3, 'CNE', 750, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], neg=neg[i])],
 2834 
 2835                 # Titles.
 2836                 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=0.0, neg=neg[i])]
 2837             ])
 2838 
 2839         # Check the data. 
 2840         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 2841 
 2842 
 2843     def test_pdb_model_pseudo_ellipse_free_rotor_xz_plane_tilt(self):
 2844         """Check the frame_order.pdb_model user function PDB file for the free rotor pseudo-ellipse model with a xz-plane tilt."""
 2845 
 2846         # Init.
 2847         theta_x = 2.0
 2848         theta_y = 0.1
 2849         pivot = array([1, -2, 1.1], float64)
 2850         l = 50.0
 2851         l_rotor = l + 5.0
 2852 
 2853         # The axis parameters, and printout.
 2854         eigen_beta = -pi/2.0
 2855         R = zeros((3, 3), float64)
 2856         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 2857         print("Motional eigenframe:\n%s" % R)
 2858 
 2859         # Set up.
 2860         self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y)
 2861 
 2862         # Create the PDB.
 2863         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 2864 
 2865         # The xy-plane vectors and angles.
 2866         inc = 2.0 * pi / 10.0
 2867         vectors = zeros((10, 3), float64)
 2868         theta_max = zeros(10, float64)
 2869         for i in range(10):
 2870             # The angle phi.
 2871             phi = inc * i
 2872 
 2873             # The xy-plane, starting along the x-axis.
 2874             vectors[i, 0] = cos(phi)
 2875             vectors[i, 1] = sin(phi)
 2876 
 2877             # The cone opening angle.
 2878             theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
 2879 
 2880         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2881         neg = [False, True]
 2882         tle = ['a', 'b']
 2883         data = []
 2884         for i in range(2):
 2885             data.append([
 2886                 # The pivot.
 2887                 [ 1, 'PIV',   1, 'Piv',  pivot],
 2888 
 2889                 # The rotor.
 2890                 [ 1, 'RTX',   2, 'CTR',  pivot],
 2891                 [ 2, 'RTX',   3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
 2892                 [ 3, 'RTB',   4, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
 2893                 [ 4, 'RTB', 186, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
 2894                 [ 5, 'RTB', 368, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
 2895                 [ 6, 'RTB', 550, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=eigen_beta, neg=neg[i])],
 2896                 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=eigen_beta, neg=neg[i])],
 2897 
 2898                 # The axis system.
 2899                 [ 1, 'AXE', 733, 'R',  pivot],
 2900                 [ 2, 'AXE', 734, 'R',  pivot],
 2901                 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0+eigen_beta, neg=neg[i])],
 2902                 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0+eigen_beta, neg=neg[i])],
 2903                 [ 2, 'AXE', 737, 'R',  pivot],
 2904                 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])],
 2905                 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])],
 2906 
 2907                 # The cone edge.
 2908                 [ 3, 'CNE', 740, 'APX',  pivot],
 2909                 [ 3, 'CNE', 741, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], R=R, neg=neg[i])],
 2910                 [ 3, 'CNE', 742, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], R=R, neg=neg[i])],
 2911                 [ 3, 'CNE', 743, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], R=R, neg=neg[i])],
 2912                 [ 3, 'CNE', 744, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], R=R, neg=neg[i])],
 2913                 [ 3, 'CNE', 745, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], R=R, neg=neg[i])],
 2914                 [ 3, 'CNE', 746, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], R=R, neg=neg[i])],
 2915                 [ 3, 'CNE', 747, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], R=R, neg=neg[i])],
 2916                 [ 3, 'CNE', 748, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], R=R, neg=neg[i])],
 2917                 [ 3, 'CNE', 749, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], R=R, neg=neg[i])],
 2918                 [ 3, 'CNE', 750, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], R=R, neg=neg[i])],
 2919 
 2920                 # Titles.
 2921                 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=eigen_beta, neg=neg[i])]
 2922             ])
 2923 
 2924         # Check the data. 
 2925         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 2926 
 2927 
 2928     def test_pdb_model_pseudo_ellipse_free_rotor_z_axis(self):
 2929         """Check the frame_order.pdb_model user function PDB file for the free rotor pseudo-ellipse model along the z-axis."""
 2930 
 2931         # Init.
 2932         theta_x = 2.0
 2933         theta_y = 0.1
 2934         pivot = array([1, 1, 1], float64)
 2935         l = 40.0
 2936         l_rotor = l + 5.0
 2937 
 2938         # The axis parameters, and printout.
 2939         eigen_beta = 0.0
 2940         R = zeros((3, 3), float64)
 2941         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 2942         print("Motional eigenframe:\n%s" % R)
 2943 
 2944         # Set up.
 2945         self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, free rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y)
 2946 
 2947         # Create the PDB.
 2948         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 2949 
 2950         # The xy-plane vectors and angles.
 2951         inc = 2.0 * pi / 10.0
 2952         vectors = zeros((10, 3), float64)
 2953         theta_max = zeros(10, float64)
 2954         for i in range(10):
 2955             # The angle phi.
 2956             phi = inc * i
 2957 
 2958             # The xy-plane, starting along the x-axis.
 2959             vectors[i, 0] = cos(phi)
 2960             vectors[i, 1] = sin(phi)
 2961 
 2962             # The cone opening angle.
 2963             theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
 2964 
 2965         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 2966         neg = [False, True]
 2967         tle = ['a', 'b']
 2968         data = []
 2969         for i in range(2):
 2970             data.append([
 2971                 # The pivot.
 2972                 [ 1, 'PIV',   1, 'Piv',  pivot],
 2973 
 2974                 # The rotor.
 2975                 [ 1, 'RTX',   2, 'CTR',  pivot],
 2976                 [ 2, 'RTX',   3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
 2977                 [ 3, 'RTB',   4, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
 2978                 [ 4, 'RTB', 186, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
 2979                 [ 5, 'RTB', 368, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
 2980                 [ 6, 'RTB', 550, 'BLO',  self.rotate_from_Z(origin=pivot, length=l_rotor, angle=0.0, neg=neg[i])],
 2981                 [ 7, 'RTL', 732, 'z-ax', self.rotate_from_Z(origin=pivot, length=l_rotor+2.0, angle=0.0, neg=neg[i])],
 2982 
 2983                 # The axis system.
 2984                 [ 1, 'AXE', 733, 'R',  pivot],
 2985                 [ 2, 'AXE', 734, 'R',  pivot],
 2986                 [ 2, 'AXE', 735, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, neg=neg[i])],
 2987                 [ 2, 'AXE', 736, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, neg=neg[i])],
 2988                 [ 2, 'AXE', 737, 'R',  pivot],
 2989                 [ 2, 'AXE', 738, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])],
 2990                 [ 2, 'AXE', 739, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])],
 2991 
 2992                 # The cone edge.
 2993                 [ 3, 'CNE', 740, 'APX',  pivot],
 2994                 [ 3, 'CNE', 741, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], neg=neg[i])],
 2995                 [ 3, 'CNE', 742, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], neg=neg[i])],
 2996                 [ 3, 'CNE', 743, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], neg=neg[i])],
 2997                 [ 3, 'CNE', 744, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], neg=neg[i])],
 2998                 [ 3, 'CNE', 745, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], neg=neg[i])],
 2999                 [ 3, 'CNE', 746, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], neg=neg[i])],
 3000                 [ 3, 'CNE', 747, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], neg=neg[i])],
 3001                 [ 3, 'CNE', 748, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], neg=neg[i])],
 3002                 [ 3, 'CNE', 749, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], neg=neg[i])],
 3003                 [ 3, 'CNE', 750, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], neg=neg[i])],
 3004 
 3005                 # Titles.
 3006                 [ 1, 'TLE', 811, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=0.0, neg=neg[i])]
 3007             ])
 3008 
 3009         # Check the data. 
 3010         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 3011 
 3012 
 3013     def test_pdb_model_pseudo_ellipse_torsionless_xz_plane_tilt(self):
 3014         """Check the frame_order.pdb_model user function PDB file for the torsionless pseudo-ellipse model with a xz-plane tilt."""
 3015 
 3016         # Init.
 3017         theta_x = 2.0
 3018         theta_y = 0.1
 3019         pivot = array([1, -2, 1.1], float64)
 3020         l = 50.0
 3021         l_rotor = l + 5.0
 3022 
 3023         # The axis parameters, and printout.
 3024         eigen_beta = -pi/2.0
 3025         R = zeros((3, 3), float64)
 3026         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 3027         print("Motional eigenframe:\n%s" % R)
 3028 
 3029         # Set up.
 3030         self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y)
 3031 
 3032         # Create the PDB.
 3033         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 3034 
 3035         # The xy-plane vectors and angles.
 3036         inc = 2.0 * pi / 10.0
 3037         vectors = zeros((10, 3), float64)
 3038         theta_max = zeros(10, float64)
 3039         for i in range(10):
 3040             # The angle phi.
 3041             phi = inc * i
 3042 
 3043             # The xy-plane, starting along the x-axis.
 3044             vectors[i, 0] = cos(phi)
 3045             vectors[i, 1] = sin(phi)
 3046 
 3047             # The cone opening angle.
 3048             theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
 3049 
 3050         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 3051         neg = [False, True]
 3052         tle = ['a', 'b']
 3053         data = []
 3054         for i in range(2):
 3055             data.append([
 3056                 # The pivot.
 3057                 [ 1, 'PIV',   1, 'Piv',  pivot],
 3058 
 3059                 # The axis system.
 3060                 [ 1, 'AXE',   2, 'R',  pivot],
 3061                 [ 2, 'AXE',   3, 'R',  pivot],
 3062                 [ 2, 'AXE',   4, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, R=R, neg=neg[i])],
 3063                 [ 2, 'AXE',   5, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, R=R, neg=neg[i])],
 3064                 [ 2, 'AXE',   6, 'R',  pivot],
 3065                 [ 2, 'AXE',   7, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, R=R, neg=neg[i])],
 3066                 [ 2, 'AXE',   8, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, R=R, neg=neg[i])],
 3067                 [ 2, 'AXE',   9, 'R',  pivot],
 3068                 [ 2, 'AXE',  10, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, R=R, neg=neg[i])],
 3069                 [ 2, 'AXE',  11, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=0.0, R=R, neg=neg[i])],
 3070 
 3071                 # The cone edge.
 3072                 [ 3, 'CNE',  12, 'APX',  pivot],
 3073                 [ 3, 'CNE',  13, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], R=R, neg=neg[i])],
 3074                 [ 3, 'CNE',  14, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], R=R, neg=neg[i])],
 3075                 [ 3, 'CNE',  15, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], R=R, neg=neg[i])],
 3076                 [ 3, 'CNE',  16, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], R=R, neg=neg[i])],
 3077                 [ 3, 'CNE',  17, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], R=R, neg=neg[i])],
 3078                 [ 3, 'CNE',  18, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], R=R, neg=neg[i])],
 3079                 [ 3, 'CNE',  19, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], R=R, neg=neg[i])],
 3080                 [ 3, 'CNE',  20, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], R=R, neg=neg[i])],
 3081                 [ 3, 'CNE',  21, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], R=R, neg=neg[i])],
 3082                 [ 3, 'CNE',  22, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], R=R, neg=neg[i])],
 3083 
 3084                 # Titles.
 3085                 [ 1, 'TLE',  83, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=eigen_beta, neg=neg[i])]
 3086             ])
 3087 
 3088         # Check the data. 
 3089         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 3090 
 3091 
 3092     def test_pdb_model_pseudo_ellipse_torsionless_z_axis(self):
 3093         """Check the frame_order.pdb_model user function PDB file for the torsionless pseudo-ellipse model along the z-axis."""
 3094 
 3095         # Init.
 3096         theta_x = 2.0
 3097         theta_y = 0.1
 3098         pivot = array([1, 1, 1], float64)
 3099         l = 40.0
 3100         l_rotor = l + 5.0
 3101 
 3102         # The axis parameters, and printout.
 3103         eigen_beta = 0.0
 3104         R = zeros((3, 3), float64)
 3105         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 3106         print("Motional eigenframe:\n%s" % R)
 3107 
 3108         # Set up.
 3109         self.setup_model(pipe_name='PDB model', model='pseudo-ellipse, torsionless', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_theta_x=theta_x, cone_theta_y=theta_y)
 3110 
 3111         # Create the PDB.
 3112         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=10, size=l)
 3113 
 3114         # The xy-plane vectors and angles.
 3115         inc = 2.0 * pi / 10.0
 3116         vectors = zeros((10, 3), float64)
 3117         theta_max = zeros(10, float64)
 3118         for i in range(10):
 3119             # The angle phi.
 3120             phi = inc * i
 3121 
 3122             # The xy-plane, starting along the x-axis.
 3123             vectors[i, 0] = cos(phi)
 3124             vectors[i, 1] = sin(phi)
 3125 
 3126             # The cone opening angle.
 3127             theta_max[i] = theta_x * theta_y / sqrt((cos(phi)*theta_y)**2 + (sin(phi)*theta_x)**2)
 3128 
 3129         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 3130         neg = [False, True]
 3131         tle = ['a', 'b']
 3132         data = []
 3133         for i in range(2):
 3134             data.append([
 3135                 # The pivot.
 3136                 [ 1, 'PIV',   1, 'Piv',  pivot],
 3137 
 3138                 # The axis system.
 3139                 [ 1, 'AXE',   2, 'R',  pivot],
 3140                 [ 2, 'AXE',   3, 'R',  pivot],
 3141                 [ 2, 'AXE',   4, 'x-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, neg=neg[i])],
 3142                 [ 2, 'AXE',   5, 'x-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, neg=neg[i])],
 3143                 [ 2, 'AXE',   6, 'R',  pivot],
 3144                 [ 2, 'AXE',   7, 'y-ax', self.rotate_from_Z(origin=pivot, length=l, angle=pi/2.0, axis=y_axis, neg=neg[i])],
 3145                 [ 2, 'AXE',   8, 'y-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=pi/2.0, axis=y_axis, neg=neg[i])],
 3146                 [ 2, 'AXE',   9, 'R',  pivot],
 3147                 [ 2, 'AXE',  10, 'z-ax', self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=neg[i])],
 3148                 [ 2, 'AXE',  11, 'z-ax', self.rotate_from_Z(origin=pivot, length=l*1.1, angle=0.0, neg=neg[i])],
 3149 
 3150                 # The cone edge.
 3151                 [ 3, 'CNE',  12, 'APX',  pivot],
 3152                 [ 3, 'CNE',  13, 'H2',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[0], axis=vectors[0], neg=neg[i])],
 3153                 [ 3, 'CNE',  14, 'H3',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[1], axis=vectors[1], neg=neg[i])],
 3154                 [ 3, 'CNE',  15, 'H4',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[2], axis=vectors[2], neg=neg[i])],
 3155                 [ 3, 'CNE',  16, 'H5',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[3], axis=vectors[3], neg=neg[i])],
 3156                 [ 3, 'CNE',  17, 'H6',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[4], axis=vectors[4], neg=neg[i])],
 3157                 [ 3, 'CNE',  18, 'H7',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[5], axis=vectors[5], neg=neg[i])],
 3158                 [ 3, 'CNE',  19, 'H8',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[6], axis=vectors[6], neg=neg[i])],
 3159                 [ 3, 'CNE',  20, 'H9',   self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[7], axis=vectors[7], neg=neg[i])],
 3160                 [ 3, 'CNE',  21, 'H10',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[8], axis=vectors[8], neg=neg[i])],
 3161                 [ 3, 'CNE',  22, 'H11',  self.rotate_from_Z(origin=pivot, length=l, angle=theta_max[9], axis=vectors[9], neg=neg[i])],
 3162 
 3163                 # Titles.
 3164                 [ 1, 'TLE',  83, tle[i], self.rotate_from_Z(origin=pivot, length=l+10, angle=0.0, neg=neg[i])]
 3165             ])
 3166 
 3167         # Check the data. 
 3168         self.check_pdb_model_representation(data=data, files=['frame_order_A.pdb', 'frame_order_B.pdb'])
 3169 
 3170 
 3171     def test_pdb_model_rotor_xz_plane_tilt(self):
 3172         """Check the frame_order.pdb_model user function PDB file for the rotor model with a xz-plane tilt."""
 3173 
 3174         # Init.
 3175         pivot = array([1, 0, 1], float64)
 3176         l = 100.0
 3177 
 3178         # The axis alpha parameter, and printout.
 3179         axis_alpha = pi / 2.0
 3180         axis =  create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64))
 3181         print("\nRotor axis:\n    %s" % axis)
 3182         print("Rotor apex (100*axis + [1, 0, 1]):\n    %s" % (l*axis + pivot))
 3183 
 3184         # Set up.
 3185         self.setup_model(pipe_name='PDB model', model='rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha, cone_sigma_max=0.0)
 3186 
 3187         # Create the PDB.
 3188         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=100.0)
 3189 
 3190         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 3191         data = [
 3192             [ 1, 'PIV',    1, 'Piv',  pivot],
 3193             [ 1, 'RTX',    2, 'CTR',  pivot],
 3194             [ 2, 'RTX',    3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
 3195             [ 3, 'RTX',    4, 'PRP',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
 3196             [ 4, 'RTB',    5, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
 3197             [ 5, 'RTB',  187, 'BLO',  self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0)],
 3198             [ 6, 'RTB',  369, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0)],
 3199             [ 7, 'RTB',  551, 'BLO',  self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0)],
 3200             [ 8, 'RTB',  733, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
 3201             [ 9, 'RTB',  915, 'BLO',  self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0, neg=True)],
 3202             [10, 'RTB', 1097, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=-pi/4.0, neg=True)],
 3203             [11, 'RTB', 1279, 'BLO',  self.rotate_from_Z(origin=pivot, length=l-2.0, angle=-pi/4.0, neg=True)],
 3204             [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0)],
 3205             [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=-pi/4.0, neg=True)]
 3206         ]
 3207 
 3208         # Check the data. 
 3209         self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
 3210 
 3211 
 3212     def test_pdb_model_rotor_z_axis(self):
 3213         """Check the frame_order.pdb_model user function PDB file for the rotor model along the z-axis."""
 3214 
 3215         # Init.
 3216         pivot = array([1, 0, 0], float64)
 3217         l = 30.0
 3218 
 3219         # The axis alpha parameter, and printout.
 3220         axis_alpha = pi / 2.0
 3221         axis = create_rotor_axis_alpha(pi/2, pivot, array([0, 0, 0], float64))
 3222         print("\nRotor axis:  %s" % axis)
 3223         print("Rotor apex (100*axis + [1, 0, 0]):\n    %s" % (l*axis + pivot))
 3224 
 3225         # Set up.
 3226         self.setup_model(pipe_name='PDB model', model='rotor', pivot=pivot, ave_pos_x=0.0, ave_pos_y=0.0, ave_pos_z=0.0, ave_pos_alpha=0.0, ave_pos_beta=0.0, ave_pos_gamma=0.0, axis_alpha=axis_alpha, cone_sigma_max=0.0)
 3227 
 3228         # Create the PDB.
 3229         self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=l)
 3230 
 3231         # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot.
 3232         data = [
 3233             [ 1, 'PIV',    1, 'Piv',  pivot],
 3234             [ 1, 'RTX',    2, 'CTR',  pivot],
 3235             [ 2, 'RTX',    3, 'PRP',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
 3236             [ 3, 'RTX',    4, 'PRP',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
 3237             [ 4, 'RTB',    5, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
 3238             [ 5, 'RTB',  187, 'BLO',  self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0)],
 3239             [ 6, 'RTB',  369, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0)],
 3240             [ 7, 'RTB',  551, 'BLO',  self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0)],
 3241             [ 8, 'RTB',  733, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
 3242             [ 9, 'RTB',  915, 'BLO',  self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0, neg=True)],
 3243             [10, 'RTB', 1097, 'BLO',  self.rotate_from_Z(origin=pivot, length=l, angle=0.0, neg=True)],
 3244             [11, 'RTB', 1279, 'BLO',  self.rotate_from_Z(origin=pivot, length=l-2.0, angle=0.0, neg=True)],
 3245             [12, 'RTL', 1461, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0)],
 3246             [12, 'RTL', 1462, 'z-ax', self.rotate_from_Z(origin=pivot, length=l+2.0, angle=0.0, neg=True)]
 3247         ]
 3248 
 3249         # Check the data. 
 3250         self.check_pdb_model_representation(data=[data], files=['frame_order.pdb'])
 3251 
 3252 
 3253     def test_pseudo_ellipse_zero_cone_angle(self):
 3254         """Catch for a bug in optimisation when the cone_theta_x is set to zero in the pseudo-ellipse models."""
 3255 
 3256         # Reset.
 3257         self.interpreter.reset()
 3258 
 3259         # Load the state file.
 3260         data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations'
 3261         self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse')
 3262 
 3263         # Change the original parameters.
 3264         cdp.cone_theta_x = 0.0
 3265         cdp.cone_theta_y = 2.0
 3266 
 3267         # Optimisation.
 3268         self.interpreter.minimise.execute('simplex', max_iter=2)
 3269 
 3270 
 3271     def test_rigid_data_to_double_rotor_model(self):
 3272         """Test the double rotor target function for the data from a rigid test molecule."""
 3273 
 3274         # Set the model.
 3275         ds.model = MODEL_DOUBLE_ROTOR
 3276 
 3277         # Execute the script.
 3278         self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
 3279 
 3280         # Check the chi2 value.
 3281         self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
 3282 
 3283 
 3284     def test_rigid_data_to_free_rotor_model(self):
 3285         """Test the free rotor target function for the data from a rigid test molecule."""
 3286 
 3287         # Set the model.
 3288         ds.model = MODEL_FREE_ROTOR
 3289 
 3290         # Execute the script.
 3291         self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
 3292 
 3293         # Check the chi2 value.
 3294         self.assertAlmostEqual(cdp.chi2, 212124.83317383687)
 3295 
 3296 
 3297     def test_rigid_data_to_iso_cone_free_rotor_model(self):
 3298         """Test the iso cone, free rotor target function for the data from a rigid test molecule."""
 3299 
 3300         # Set the model.
 3301         ds.model = MODEL_ISO_CONE_FREE_ROTOR
 3302 
 3303         # Execute the script.
 3304         self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
 3305 
 3306         # Check the chi2 value.
 3307         self.assertAlmostEqual(cdp.chi2, 22295.500553417492)
 3308 
 3309 
 3310     def test_rigid_data_to_iso_cone_model(self):
 3311         """Test the iso cone target function for the data from a rigid test molecule."""
 3312 
 3313         # Set the model.
 3314         ds.model = MODEL_ISO_CONE
 3315 
 3316         # Execute the script.
 3317         self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
 3318 
 3319         # Check the chi2 value.
 3320         self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
 3321 
 3322 
 3323     def test_rigid_data_to_iso_cone_torsionless_model(self):
 3324         """Test the iso cone, torsionless target function for the data from a rigid test molecule."""
 3325 
 3326         # Set the model.
 3327         ds.model = MODEL_ISO_CONE_TORSIONLESS
 3328 
 3329         # Execute the script.
 3330         self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
 3331 
 3332         # Check the chi2 value.
 3333         self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
 3334 
 3335 
 3336     def test_rigid_data_to_pseudo_ellipse_model(self):
 3337         """Test the pseudo-ellipse target function for the data from a rigid test molecule."""
 3338 
 3339         # Set the model.
 3340         ds.model = MODEL_PSEUDO_ELLIPSE
 3341 
 3342         # Execute the script.
 3343         self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
 3344 
 3345         # Check the chi2 value.
 3346         self.assertAlmostEqual(cdp.chi2, 0.01137748706675365, 5)
 3347 
 3348 
 3349     def test_rigid_data_to_pseudo_ellipse_torsionless_model(self):
 3350         """Test the pseudo-ellipse, torsionless target function for the data from a rigid test molecule."""
 3351 
 3352         # Set the model.
 3353         ds.model = MODEL_PSEUDO_ELLIPSE_TORSIONLESS
 3354 
 3355         # Execute the script.
 3356         self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
 3357 
 3358         # Check the chi2 value.
 3359         self.assertAlmostEqual(cdp.chi2, 0.011377491600681364)
 3360 
 3361 
 3362     def test_rigid_data_to_rigid_model(self):
 3363         """Test the rigid target function for the data from a rigid test molecule."""
 3364 
 3365         # Set the model.
 3366         ds.model = MODEL_RIGID
 3367 
 3368         # Execute the script.
 3369         self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
 3370 
 3371         # Check the chi2 value.
 3372         self.assertAlmostEqual(cdp.chi2, 0.0113763520134, 5)
 3373 
 3374 
 3375     def test_rigid_data_to_rotor_model(self):
 3376         """Test the rotor target function for the data from a rigid test molecule."""
 3377 
 3378         # Set the model.
 3379         ds.model = MODEL_ROTOR
 3380 
 3381         # Execute the script.
 3382         self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
 3383 
 3384         # Check the chi2 value.
 3385         self.assertAlmostEqual(cdp.chi2, 0.011377487066752203, 5)
 3386 
 3387 
 3388     def test_simulate_double_rotor_mode1_xz_plane_tilt(self, type='sim'):
 3389         """Check the frame_order.simulate user function PDB file for the double rotor model with a xz-plane tilt for the first rotation mode."""
 3390 
 3391         # Init.
 3392         cone_sigma_max = pi / 2.0
 3393         cone_sigma_max_2 = 0.0
 3394         pivot = array([20, 20, -20], float64)
 3395         l = 100.0
 3396         sim_num = 500
 3397         pivot_disp = 100.0
 3398 
 3399         # The eigenframe.
 3400         eigen_beta = -pi/4.0
 3401         R = zeros((3, 3), float64)
 3402         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 3403         print("Motional eigenframe:\n%s" % R)
 3404 
 3405         # Set up.
 3406         self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2)
 3407 
 3408         # Create the PDB.
 3409         files = []
 3410         if type == 'sim':
 3411             file = 'simulation.pdb'
 3412             self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
 3413             files.append(file)
 3414         elif type == 'dist':
 3415             file = 'distribution.pdb'
 3416             self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num)
 3417             files.append(file)
 3418         elif type == 'decomp':
 3419             self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir)
 3420             files.append('decompose_mode1.pdb')
 3421             files.append('decompose_mode2.pdb')
 3422         elif type == 'decomp2':
 3423             self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True)
 3424             files.append('decompose_mode1.pdb')
 3425             files.append('decompose_mode2.pdb')
 3426 
 3427         # Check each PDB.
 3428         for file in files:
 3429             # Delete all structural data.
 3430             self.interpreter.structure.delete()
 3431 
 3432             # Read the contents of the file.
 3433             self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir)
 3434 
 3435             # X vector maxima.
 3436             X_theta_min = cartesian_to_spherical([100, 0, 200])[1]
 3437             X_theta_max = cartesian_to_spherical([-100, 0, 0])[1] + pi
 3438             print("X vector theta range of [%.5f, %.5f]" % (X_theta_min, X_theta_max))
 3439 
 3440             # Check the atomic coordinates.
 3441             selection = cdp.structure.selection()
 3442             num_pos = cdp.structure.num_models()
 3443             epsilon = 1e-3
 3444             for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
 3445                 # Loop over all positions.
 3446                 for i in range(num_pos):
 3447                     # Shift the position back to the origin, and decompose into spherical coordinates.
 3448                     new_pos = pos[i] - pivot
 3449                     r, theta, phi = cartesian_to_spherical(dot(transpose(R), new_pos))
 3450 
 3451                     # Printout.
 3452                     print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
 3453 
 3454                     # Check the X and nX vectors.
 3455                     if res_name in ['X', 'nX']:
 3456                         self.assert_(theta >= X_theta_min - epsilon)
 3457                         self.assert_(theta <= X_theta_max + epsilon)
 3458                         if phi < 0.1:
 3459                             self.assertAlmostEqual(phi, 0.0, 3)
 3460                         else:
 3461                             self.assertAlmostEqual(phi, pi, 3)
 3462                         self.assertAlmostEqual(new_pos[1], 0.0, 3)
 3463 
 3464                     # Check the Y vector.
 3465                     elif res_name == 'Y':
 3466                         self.assert_(r/100.0 >= 1.0 - epsilon)
 3467                         self.assert_(theta >= pi/4.0 - epsilon)
 3468                         self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
 3469                         self.assertAlmostEqual(new_pos[1], 100.0, 3)
 3470 
 3471                     # Check the Z vector (should not move).
 3472                     elif res_name == 'Z':
 3473                         self.assert_(r/100.0 >= 1.0 - epsilon)
 3474                         self.assertAlmostEqual(new_pos[0], -70.711, 3)
 3475                         self.assertAlmostEqual(new_pos[1], 0.0, 3)
 3476                         self.assertAlmostEqual(new_pos[2], 70.711, 3)
 3477 
 3478                     # Check the nY vector.
 3479                     elif res_name == 'nY':
 3480                         self.assert_(r/100.0 >= 1.0 - epsilon)
 3481                         self.assert_(theta >= pi/4.0 - epsilon)
 3482                         self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
 3483                         self.assertAlmostEqual(new_pos[1], -100.0, 3)
 3484 
 3485                     # Check the nZ vector (should not move).
 3486                     elif res_name == 'nZ':
 3487                         self.assert_(r/100.0 >= 1.0 - epsilon)
 3488                         self.assert_(theta >= pi/4.0 - epsilon)
 3489                         self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
 3490                         self.assertAlmostEqual(new_pos[1], 0.0, 3)
 3491 
 3492                     # Check the centre.
 3493                     elif res_name == 'C':
 3494                         self.assert_(r/100.0 <= 1.4142135623730951 + epsilon)
 3495                         if not (new_pos[0] == 0.0 and new_pos[1] == 0.0 and new_pos[2] == 0.0):
 3496                             self.assert_(theta >= pi/4.0 - epsilon)
 3497                             self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
 3498                         self.assertAlmostEqual(new_pos[1], 0.0, 3)
 3499 
 3500                     # Check the origin.
 3501                     elif res_name == '0':
 3502                         self.assertAlmostEqual(r, 34.641016151377549, 4)
 3503                         self.assertAlmostEqual(pos[0], 0.0, 3)
 3504                         self.assertAlmostEqual(pos[1], 0.0, 3)
 3505                         self.assertAlmostEqual(pos[2], 0.0, 3)
 3506 
 3507             # Check the number of structures.
 3508             if type == 'decomp2':
 3509                 self.assertEqual(num_pos, 21)
 3510 
 3511 
 3512     def test_simulate_double_rotor_mode1_z_axis(self, type='sim'):
 3513         """Check the frame_order.simulate user function PDB file for the double rotor model along the z-axis for the first rotation mode."""
 3514 
 3515         # Init.
 3516         cone_sigma_max = pi / 2.0
 3517         cone_sigma_max_2 = 0.0
 3518         pivot = array([20, 20, -20], float64)
 3519         l = 100.0
 3520         sim_num = 500
 3521         pivot_disp = 100.0
 3522 
 3523         # The eigenframe.
 3524         eigen_beta = 0.0
 3525         R = zeros((3, 3), float64)
 3526         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 3527         print("Motional eigenframe:\n%s" % R)
 3528 
 3529         # Set up.
 3530         self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2)
 3531 
 3532         # Create the PDB.
 3533         files = []
 3534         if type == 'sim':
 3535             file = 'simulation.pdb'
 3536             self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
 3537             files.append(file)
 3538         elif type == 'dist':
 3539             file = 'distribution.pdb'
 3540             self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num)
 3541             files.append(file)
 3542         elif type == 'decomp':
 3543             self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir)
 3544             files.append('decompose_mode1.pdb')
 3545             files.append('decompose_mode2.pdb')
 3546         elif type == 'decomp2':
 3547             self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True)
 3548             files.append('decompose_mode1.pdb')
 3549             files.append('decompose_mode2.pdb')
 3550 
 3551         # Check each PDB.
 3552         for file in files:
 3553             # Delete all structural data.
 3554             self.interpreter.structure.delete()
 3555 
 3556             # Read the contents of the file.
 3557             self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir)
 3558 
 3559             # X vector maxima.
 3560             X_theta_min = cartesian_to_spherical([100, 0, 200])[1]
 3561             X_theta_max = cartesian_to_spherical([-100, 0, 0])[1] + pi
 3562             print("X vector theta range of [%.5f, %.5f]" % (X_theta_min, X_theta_max))
 3563 
 3564             # Check the atomic coordinates.
 3565             selection = cdp.structure.selection()
 3566             num_pos = cdp.structure.num_models()
 3567             epsilon = 1e-3
 3568             for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
 3569                 # Loop over all positions.
 3570                 for i in range(num_pos):
 3571                     # Shift the position back to the origin, and decompose into spherical coordinates.
 3572                     new_pos = pos[i] - pivot
 3573                     r, theta, phi = cartesian_to_spherical(new_pos)
 3574 
 3575                     # Printout.
 3576                     print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
 3577 
 3578                     # Check the X and nX vectors.
 3579                     if res_name in ['X', 'nX']:
 3580                         self.assert_(theta >= X_theta_min - epsilon)
 3581                         self.assert_(theta <= X_theta_max + epsilon)
 3582                         if phi < 0.1:
 3583                             self.assertAlmostEqual(phi, 0.0, 3)
 3584                         else:
 3585                             self.assertAlmostEqual(phi, pi, 3)
 3586                         self.assertAlmostEqual(new_pos[1], 0.0, 3)
 3587 
 3588                     # Check the Y vector.
 3589                     elif res_name == 'Y':
 3590                         self.assert_(r/100.0 >= 1.0 - epsilon)
 3591                         self.assert_(theta >= pi/4.0 - epsilon)
 3592                         self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
 3593                         self.assertAlmostEqual(new_pos[1], 100.0, 3)
 3594 
 3595                     # Check the Z vector (should not move).
 3596                     elif res_name == 'Z':
 3597                         self.assert_(r/100.0 >= 1.0 - epsilon)
 3598                         self.assertAlmostEqual(new_pos[0], 0.0, 3)
 3599                         self.assertAlmostEqual(new_pos[1], 0.0, 3)
 3600                         self.assertAlmostEqual(new_pos[2], 100.0, 3)
 3601 
 3602                     # Check the nY vector.
 3603                     elif res_name == 'nY':
 3604                         self.assert_(r/100.0 >= 1.0 - epsilon)
 3605                         self.assert_(theta >= pi/4.0 - epsilon)
 3606                         self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
 3607                         self.assertAlmostEqual(new_pos[1], -100.0, 3)
 3608 
 3609                     # Check the nZ vector (should not move).
 3610                     elif res_name == 'nZ':
 3611                         self.assert_(r/100.0 >= 1.0 - epsilon)
 3612                         self.assert_(theta >= pi/4.0 - epsilon)
 3613                         self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
 3614                         self.assertAlmostEqual(new_pos[1], 0.0, 3)
 3615 
 3616                     # Check the centre.
 3617                     elif res_name == 'C':
 3618                         self.assert_(r/100.0 <= 1.4142135623730951 + epsilon)
 3619                         if not (new_pos[0] == 0.0 and new_pos[1] == 0.0 and new_pos[2] == 0.0):
 3620                             self.assert_(theta >= pi/4.0 - epsilon)
 3621                             self.assert_(theta <= 2.0*pi - pi/4.0 + epsilon)
 3622                         self.assertAlmostEqual(new_pos[1], 0.0, 3)
 3623 
 3624                     # Check the origin.
 3625                     elif res_name == '0':
 3626                         self.assertAlmostEqual(r, 34.641016151377549, 4)
 3627                         self.assertAlmostEqual(pos[0], 0.0, 3)
 3628                         self.assertAlmostEqual(pos[1], 0.0, 3)
 3629                         self.assertAlmostEqual(pos[2], 0.0, 3)
 3630 
 3631             # Check the number of structures.
 3632             if type == 'decomp2':
 3633                 self.assertEqual(num_pos, 21)
 3634 
 3635 
 3636     def test_simulate_double_rotor_mode2_xz_plane_tilt(self, type='sim'):
 3637         """Check the frame_order.simulate user function PDB file for the double rotor model with a xz-plane tilt for the second rotation mode."""
 3638 
 3639         # Init.
 3640         cone_sigma_max = 0.0
 3641         cone_sigma_max_2 = pi / 2.0
 3642         pivot = array([20, 20, -20], float64)
 3643         l = 100.0
 3644         sim_num = 500
 3645         pivot_disp = 100.0
 3646 
 3647         # The eigenframe.
 3648         eigen_beta = -pi/4.0
 3649         R = zeros((3, 3), float64)
 3650         euler_to_R_zyz(0.0, eigen_beta, 0.0, R)
 3651         print("Motional eigenframe:\n%s" % R)
 3652 
 3653         # Set up.
 3654         self.setup_model(pipe_name='PDB model', model='double rotor', pivot=pivot, ave_pos_x=pivot[0], ave_pos_y=pivot[1], ave_pos_z=pivot[2], ave_pos_alpha=0.0, ave_pos_beta=eigen_beta, ave_pos_gamma=0.0, pivot_disp=pivot_disp, eigen_alpha=0.0, eigen_beta=eigen_beta, eigen_gamma=0.0, cone_sigma_max=cone_sigma_max, cone_sigma_max_2=cone_sigma_max_2)
 3655 
 3656         # Create the PDB.
 3657         files = []
 3658         if type == 'sim':
 3659             file = 'simulation.pdb'
 3660             self.interpreter.frame_order.simulate(file=file, dir=ds.tmpdir, step_size=10.0, snapshot=10, total=sim_num)
 3661             files.append(file)
 3662         elif type == 'dist':
 3663             file = 'distribution.pdb'
 3664             self.interpreter.frame_order.distribute(file=file, dir=ds.tmpdir, total=sim_num)
 3665             files.append(file)
 3666         elif type == 'decomp':
 3667             self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir)
 3668             files.append('decompose_mode1.pdb')
 3669             files.append('decompose_mode2.pdb')
 3670         elif type == 'decomp2':
 3671             self.interpreter.frame_order.decompose(root='decompose', dir=ds.tmpdir, total=21, reverse=True, mirror=True)
 3672             files.append('decompose_mode1.pdb')
 3673             files.append('decompose_mode2.pdb')
 3674 
 3675         # Check each PDB.
 3676         for file in files:
 3677             # Delete all structural data.
 3678             self.interpreter.structure.delete()
 3679 
 3680             # Read the contents of the file.
 3681             self.interpreter.structure.read_pdb(file=file, dir=ds.tmpdir)
 3682 
 3683             # Check the atomic coordinates.
 3684             selection = cdp.structure.selection()
 3685             num_pos = cdp.structure.num_models()
 3686             epsilon = 1e-3
 3687             for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True):
 3688                 # Loop over all positions.
 3689                 for i in range(num_pos):
 3690                     # Shift the position back to the origin, and decompose into spherical coordinates.
 3691                     new_pos = pos[i] - pivot
 3692                     r, theta, phi = cartesian_to_spherical(dot(transpose(R), new_pos))
 3693 
 3694                     # Printout.
 3695                     print("Checking residue %s %s, atom %s %s, at shifted position %s, with spherical coordinates %s." % (res_num, res_name, atom_num, atom_name, new_pos, [r, theta, phi]))
 3696 
 3697                     # Check the X vector.
 3698                     if res_name == 'X':
 3699                         self.assertAlmostEqual(new_pos[0], 70.711, 3)
 3700                         self.assertAlmostEqual(new_pos[1], 0.0, 3)
 3701                         self.assertAlmostEqual(new_pos[2], 70.711, 3)
 3702 
 3703                     # Check the Y vector.
 3704                     elif res_name == 'Y':
 3705                         self.assertAlmostEqual(r/100.0, 1.0, 3)
 3706                         self.assert_(new_pos[0] >= -70.711 - epsilon)
 3707                         self.assert_(new_pos[0] <= 70.711 + epsilon)
 3708                         self.assert_(new_pos[1] >= 0.0 - epsilon)
 3709                         self.assert_(new_pos[1] <= 100.0 + epsilon)
 3710                         self.assert_(new_pos[2] >= -70.711 - epsilon)
 3711                         self.assert_(new_pos[2] <= 70.711 + epsilon)
 3712 
 3713                     # Check the Z vector (should not move).
 3714                     elif res_name == 'Z':
 3715                         self.assertAlmostEqual(r/100.0, 1.0, 3)
 3716                         self.assert_(new_pos[0] >= -70.711 - epsilon)
 3717                         self.assert_(new_pos[0] <= 0.0 + epsilon)
 3718                         self.assert_(new_pos[1] >= -100.0 - epsilon)
 3719                         self.assert_(new_pos[1] <= 100.0 + epsilon)
 3720                         self.assert_(new_pos[2] >= 0.0 - epsilon)
 3721                         self.assert_(new_pos[2] <= 70.711 + epsilon)
 3722 
 3723                     # Check the nX vector.
 3724                     elif res_name == 'nX':
 3725                         self.assertAlmostEqual(new_pos[0], -70.711, 3)
 3726                         self.assertAlmostEqual(new_pos[1], 0.0, 3)
 3727                         self.assertAlmostEqual(new_pos[2], -