Skip to content

Commit

Permalink
mnt: ensured delta files need not have diagonal components
Browse files Browse the repository at this point in the history
Should make delta files smaller and just needs
a small test in tbtrans.
  • Loading branch information
zerothi committed Sep 8, 2022
1 parent 64915eb commit 3f11290
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ we hit release version 1.0.0.
as the only argument.

### Fixed
- delta-files (netCDF) would always have diagonal components,
this has now been removed since it only needs the elements with
values
- Siesta sparse matrices could in some cases set wrong diagonal
components
- orbital quantum numbers from HSX file was wrong in v1, #462
- RealSpaceSI for right semi-infinite directions, #475
- tbtrans files now have a separate entry in the documentation
Expand Down
14 changes: 11 additions & 3 deletions sisl/io/siesta/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@ def _csr_from_siesta(geom, csr):
_csr_from_sc_off(geom, _siesta.siesta_sc_off(*geom.nsc).T, csr)


def _csr_to_siesta(geom, csr):
""" Internal routine to convert *any* SparseCSR matrix from sisl nsc to siesta nsc """
_ensure_diagonal(csr)
def _csr_to_siesta(geom, csr, diag=True):
""" Internal routine to convert *any* SparseCSR matrix from sisl nsc to siesta nsc
Parameters
----------
...
diag: bool, optional
whether the csr matrix will be ensured diagonal as well
"""
if diag:
_ensure_diagonal(csr)
_csr_to_sc_off(geom, _siesta.siesta_sc_off(*geom.nsc).T, csr)


Expand Down
2 changes: 1 addition & 1 deletion sisl/io/tbtrans/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def write_delta(self, delta, **kwargs):
raise SileError(f"{self!s}.write_overlap cannot write a zero element sparse matrix!")

# convert to siesta thing and store
_csr_to_siesta(delta.geometry, csr)
_csr_to_siesta(delta.geometry, csr, diag=False)
# delta should always write sorted matrices
csr.finalize(sort=True)
_mat_spin_convert(csr, delta.spin)
Expand Down

0 comments on commit 3f11290

Please sign in to comment.