Skip to content

Commit 1174a1e

Browse files
authored
Merge pull request #146 from Exabyte-io/feat/SOF-7417
SOF-7417: consider non-collinear case while parsing qe bandstructure
2 parents 10a3759 + 09c8294 commit 1174a1e

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

.github/workflows/cicd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ concurrency:
88

99
jobs:
1010
run-linter:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-22.04
1212
strategy:
1313
matrix:
1414
python-version:
@@ -36,7 +36,7 @@ jobs:
3636
python-version: ${{ matrix.python-version }}
3737

3838
run-tests:
39-
runs-on: ubuntu-20.04
39+
runs-on: ubuntu-22.04
4040
strategy:
4141
matrix:
4242
python-version:

express/parsers/apps/espresso/formats/xml/xml_post64.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ def eigenvalues_at_kpoints(self) -> list:
127127
all_kpoints = []
128128
bs_tag = self.root.find(self.band_structure_tag)
129129
is_lsda = self._get_xml_tag_value(bs_tag.find("lsda"))
130-
is_noncolinear = self._get_xml_tag_value(bs_tag.find("noncolin"))
131130

132131
if is_lsda:
133132
nband = int(bs_tag.find("nbnd_up").text)
@@ -144,10 +143,7 @@ def eigenvalues_at_kpoints(self) -> list:
144143
}
145144
if is_lsda:
146145
kpoint_dict["eigenvalues"] = self.__process_ks_lsda(ks_entry, nband)
147-
148-
# TODO: implement noncolinear spin magnetization case, values come in pairs
149-
elif is_noncolinear:
150-
raise NotImplementedError("Noncolinear spin magnetization case not implemented")
146+
# below clause is applicable to both non-magnetic and non-collinear magnetic cases
151147
else:
152148
kpoint_dict["eigenvalues"] = self.__process_ks_non_mag(ks_entry)
153149

express/properties/non_scalar/bandgaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def _find_gap(
157157
Returns:
158158
tuple: a (gap, k1, k2) tuple where k1 and k2 are the indices of the valence and conduction k-points.
159159
"""
160-
if occupations.ptp() > 0:
160+
if np.ptp(occupations) > 0:
161161
# Some band must be crossing fermi-level. Hence, we return zero for band gap and the actual k-points
162162
kv = kc = occupations.argmax()
163163
return 0.0, kv, kc

express/properties/non_scalar/two_dimensional_plot/band_structure.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ class BandStructure(TwoDimensionalPlotProperty):
1616

1717
def __init__(self, name, parser, *args, **kwargs):
1818
super(BandStructure, self).__init__(name, parser, *args, **kwargs)
19-
self.nspins = self.parser.nspins()
19+
# There could be three possibilities for nspins:
20+
# (1) non-magnetic ==> nspins = 1
21+
# (2) collinear magnetic (LSDA) ==> nspins = 2
22+
# (3) non-collinear magnetic ==> nspins = 4
23+
# Prior to Quantum ESPRESSO version 6.4, the XML output contains the tag
24+
# NUMBER_OF_SPIN_COMPONENTS, which is set to 4 for non-collinear case,
25+
# and we return the same for versions above 6.4 if noncolin is True.
26+
# However, for non-collinear magnetic case there is one eigenvalue per
27+
# k-point. Here we override nspins for non-collinear case.
28+
self.nspins = 1 if self.parser.nspins() == 4 else self.parser.nspins()
2029

2130
self.eigenvalues_at_kpoints = self.parser.eigenvalues_at_kpoints()
2231
if kwargs.get("remove_non_zero_weight_kpoints", False):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies = [
2323
# "rdkit-pypi>=2022.3.5",
2424
"jarvis-tools>=2023.12.12",
2525
# To avoid module 'numpy.linalg._umath_linalg' has no attribute '_ilp64' in Colab
26-
# "numpy==1.23.5",
26+
"numpy>=1.24.4,<2",
2727
]
2828

2929
[project.optional-dependencies]

0 commit comments

Comments
 (0)