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):