コード例 #1
0
    def __init__(self,
                 fc4,
                 supercell,
                 primitive,
                 mesh,
                 temperatures=None,
                 band_indices=None,
                 frequency_factor_to_THz=VaspToTHz,
                 is_nosym=False,
                 symprec=1e-3,
                 cutoff_frequency=1e-4,
                 log_level=False,
                 lapack_zheev_uplo='L'):
        self._fc4 = fc4
        self._supercell = supercell
        self._primitive = primitive
        self._masses = np.double(self._primitive.get_masses())
        self._mesh = np.intc(mesh)
        if temperatures is None:
            self._temperatures = np.double([0])
        else:
            self._temperatures = np.double(temperatures)
        num_band = primitive.get_number_of_atoms() * 3
        if band_indices is None:
            self._band_indices = np.arange(num_band, dtype='intc')
        else:
            self._band_indices = np.intc(band_indices)
        self._frequency_factor_to_THz = frequency_factor_to_THz
        self._is_nosym = is_nosym
        self._symprec = symprec
        self._cutoff_frequency = cutoff_frequency
        self._log_level = log_level
        self._lapack_zheev_uplo = lapack_zheev_uplo

        symmetry = Symmetry(primitive, symprec=symprec)
        self._point_group_operations = symmetry.get_pointgroup_operations()

        self._grid_address = get_grid_address(mesh)
        self._grid_point = None
        self._quartets_at_q = None
        self._weights_at_q = None

        self._phonon_done = None
        self._frequencies = None
        self._eigenvectors = None
        self._dm = None
        self._nac_q_direction = None

        self._frequency_shifts = None

        # Unit to THz of Gamma
        self._unit_conversion = (EV / Angstrom**4 / AMU**2 /
                                 (2 * np.pi * THz)**2 * Hbar * EV /
                                 (2 * np.pi * THz) / 8 /
                                 len(self._grid_address))
コード例 #2
0
    def __init__(self,
                 fc4,
                 supercell,
                 primitive,
                 mesh,
                 temperatures=None,
                 band_indices=None,
                 frequency_factor_to_THz=VaspToTHz,
                 is_nosym=False,
                 symprec=1e-3,
                 cutoff_frequency=1e-4,
                 log_level=False,
                 lapack_zheev_uplo='L'):
        self._fc4 = fc4
        self._supercell = supercell
        self._primitive = primitive
        self._masses = np.double(self._primitive.get_masses())
        self._mesh = np.intc(mesh)
        if temperatures is None:
            self._temperatures = np.double([0])
        else:
            self._temperatures = np.double(temperatures)
        num_band = primitive.get_number_of_atoms() * 3
        if band_indices is None:
            self._band_indices = np.arange(num_band, dtype='intc')
        else:
            self._band_indices = np.intc(band_indices)
        self._frequency_factor_to_THz = frequency_factor_to_THz
        self._is_nosym = is_nosym
        self._symprec = symprec
        self._cutoff_frequency = cutoff_frequency
        self._log_level = log_level
        self._lapack_zheev_uplo = lapack_zheev_uplo

        symmetry = Symmetry(primitive, symprec=symprec)
        self._point_group_operations = symmetry.get_pointgroup_operations()

        self._grid_address = get_grid_address(mesh)
        self._grid_point = None
        self._quartets_at_q = None
        self._weights_at_q = None

        self._phonon_done = None
        self._frequencies = None
        self._eigenvectors = None
        self._dm = None
        self._nac_q_direction = None

        self._frequency_shifts = None
        
        # Unit to THz of Gamma
        self._unit_conversion = (EV / Angstrom ** 4 / AMU ** 2
                                 / (2 * np.pi * THz) ** 2
                                 * Hbar * EV / (2 * np.pi * THz) / 8
                                 / len(self._grid_address))
