Skip to content

Open-shell doublet as default for uneven number of electrons#1406

Merged
thfroitzheim merged 1 commit into
grimme-lab:mainfrom
thfroitzheim:fix-uhf
May 14, 2026
Merged

Open-shell doublet as default for uneven number of electrons#1406
thfroitzheim merged 1 commit into
grimme-lab:mainfrom
thfroitzheim:fix-uhf

Conversation

@thfroitzheim
Copy link
Copy Markdown
Member

This PR reverts part of the #1235 following discussions with @stefangrimme.
An error occurs only if the number of unpaired electrons specified via the .UHF file or the --uhf flag is inconsistent with the total number of electrons (i.e., it is even and the number of electrons is odd or the other way around).
In all other cases, we specify a default:

  • closed-shell singlet (unpaired=0) if the number of electrons is even
  • open-shell doublet (unpaired=1) if the number of electrons is odd

Given that we use the first default all of the time, the low-spin open-shell default is the logical extension.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the default spin handling so odd-electron systems can default to an open-shell doublet instead of always failing multiplicity consistency checks, and updates user-facing documentation/output to reflect the effective unpaired-electron count.

Changes:

  • Defaults odd-electron xTB calculations with no nonzero UHF assignment to nopen = 1.
  • Prints wfn%nopen instead of mol%uhf in SCF setup output.
  • Updates CLI help and man page text for the --uhf default.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/prog/main.F90 Updates wavefunction spin/default consistency logic.
src/scf_module.F90 Reports the initialized wavefunction unpaired-electron count.
src/xhelp.f90 Documents parity-dependent default --uhf behavior.
man/xtb.1.adoc Updates man page documentation for --uhf defaults.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/prog/main.F90
@thfroitzheim thfroitzheim merged commit 886363e into grimme-lab:main May 14, 2026
27 of 28 checks passed
@thfroitzheim thfroitzheim deleted the fix-uhf branch May 14, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants