mirror of https://github.com/phonopy/phonopy.git
Update int/int by int//int if necessary
This commit is contained in:
parent
8f2961f974
commit
0eaffc3581
|
@ -158,7 +158,7 @@ class CollisionMatrix(ImagSelfEnergy):
|
|||
|
||||
for i, ir_gp in enumerate(self._ir_grid_points):
|
||||
r_gps = self._rot_grid_points[i]
|
||||
multi = len(r_gps) / (r_gps < num_mesh_points).sum()
|
||||
multi = len(r_gps) // (r_gps < num_mesh_points).sum()
|
||||
|
||||
for r, r_gp in zip(self._rotations_cartesian, r_gps):
|
||||
if r_gp > num_mesh_points - 1:
|
||||
|
@ -210,8 +210,8 @@ class CollisionMatrix(ImagSelfEnergy):
|
|||
sinh = np.where(
|
||||
freqs > self._cutoff_frequency,
|
||||
np.sinh(freqs * THzToEv / (2 * Kb * self._temperature)),
|
||||
-1)
|
||||
inv_sinh = np.where(sinh > 0, 1 / sinh, 0)
|
||||
-1.0)
|
||||
inv_sinh = np.where(sinh > 0, 1.0 / sinh, 0)
|
||||
|
||||
return inv_sinh
|
||||
|
||||
|
|
|
@ -245,11 +245,11 @@ class Conductivity:
|
|||
" axis can not be shifted. Set False.")
|
||||
self._coarse_mesh_shifts[i] = False
|
||||
|
||||
self._coarse_mesh = self._mesh / self._mesh_divisors
|
||||
self._coarse_mesh = self._mesh // self._mesh_divisors
|
||||
|
||||
if self._log_level:
|
||||
print("Lifetime sampling mesh: [ %d %d %d ]" %
|
||||
tuple(self._mesh / self._mesh_divisors))
|
||||
tuple(self._mesh // self._mesh_divisors))
|
||||
|
||||
def _get_ir_grid_points(self):
|
||||
if self._coarse_mesh_shifts is None:
|
||||
|
@ -270,7 +270,7 @@ class Conductivity:
|
|||
coarse_mesh_shifts=self._coarse_mesh_shifts)
|
||||
grid_weights = coarse_grid_weights
|
||||
|
||||
assert grid_weights.sum() == np.prod(self._mesh /
|
||||
assert grid_weights.sum() == np.prod(self._mesh //
|
||||
self._mesh_divisors)
|
||||
|
||||
return grid_points, grid_weights
|
||||
|
|
|
@ -512,7 +512,7 @@ class Conductivity_LBTE(Conductivity):
|
|||
for j, k in list(np.ndindex((len(self._sigmas),
|
||||
len(self._temperatures)))):
|
||||
for i, ir_gp in enumerate(self._ir_grid_points):
|
||||
multi = ((self._rot_grid_points == ir_gp).sum() /
|
||||
multi = ((self._rot_grid_points == ir_gp).sum() //
|
||||
(self._rot_BZ_grid_points == ir_gp).sum())
|
||||
for r, r_BZ_gp in zip(self._rotations_cartesian,
|
||||
self._rot_BZ_grid_points[i]):
|
||||
|
@ -672,8 +672,8 @@ class Conductivity_LBTE(Conductivity):
|
|||
|
||||
sinh = np.where(freqs > self._cutoff_frequency,
|
||||
np.sinh(freqs * THzToEv / (2 * Kb * t)),
|
||||
-1)
|
||||
inv_sinh = np.where(sinh > 0, 1 / sinh, 0)
|
||||
-1.0)
|
||||
inv_sinh = np.where(sinh > 0, 1.0 / sinh, 0)
|
||||
freqs_sinh = freqs * THzToEv * inv_sinh / (4 * Kb * t ** 2)
|
||||
|
||||
for i, f in enumerate(freqs_sinh):
|
||||
|
|
|
@ -518,7 +518,7 @@ class Conductivity_RTA(Conductivity):
|
|||
for r in self._rotations_cartesian:
|
||||
gvs_rot = np.dot(self._gv[i], r.T)
|
||||
gv_by_gv += [np.outer(r_gv, r_gv) for r_gv in gvs_rot]
|
||||
gv_by_gv /= len(rotation_map) / len(np.unique(rotation_map))
|
||||
gv_by_gv /= len(rotation_map) // len(np.unique(rotation_map))
|
||||
order_kstar = len(np.unique(rotation_map))
|
||||
|
||||
if order_kstar != self._grid_weights[i]:
|
||||
|
|
|
@ -265,7 +265,7 @@ class Gruneisen:
|
|||
g[s] += (w[nu * 3 + i, s].conjugate() *
|
||||
dDdu[nu, pi, i, j] * w[pi * 3 + j, s]).real
|
||||
|
||||
g[s] *= -1.0/2/omega2[s]
|
||||
g[s] *= -1.0 / 2 / omega2[s]
|
||||
|
||||
return g, omega2
|
||||
|
||||
|
@ -379,9 +379,10 @@ class Gruneisen:
|
|||
for i in range(3):
|
||||
# Eigenvectors are real.
|
||||
# 3: means optical modes
|
||||
G[pi, mu, k, i] = 1.0 / np.sqrt(m[pi] * m[mu]) * \
|
||||
G[pi, mu, k, i] = (
|
||||
1.0 / np.sqrt(m[pi] * m[mu]) *
|
||||
(vecs[pi * 3 + k, 3:] * vecs[mu * 3 + i, 3:] /
|
||||
vals[3:]).sum()
|
||||
vals[3:]).sum())
|
||||
return G
|
||||
|
||||
|
||||
|
|
|
@ -172,7 +172,8 @@ class Interaction:
|
|||
(grid_address[tp],
|
||||
np.linalg.norm(
|
||||
np.dot(reciprocal_lattice,
|
||||
grid_address[tp] / self._mesh))))
|
||||
grid_address[tp] /
|
||||
self._mesh.astype('double')))))
|
||||
print("%s" % sum_q)
|
||||
print("============= Warning ==================")
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ def reduce_grid_points(mesh_divisors,
|
|||
if coarse_mesh_shifts is None:
|
||||
shift = [0, 0, 0]
|
||||
else:
|
||||
shift = np.where(coarse_mesh_shifts, divisors / 2, [0, 0, 0])
|
||||
shift = np.where(coarse_mesh_shifts, divisors // 2, [0, 0, 0])
|
||||
modulo = grid_address[dense_grid_points] % divisors
|
||||
condition = (modulo == shift).all(axis=1)
|
||||
coarse_grid_points = np.extract(condition, dense_grid_points)
|
||||
|
@ -190,7 +190,7 @@ def from_coarse_to_dense_grid_points(dense_mesh,
|
|||
shifts = np.where(coarse_mesh_shifts, 1, 0)
|
||||
dense_grid_points = []
|
||||
for cga in coarse_grid_address[coarse_grid_points]:
|
||||
dense_address = cga * mesh_divisors + shifts * (mesh_divisors / 2)
|
||||
dense_address = cga * mesh_divisors + shifts * (mesh_divisors // 2)
|
||||
dense_grid_points.append(get_grid_point_from_address(dense_address,
|
||||
dense_mesh))
|
||||
return np.array(dense_grid_points, dtype='intc')
|
||||
|
@ -207,7 +207,7 @@ def get_coarse_ir_grid_points(primitive,
|
|||
mesh_divs = mesh_divisors
|
||||
mesh = np.array(mesh, dtype='intc')
|
||||
mesh_divs = np.array(mesh_divs, dtype='intc')
|
||||
coarse_mesh = mesh / mesh_divs
|
||||
coarse_mesh = mesh // mesh_divs
|
||||
if coarse_mesh_shifts is None:
|
||||
coarse_mesh_shifts = [False, False, False]
|
||||
|
||||
|
|
Loading…
Reference in New Issue