Repository navigation
Fix uninitialized optimizer status for single-atom systems (gfortran bug) - #1441
Merged
Merged
Conversation
thfroitzheim
requested changes
Sep 4, 2026
|
|
||
| add_test("xtb/Argparser_print_version" ${XTB-EXE} --version) | ||
| add_test("xtb/Argparser_print_help" ${XTB-EXE} --help) | ||
| add_test("xtb/Argparser_print_license" ${XTB-EXE} --license) |
Member
There was a problem hiding this comment.
This isn't really command-line specific. Could you please move this into a optimization unit test (I don't think there is one present yet, but you can adapt one of the other unit tests)
Contributor
Author
There was a problem hiding this comment.
Replaced the command-line test with a TestDrive optimizer suite covering ANCopt, FIRE, and L-ANCopt for a single atom. All cases verify fail = .false. and iter_needed = 0.
Member
There was a problem hiding this comment.
This should also be part of a unit test
Contributor
Author
There was a problem hiding this comment.
Removed lithium.xyz; the single-atom Li+ molecule is now constructed directly in the unit test. All 30 xTB unit-test suites pass with gfortran.
mcbennet
force-pushed
the
issue_1440
branch
from
September 17, 2026 01:25
d7068a2 to
20257f8
Compare
thfroitzheim
approved these changes
Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix a bug in geometry optimization for single-atom systems when xTB is compiled with gfortran.
The ANCopt, FIRE, and L-ANCopt routines return immediately when
mol%n == 1, because a single atom has no internal geometry to optimize. However, this return occurred before the output variablesfail,iter, and optionaliter_neededwere initialized.With gfortran,
failcould therefore contain an undefined.true.(or equivalent) value. The caller interpreted this as a failed geometry optimization, producing a non-convergence error and a nonzero exit status. Other compilers happened not to expose the issue consistently.Changes
failto.false.and the iteration count to zero before the single-atom early return in:iter_neededwhen present.The present changes should resolve #1440
Expected behavior
A command such as:
should complete successfully.