Skip to content

Warning generated for spin polarised calculation expected but not found when the calculation is spin polarised #81

@dylanbmorgan

Description

@dylanbmorgan

For example:

/mnt/lustre/a2fs-work3/work/e772/e772/morgs/comp_chem/DeltaSCF-pSOC/.venv/lib/python3.13/site-packages/dfttoolkit/output.py:1464: UserWarning: A spin polarised calculation was expected but not found.
  n_ks_states = self.get_n_initial_ks_states()

I think the logic is incorrect in dfttoolkit.output.AimsOutput:

    def get_n_initial_ks_states(self, include_spin_polarised: bool = True) -> int:

    ...

        # Count the spin-down eigenvalues if the calculation is spin polarised
        if include_spin_polarised:
            init_ev_end = init_ev_start + n_ks_states
            if target_line == self.lines[init_ev_end + 3].strip():
                init_ev_end += 4
                for line in self.lines[init_ev_end:]:
                    if len(line) > 1:
                        n_ks_states += 1
                    else:
                        break

            else:  # If SD states are not found 4 lines below end of SU states
                warnings.warn(
                    "A spin polarised calculation was expected but not found.",
                    stacklevel=2,
                )

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions