Skip to content

Commit

Permalink
Merge pull request #519 from juijan/read-basis-fix
Browse files Browse the repository at this point in the history
Fix reading of basis
  • Loading branch information
zerothi authored Nov 29, 2022
2 parents db0fc67 + 9b7d872 commit eba4dec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sisl/io/siesta/orb_indx.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ def crt_atom(i_s, spec, orbs):
orbs = []
specs = []
ia = 1
i_s = 0
for _ in range(no):
line = self.readline().split()

i_a = int(line[1])
i_s = int(line[2]) - 1
spec = line[3]
if i_a != ia:
if i_s not in specs:
Expand All @@ -96,6 +96,8 @@ def crt_atom(i_s, spec, orbs):
ia = i_a
orbs = []

i_s = int(line[2]) - 1

if i_s in specs:
continue
nlmz = list(map(int, line[5:9]))
Expand Down
13 changes: 13 additions & 0 deletions sisl/io/siesta/tests/test_orb_indx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,18 @@ def test_si_pdos_kgrid_orb_indx(sisl_files):
atoms = orbindxSileSiesta(f).read_basis()

assert len(atoms) == 2
assert atoms.nspecie == 1
assert len(atoms[0]) == 13
assert len(atoms[1]) == 13


def test_sih_orb_indx(sisl_files):
f = sisl_files(_dir, 'sih.ORB_INDX')
nsc = orbindxSileSiesta(f).read_supercell_nsc()
assert np.all(nsc == 1)
atoms = orbindxSileSiesta(f).read_basis()

assert len(atoms) == 65
assert atoms.nspecie == 2
assert len(atoms[0]) == 4
assert len(atoms[-1]) == 1

0 comments on commit eba4dec

Please sign in to comment.