本文整理汇总了Python中phonopy.structure.symmetry.Symmetry.get_pointgroup_operations方法的典型用法代码示例。如果您正苦于以下问题:Python Symmetry.get_pointgroup_operations方法的具体用法?Python Symmetry.get_pointgroup_operations怎么用?Python Symmetry.get_pointgroup_operations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phonopy.structure.symmetry.Symmetry
的用法示例。
在下文中一共展示了Symmetry.get_pointgroup_operations方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
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 = None
self._bz_map = None
self._set_grid_address()
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 Delta
self._unit_conversion = (EV / Angstrom ** 4 / AMU ** 2
/ (2 * np.pi * THz) ** 2
* Hbar * EV / (2 * np.pi * THz) / 8
/ np.prod(self._mesh))
self._allocate_phonon()
示例2: get_born_OUTCAR
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
def get_born_OUTCAR(
poscar_filename="POSCAR",
outcar_filename="OUTCAR",
primitive_axis=np.eye(3),
supercell_matrix=np.eye(3, dtype="intc"),
is_symmetry=True,
symmetrize_tensors=False,
symprec=1e-5,
):
ucell = read_vasp(poscar_filename)
outcar = open(outcar_filename)
borns, epsilon = _read_born_and_epsilon(outcar)
num_atom = len(borns)
assert num_atom == ucell.get_number_of_atoms()
if symmetrize_tensors:
lattice = ucell.get_cell().T
positions = ucell.get_scaled_positions()
u_sym = Symmetry(ucell, is_symmetry=is_symmetry, symprec=symprec)
point_sym = [similarity_transformation(lattice, r) for r in u_sym.get_pointgroup_operations()]
epsilon = _symmetrize_tensor(epsilon, point_sym)
borns = _symmetrize_borns(borns, u_sym, lattice, positions, symprec)
inv_smat = np.linalg.inv(supercell_matrix)
scell = get_supercell(ucell, supercell_matrix, symprec=symprec)
pcell = get_primitive(scell, np.dot(inv_smat, primitive_axis), symprec=symprec)
p2s = np.array(pcell.get_primitive_to_supercell_map(), dtype="intc")
p_sym = Symmetry(pcell, is_symmetry=is_symmetry, symprec=symprec)
s_indep_atoms = p2s[p_sym.get_independent_atoms()]
u2u = scell.get_unitcell_to_unitcell_map()
u_indep_atoms = [u2u[x] for x in s_indep_atoms]
reduced_borns = borns[u_indep_atoms].copy()
return reduced_borns, epsilon
示例3: get_born_OUTCAR
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
def get_born_OUTCAR(poscar_filename="POSCAR",
outcar_filename="OUTCAR",
primitive_axis=np.eye(3),
is_symmetry=True,
symmetrize_tensors=False):
cell = read_vasp(poscar_filename)
primitive = Primitive(cell, primitive_axis)
p2p = primitive.get_primitive_to_primitive_map()
symmetry = Symmetry(primitive, is_symmetry=is_symmetry)
independent_atoms = symmetry.get_independent_atoms()
prim_lat = primitive.get_cell().T
outcar = open(outcar_filename)
borns = []
while True:
line = outcar.readline()
if not line:
break
if "NIONS" in line:
num_atom = int(line.split()[11])
if "MACROSCOPIC STATIC DIELECTRIC TENSOR" in line:
epsilon = []
outcar.readline()
epsilon.append([float(x) for x in outcar.readline().split()])
epsilon.append([float(x) for x in outcar.readline().split()])
epsilon.append([float(x) for x in outcar.readline().split()])
if "BORN" in line:
outcar.readline()
line = outcar.readline()
if "ion" in line:
for i in range(num_atom):
born = []
born.append([float(x) for x in outcar.readline().split()][1:])
born.append([float(x) for x in outcar.readline().split()][1:])
born.append([float(x) for x in outcar.readline().split()][1:])
outcar.readline()
borns.append(born)
reduced_borns = []
for p_i, u_i in enumerate(p2p):
if p_i in independent_atoms:
if symmetrize_tensors:
site_sym = [similarity_transformation(prim_lat, rot)
for rot in symmetry.get_site_symmetry(p_i)]
reduced_borns.append(symmetrize_tensor(borns[u_i], site_sym))
else:
reduced_borns.append(borns[u_i])
if symmetrize_tensors:
point_sym = [similarity_transformation(prim_lat, rot)
for rot in symmetry.get_pointgroup_operations()]
epsilon = symmetrize_tensor(epsilon, point_sym)
else:
epsilon = np.array(epsilon)
return np.array(reduced_borns), epsilon
示例4: get_coarse_ir_grid_points
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
def get_coarse_ir_grid_points(primitive,
mesh,
mesh_divisors,
coarse_mesh_shifts,
is_kappa_star=True,
symprec=1e-5):
mesh = np.array(mesh, dtype='intc')
symmetry = Symmetry(primitive, symprec)
point_group = symmetry.get_pointgroup_operations()
if mesh_divisors is None:
(ir_grid_points,
ir_grid_weights,
grid_address,
grid_mapping_table) = get_ir_grid_points(mesh, point_group)
else:
mesh_divs = np.array(mesh_divisors, dtype='intc')
coarse_mesh = mesh // mesh_divs
if coarse_mesh_shifts is None:
coarse_mesh_shifts = [False, False, False]
if not is_kappa_star:
coarse_grid_address = get_grid_address(coarse_mesh)
coarse_grid_points = np.arange(np.prod(coarse_mesh), dtype='intc')
coarse_grid_weights = np.ones(len(coarse_grid_points), dtype='intc')
else:
(coarse_ir_grid_points,
coarse_ir_grid_weights,
coarse_grid_address,
coarse_grid_mapping_table) = get_ir_grid_points(
coarse_mesh,
point_group,
mesh_shifts=coarse_mesh_shifts)
ir_grid_points = from_coarse_to_dense_grid_points(
mesh,
mesh_divs,
coarse_grid_points,
coarse_grid_address,
coarse_mesh_shifts=coarse_mesh_shifts)
grid_address = get_grid_address(mesh)
ir_grid_weights = ir_grid_weights
primitive_lattice = np.linalg.inv(primitive.get_cell())
bz_grid_address, bz_map = spg.relocate_BZ_grid_address(grid_address,
mesh,
primitive_lattice)
return (ir_grid_points,
ir_grid_weights,
bz_grid_address,
grid_mapping_table)
示例5: get_number_of_triplets
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
def get_number_of_triplets(primitive,
mesh,
grid_point,
symprec=1e-5):
mesh = np.array(mesh, dtype='intc')
symmetry = Symmetry(primitive, symprec)
point_group = symmetry.get_pointgroup_operations()
primitive_lattice = np.linalg.inv(primitive.get_cell())
triplets_at_q, _, _, _, _, _ = get_triplets_at_q(
grid_point,
mesh,
point_group,
primitive_lattice)
return len(triplets_at_q)
示例6: get_coarse_ir_grid_points
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
def get_coarse_ir_grid_points(primitive,
mesh,
mesh_divisors,
coarse_mesh_shifts,
is_nosym=False,
symprec=1e-5):
if mesh_divisors is None:
mesh_divs = [1, 1, 1]
else:
mesh_divs = mesh_divisors
mesh = np.array(mesh, dtype='intc')
mesh_divs = np.array(mesh_divs, dtype='intc')
coarse_mesh = mesh // mesh_divs
if coarse_mesh_shifts is None:
coarse_mesh_shifts = [False, False, False]
if is_nosym:
coarse_grid_address = get_grid_address(coarse_mesh)
coarse_grid_points = np.arange(np.prod(coarse_mesh), dtype='intc')
coarse_grid_weights = np.ones(len(coarse_grid_points), dtype='intc')
else:
symmetry = Symmetry(primitive, symprec)
(coarse_grid_points,
coarse_grid_weights,
coarse_grid_address) = get_ir_grid_points(
coarse_mesh,
symmetry.get_pointgroup_operations(),
mesh_shifts=coarse_mesh_shifts)
grid_points = from_coarse_to_dense_grid_points(
mesh,
mesh_divs,
coarse_grid_points,
coarse_grid_address,
coarse_mesh_shifts=coarse_mesh_shifts)
grid_address = get_grid_address(mesh)
primitive_lattice = np.linalg.inv(primitive.get_cell())
bz_grid_address, _ = spg.relocate_BZ_grid_address(grid_address,
mesh,
primitive_lattice)
return grid_points, coarse_grid_weights, bz_grid_address
示例7: set_grid_point
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
def set_grid_point(self,
grid_point,
grid_points2=None,
weights2 = None):
"The grid_point is numbered using the bz scheme"
self._grid_point = grid_point
if self._grid_address is None:
primitive_lattice = np.linalg.inv(self._primitive.get_cell())
self._grid_address, self._bz_map, self._bz_to_pp_map = get_bz_grid_address(
self._mesh, primitive_lattice, with_boundary=True, is_bz_map_to_pp=True)
if grid_points2 is not None:
self._grid_points2 = grid_points2
self._weights2 = weights2
elif not self._is_nosym:
symmetry = Symmetry(self._primitive, symprec=self._symprec)
qpoint = self._grid_address[grid_point] / np.double(self._mesh)
mapping, grid_points = spg.get_stabilized_reciprocal_mesh(self._mesh,
symmetry.get_pointgroup_operations(),
is_shift=np.zeros(3, dtype='intc'),
is_time_reversal=True,
qpoints=[qpoint])
grid_points2 = np.unique(mapping)
# weight = np.zeros_like(grid_points2)
# bz_grid_points2 = np.zeros_like(grid_points2)
# for g, grid in enumerate(grid_points2):
# weight[g] = len(np.where(grid == mapping)[0])
# bz_grid_points2[g] = np.where(grid == self._bz_to_pp_map)[0][0]
# self._grid_points2 = bz_grid_points2
weight_temp = np.bincount(mapping)
weight = weight_temp[np.nonzero(weight_temp)]
self._grid_points2 = grid_points2
self._weights2 = weight
else:
self._grid_points2 = np.arange(np.prod(self._mesh))
self._weights2 = np.ones_like(self._grid_points2, dtype="intc")
示例8: __init__
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
#.........这里部分代码省略.........
num_freq_points = len(self._frequency_points)
jdos = np.zeros((num_freq_points, 2), dtype='double')
for vertices, w in zip(self._vertices, self._weights_at_q):
for i, j in list(np.ndindex(self._num_band, self._num_band)):
f1 = self._frequencies[vertices[0], i]
f2 = self._frequencies[vertices[1], j]
thm.set_tetrahedra_omegas(f1 + f2)
thm.run(self._frequency_points)
iw = thm.get_integration_weight()
jdos[:, 0] += iw * w
thm.set_tetrahedra_omegas(f1 - f2)
thm.run(self._frequency_points)
iw = thm.get_integration_weight()
jdos[:, 1] += iw * w
thm.set_tetrahedra_omegas(-f1 + f2)
thm.run(self._frequency_points)
iw = thm.get_integration_weight()
jdos[:, 1] += iw * w
self._joint_dos = jdos / np.prod(self._mesh)
def _run_smearing_method(self):
import anharmonic._phono3py as phono3c
self.set_phonon(self._triplets_at_q.ravel())
f_max = np.max(self._frequencies) * 2 + self._sigma * 4
f_min = np.min(self._frequencies) * 2 - self._sigma * 4
self._set_frequency_points(f_min, f_max)
jdos = np.zeros((len(self._frequency_points), 2), dtype='double')
phono3c.joint_dos(jdos,
self._frequency_points,
self._triplets_at_q,
self._weights_at_q,
self._frequencies,
self._sigma)
jdos /= np.prod(self._mesh)
self._joint_dos = jdos
def _set_dynamical_matrix(self):
self._dm = get_dynamical_matrix(
self._fc2,
self._supercell,
self._primitive,
nac_params=self._nac_params,
frequency_scale_factor=self._frequency_scale_factor,
symprec=self._symprec)
def _set_triplets(self):
if self._is_nosym:
if self._log_level:
print "Triplets at q without considering symmetry"
sys.stdout.flush()
(self._triplets_at_q,
self._weights_at_q,
self._grid_address,
self._bz_map,
map_triplets,
map_q) = get_nosym_triplets_at_q(
self._grid_point,
self._mesh,
self._reciprocal_lattice,
with_bz_map=True)
else:
(self._triplets_at_q,
self._weights_at_q,
self._grid_address,
self._bz_map,
map_triplets,
map_q) = get_triplets_at_q(
self._grid_point,
self._mesh,
self._symmetry.get_pointgroup_operations(),
self._reciprocal_lattice)
def set_phonon(self, grid_points):
set_phonon_c(self._dm,
self._frequencies,
self._eigenvectors,
self._phonon_done,
grid_points,
self._grid_address,
self._mesh,
self._frequency_factor_to_THz,
self._nac_q_direction,
self._lapack_zheev_uplo)
def _set_frequency_points(self, f_min, f_max):
if self._num_frequency_points is None:
if self._frequency_step is not None:
self._frequency_points = np.arange(
f_min, f_max, self._frequency_step, dtype='double')
else:
self._frequency_points = np.array(np.linspace(
f_min, f_max, 201), dtype='double')
else:
self._frequency_points = np.array(np.linspace(
f_min, f_max, self._num_frequency_points), dtype='double')
示例9: __init__
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
#.........这里部分代码省略.........
read_gamma=read_gamma,
input_filename=input_filename,
output_filename=output_filename,
log_level=self._log_level)
def get_thermal_conductivity(self):
return self._thermal_conductivity
def get_frequency_shift(self,
grid_points,
epsilons=None,
temperatures=np.arange(0, 1001, 10, dtype='double'),
output_filename=None):
if epsilons is None:
epsilons = [0.1]
self._grid_points = grid_points
get_frequency_shift(self._interaction,
self._grid_points,
self._band_indices,
epsilons,
temperatures,
output_filename=output_filename,
log_level=self._log_level)
def _search_symmetry(self):
self._symmetry = Symmetry(self._supercell,
self._symprec,
self._is_symmetry)
def _search_primitive_symmetry(self):
self._primitive_symmetry = Symmetry(self._primitive,
self._symprec,
self._is_symmetry)
if (len(self._symmetry.get_pointgroup_operations()) !=
len(self._primitive_symmetry.get_pointgroup_operations())):
print("Warning: point group symmetries of supercell and primitive"
"cell are different.")
def _search_phonon_supercell_symmetry(self):
if self._phonon_supercell_matrix is None:
self._phonon_supercell_symmetry = self._symmetry
else:
self._phonon_supercell_symmetry = Symmetry(self._phonon_supercell,
self._symprec,
self._is_symmetry)
def _build_supercell(self):
self._supercell = get_supercell(self._unitcell,
self._supercell_matrix,
self._symprec)
def _build_primitive_cell(self):
"""
primitive_matrix:
Relative axes of primitive cell to the input unit cell.
Relative axes to the supercell is calculated by:
supercell_matrix^-1 * primitive_matrix
Therefore primitive cell lattice is finally calculated by:
(supercell_lattice * (supercell_matrix)^-1 * primitive_matrix)^T
"""
self._primitive = self._get_primitive_cell(
self._supercell, self._supercell_matrix, self._primitive_matrix)
def _build_phonon_supercell(self):
"""
phonon_supercell:
示例10: PhonopyUnfolding
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
#.........这里部分代码省略.........
group_velocity=self._group_velocity,
factor=self._factor,
star=self._star,
mode=self._mode,
verbose=True)
return True
# Sampling mesh
def set_mesh(self,
mesh,
shift=None,
is_time_reversal=True,
is_mesh_symmetry=True,
is_eigenvectors=False,
is_gamma_center=False):
if self._dynamical_matrix is None:
print("Warning: Dynamical matrix has not yet built.")
self._mesh = None
return False
# TODO(ikeda): Check how "rotations" works.
self._mesh = MeshUnfolding(
self._dynamical_matrix,
self._unitcell_ideal,
self._primitive_matrix_ideal,
mesh,
shift=shift,
is_time_reversal=is_time_reversal,
is_mesh_symmetry=is_mesh_symmetry,
is_eigenvectors=is_eigenvectors,
is_gamma_center=is_gamma_center,
star=self._star,
group_velocity=self._group_velocity,
rotations=self._primitive_symmetry.get_pointgroup_operations(),
factor=self._factor,
use_lapack_solver=self._use_lapack_solver,
mode=self._mode)
return True
# DOS
def set_total_DOS(self,
sigma=None,
freq_min=None,
freq_max=None,
freq_pitch=None,
tetrahedron_method=False):
if self._mesh is None:
print("Warning: \'set_mesh\' has to finish correctly "
"before DOS calculation.")
self._total_dos = None
return False
total_dos = TotalDosUnfolding(
self._mesh,
sigma=sigma,
tetrahedron_method=tetrahedron_method)
total_dos.set_draw_area(freq_min, freq_max, freq_pitch)
total_dos.run()
self._total_dos = total_dos
return True
def _set_dynamical_matrix(self):
self._dynamical_matrix = None
if self._supercell is None or self._primitive is None:
示例11: __init__
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
#.........这里部分代码省略.........
group_velocity=self._group_velocity,
factor=self._factor)
def get_band_structure(self):
band = self._band_structure
return (band.get_qpoints(),
band.get_distances(),
band.get_frequencies(),
band.get_eigenvectors())
def plot_band_structure(self, symbols=None):
return self._band_structure.plot_band(symbols)
def write_yaml_band_structure(self):
self._band_structure.write_yaml()
def set_mesh(self,
mesh,
shift=None,
is_time_reversal=True,
is_mesh_symmetry=True,
is_eigenvectors=False,
is_gamma_center=False):
self._set_dynamical_matrix()
self._mesh = Mesh(
self._dynamical_matrix,
mesh,
shift=shift,
is_time_reversal=is_time_reversal,
is_mesh_symmetry=is_mesh_symmetry,
is_eigenvectors=is_eigenvectors,
is_gamma_center=is_gamma_center,
group_velocity=self._group_velocity,
rotations=self._primitive_symmetry.get_pointgroup_operations(),
factor=self._factor)
def get_mesh(self):
return (self._mesh.get_qpoints(),
self._mesh.get_weights(),
self._mesh.get_frequencies(),
self._mesh.get_eigenvectors())
def write_yaml_mesh(self):
self._mesh.write_yaml()
def set_thermal_properties(self,
t_step=10,
t_max=1000,
t_min=0,
is_projection=False,
band_indices=None,
cutoff_frequency=None):
if self._mesh is None:
print "set_mesh has to be done before set_thermal_properties"
return False
else:
tp = ThermalProperties(self._mesh.get_frequencies(),
weights=self._mesh.get_weights(),
eigenvectors=self._mesh.get_eigenvectors(),
is_projection=is_projection,
band_indices=band_indices,
cutoff_frequency=cutoff_frequency)
tp.set_thermal_properties(t_step=t_step,
t_max=t_max,
t_min=t_min)
self._thermal_properties = tp
示例12: __init__
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
#.........这里部分代码省略.........
print "%d / %d" % (len(weights), weights.sum())
fst.run_interaction()
fst.set_epsilon(epsilon)
delta = np.zeros((len(temperatures),
len(self._band_indices_flatten)),
dtype='double')
for i, t in enumerate(temperatures):
fst.set_temperature(t)
fst.run()
delta[i] = fst.get_frequency_shift()
for i, bi in enumerate(self._band_indices):
pos = 0
for j in range(i):
pos += len(self._band_indices[j])
write_frequency_shift(gp,
bi,
temperatures,
delta[:, pos:(pos+len(bi))],
self._mesh,
epsilon=epsilon,
filename=output_filename)
def _search_symmetry(self):
self._symmetry = Symmetry(self._supercell,
self._symprec,
self._is_symmetry)
def _search_primitive_symmetry(self):
self._primitive_symmetry = Symmetry(self._primitive,
self._symprec,
self._is_symmetry)
if (len(self._symmetry.get_pointgroup_operations()) !=
len(self._primitive_symmetry.get_pointgroup_operations())):
print ("Warning: point group symmetries of supercell and primitive"
"cell are different.")
def _search_phonon_supercell_symmetry(self):
if self._phonon_supercell_matrix is None:
self._phonon_supercell_symmetry = self._symmetry
else:
self._phonon_supercell_symmetry = Symmetry(self._phonon_supercell,
self._symprec,
self._is_symmetry)
def _build_supercell(self):
self._supercell = get_supercell(self._unitcell,
self._supercell_matrix,
self._symprec)
def _build_primitive_cell(self):
"""
primitive_matrix:
Relative axes of primitive cell to the input unit cell.
Relative axes to the supercell is calculated by:
supercell_matrix^-1 * primitive_matrix
Therefore primitive cell lattice is finally calculated by:
(supercell_lattice * (supercell_matrix)^-1 * primitive_matrix)^T
"""
self._primitive = self._get_primitive_cell(
self._supercell, self._supercell_matrix, self._primitive_matrix)
def _build_phonon_supercell(self):
"""
phonon_supercell:
示例13: __init__
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
class Interaction:
def __init__(self,
fc3,
supercell,
primitive,
mesh,
band_indices=None,
frequency_factor_to_THz=VaspToTHz,
is_nosym=False,
symmetrize_fc3_q=False,
symprec=1e-3,
triplet_cut_super = None,
triplet_cut_prim = None,
cutoff_frequency=None,
cutoff_hfrequency=None,
cutoff_delta = None,
is_triplets_dispersed=False,
is_read_amplitude=False,
is_write_amplitude = False,
is_triplets_permute=True,
lapack_zheev_uplo='L'):
self._fc3 = fc3
self._supercell = supercell
self._primitive = primitive
self._mesh = np.intc(mesh)
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 = band_indices.astype("intc")
self._frequency_factor_to_THz = frequency_factor_to_THz
self._symprec = symprec
self._is_tripelts_permute=is_triplets_permute
natom_super = supercell.get_number_of_atoms()
natom_prim = primitive.get_number_of_atoms()
if triplet_cut_super is None:
self._triplet_cut_super=np.zeros((natom_super, natom_super, natom_super), dtype='bool')
else:
self._triplet_cut_super=triplet_cut_super
if triplet_cut_prim is None:
self._triplet_cut_prim=np.zeros((natom_prim, natom_prim, natom_prim), dtype='bool')
else:
self._triplet_cut_prim=triplet_cut_prim
if cutoff_delta is None:
self._cutoff_delta = 1000.0
else:
self._cutoff_delta = cutoff_delta
if cutoff_frequency is None:
self._cutoff_frequency = 0
else:
self._cutoff_frequency = cutoff_frequency
if cutoff_hfrequency is None:
self._cutoff_hfrequency = 10000.0 # THz
elif symmetrize_fc3_q:
print "Warning: symmetryze_fc3_q and cutoff_hfrequency are not compatible"
self._cutoff_hfrequency = 10000.0
else:
self._cutoff_hfrequency = cutoff_hfrequency
self._is_nosym = is_nosym
self._symmetrize_fc3_q = symmetrize_fc3_q
self._lapack_zheev_uplo = lapack_zheev_uplo
self._symmetry = Symmetry(primitive, symprec=symprec)
if self._is_nosym:
self._point_group_operations = np.array([np.eye(3)],dtype="intc")
self._kpoint_operations = get_kpoint_group(self._mesh, self._point_group_operations, is_time_reversal=False)
else:
self._point_group_operations = self._symmetry.get_pointgroup_operations()
self._kpoint_operations = get_kpoint_group(self._mesh, self._point_group_operations)
if self.is_nosym():
grid_mapping = np.arange(np.prod(self._mesh))
grid_mapping_rots = np.zeros(len(grid_mapping), dtype="intc")
else:
grid_mapping, grid_mapping_rots = get_mappings(self._mesh,
self.get_point_group_operations(),
qpoints=np.array([0,0,0],dtype="double"))
self._svecs, self._multiplicity = get_smallest_vectors(self._supercell,
self._primitive,
self._symprec)
self._grid_mapping = grid_mapping
self._grid_mapping_rot = grid_mapping_rots
self._is_read_amplitude = is_read_amplitude
self._is_write_amplitude = is_write_amplitude
self._grid_point = None
self._triplets_at_q = None
self._weights_at_q = None
self._grid_address = None
self._interaction_strength = None
self._phonon_done = None
self._frequencies = None
self._eigenvectors = None
self._degenerates = None
self._grid_points = None
self._dm = None
#.........这里部分代码省略.........
示例14: __init__
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
class Phono3py:
def __init__(self,
interaction,
mass_variances=None,
length=None,
adaptive_sigma_step = 0,
frequency_factor_to_THz=None,
is_nosym=False,
symprec=1e-5,
log_level=0,
is_thm = False, # is tetrahedron method
write_tecplot=False):
self._interaction = interaction
self._primitive = interaction.get_primitive()
self._supercell = interaction.get_supercell()
self._mesh = interaction.get_mesh_numbers()
self._band_indices = interaction.get_band_indices()
self._frequency_factor_to_THz = frequency_factor_to_THz
self._is_nosym = is_nosym
self._is_symmetry = not is_nosym
self._symprec = symprec
self._log_level = log_level
self._asigma_step=adaptive_sigma_step
self._step=0
self._kappa = None
self._gamma = None
self._br = None
self._is_thm = is_thm
self._write_tecplot=write_tecplot
self._mass_variances = mass_variances
self._length=length
self._symmetry = None
self._primitive_symmetry = None
self._search_symmetry()
self._search_primitive_symmetry()
def get_symmetry(self):
"""return symmetry of supercell"""
return self._symmetry
def get_primitive_symmetry(self):
return self._primitive_symmetry
def _search_symmetry(self):
self._symmetry = Symmetry(self._supercell,
self._symprec,
self._is_symmetry)
def _search_primitive_symmetry(self):
self._primitive_symmetry = Symmetry(self._primitive,
self._symprec,
self._is_symmetry)
if (len(self._symmetry.get_pointgroup_operations()) !=
len(self._primitive_symmetry.get_pointgroup_operations())):
print ("Warning: point group symmetries of supercell and primitive"
"cell are different.")
def set_dynamical_matrix(self,
fc2,
supercell,
primitive,
nac_params=None,
nac_q_direction=None,
frequency_scale_factor=None):
self._interaction.set_dynamical_matrix(
fc2,
supercell,
primitive,
nac_params=nac_params,
frequency_scale_factor=frequency_scale_factor)
self._interaction.set_nac_q_direction(nac_q_direction=nac_q_direction)
def get_imag_self_energy(self,
grid_points,
frequency_step=1.0,
sigmas=[None],
temperatures=[0.0],
filename=None):
ise = ImagSelfEnergy(self._interaction, is_thm = self._is_thm)
for gp in grid_points:
ise.set_grid_point(gp)
ise.run_interaction()
for sigma in sigmas:
ise.set_sigma(sigma)
for t in temperatures:
ise.set_temperature(t)
max_freq = (np.amax(self._interaction.get_phonons()[0]) * 2
+ sigma * 4)
fpoints = np.arange(0, max_freq + frequency_step / 2,
frequency_step)
ise.set_fpoints(fpoints)
ise.run()
gamma = ise.get_imag_self_energy()
for i, bi in enumerate(self._band_indices):
pos = 0
for j in range(i):
pos += len(self._band_indices[j])
write_damping_functions(
#.........这里部分代码省略.........
示例15: __init__
# 需要导入模块: from phonopy.structure.symmetry import Symmetry [as 别名]
# 或者: from phonopy.structure.symmetry.Symmetry import get_pointgroup_operations [as 别名]
#.........这里部分代码省略.........
self._mesh,
self._triplets_at_q,
self._frequencies,
self._grid_address,
self._bz_map)
jdos = np.tensordot(g, self._weights_at_q, axes=([0, 0]))
jdos = jdos.sum(axis=1).sum(axis=1)[:, 0]
self._joint_dos = jdos / np.prod(self._mesh)
self._frequency_points = frequency_points
def _run_py_tetrahedron_method(self):
self._vertices = get_tetrahedra_vertices(
self._tetrahedron_method.get_tetrahedra(),
self._mesh,
self._triplets_at_q,
self._grid_address,
self._bz_map)
self._set_phonon(self._vertices.ravel())
thm = self._tetrahedron_method
f_max = np.max(self._frequencies) * 2 + self._frequency_step / 10
f_min = np.min(self._frequencies) * 2
freq_points = np.arange(f_min, f_max, self._frequency_step,
dtype='double')
jdos = np.zeros_like(freq_points)
for vertices, w in zip(self._vertices, self._weights_at_q):
for i, j in list(np.ndindex(self._num_band, self._num_band)):
f1 = self._frequencies[vertices[0], i]
f2 = self._frequencies[vertices[1], j]
thm.set_tetrahedra_omegas(f1 + f2)
thm.run(freq_points)
iw = thm.get_integration_weight()
jdos += iw * w
self._joint_dos = jdos / np.prod(self._mesh)
self._frequency_points = freq_points
def _run_smearing_method(self):
import anharmonic._phono3py as phono3c
self._set_phonon(self._triplets_at_q.ravel())
f_max = np.max(self._frequencies) * 2 + self._sigma * 4
f_min = np.min(self._frequencies) * 2 - self._sigma * 4
freq_points = np.arange(f_min, f_max, self._frequency_step,
dtype='double')
jdos = np.zeros_like(freq_points)
phono3c.joint_dos(jdos,
freq_points,
self._triplets_at_q,
self._weights_at_q,
self._frequencies,
self._sigma)
jdos /= np.prod(self._mesh)
self._joint_dos = jdos
self._frequency_points = freq_points
def _set_dynamical_matrix(self):
self._dm = get_dynamical_matrix(
self._fc2,
self._supercell,
self._primitive,
nac_params=self._nac_params,
frequency_scale_factor=self._frequency_scale_factor,
symprec=self._symprec)
def _set_triplets(self):
if self._is_nosym:
if self._log_level:
print "Triplets at q without considering symmetry"
sys.stdout.flush()
(self._triplets_at_q,
self._weights_at_q,
self._grid_address,
self._bz_map) = get_nosym_triplets_at_q(
self._grid_point,
self._mesh,
self._reciprocal_lattice,
with_bz_map=True)
else:
(self._triplets_at_q,
self._weights_at_q,
self._grid_address,
self._bz_map) = get_triplets_at_q(
self._grid_point,
self._mesh,
self._symmetry.get_pointgroup_operations(),
self._reciprocal_lattice)
def _set_phonon(self, grid_points):
set_phonon_c(self._dm,
self._frequencies,
self._eigenvectors,
self._phonon_done,
grid_points,
self._grid_address,
self._mesh,
self._frequency_factor_to_THz,
self._nac_q_direction,
self._lapack_zheev_uplo)