Beispiel #1
0
    def set_integration_weights(self, scattering_event_class=None):
        if self._frequency_points is None:
            bi = self._pp.band_indices
            f_points = self._frequencies[self._grid_point][bi]
        else:
            f_points = self._frequency_points

        self._g, _g_zero = get_triplets_integration_weights(
            self._pp,
            np.array(f_points, dtype='double'),
            self._sigma,
            self._sigma_cutoff,
            is_collision_matrix=self._is_collision_matrix)
        if self._frequency_points is None:
            self._g_zero = _g_zero
        else:
            # g_zero feature can not be used in frequency sampling mode.
            # zero values of the following array shape is used in C-routine.
            # shape = [num_triplets, num_band0, num_band, num_band]
            shape = list(self._g.shape[1:])
            shape[1] = len(self._pp.band_indices)
            self._g_zero_zeros = np.zeros(shape=shape, dtype='byte', order='C')
            self._g_zero_frequency_points = _g_zero

        if scattering_event_class == 1 or scattering_event_class == 2:
            self._g[scattering_event_class - 1] = 0
Beispiel #2
0
 def run_integration_weights(self, lang="C"):
     """Compute triplets integration weights."""
     self._g, self._g_zero = get_triplets_integration_weights(
         self,
         self._frequency_points,
         self._sigma,
         sigma_cutoff=self._sigma_cutoff,
         is_collision_matrix=(self._temperature is None),
         lang=lang,
     )
Beispiel #3
0
    def _run_c_with_g(self):
        self.run_phonon_solver(self._triplets_at_q.ravel())
        max_phonon_freq = np.max(self._frequencies)
        self._frequency_points = get_frequency_points(
            max_phonon_freq=max_phonon_freq,
            sigmas=[
                self._sigma,
            ],
            frequency_points=None,
            frequency_step=self._frequency_step,
            num_frequency_points=self._num_frequency_points)
        num_freq_points = len(self._frequency_points)
        num_mesh = np.prod(self._mesh)

        if self._temperatures is None:
            jdos = np.zeros((num_freq_points, 2), dtype='double')
        else:
            num_temps = len(self._temperatures)
            jdos = np.zeros((num_temps, num_freq_points, 2), dtype='double')
            occ_phonons = []
            for t in self._temperatures:
                freqs = self._frequencies[self._triplets_at_q[:, 1:]]
                occ_phonons.append(
                    np.where(freqs > self._cutoff_frequency,
                             bose_einstein(freqs, t), 0))

        for i, freq_point in enumerate(self._frequency_points):
            g, _ = get_triplets_integration_weights(
                self,
                np.array([freq_point], dtype='double'),
                self._sigma,
                is_collision_matrix=True,
                neighboring_phonons=(i == 0))

            if self._temperatures is None:
                jdos[i, 1] = np.sum(
                    np.tensordot(g[0, :, 0], self._weights_at_q, axes=(0, 0)))
                gx = g[2] - g[0]
                jdos[i, 0] = np.sum(
                    np.tensordot(gx[:, 0], self._weights_at_q, axes=(0, 0)))
            else:
                for j, n in enumerate(occ_phonons):
                    for k, l in list(np.ndindex(g.shape[3:])):
                        jdos[j, i, 1] += np.dot(
                            (n[:, 0, k] + n[:, 1, l] + 1) * g[0, :, 0, k, l],
                            self._weights_at_q)
                        jdos[j, i, 0] += np.dot(
                            (n[:, 0, k] - n[:, 1, l]) * g[1, :, 0, k, l],
                            self._weights_at_q)

        self._joint_dos = jdos / num_mesh
    def set_integration_weights(self, scattering_event_class=None):
        if self._frequency_points is None:
            f_points = self._frequencies[self._grid_point][self._band_indices]
        else:
            f_points = self._frequency_points

        self._g, _g_zero = get_triplets_integration_weights(
            self._pp,
            np.array(f_points, dtype='double'),
            self._sigma,
            is_collision_matrix=self._is_collision_matrix)
        if self._frequency_points is None:
            self._g_zero = _g_zero

        if scattering_event_class == 1 or scattering_event_class == 2:
            self._g[scattering_event_class - 1] = 0