コード例 #1
0
    def test_compile_2nd_matrix_rotor_point1(self):
        """Check the operation of the compile_2nd_matrix_rotor() function."""

        # The simulated in frame rotor 2nd degree frame order matrix (1e7 ensembles).
        real = array(
                    [[  7.06775425e-01,  1.36710179e-04,  0.00000000e+00,  1.36710179e-04, 2.93224575e-01,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [ -1.36710179e-04,  7.06775425e-01,  0.00000000e+00, -2.93224575e-01, 1.36710179e-04,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [  0.00000000e+00,  0.00000000e+00,  8.27014112e-01,  0.00000000e+00, 0.00000000e+00,  2.19539417e-04,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [ -1.36710179e-04, -2.93224575e-01,  0.00000000e+00,  7.06775425e-01, 1.36710179e-04,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [  2.93224575e-01, -1.36710179e-04,  0.00000000e+00, -1.36710179e-04, 7.06775425e-01,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [  0.00000000e+00,  0.00000000e+00, -2.19539417e-04,  0.00000000e+00, 0.00000000e+00,  8.27014112e-01,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [  0.00000000e+00,  0.00000000e+00,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00,  0.00000000e+00,  8.27014112e-01, 2.19539417e-04, 0.00000000e+00],
                     [  0.00000000e+00,  0.00000000e+00,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00,  0.00000000e+00, -2.19539417e-04, 8.27014112e-01, 0.00000000e+00],
                     [  0.00000000e+00,  0.00000000e+00,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])

        # Init.
        sigma_max = 60.0 / 180.0 * pi

        # The Kronecker product of the eigenframe rotation.
        Rx2_eigen = self.calc_Rx2_eigen_axis(0.0, 0.0)

        # Calculate the matrix.
        f2 = compile_2nd_matrix_rotor(self.f2_temp, Rx2_eigen, sigma_max)

        # Print out.
        print_frame_order_2nd_degree(real, "real")
        print_frame_order_2nd_degree(f2, "calculated")
        print_frame_order_2nd_degree(real-f2, "difference")

        # Check the values.
        for i in range(9):
            for j in range(9):
                print("Element %s, %s." % (i, j))
                self.assert_(abs(f2[i, j] - real[i, j]) < 1e-3)
コード例 #2
0
ファイル: test_matrix_ops.py プロジェクト: pombredanne/relax
    def test_compile_2nd_matrix_rotor_point1(self):
        """Check the operation of the compile_2nd_matrix_rotor() function."""

        # The simulated in frame rotor 2nd degree frame order matrix (1e7 ensembles).
        real = array(
                    [[  7.06775425e-01,  1.36710179e-04,  0.00000000e+00,  1.36710179e-04, 2.93224575e-01,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [ -1.36710179e-04,  7.06775425e-01,  0.00000000e+00, -2.93224575e-01, 1.36710179e-04,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [  0.00000000e+00,  0.00000000e+00,  8.27014112e-01,  0.00000000e+00, 0.00000000e+00,  2.19539417e-04,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [ -1.36710179e-04, -2.93224575e-01,  0.00000000e+00,  7.06775425e-01, 1.36710179e-04,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [  2.93224575e-01, -1.36710179e-04,  0.00000000e+00, -1.36710179e-04, 7.06775425e-01,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [  0.00000000e+00,  0.00000000e+00, -2.19539417e-04,  0.00000000e+00, 0.00000000e+00,  8.27014112e-01,  0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                     [  0.00000000e+00,  0.00000000e+00,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00,  0.00000000e+00,  8.27014112e-01, 2.19539417e-04, 0.00000000e+00],
                     [  0.00000000e+00,  0.00000000e+00,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00,  0.00000000e+00, -2.19539417e-04, 8.27014112e-01, 0.00000000e+00],
                     [  0.00000000e+00,  0.00000000e+00,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00,  0.00000000e+00,  0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])

        # Init.
        sigma_max = 60.0 / 180.0 * pi

        # The Kronecker product of the eigenframe rotation.
        Rx2_eigen = self.calc_Rx2_eigen_axis(0.0, 0.0)

        # Calculate the matrix.
        f2 = compile_2nd_matrix_rotor(self.f2_temp, Rx2_eigen, sigma_max)

        # Print out.
        print_frame_order_2nd_degree(real, "real")
        print_frame_order_2nd_degree(f2, "calculated")
        print_frame_order_2nd_degree(real-f2, "difference")

        # Check the values.
        for i in range(9):
            for j in range(9):
                print("Element %s, %s." % (i, j))
                self.assert_(abs(f2[i, j] - real[i, j]) < 1e-3)
コード例 #3
0
    def __init__(self):
        """Calculate the frame order at infinity.

        This is when the starting positions are random.
        """

        # Loop over the models.
        for model_index in range(len(MODELS)):
            # Aliases.
            model = MODELS[model_index]
            model_text = MODEL_TEXT[model_index]

            # Loop over the tags.
            for tag in TAGS:
                # Set up the variables to loop over.
                if model in ['rotor', 'free_rotor']:
                    vars = ['Z']
                elif model in ['iso_cone_free_rotor', 'iso_cone_torsionless']:
                    vars = ['X']
                elif model in ['iso_cone']:
                    vars = ['X', 'Z']
                elif model in ['double_rotor', 'pseudo-ellipse_free_rotor', 'pseudo-ellipse_torsionless']:
                    vars = ['X', 'Y']
                elif model in ['pseudo-ellipse']:
                    vars = ['X', 'Y', 'Z']
                else:
                    raise RelaxError("Unknown model '%s'." % model)

                # Loop over the variables.
                for var in vars:
                    # The file name.
                    file_name = '_%s_%s_theta_%s_calc.agr' % (model, tag, lower(var))
                    print("Creating the '*%s' files." % file_name)

                    # Set up the eigenframe.
                    self.setup_eigenframe(tag=tag)

                    # The Kronecker product of the eigenframe rotation.
                    Rx2_eigen = kron_prod(self.eigenframe, self.eigenframe)

                    # Set the initial storage structures.
                    self.init_storage()

                    # Loop over the angle incs.
                    for i in range(INC+1):
                        # Get the angle for the increment.
                        theta = self.get_angle(i-1, model=model, var=var)

                        # Vary X.
                        if var == 'X':
                            theta_x = theta
                            theta_y = THETA_Y
                            theta_z = THETA_Z

                        # Vary Y.
                        elif var == 'Y':
                            theta_x = THETA_X
                            theta_y = theta
                            theta_z = THETA_Z

                        # Vary Z.
                        elif var == 'Z':
                            theta_x = THETA_X
                            theta_y = THETA_Y
                            theta_z = theta

                        # Calculate the frame order matrices.
                        if model == 'rotor':
                            self.first_frame_order[i] = rotor.compile_1st_matrix_rotor(self.first_frame_order[i], self.eigenframe, theta_z)
                            self.second_frame_order[i] = rotor.compile_2nd_matrix_rotor(self.second_frame_order[i], Rx2_eigen, theta_z)
                        elif model == 'free_rotor':
                            self.first_frame_order[i] = free_rotor.compile_1st_matrix_free_rotor(self.first_frame_order[i], self.eigenframe)
                            self.second_frame_order[i] = free_rotor.compile_2nd_matrix_free_rotor(self.second_frame_order[i], Rx2_eigen)
                        elif model == 'iso_cone':
                            self.first_frame_order[i] = iso_cone.compile_1st_matrix_iso_cone(self.first_frame_order[i], self.eigenframe, theta_x, theta_z)
                            self.second_frame_order[i] = iso_cone.compile_2nd_matrix_iso_cone(self.second_frame_order[i], Rx2_eigen, theta_x, theta_z)
                        elif model == 'iso_cone_free_rotor':
                            self.first_frame_order[i] = iso_cone_free_rotor.compile_1st_matrix_iso_cone_free_rotor(self.first_frame_order[i], self.eigenframe, theta_x)
                            self.second_frame_order[i] = iso_cone_free_rotor.compile_2nd_matrix_iso_cone_free_rotor(self.second_frame_order[i], Rx2_eigen, theta_x)
                        elif model == 'iso_cone_torsionless':
                            self.first_frame_order[i] = iso_cone_torsionless.compile_1st_matrix_iso_cone_torsionless(self.first_frame_order[i], self.eigenframe, theta_x)
                            self.second_frame_order[i] = iso_cone_torsionless.compile_2nd_matrix_iso_cone_torsionless(self.second_frame_order[i], Rx2_eigen, theta_x)
                        elif model == 'pseudo-ellipse':
                            self.first_frame_order[i] = pseudo_ellipse.compile_1st_matrix_pseudo_ellipse(self.first_frame_order[i], self.eigenframe, theta_x, theta_y, theta_z)
                            self.second_frame_order[i] = pseudo_ellipse.compile_2nd_matrix_pseudo_ellipse(self.second_frame_order[i], Rx2_eigen, theta_x, theta_y, theta_z)
                        elif model == 'pseudo-ellipse_free_rotor':
                            self.first_frame_order[i] = pseudo_ellipse_free_rotor.compile_1st_matrix_pseudo_ellipse_free_rotor(self.first_frame_order[i], self.eigenframe, theta_x, theta_y)
                            self.second_frame_order[i] = pseudo_ellipse_free_rotor.compile_2nd_matrix_pseudo_ellipse_free_rotor(self.second_frame_order[i], Rx2_eigen, theta_x, theta_y)
                        elif model == 'pseudo-ellipse_torsionless':
                            self.first_frame_order[i] = pseudo_ellipse_torsionless.compile_1st_matrix_pseudo_ellipse_torsionless(self.first_frame_order[i], self.eigenframe, theta_x, theta_y)
                            self.second_frame_order[i] = pseudo_ellipse_torsionless.compile_2nd_matrix_pseudo_ellipse_torsionless(self.second_frame_order[i], Rx2_eigen, theta_x, theta_y)
                        elif model == 'double_rotor':
                            self.first_frame_order[i] = double_rotor.compile_1st_matrix_double_rotor(self.first_frame_order[i], self.eigenframe, theta_y, theta_x)
                            self.second_frame_order[i] = double_rotor.compile_2nd_matrix_double_rotor(self.second_frame_order[i], Rx2_eigen, theta_y, theta_x)
                        else:
                            raise RelaxError("Unknown model '%s'." % model)

                    # Write the data.
                    self.write_data(file_name=file_name, model=model, model_text=model_text, var=var)
コード例 #4
0
    def __init__(self):
        """Calculate the frame order at infinity.

        This is when the starting positions are random.
        """

        # Loop over the models.
        for model_index in range(len(MODELS)):
            # Aliases.
            model = MODELS[model_index]
            model_text = MODEL_TEXT[model_index]

            # Loop over the tags.
            for tag in TAGS:
                # Set up the variables to loop over.
                if model in ['rotor', 'free_rotor']:
                    vars = ['Z']
                elif model in ['iso_cone_free_rotor', 'iso_cone_torsionless']:
                    vars = ['X']
                elif model in ['iso_cone']:
                    vars = ['X', 'Z']
                elif model in [
                        'double_rotor', 'pseudo-ellipse_free_rotor',
                        'pseudo-ellipse_torsionless'
                ]:
                    vars = ['X', 'Y']
                elif model in ['pseudo-ellipse']:
                    vars = ['X', 'Y', 'Z']
                else:
                    raise RelaxError("Unknown model '%s'." % model)

                # Loop over the variables.
                for var in vars:
                    # The file name.
                    file_name = '_%s_%s_theta_%s_calc.agr' % (model, tag,
                                                              lower(var))
                    print("Creating the '*%s' files." % file_name)

                    # Set up the eigenframe.
                    self.setup_eigenframe(tag=tag)

                    # The Kronecker product of the eigenframe rotation.
                    Rx2_eigen = kron_prod(self.eigenframe, self.eigenframe)

                    # Set the initial storage structures.
                    self.init_storage()

                    # Loop over the angle incs.
                    for i in range(INC + 1):
                        # Get the angle for the increment.
                        theta = self.get_angle(i - 1, model=model, var=var)

                        # Vary X.
                        if var == 'X':
                            theta_x = theta
                            theta_y = THETA_Y
                            theta_z = THETA_Z

                        # Vary Y.
                        elif var == 'Y':
                            theta_x = THETA_X
                            theta_y = theta
                            theta_z = THETA_Z

                        # Vary Z.
                        elif var == 'Z':
                            theta_x = THETA_X
                            theta_y = THETA_Y
                            theta_z = theta

                        # Calculate the frame order matrices.
                        if model == 'rotor':
                            self.first_frame_order[
                                i] = rotor.compile_1st_matrix_rotor(
                                    self.first_frame_order[i], self.eigenframe,
                                    theta_z)
                            self.second_frame_order[
                                i] = rotor.compile_2nd_matrix_rotor(
                                    self.second_frame_order[i], Rx2_eigen,
                                    theta_z)
                        elif model == 'free_rotor':
                            self.first_frame_order[
                                i] = free_rotor.compile_1st_matrix_free_rotor(
                                    self.first_frame_order[i], self.eigenframe)
                            self.second_frame_order[
                                i] = free_rotor.compile_2nd_matrix_free_rotor(
                                    self.second_frame_order[i], Rx2_eigen)
                        elif model == 'iso_cone':
                            self.first_frame_order[
                                i] = iso_cone.compile_1st_matrix_iso_cone(
                                    self.first_frame_order[i], self.eigenframe,
                                    theta_x, theta_z)
                            self.second_frame_order[
                                i] = iso_cone.compile_2nd_matrix_iso_cone(
                                    self.second_frame_order[i], Rx2_eigen,
                                    theta_x, theta_z)
                        elif model == 'iso_cone_free_rotor':
                            self.first_frame_order[
                                i] = iso_cone_free_rotor.compile_1st_matrix_iso_cone_free_rotor(
                                    self.first_frame_order[i], self.eigenframe,
                                    theta_x)
                            self.second_frame_order[
                                i] = iso_cone_free_rotor.compile_2nd_matrix_iso_cone_free_rotor(
                                    self.second_frame_order[i], Rx2_eigen,
                                    theta_x)
                        elif model == 'iso_cone_torsionless':
                            self.first_frame_order[
                                i] = iso_cone_torsionless.compile_1st_matrix_iso_cone_torsionless(
                                    self.first_frame_order[i], self.eigenframe,
                                    theta_x)
                            self.second_frame_order[
                                i] = iso_cone_torsionless.compile_2nd_matrix_iso_cone_torsionless(
                                    self.second_frame_order[i], Rx2_eigen,
                                    theta_x)
                        elif model == 'pseudo-ellipse':
                            self.first_frame_order[
                                i] = pseudo_ellipse.compile_1st_matrix_pseudo_ellipse(
                                    self.first_frame_order[i], self.eigenframe,
                                    theta_x, theta_y, theta_z)
                            self.second_frame_order[
                                i] = pseudo_ellipse.compile_2nd_matrix_pseudo_ellipse(
                                    self.second_frame_order[i], Rx2_eigen,
                                    theta_x, theta_y, theta_z)
                        elif model == 'pseudo-ellipse_free_rotor':
                            self.first_frame_order[
                                i] = pseudo_ellipse_free_rotor.compile_1st_matrix_pseudo_ellipse_free_rotor(
                                    self.first_frame_order[i], self.eigenframe,
                                    theta_x, theta_y)
                            self.second_frame_order[
                                i] = pseudo_ellipse_free_rotor.compile_2nd_matrix_pseudo_ellipse_free_rotor(
                                    self.second_frame_order[i], Rx2_eigen,
                                    theta_x, theta_y)
                        elif model == 'pseudo-ellipse_torsionless':
                            self.first_frame_order[
                                i] = pseudo_ellipse_torsionless.compile_1st_matrix_pseudo_ellipse_torsionless(
                                    self.first_frame_order[i], self.eigenframe,
                                    theta_x, theta_y)
                            self.second_frame_order[
                                i] = pseudo_ellipse_torsionless.compile_2nd_matrix_pseudo_ellipse_torsionless(
                                    self.second_frame_order[i], Rx2_eigen,
                                    theta_x, theta_y)
                        elif model == 'double_rotor':
                            self.first_frame_order[
                                i] = double_rotor.compile_1st_matrix_double_rotor(
                                    self.first_frame_order[i], self.eigenframe,
                                    theta_y, theta_x)
                            self.second_frame_order[
                                i] = double_rotor.compile_2nd_matrix_double_rotor(
                                    self.second_frame_order[i], Rx2_eigen,
                                    theta_y, theta_x)
                        else:
                            raise RelaxError("Unknown model '%s'." % model)

                    # Write the data.
                    self.write_data(file_name=file_name,
                                    model=model,
                                    model_text=model_text,
                                    var=var)