示例#1
0
    def _set_integration_weights_py(self, thm):
        for i, gp in enumerate(self._grid_points):
            tfreqs = get_tetrahedra_frequencies(
                gp, self._mesh,
                [1, self._mesh[0], self._mesh[0] * self._mesh[1]],
                self._grid_address, thm.get_tetrahedra(), self._grid_points,
                self._frequencies)

            for bi, frequencies in enumerate(tfreqs):
                thm.set_tetrahedra_omegas(frequencies)
                thm.run(self._frequencies[self._grid_point,
                                          self._band_indices])
                iw = thm.get_integration_weight()
                self._integration_weights[i, :, bi] = iw
示例#2
0
文件: isotope.py 项目: nfh/phonopy
 def _set_integration_weights_py(self, thm):
     for i, gp in enumerate(self._grid_points):
         tfreqs = get_tetrahedra_frequencies(
             gp,
             self._mesh,
             [1, self._mesh[0], self._mesh[0] * self._mesh[1]],
             self._grid_address,
             thm.get_tetrahedra(),
             self._grid_points,
             self._frequencies)
         
         for bi, frequencies in enumerate(tfreqs):
             thm.set_tetrahedra_omegas(frequencies)
             thm.run(self._frequencies[self._grid_point, self._band_indices])
             iw = thm.get_integration_weight()
             self._integration_weights[i, :, bi] = iw
示例#3
0
    def _set_integration_weights_py(self, thm, infinitesmal=1e-10):
        grid_order = [1, self._mesh[0], self._mesh[0] * self._mesh[1]]
        for i, gp in enumerate(self._grid_points2):
            address = thm.get_tetrahedra().reshape(-1,
                                                   3) + self._grid_address[gp]
            for neighbor in np.unique(np.dot(address % self._mesh,
                                             grid_order)):
                self._set_phonon_py(neighbor)
            tfreqs = get_tetrahedra_frequencies(
                gp, self._mesh,
                [1, self._mesh[0], self._mesh[0] * self._mesh[1]],
                self._grid_address, thm.get_tetrahedra(),
                np.arange(np.prod(self._mesh)), self._frequencies)

            for bi, frequencies in enumerate(tfreqs):
                thm.set_segments_omegas(frequencies)
                thm.run(self._frequencies[self._grid_point,
                                          self._band_indices] + infinitesmal)
                iw = thm.get_integration_weight()
                self._integration_weights[i, :, bi] = iw
示例#4
0
 def _set_integration_weights_py(self, thm, infinitesmal = 1e-10):
     grid_order = [1, self._mesh[0], self._mesh[0] * self._mesh[1]]
     for i, gp in enumerate(self._grid_points2):
         address = thm.get_tetrahedra().reshape(-1,3) + self._grid_address[gp]
         for neighbor in np.unique(np.dot(address % self._mesh, grid_order)):
             self._set_phonon_py(neighbor)
         tfreqs = get_tetrahedra_frequencies(
             gp,
             self._mesh,
             [1, self._mesh[0], self._mesh[0] * self._mesh[1]],
             self._grid_address,
             thm.get_tetrahedra(),
             np.arange(np.prod(self._mesh)),
             self._frequencies)
         
         for bi, frequencies in enumerate(tfreqs):
             thm.set_segments_omegas(frequencies)
             thm.run(self._frequencies[self._grid_point, self._band_indices] + infinitesmal)
             iw = thm.get_integration_weight()
             self._integration_weights[i, :, bi] = iw
示例#5
0
    def _set_integration_weights_py(self):
        if self._bz_grid.store_dense_gp_map:
            raise NotImplementedError("Only for type-I bz_map.")
        if self._bz_grid.grid_matrix is not None:
            raise NotImplementedError(
                "Generalized regular grid is not supported.")
        thm = TetrahedronMethod(self._bz_grid.microzone_lattice)
        num_grid_points = len(self._grid_points)
        num_band = len(self._primitive) * 3
        self._integration_weights = np.zeros(
            (num_grid_points, len(self._band_indices), num_band),
            dtype="double")

        for i, gp in enumerate(self._grid_points):
            tfreqs = get_tetrahedra_frequencies(
                gp,
                self._bz_grid.D_diag,
                self._bz_grid.addresses,
                np.array(
                    np.dot(thm.get_tetrahedra(), self._bz_grid.P.T),
                    dtype="int_",
                    order="C",
                ),
                self._grid_points,
                self._frequencies,
                grid_order=[
                    1,
                    self._bz_grid.D_diag[0],
                    self._bz_grid.D_diag[0] * self._bz_grid.D_diag[1],
                ],
                lang="Py",
            )

            for bi, frequencies in enumerate(tfreqs):
                thm.set_tetrahedra_omegas(frequencies)
                thm.run(self._frequencies[self._grid_point,
                                          self._band_indices])
                iw = thm.get_integration_weight()
                self._integration_weights[i, :, bi] = iw