Skip to content

Commit ae6fb71

Browse files
committed
[fix] ensure tetrahedron arrays use int64 for atm.dos_tetra_weights_3d
1 parent 4c00977 commit ae6fb71

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

python/triqs_dft_tools/converters/plovasp/proj_shell.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,9 @@ def density_of_states(self, el_struct, emesh):
430430
w_k[ik, ib, isp, io, :] = proj_k * proj_k.conj()
431431

432432
# eigv_ef = el_struct.eigvals[ik, ib, isp] - el_struct.efermi
433-
itt = el_struct.kmesh['itet'].T.copy()
434-
# k-indices are starting from 0 in Python
433+
# Ensure correct dtype for C++ atm.dos_tetra_weights_3d (expects long)
434+
itt = np.ascontiguousarray(el_struct.kmesh['itet'].T, dtype=np.int64)
435+
# k-indices are starting from 0 in Python
435436
itt[1:, :] -= 1
436437
for isp in range(ns):
437438
for ib, eigk in enumerate(el_struct.eigvals[:, self.ib_min:self.ib_max+1, isp].T):

python/triqs_dft_tools/converters/plovasp/vaspio.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,9 +733,11 @@ def __init__(self, h5path):
733733
self.ksymmap = kpoints['kpoints_symmetry_mapping']
734734
self.ksymmap -= 1
735735
try:
736-
self.ntet = kpoints['num_tetrahedra']
737-
self.vtet = kpoints['volume_weight_tetrahedra']
738-
self.itet = kpoints['coordinate_id_tetrahedra']
736+
self.ntet = int(kpoints['num_tetrahedra'])
737+
# VASP stores a single tetrahedron volume weight
738+
self.volt = float(np.array(kpoints['volume_weight_tetrahedra']).ravel()[0])
739+
# Ensure correct dtype for C++ atm.dos_tetra_weights_3d (expects long)
740+
self.itet = np.ascontiguousarray(kpoints['coordinate_id_tetrahedra'], dtype=np.int64)
739741
except KeyError:
740742
print(" No tetrahedron data found in vaspout.h5. Skipping...")
741743
self.ntet = 0

0 commit comments

Comments
 (0)