Example #1
0
    def shift_y(self, shift):
        '''
        Shift by *delta_x* the x coordinates.

        :param shift: Real number. Shift value.
        '''
        error_handling.empty_coor(self.coor)
        error_handling.real_number(shift, 'shift')
        self.coor['y'] += shift
Example #2
0
    def shift_y(self, shift):
        """
        Shift by *delta_x* the x coordinates.

        :param shift: Real number. Shift value.
        """
        error_handling.empty_coor(self.coor)
        error_handling.real_number(shift, "shift")
        self.coor["y"] += shift
Example #3
0
    def rotation(self, theta):
        r'''
        Rotate the lattice structure by the angle :math:`\theta`.

        :param theta: Rotation angle in degrees.
        '''
        error_handling.empty_coor(self.coor)
        error_handling.real_number(theta, 'theta')
        theta *= PI / 360
        for dic in self.unit_cell:
            x  = self.coor['x'] - dic['r0'][0]
            y  = self.coor['y'] - dic['r0'][1]
            self.coor['x'] = x * np.cos(theta) - y * np.sin(theta) + dic['r0'][0]
            self.coor['y'] = y * np.cos(theta) + x* np.sin(theta) + dic['r0'][1]
Example #4
0
    def rotation(self, theta):
        r"""
        Rotate the lattice structure by the angle :math:`\theta`.

        :param theta: Rotation angle in degrees.
        """
        error_handling.empty_coor(self.coor)
        error_handling.real_number(theta, "theta")
        theta *= PI / 360
        for dic in self.unit_cell:
            x = self.coor["x"] - dic["r0"][0]
            y = self.coor["y"] - dic["r0"][1]
            self.coor["x"] = x * np.cos(theta) - y * np.sin(theta) + dic["r0"][0]
            self.coor["y"] = y * np.cos(theta) + x * np.sin(theta) + dic["r0"][1]
Example #5
0
File: system.py Project: cpoli/tbee
    def change_hopping_ellipse(self, list_hop, rx, ry, x0=0., y0=0.):
        '''
        Change hopping values.

        :param list_hop: List of Dictionary (see set_hopping definition).
        :param rx: Positive Float. Radius along :math:`x`. 
        :param ry: Positive Float. Radius along :math:`y`.
        :param x0: Float. Default value 0. :math:`x` center. 
        :param y0: Float. Default value 0. :math:`y` center.
        '''
        error_handling.empty_hop(self.hop)
        error_handling.set_hopping(list_hop, self.nmax)
        error_handling.positive_real(rx, 'rx')
        error_handling.positive_real(ry, 'rx')
        error_handling.real_number(x0, 'x0')
        error_handling.real_number(y0, 'y0')
        ind = self.find_ellipse(rx, ry, x0, y0)
        self.set_new_hopping(list_hop, ind)
Example #6
0
    def change_hopping_ellipse(self, list_hop, rx, ry, x0=0., y0=0.):
        '''
        Change hopping values.

        :param list_hop: List of Dictionary (see set_hopping definition).
        :param rx: Positive Float. Radius along :math:`x`. 
        :param ry: Positive Float. Radius along :math:`y`.
        :param x0: Float. Default value 0. :math:`x` center. 
        :param y0: Float. Default value 0. :math:`y` center.
        '''
        error_handling.empty_hop(self.hop)
        error_handling.set_hopping(list_hop, self.nmax)
        error_handling.positive_real(rx, 'rx')
        error_handling.positive_real(ry, 'rx')
        error_handling.real_number(x0, 'x0')
        error_handling.real_number(y0, 'y0')
        ind = self.find_ellipse(rx, ry, x0, y0)
        self.set_new_hopping(list_hop, ind)
Example #7
0
    def ellipse_in(self, rx, ry, x0, y0):
        """
        Select sites according to 

        .. math:: 

            (x-x_0)^2/a^2+(y-y_0)^2/b^2 < 1\,  .

        :param list_hop: List of Dictionary (see set_hopping definition).
        :param rx: Positive Real number. Radius along :math:`x`. 
        :param ry: Positive Real number. Radius along :math:`y`.
        :param x0: Real number. :math:`x` center. 
        :param y0: Real number. :math:`y` center.
        """
        error_handling.empty_coor(self.coor)
        error_handling.positive_real(rx, "rx")
        error_handling.positive_real(ry, "ry")
        error_handling.real_number(x0, "x0")
        error_handling.real_number(y0, "y0")
        self.coor = self.coor[(self.coor["x"] - x0) ** 2 / rx ** 2 + (self.coor["y"] - y0) ** 2 / ry ** 2 < 1.0]
        self.sites = len(self.coor)
Example #8
0
    def ellipse_in(self, rx, ry, x0, y0):
        '''
        Select sites according to 

        .. math:: 

            (x-x_0)^2/a^2+(y-y_0)^2/b^2 < 1\,  .

        :param list_hop: List of Dictionary (see set_hopping definition).
        :param rx: Positive Real number. Radius along :math:`x`. 
        :param ry: Positive Real number. Radius along :math:`y`.
        :param x0: Real number. :math:`x` center. 
        :param y0: Real number. :math:`y` center.
        '''
        error_handling.empty_coor(self.coor)
        error_handling.positive_real(rx, 'rx')
        error_handling.positive_real(ry, 'ry')
        error_handling.real_number(x0, 'x0')
        error_handling.real_number(y0, 'y0')
        self.coor = self.coor[(self.coor['x'] -x0) ** 2 / rx ** 2 +  \
                                        (self.coor['y'] -y0) ** 2 / ry ** 2 < 1.]
        self.sites = len(self.coor)
Example #9
0
    def boundary_line(self, cx, cy, co):
        '''
        Select sites according to :math:`c_yy+c_xx > c_0`.

        :param cx: Real number. cx value.
        :param cy: Real number. cy value.
        :param co: Real number. co value.
        '''
        error_handling.empty_coor(self.coor)
        error_handling.real_number(cx, 'cx')
        error_handling.real_number(cy, 'cy')
        error_handling.real_number(co, 'co')
        self.coor = self.coor[cy * self.coor['y'] + cx * self.coor['x'] > co]
        self.sites = len(self.coor)
Example #10
0
    def boundary_line(self, cx, cy, co):
        """
        Select sites according to :math:`c_yy+c_xx > c_0`.

        :param cx: Real number. cx value.
        :param cy: Real number. cy value.
        :param co: Real number. co value.
        """
        error_handling.empty_coor(self.coor)
        error_handling.real_number(cx, "cx")
        error_handling.real_number(cy, "cy")
        error_handling.real_number(co, "co")
        self.coor = self.coor[cy * self.coor["y"] + cx * self.coor["x"] > co]
        self.sites = len(self.coor)