Пример #1
0
    def operation_matrix_list(self):

        op_matrix_list = []
        for angle in [
                2 * np.pi / self._order * self._exp,
                -2 * np.pi / self._order * self._exp
        ]:
            operation1 = rotation(angle, self._axis)
            operation2 = reflection(self._axis)
            operation = np.dot(operation2, operation1)
            op_matrix_list.append(operation)
        return op_matrix_list
Пример #2
0
    def get_measure_func(self, op_function, self_similarity, orientation=None):

        rotated_axis = self._axis if orientation is None else orientation.apply(
            self._axis)

        measure_fn = []
        for angle in [
                2 * np.pi / self._order * self._exp,
                -2 * np.pi / self._order * self._exp
        ]:
            operation1 = rotation(angle, rotated_axis)
            operation2 = reflection(rotated_axis)
            operation = np.dot(operation2, operation1)

            op_function_ir = op_function.copy()
            op_function_ir.apply_linear_transformation(operation)

            measure_fn.append(
                (op_function_ir * op_function).integrate / self_similarity)

        measure_coor_total = np.average(measure_fn)

        return measure_coor_total
Пример #3
0
    def get_measure_pos(self, coordinates, symbols, orientation=None):

        rotated_axis = self._axis if orientation is None else orientation.apply(
            self._axis)

        measure_coor = []
        for angle in [
                2 * np.pi / self._order * self._exp,
                -2 * np.pi / self._order * self._exp
        ]:
            # for angle in np.arange(2*np.pi/self._order, 2*np.pi, 2*np.pi/self._order)[::2]:
            operation1 = rotation(angle, rotated_axis)
            operation2 = reflection(rotated_axis)
            operation = np.dot(operation2, operation1)

            mesure_coor, permu = self.get_permutation(operation, coordinates,
                                                      symbols)

            measure_coor.append(mesure_coor)

        measure_coor_total = np.average(measure_coor)

        return measure_coor_total
Пример #4
0
    def get_measure(self, coordinates, modes, symbols, orientation=None):

        rotated_axis = self._axis if orientation is None else orientation.apply(
            self._axis)

        measure_mode = []
        for angle in [
                2 * np.pi / self._order * self._exp,
                -2 * np.pi / self._order * self._exp
        ]:
            # for angle in np.arange(2*np.pi/self._order, 2*np.pi, 2*np.pi/self._order)[::2]:
            operation1 = rotation(angle, rotated_axis)
            operation2 = reflection(rotated_axis)
            operation = np.dot(operation2, operation1)

            operated_coor = np.dot(operation, coordinates.T).T

            mesure_coor, permu = self.get_permutation(operation, coordinates,
                                                      symbols)

            measure_mode_list = []
            for mode in modes:

                operated_mode = np.dot(
                    operation,
                    prepare_vector(coordinates, mode).T).T - operated_coor
                norm = np.linalg.norm(mode)
                permu_mode = np.array(operated_mode)[permu]

                measure_mode_list.append(
                    np.trace(np.dot(mode, permu_mode.T)) / norm)

            measure_mode.append(measure_mode_list)

        measure_mode_total = np.average(measure_mode, axis=0)

        return measure_mode_total
Пример #5
0
        #print(optimization_function(res.x))
        #rotmol = R.from_euler('zyx', res.x, degrees=True)

    #operation = Rotation(label='C3', axis=[0, 0, 1], order=3)
    #rotmol = R.from_euler('zyx', [0, 0, 0], degrees=True)
    #mode_m, coor_m = operation.get_measure(np.array(coordinates), modes, symbols, orientation=rotmol)
    #print('measure', coor_m)
    #rotmol = R.from_euler('zyx', [360./3, 0, 0], degrees=True)
    #print('---')

    print(Structure(coordinates, symbols))

    # rotations
    rotated_axis = rotmol.apply([0, 0, 1])
    operation = rotation(2 * np.pi / 2, rotated_axis)
    print('axis', rotated_axis)

    # reflection
    #rotated_axis_r = rotmol.apply([0, 1,  0])
    #operation = reflection(rotated_axis_r)
    #print('axis_r', rotated_axis_r)

    # C2 rotation
    # rotated_axis_i = rotmol.apply([(np.sqrt(8 / 9))/2, 0, (1-1 / 3)/2])

    # S4 rotation
    #rotated_axis_i = rotmol.apply([np.sqrt(2 / 9), 0, 1 / 3])
    #operation1 = rotation(2*np.pi/4, rotated_axis_i)
    #operation2 = reflection(rotated_axis_i)
    #operation = np.dot(operation2, operation1)