diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 638e912f..893b9fbe 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -8,7 +8,7 @@ concurrency: jobs: run-linter: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: python-version: @@ -36,7 +36,7 @@ jobs: python-version: ${{ matrix.python-version }} run-tests: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: python-version: diff --git a/express/parsers/apps/espresso/formats/xml/xml_post64.py b/express/parsers/apps/espresso/formats/xml/xml_post64.py index cf19037e..8c3241f7 100644 --- a/express/parsers/apps/espresso/formats/xml/xml_post64.py +++ b/express/parsers/apps/espresso/formats/xml/xml_post64.py @@ -127,7 +127,6 @@ def eigenvalues_at_kpoints(self) -> list: all_kpoints = [] bs_tag = self.root.find(self.band_structure_tag) is_lsda = self._get_xml_tag_value(bs_tag.find("lsda")) - is_noncolinear = self._get_xml_tag_value(bs_tag.find("noncolin")) if is_lsda: nband = int(bs_tag.find("nbnd_up").text) @@ -144,10 +143,7 @@ def eigenvalues_at_kpoints(self) -> list: } if is_lsda: kpoint_dict["eigenvalues"] = self.__process_ks_lsda(ks_entry, nband) - - # TODO: implement noncolinear spin magnetization case, values come in pairs - elif is_noncolinear: - raise NotImplementedError("Noncolinear spin magnetization case not implemented") + # below clause is applicable to both non-magnetic and non-collinear magnetic cases else: kpoint_dict["eigenvalues"] = self.__process_ks_non_mag(ks_entry) diff --git a/express/properties/non_scalar/bandgaps.py b/express/properties/non_scalar/bandgaps.py index 69182d41..b26f83ec 100644 --- a/express/properties/non_scalar/bandgaps.py +++ b/express/properties/non_scalar/bandgaps.py @@ -157,7 +157,7 @@ def _find_gap( Returns: tuple: a (gap, k1, k2) tuple where k1 and k2 are the indices of the valence and conduction k-points. """ - if occupations.ptp() > 0: + if np.ptp(occupations) > 0: # Some band must be crossing fermi-level. Hence, we return zero for band gap and the actual k-points kv = kc = occupations.argmax() return 0.0, kv, kc diff --git a/express/properties/non_scalar/two_dimensional_plot/band_structure.py b/express/properties/non_scalar/two_dimensional_plot/band_structure.py index dd9da0c4..b74552fe 100644 --- a/express/properties/non_scalar/two_dimensional_plot/band_structure.py +++ b/express/properties/non_scalar/two_dimensional_plot/band_structure.py @@ -16,7 +16,16 @@ class BandStructure(TwoDimensionalPlotProperty): def __init__(self, name, parser, *args, **kwargs): super(BandStructure, self).__init__(name, parser, *args, **kwargs) - self.nspins = self.parser.nspins() + # There could be three possibilities for nspins: + # (1) non-magnetic ==> nspins = 1 + # (2) collinear magnetic (LSDA) ==> nspins = 2 + # (3) non-collinear magnetic ==> nspins = 4 + # Prior to Quantum ESPRESSO version 6.4, the XML output contains the tag + # NUMBER_OF_SPIN_COMPONENTS, which is set to 4 for non-collinear case, + # and we return the same for versions above 6.4 if noncolin is True. + # However, for non-collinear magnetic case there is one eigenvalue per + # k-point. Here we override nspins for non-collinear case. + self.nspins = 1 if self.parser.nspins() == 4 else self.parser.nspins() self.eigenvalues_at_kpoints = self.parser.eigenvalues_at_kpoints() if kwargs.get("remove_non_zero_weight_kpoints", False): diff --git a/pyproject.toml b/pyproject.toml index 1dde2933..1f6420f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ dependencies = [ # "rdkit-pypi>=2022.3.5", "jarvis-tools>=2023.12.12", # To avoid module 'numpy.linalg._umath_linalg' has no attribute '_ilp64' in Colab - # "numpy==1.23.5", + "numpy>=1.24.4,<2", ] [project.optional-dependencies]