コード例 #3
0
ファイル: __init__.py プロジェクト: Johnson-Wang/phonopy
    def get_linewidth_at_paths(self,
                               ise,
                               sigmas,
                               temperatures,
                               band_paths,
                               is_nu,
                               scattering_class=None,
                               filename=None):

        if self._is_nosym:
            grid_address, grid_mapping =get_grid_address([x + (x % 2 == 0) for x in self._mesh], is_return_map=True)
        else:
            grids, weights, grid_address, grid_mapping = get_ir_grid_points([x + (x % 2 == 0) for x in self._mesh],
                                                                            self._primitive,
                                                                            is_return_map=True)
        qpoints_address=grid_address / np.array(self._mesh, dtype=float)
        print "Paths in reciprocal reduced coordinates:"
        for sigma in sigmas:
            self._sigma = sigma
            lws_paths=[]
            distances=[]
            frequencies=[]
            new_paths = []
            for path in band_paths:
                print "[%5.2f %5.2f %5.2f] --> [%5.2f %5.2f %5.2f]" % (tuple(path[0]) + tuple(path[-1]))
                (new_path,
                 dists,
                freqs,
                lws)=self.path(path,
                              qpoints_address,
                              grid_mapping,
                              ise,
                              temperatures,
                              scattering_class)
                new_paths.append(new_path)
                distances.append(dists)
                frequencies.append(freqs)
                lws_paths.append(lws)
            self._distances=distances
            self._freqs_on_path=frequencies
            self._lws_on_path=lws_paths

            write_linewidth_band_csv(self._mesh,
                                     new_paths,
                                     distances=self._distances,
                                     lws=self._lws_on_path,
                                     band_indices=self._band_indices,
                                     temperatures=temperatures,
                                     frequencies=self._freqs_on_path,
                                     scattering_class=scattering_class,
                                     nu=is_nu,
                                     filename=(("-s%s"%sigma) if sigma is not None else ""))
            self.plot_lw()
コード例 #4
0
    def get_linewidth_at_paths(self,
                               ise,
                               sigmas,
                               temperatures,
                               band_paths,
                               is_nu,
                               scattering_class=None,
                               filename=None):

        if self._is_nosym:
            grid_address, grid_mapping = get_grid_address(
                [x + (x % 2 == 0) for x in self._mesh], is_return_map=True)
        else:
            grids, weights, grid_address, grid_mapping = get_ir_grid_points(
                [x + (x % 2 == 0) for x in self._mesh],
                self._primitive,
                is_return_map=True)
        qpoints_address = grid_address / np.array(self._mesh, dtype=float)
        print "Paths in reciprocal reduced coordinates:"
        for sigma in sigmas:
            self._sigma = sigma
            lws_paths = []
            distances = []
            frequencies = []
            new_paths = []
            for path in band_paths:
                print "[%5.2f %5.2f %5.2f] --> [%5.2f %5.2f %5.2f]" % (
                    tuple(path[0]) + tuple(path[-1]))
                (new_path, dists, freqs,
                 lws) = self.path(path, qpoints_address, grid_mapping, ise,
                                  temperatures, scattering_class)
                new_paths.append(new_path)
                distances.append(dists)
                frequencies.append(freqs)
                lws_paths.append(lws)
            self._distances = distances
            self._freqs_on_path = frequencies
            self._lws_on_path = lws_paths

            write_linewidth_band_csv(
                self._mesh,
                new_paths,
                distances=self._distances,
                lws=self._lws_on_path,
                band_indices=self._band_indices,
                temperatures=temperatures,
                frequencies=self._freqs_on_path,
                scattering_class=scattering_class,
                nu=is_nu,
                filename=(("-s%s" % sigma) if sigma is not None else ""))
            self.plot_lw()
コード例 #5
0
ファイル: conductivity.py プロジェクト: Johnson-Wang/phonopy
    def _set_grid_properties(self, grid_points):
        self._grid_address = self._pp.get_grid_address()

        if grid_points is not None:  # Specify grid points
            self._grid_points = reduce_grid_points(
                self._mesh_divisors,
                self._grid_address,
                grid_points,
                coarse_mesh_shifts=self._coarse_mesh_shifts)
            (self._ir_grid_points,
             self._ir_grid_weights) = self._get_ir_grid_points()
        elif self._no_kappa_stars:  # All grid points
            coarse_grid_address = get_grid_address(self._coarse_mesh)
            coarse_grid_points = np.arange(np.prod(self._coarse_mesh),
                                           dtype='intc')
            self._grid_points = from_coarse_to_dense_grid_points(
                self._mesh,
                self._mesh_divisors,
                coarse_grid_points,
                coarse_grid_address,
                coarse_mesh_shifts=self._coarse_mesh_shifts)
            self._grid_weights = np.ones(len(self._grid_points), dtype='intc')
            self._ir_grid_points = self._grid_points
            self._ir_grid_weights = self._grid_weights
        else:  # Automatic sampling
            self._grid_points, self._grid_weights = self._get_ir_grid_points()
            self._ir_grid_points = self._grid_points
            self._ir_grid_weights = self._grid_weights

        self._qpoints = np.array(self._grid_address[self._grid_points] /
                                 self._mesh.astype('double'),
                                 dtype='double',
                                 order='C')

        self._grid_point_count = 0
        self._pp.set_phonons(self._grid_points)
        self._frequencies = self._pp.get_phonons()[0][self._grid_points]
        self._eigen_vectors = self._pp.get_phonons()[1][self._grid_points]
        self._degeneracies = self._pp.get_degeneracy()[self._grid_points]
        if self._write_tecplot:
            self._dim = np.count_nonzero(np.array(self._mesh) > 1)
            #only dim=2 or 3 are implemented
            assert self._dim > 1, "The dimention of the given system is %d, but only dim=2 or 3 are implemented" % self._dim
            self.set_bz_grid_points()
            self.tetrahedra_specify()
