Skip to content

Commit

Permalink
maint: added some missing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pfebrer committed Nov 8, 2021
1 parent 3ca44b4 commit 85d73bd
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion sisl/io/siesta/binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,21 @@ def _setup_parsing(self, close=True, skip_basis=True):
self._close_wfsx()

def _read_next_sizes(self, skip_basis=False):
"""
"""Reads the sizes if they are the next thing to be read.
Parameters
-----------
skip_basis: boolean, optional
Whether this method should also skip over the basis information.
Returns
--------
dict:
Dictionary containing the sizes related to the file.
- 'nspin': int. Number of spin components.
- 'nou': int. Number of orbitals in the unit cell.
- 'nk': int. Number of k points in the file.
- 'Gamma': bool. Whether the file contains only the gamma point.
"""
# Check that we are in the right position in the file
if self._state != -1:
Expand All @@ -1167,6 +1181,13 @@ def _read_next_sizes(self, skip_basis=False):
return {k:v for k, v in zip(('nspin', 'nou', 'nk', 'Gamma'), sizes)}

def _read_next_basis(self):
"""Reads the basis if it is the next thing to be read.
Returns
-------
Atoms:
the basis read.
"""
# Check that we are in the right position in the file
if self._state != 0:
raise SileError(f"We are not in a position to read the basis. State is: {self._state}")
Expand Down Expand Up @@ -1323,12 +1344,34 @@ def _read_next_eigenstate(self, ispin, ik, parent, convert_k):
return EigenstateElectron(state.T, eig, parent=parent, **info)

def read_sizes(self):
"""Reads the sizes related to this WFSX file
Returns
--------
dict:
Dictionary containing the sizes related to the file.
- 'nspin': int. Number of spin components.
- 'nou': int. Number of orbitals in the unit cell.
- 'nk': int. Number of k points in the file.
- 'Gamma': bool. Whether the file contains only the gamma point.
"""
self._open_wfsx("r")
sizes = self._read_next_sizes()
self._close_wfsx()
return sizes

def read_basis(self):
"""Reads the basis contained in the WFSX file.
The WFSX file only contains information about the atom labels, which atom
each orbital belongs to and the orbital quantum numbers. Therefore it should
probably be used only as a last resort.
Returns
---------
Atoms:
the basis read.
"""
self._open_wfsx("r")
self._sizes = self._read_next_sizes(skip_basis=False)
basis = self._read_next_basis()
Expand Down

0 comments on commit 85d73bd

Please sign in to comment.