예제 #1
0
 def _allocate_phonon(self):
     primitive_lattice = np.linalg.inv(self._primitive.get_cell())
     self._grid_address, self._bz_map = get_bz_grid_address(
         self._mesh, primitive_lattice, with_boundary=True)
     num_band = self._primitive.get_number_of_atoms() * 3
     num_grid = len(self._grid_address)
     self._phonon_done = np.zeros(num_grid, dtype='byte')
     self._frequencies = np.zeros((num_grid, num_band), dtype='double')
     self._eigenvectors = np.zeros((num_grid, num_band, num_band),
                                   dtype='complex128')
예제 #2
0
파일: isotope.py 프로젝트: shanghui/phonopy
    def set_grid_point(self, grid_point):
        self._grid_point = grid_point
        num_band = self._primitive.get_number_of_atoms() * 3
        if self._band_indices is None:
            self._band_indices = np.arange(num_band, dtype="intc")
        else:
            self._band_indices = np.array(self._band_indices, dtype="intc")

        self._grid_points = np.arange(np.prod(self._mesh), dtype="intc")

        if self._grid_address is None:
            primitive_lattice = np.linalg.inv(self._primitive.get_cell())
            self._grid_address, self._bz_map = get_bz_grid_address(self._mesh, primitive_lattice, with_boundary=True)

        if self._phonon_done is None:
            self._allocate_phonon()
예제 #3
0
파일: isotope.py 프로젝트: matk86/phonopy
 def set_grid_point(self, grid_point):
     self._grid_point = grid_point
     num_band = self._primitive.get_number_of_atoms() * 3
     if self._band_indices is None:
         self._band_indices = np.arange(num_band, dtype='intc')
     else:
         self._band_indices = np.array(self._band_indices, dtype='intc')
         
     self._grid_points = np.arange(np.prod(self._mesh), dtype='intc')
     
     if self._grid_address is None:
         primitive_lattice = np.linalg.inv(self._primitive.get_cell())
         self._grid_address, self._bz_map = get_bz_grid_address(
             self._mesh, primitive_lattice, with_boundary=True)
     
     if self._phonon_done is None:
         self._allocate_phonon()
예제 #4
0
    def set_grid_point(self, grid_point, grid_points2=None, weights2=None):
        "The grid_point is numbered using the bz scheme"
        self._grid_point = grid_point
        if self._grid_address is None:
            primitive_lattice = np.linalg.inv(self._primitive.get_cell())
            self._grid_address, self._bz_map, self._bz_to_pp_map = get_bz_grid_address(
                self._mesh,
                primitive_lattice,
                with_boundary=True,
                is_bz_map_to_pp=True)

        if grid_points2 is not None:
            self._grid_points2 = grid_points2
            self._weights2 = weights2
        elif not self._is_nosym:
            symmetry = Symmetry(self._primitive, symprec=self._symprec)
            qpoint = self._grid_address[grid_point] / np.double(self._mesh)
            mapping, grid_points = spg.get_stabilized_reciprocal_mesh(
                self._mesh,
                symmetry.get_pointgroup_operations(),
                is_shift=np.zeros(3, dtype='intc'),
                is_time_reversal=True,
                qpoints=[qpoint])

            grid_points2 = np.unique(mapping)
            # weight = np.zeros_like(grid_points2)
            # bz_grid_points2 = np.zeros_like(grid_points2)
            # for g, grid in enumerate(grid_points2):
            #     weight[g] = len(np.where(grid == mapping)[0])
            #     bz_grid_points2[g] = np.where(grid == self._bz_to_pp_map)[0][0]
            # self._grid_points2 = bz_grid_points2
            weight_temp = np.bincount(mapping)
            weight = weight_temp[np.nonzero(weight_temp)]
            self._grid_points2 = grid_points2
            self._weights2 = weight
        else:
            self._grid_points2 = np.arange(np.prod(self._mesh))
            self._weights2 = np.ones_like(self._grid_points2, dtype="intc")
예제 #5
0
    def set_grid_point(self,
                       grid_point,
                       grid_points2=None,
                       weights2 = None):
        "The grid_point is numbered using the bz scheme"
        self._grid_point = grid_point
        if self._grid_address is None:
            primitive_lattice = np.linalg.inv(self._primitive.get_cell())
            self._grid_address, self._bz_map, self._bz_to_pp_map = get_bz_grid_address(
                self._mesh, primitive_lattice, with_boundary=True, is_bz_map_to_pp=True)

        if grid_points2 is not None:
            self._grid_points2 = grid_points2
            self._weights2 = weights2
        elif not self._is_nosym:
            symmetry = Symmetry(self._primitive, symprec=self._symprec)
            qpoint = self._grid_address[grid_point] / np.double(self._mesh)
            mapping, grid_points = spg.get_stabilized_reciprocal_mesh(self._mesh,
                                                                      symmetry.get_pointgroup_operations(),
                                                                      is_shift=np.zeros(3, dtype='intc'),
                                                                      is_time_reversal=True,
                                                                      qpoints=[qpoint])

            grid_points2 = np.unique(mapping)
            # weight = np.zeros_like(grid_points2)
            # bz_grid_points2 = np.zeros_like(grid_points2)
            # for g, grid in enumerate(grid_points2):
            #     weight[g] = len(np.where(grid == mapping)[0])
            #     bz_grid_points2[g] = np.where(grid == self._bz_to_pp_map)[0][0]
            # self._grid_points2 = bz_grid_points2
            weight_temp = np.bincount(mapping)
            weight = weight_temp[np.nonzero(weight_temp)]
            self._grid_points2 = grid_points2
            self._weights2 = weight
        else:
            self._grid_points2 = np.arange(np.prod(self._mesh))
            self._weights2 = np.ones_like(self._grid_points2, dtype="intc")