Exemplo n.º 1
0
    def _run_c_with_g(self, is_band_freq=False):
        self.set_phonons(self._triplets_at_q.ravel())
        if is_band_freq == True:
            self._frequency_points = self._frequencies[self._grid_point]
        else:
            if self._sigma is None:
                f_max = np.max(self._frequencies) * 2
            else:
                f_max = np.max(self._frequencies) * 2 + self._sigma * 4
            f_max *= 1.005
            f_min = 0
            self._set_frequency_points(f_min, f_max)

        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,
                                            occupation(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,
                neighboring_phonons=(i == 0),
                is_triplet_symmetry=False)


            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]
                gx = g[1] + g[2]
                jdos[i, 0] = - np.sum(
                    np.tensordot(gx[:, 0], self._weights_at_q, axes=(0, 0)))# the negative sign is for a clearer plot

            else:
                # g1 = g[1]
                g1 = g[2] - g[1]
                for j, n in enumerate(occ_phonons): # loop over temperature
                    for k, l in list(np.ndindex(g.shape[3:])): # double loop over other two phonon branches
                        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]) *
                                                g1[:, 0, k, l],
                                                self._weights_at_q) # the negative sign is for a clearer plot

        self._joint_dos = jdos / num_mesh
Exemplo n.º 2
0
    def set_integration_weights(self):
        if self._frequency_points is None:
            f_points = self._frequencies[self._grid_point][self._band_indices]
        else:
            f_points = self._frequency_points

        self._g = get_triplets_integration_weights(
            self._interaction,
            f_points,
            self._sigma,
            is_collision_matrix=self._is_collision_matrix)
Exemplo n.º 3
0
    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 = get_triplets_integration_weights(
            self._interaction,
            np.array(f_points, dtype='double'),
            self._sigma,
            is_collision_matrix=self._is_collision_matrix)

        if scattering_event_class == 1 or scattering_event_class == 2:
            self._g[scattering_event_class - 1] = 0
Exemplo n.º 4
0
    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 = get_triplets_integration_weights(
            self._pp,
            np.array(f_points, dtype='double'),
            self._sigma,
            is_collision_matrix=self._is_collision_matrix)

        if scattering_event_class == 1 or scattering_event_class == 2:
            self._g[scattering_event_class - 1] = 0
Exemplo n.º 5
0
    def _run_c_with_g(self):
        self.set_phonon(self._triplets_at_q.ravel())
        if self._sigma is None:
            f_max = np.max(self._frequencies) * 2
        else:
            f_max = np.max(self._frequencies) * 2 + self._sigma * 4
        f_max *= 1.005
        f_min = 0
        self._set_uniform_frequency_points(f_min, f_max)

        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,
                             occupation(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
Exemplo n.º 6
0
    def _run_c_with_g(self):
        self.set_phonon(self._triplets_at_q.ravel())
        if self._sigma is None:
            f_max = np.max(self._frequencies) * 2
        else:
            f_max = np.max(self._frequencies) * 2 + self._sigma * 4
        f_max *= 1.005
        f_min = 0
        self._set_frequency_points(f_min, f_max)

        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,
                                            occupation(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, 0] = np.sum(
                    np.tensordot(g[0, :, 0], self._weights_at_q, axes=(0, 0)))
                gx = g[2] - g[0]
                jdos[i, 1] = 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, 0] += np.dot(
                            (n[:, 0, k] + n[:, 1, l] + 1) *
                            g[0, :, 0, k, l], self._weights_at_q)
                        jdos[j, i, 1] += np.dot((n[:, 0, k] - n[:, 1, l]) *
                                                g[1, :, 0, k, l],
                                                self._weights_at_q)

        self._joint_dos = jdos / num_mesh