From 001bdb92013776a4ad26f7088347904346f3c340 Mon Sep 17 00:00:00 2001 From: Pranab Das <31024886+pranabdas@users.noreply.github.com> Date: Mon, 5 Aug 2024 19:33:40 +0800 Subject: [PATCH] SOF-7417: fix non-colin nspins for bandstructure plot --- .../non_scalar/two_dimensional_plot/band_structure.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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..70680a9e 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 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 are one eigenvalue per + # k-pont. Here we override nspins for non-collinear case. + self.nspins = self.parser.nspins() if self.parser.nspins() != 4 else 1 self.eigenvalues_at_kpoints = self.parser.eigenvalues_at_kpoints() if kwargs.get("remove_non_zero_weight_kpoints", False):