コード例 #6
0
 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 = get_grid_address(self._mesh)
         # 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()
コード例 #7
0
ファイル: conductivity.py プロジェクト: supersonic594/phonopy
    def _set_grid_properties(self, grid_points):
        self._grid_address = self._pp.get_grid_address()

        if grid_points is not None:  # Specify grid points
            self._grid_points = reduce_grid_points(
                self._mesh_divisors,
                self._grid_address,
                grid_points,
                coarse_mesh_shifts=self._coarse_mesh_shifts)
            (self._ir_grid_points,
             self._ir_grid_weights) = self._get_ir_grid_points()
        elif self._no_kappa_stars:  # All grid points
            coarse_grid_address = get_grid_address(self._coarse_mesh)
            coarse_grid_points = np.arange(np.prod(self._coarse_mesh),
                                           dtype='intc')
            self._grid_points = from_coarse_to_dense_grid_points(
                self._mesh,
                self._mesh_divisors,
                coarse_grid_points,
                coarse_grid_address,
                coarse_mesh_shifts=self._coarse_mesh_shifts)
            self._grid_weights = np.ones(len(self._grid_points), dtype='intc')
            self._ir_grid_points = self._grid_points
            self._ir_grid_weights = self._grid_weights
        else:  # Automatic sampling
            self._grid_points, self._grid_weights = self._get_ir_grid_points()
            self._ir_grid_points = self._grid_points
            self._ir_grid_weights = self._grid_weights

        self._qpoints = np.array(self._grid_address[self._grid_points] /
                                 self._mesh.astype('double'),
                                 dtype='double',
                                 order='C')

        self._grid_point_count = 0
        self._pp.set_phonon(self._grid_points)
        self._frequencies = self._pp.get_phonons()[0]
コード例 #8
0
ファイル: conductivity.py プロジェクト: arbegla/phonopy
    def _set_grid_properties(self, grid_points):
        self._grid_address = self._pp.get_grid_address()

        if grid_points is not None: # Specify grid points
            self._grid_points = reduce_grid_points(
                self._mesh_divisors,
                self._grid_address,
                grid_points,
                coarse_mesh_shifts=self._coarse_mesh_shifts)
            (self._ir_grid_points,
             self._ir_grid_weights) = self._get_ir_grid_points()
        elif self._no_kappa_stars: # All grid points
            coarse_grid_address = get_grid_address(self._coarse_mesh)
            coarse_grid_points = np.arange(np.prod(self._coarse_mesh),
                                           dtype='intc')
            self._grid_points = from_coarse_to_dense_grid_points(
                self._mesh,
                self._mesh_divisors,
                coarse_grid_points,
                coarse_grid_address,
                coarse_mesh_shifts=self._coarse_mesh_shifts)
            self._grid_weights = np.ones(len(self._grid_points), dtype='intc')
            self._ir_grid_points = self._grid_points
            self._ir_grid_weights = self._grid_weights
        else: # Automatic sampling
            self._grid_points, self._grid_weights = self._get_ir_grid_points()
            self._ir_grid_points = self._grid_points
            self._ir_grid_weights = self._grid_weights

        self._qpoints = np.array(self._grid_address[self._grid_points] /
                                 self._mesh.astype('double'),
                                 dtype='double', order='C')

        self._grid_point_count = 0
        self._pp.set_phonon(self._grid_points)
        self._frequencies = self._pp.get_phonons()[0]
コード例 #9
0
ファイル: frequency_shift.py プロジェクト: shanghui/phonopy
 def _set_grid_address(self):
     grid_address = get_grid_address(self._mesh)
     self._grid_address, self._bz_map = spg.relocate_BZ_grid_address(
         grid_address, self._mesh,
         np.linalg.inv(self._primitive.get_cell()))
コード例 #10
0
ファイル: frequency_shift.py プロジェクト: Maofei/phonopy
 def _set_grid_address(self):
     grid_address = get_grid_address(self._mesh)
     self._grid_address, self._bz_map = spg.relocate_BZ_grid_address(
         grid_address,
         self._mesh,
         np.linalg.inv(self._primitive.get_cell()))