class Phono3pyIsotope: def __init__( self, mesh, primitive, mass_variances=None, # length of list is num_atom. band_indices=None, sigmas=[], frequency_factor_to_THz=VaspToTHz, symprec=1e-5, cutoff_frequency=None, log_level=0, lapack_zheev_uplo='L'): self._sigmas = sigmas self._log_level = log_level self._iso = Isotope(mesh, primitive, mass_variances=mass_variances, band_indices=band_indices, frequency_factor_to_THz=frequency_factor_to_THz, symprec=symprec, cutoff_frequency=cutoff_frequency, lapack_zheev_uplo=lapack_zheev_uplo) def run(self, grid_points): for gp in grid_points: self._iso.set_grid_point(gp) if self._log_level: print "------ Isotope scattering ------" print "Grid point: %d" % gp adrs = self._iso.get_grid_address()[gp] q = adrs.astype('double') / self._mesh print "q-point:", q print "Phonon frequency:" frequencies = self._iso.get_phonons()[0] print frequencies[gp] if self._sigmas: for sigma in self._sigmas: if sigma is None: print "Tetrahedron method" else: print "Sigma:", sigma self._iso.set_sigma(sigma) self._iso.run() print self._iso.get_gamma() else: print "sigma or tetrahedron method has to be set." def set_dynamical_matrix(self, fc2, supercell, primitive, nac_params=None, frequency_scale_factor=None, decimals=None): self._primitive = primitive self._iso.set_dynamical_matrix( fc2, supercell, primitive, nac_params=nac_params, frequency_scale_factor=frequency_scale_factor, decimals=decimals) def set_sigma(self, sigma): self._iso.set_sigma(sigma)
class Phono3pyIsotope: def __init__( self, mesh, primitive, mass_variances=None, # length of list is num_atom. band_indices=None, sigmas=None, frequency_factor_to_THz=VaspToTHz, symprec=1e-5, cutoff_frequency=None, lapack_zheev_uplo='L'): if sigmas is None: sigmas = [] self._mesh = mesh self._sigmas = sigmas self._iso = Isotope(mesh, primitive, mass_variances=mass_variances, band_indices=band_indices, frequency_factor_to_THz=frequency_factor_to_THz, symprec=symprec, cutoff_frequency=cutoff_frequency, lapack_zheev_uplo=lapack_zheev_uplo) def run(self, grid_points): for gp in grid_points: self._iso.set_grid_point(gp) print("--------------- Isotope scattering ---------------") print("Grid point: %d" % gp) adrs = self._iso.get_grid_address()[gp] q = adrs.astype('double') / self._mesh print("q-point: %s" % q) if self._sigmas: for sigma in self._sigmas: if sigma is None: print("Tetrahedron method") else: print("Sigma: %s" % sigma) self._iso.set_sigma(sigma) self._iso.run() frequencies = self._iso.get_phonons()[0] print('') print("Phonon-isotope scattering rate in THz (1/4pi-tau)") print(" Frequency Rate") for g, f in zip(self._iso.get_gamma(), frequencies[gp]): print("%8.3f %5.3e" % (f, g)) else: print("sigma or tetrahedron method has to be set.") def set_dynamical_matrix(self, fc2, supercell, primitive, nac_params=None, frequency_scale_factor=None, decimals=None): self._primitive = primitive self._iso.set_dynamical_matrix( fc2, supercell, primitive, nac_params=nac_params, frequency_scale_factor=frequency_scale_factor, decimals=decimals) def set_sigma(self, sigma): self._iso.set_sigma(sigma)
class Phono3pyIsotope: def __init__(self, mesh, primitive, mass_variances=None, # length of list is num_atom. band_indices=None, sigmas=None, frequency_factor_to_THz=VaspToTHz, symprec=1e-5, cutoff_frequency=None, lapack_zheev_uplo='L'): if sigmas is None: sigmas = [] self._mesh = mesh self._sigmas = sigmas self._iso = Isotope(mesh, primitive, mass_variances=mass_variances, band_indices=band_indices, frequency_factor_to_THz=frequency_factor_to_THz, symprec=symprec, cutoff_frequency=cutoff_frequency, lapack_zheev_uplo=lapack_zheev_uplo) def run(self, grid_points): for gp in grid_points: self._iso.set_grid_point(gp) print("--------------- Isotope scattering ---------------") print("Grid point: %d" % gp) adrs = self._iso.get_grid_address()[gp] q = adrs.astype('double') / self._mesh print("q-point: %s" % q) if self._sigmas: for sigma in self._sigmas: if sigma is None: print("Tetrahedron method") else: print("Sigma: %s" % sigma) self._iso.set_sigma(sigma) self._iso.run() frequencies = self._iso.get_phonons()[0] print('') print("Phonon-isotope scattering rate in THz (1/4pi-tau)") print(" Frequency Rate") for g, f in zip(self._iso.get_gamma(), frequencies[gp]): print("%8.3f %5.3e" % (f, g)) else: print("sigma or tetrahedron method has to be set.") def set_dynamical_matrix(self, fc2, supercell, primitive, nac_params=None, frequency_scale_factor=None, decimals=None): self._primitive = primitive self._iso.set_dynamical_matrix( fc2, supercell, primitive, nac_params=nac_params, frequency_scale_factor=frequency_scale_factor, decimals=decimals) def set_sigma(self, sigma): self._iso.set_sigma(sigma)
class Phono3pyIsotope: def __init__(self, mesh, primitive, mass_variances=None, # length of list is num_atom. band_indices=None, sigmas=[], frequency_factor_to_THz=VaspToTHz, symprec=1e-5, cutoff_frequency=None, log_level=0, lapack_zheev_uplo='L'): self._sigmas = sigmas self._log_level = log_level self._iso = Isotope(mesh, primitive, mass_variances=mass_variances, band_indices=band_indices, frequency_factor_to_THz=frequency_factor_to_THz, symprec=symprec, cutoff_frequency=cutoff_frequency, lapack_zheev_uplo=lapack_zheev_uplo) def run(self, grid_points): for gp in grid_points: self._iso.set_grid_point(gp) if self._log_level: print "------ Isotope scattering ------" print "Grid point: %d" % gp adrs = self._iso.get_grid_address()[gp] q = adrs.astype('double') / self._mesh print "q-point:", q print "Phonon frequency:" frequencies = self._iso.get_phonons()[0] print frequencies[gp] if self._sigmas: for sigma in self._sigmas: if sigma is None: print "Tetrahedron method" else: print "Sigma:", sigma self._iso.set_sigma(sigma) self._iso.run() print self._iso.get_gamma() else: print "sigma or tetrahedron method has to be set." def set_dynamical_matrix(self, fc2, supercell, primitive, nac_params=None, frequency_scale_factor=None, decimals=None): self._primitive = primitive self._iso.set_dynamical_matrix( fc2, supercell, primitive, nac_params=nac_params, frequency_scale_factor=frequency_scale_factor, decimals=decimals) def set_sigma(self, sigma): self._iso.set_sigma(sigma)