3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-23 04:43:42 +01:00

[py3] In python3 zip is identical to itertools.izip

This commit is contained in:
Nils Wentzell 2020-04-08 15:50:23 -04:00
parent 97d4e0b402
commit 0598b5f0a4
3 changed files with 7 additions and 8 deletions

View File

@ -1,4 +1,3 @@
################################################################################ ################################################################################
# #
# TRIQS: a Toolbox for Research in Interacting Quantum Systems # TRIQS: a Toolbox for Research in Interacting Quantum Systems

View File

@ -396,7 +396,7 @@ class ConfigParameters:
except (ValueError, AttributeError): except (ValueError, AttributeError):
raise ValueError("Failed to extract shell indices from a list: %s"%(sec_shells)) raise ValueError("Failed to extract shell indices from a list: %s"%(sec_shells))
self.sh_sections = {ind: sec for ind, sec in it.izip(sh_inds, sec_shells)} self.sh_sections = {ind: sec for ind, sec in zip(sh_inds, sec_shells)}
# Check that all indices are unique # Check that all indices are unique
# In principle redundant because the list of sections will contain only unique names # In principle redundant because the list of sections will contain only unique names

View File

@ -329,7 +329,7 @@ class ProjectorShell:
ib2 = self.ib_max + 1 ib2 = self.ib_max + 1
if site_diag: if site_diag:
for isp in range(ns): for isp in range(ns):
for ik, weight, occ in it.izip(it.count(), kweights, occnums[isp, :, :]): for ik, weight, occ in zip(it.count(), kweights, occnums[isp, :, :]):
for io in range(nion): for io in range(nion):
proj_k = self.proj_win[io, isp, ik, ...] proj_k = self.proj_win[io, isp, ik, ...]
occ_mats[isp, io, :, :] += np.dot(proj_k * occ[ib1:ib2], occ_mats[isp, io, :, :] += np.dot(proj_k * occ[ib1:ib2],
@ -339,7 +339,7 @@ class ProjectorShell:
else: else:
proj_k = np.zeros((ndim, nbtot), dtype=np.complex128) proj_k = np.zeros((ndim, nbtot), dtype=np.complex128)
for isp in range(ns): for isp in range(ns):
for ik, weight, occ in it.izip(it.count(), kweights, occnums[isp, :, :]): for ik, weight, occ in zip(it.count(), kweights, occnums[isp, :, :]):
for io in range(nion): for io in range(nion):
i1 = io * nlm i1 = io * nlm
i2 = (io + 1) * nlm i2 = (io + 1) * nlm
@ -376,7 +376,7 @@ class ProjectorShell:
ib1 = self.ib_min ib1 = self.ib_min
ib2 = self.ib_max + 1 ib2 = self.ib_max + 1
for isp in range(ns): for isp in range(ns):
for ik, weight, occ, eigk in it.izip(it.count(), kweights, occnums[isp, :, :], for ik, weight, occ, eigk in zip(it.count(), kweights, occnums[isp, :, :],
el_struct.eigvals[:, ib1:ib2, isp]): el_struct.eigvals[:, ib1:ib2, isp]):
for io in range(nion): for io in range(nion):
proj_k = self.proj_win[io, isp, ik, ...] proj_k = self.proj_win[io, isp, ik, ...]
@ -439,9 +439,9 @@ class ProjectorShell:
dos[ie, isp, io, im] += np.sum((cti * w_k[itt[1:, :], ib, isp, io, im].real).sum(0) * itt[0, :]) dos[ie, isp, io, im] += np.sum((cti * w_k[itt[1:, :], ib, isp, io, im].real).sum(0) * itt[0, :])
dos *= 2 * el_struct.kmesh['volt'] dos *= 2 * el_struct.kmesh['volt']
# for isp in xrange(ns): # for isp in range(ns):
# for ik, weight, occ in it.izip(it.count(), kweights, occnums[isp, :, :]): # for ik, weight, occ in zip(it.count(), kweights, occnums[isp, :, :]):
# for io in xrange(nion): # for io in range(nion):
# proj_k = self.proj_win[isp, io, ik, ...] # proj_k = self.proj_win[isp, io, ik, ...]
# occ_mats[isp, io, :, :] += np.dot(proj_k * occ[ib1:ib2], # occ_mats[isp, io, :, :] += np.dot(proj_k * occ[ib1:ib2],
# proj_k.conj().T).real * weight # proj_k.conj().T).real * weight