Skip to content

sphinx eigenvalue parser problem fix (again) #1208

Open
@ahmedabdelkawy

Description

@ahmedabdelkawy

In addition to the explanation in #1159 (PR was closed as the branch was damaged), the problem in

def _parse_band(self, term):
       arr = np.loadtxt(re.findall(term, self.log_main, re.MULTILINE))
       shape = (-1, len(self.k_points), arr.shape[-1])
       if self.spin_enabled:
           shape = (-1, 2, len(self.k_points), shape[-1])
       return arr.reshape(shape)

apparently became more severe while doing minimization. This function tried to parse all eigenvalues at the end of each ionic steps (something still not implemented in the vasp parser as far as I know). This then can not be fixed with the fix I introduced in #1159 (arr = np.vstack((arr[::2], arr[1::2]))).

The reason again is that the eigen values in the Sphinx log has the following order:

1. Ionic step = 1
    1.1 KPOINTS = 1
        1.1.1 SPIN channel = 0
        1.1.2 SPIN channel = 1
    1.2 KPOINTS = 2
        1.2.1 SPIN channel = 0
        1.2.2 SPIN channel = 1
    1.3 KPOINTS = 3
        1.1.1 SPIN channel = 0
        1.1.2 SPIN channel = 1
    1.4 KPOINTS = 4
        1.2.1 SPIN channel = 0
        1.2.2 SPIN channel = 1
2. Ionic step = 2
    2.1 KPOINTS = 1
        2.1 SPIN channel = 0
        2.1.2 SPIN channel = 1
    2.2 KPOINTS = 2
        2.2.1 SPIN channel = 0
        2.2.2 SPIN channel = 1
    2.3 KPOINTS = 3
        2.1.1 SPIN channel = 0
        2.1.2 SPIN channel = 1
    2.4 KPOINTS = 4
        2.2.1 SPIN channel = 0
        2.2.2 SPIN channel = 1

with the shape = (n_ionic_steps, n_kpoints, n_spin_channnels, n_bands)

while the parser expects the following order:

1. Ionic step = 1
    1.1 SPIN channel = 0
        1.1.1 KPOINTS = 1
        1.1.2 KPOINTS = 2
        1.1.3 KPOINTS = 3
        1.1.4 KPOINTS = 4
    1.2 SPIN channel = 1
        1.2.1 KPOINTS = 1
        1.2.2 KPOINTS = 2
        1.2.3 KPOINTS = 3
        1.2.4 KPOINTS = 4
2. Ionic step = 2
    2.1 SPIN channel = 0
        2.1.1 KPOINTS = 1
        2.1.2 KPOINTS = 2
        2.1.3 KPOINTS = 3
        2.1.4 KPOINTS = 4
    2.2 SPIN channel = 1
        2.2.1 KPOINTS = 1
        2.2.2 KPOINTS = 2
        2.2.3 KPOINTS = 3
        2.2.4 KPOINTS = 4

with the shape = (n_ionic_steps, n_spin_channnels, n_kpoints, n_bands)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions