Skip to content

Commit 4793042

Browse files
committed
more fixes
1 parent 43aeb27 commit 4793042

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

yambopy/wannier/wann_yambo_interface.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -495,22 +495,31 @@ def find_q_in_screening_db(self, q_vec: np.ndarray, tol: float = 1e-5) -> int:
495495
if not hasattr(self, 'em1s_db'):
496496
raise ValueError("Screening database not loaded. Call load_screening_db first.")
497497

498-
# Wrap q-vector to [0, 1)
499-
q_wrapped = q_vec - np.floor(q_vec)
498+
kmap = np.zeros((self.wfdb.nkBZ,2), dtype=int)
499+
kmap[:,0]=self.wfdb.ydb.kpoints_indexes
500+
kmap[:,1]=self.wfdb.ydb.symmetry_indexes
501+
self.kmap=kmap
502+
503+
iq_BZ = find_kpt(self.ktree, q_vec)
504+
iq_ibz, isym = self.kmap[iq_BZ]
505+
506+
return iq_ibz
507+
# # Wrap q-vector to [0, 1)
508+
# q_wrapped = q_vec - np.floor(q_vec)
500509

501-
# Compare with all q-points in database (also in crystal coordinates)
502-
for iq, q_db in enumerate(self.em1s_db.red_qpoints):
503-
q_db_wrapped = q_db - np.floor(q_db)
510+
# # Compare with all q-points in database (also in crystal coordinates)
511+
# for iq, q_db in enumerate(self.em1s_db.red_qpoints):
512+
# q_db_wrapped = q_db - np.floor(q_db)
504513

505-
# Check if they match (considering periodic boundary conditions)
506-
diff = q_wrapped - q_db_wrapped
507-
diff = diff - np.round(diff) # Wrap to [-0.5, 0.5]
514+
# # Check if they match (considering periodic boundary conditions)
515+
# diff = q_wrapped - q_db_wrapped
516+
# diff = diff - np.round(diff) # Wrap to [-0.5, 0.5]
508517

509-
if np.linalg.norm(diff) < tol:
510-
return iq
518+
# if np.linalg.norm(diff) < tol:
519+
# return iq
511520

512-
raise ValueError(f"q-point {q_vec} not found in screening database. "
513-
f"Available q-points: {self.em1s_db.nqpoints}")
521+
# raise ValueError(f"q-point {q_vec} not found in screening database. "
522+
# f"Available q-points: {self.em1s_db.nqpoints}")
514523

515524
def align_gvectors(self, gvecs_rho: np.ndarray, iq: int) -> Tuple[np.ndarray, np.ndarray]:
516525
"""

0 commit comments

Comments
 (0)