Fix(input): reject esolver_type=lr with a self-consistent calculation - #7779
Fix(input): reject esolver_type=lr with a self-consistent calculation#7779Stardust0831 wants to merge 1 commit into
Conversation
esolver_type=lr reads the ground state wave function from a separate SCF run, so it cannot be combined with calculation=scf. Previously the reset hook silently rewrote calculation to nscf, hiding an invalid user input. Remove the reset hook and reject the contradictory combination in check_value with an explicit diagnostic that states the required value.
|
I'm surprised that CI tests fails due to PEXSI, given that Docker build has succeed and the |
|
@Growl1234 Thanks for checking. This failure is unrelated to this PR and was caused by the mutable Intel container tag being overwritten by the LTS branch: the same job succeeded at 09:59 UTC with |
|
Uh it's really unfortunate... |
Summary
esolver_type=lr("LR-TDDFT with given KS orbitals") reads the ground state wave function (and charge density) from a separate, prior SCF run, so it is only meaningful as a non-self-consistent step. It cannot be combined withcalculation=scf.Previously the reset hook in
read_input_item_system.cppsilently rewrotecalculationfromscftonscf, hiding a contradictory user input and leaving a silently-mutated INPUT state. This is exactly the behavior that issue #7719 asks to eliminate ("A user-specified value should not be silently changed unless that behavior is deliberate, documented, and tested").This PR removes the silent rewrite and rejects the contradictory combination in
check_valuewith an explicit diagnostic that also states the required value (calculation=nscf), consistent with the approach already adopted fornoncolin/lspinorb→nspinandbndparin #7731.Changes
source/source_io/module_parameter/read_input_item_system.cppesolver_typereset_valuehook that rewrotecalculation=scf → nscf.check_valuerule thatWARNING_QUITs whenesolver_type=lr && calculation=scf, with a message that names the required value and explains why.read_input_test.cpp: newValidateLrRequiresNscfend-to-end test — rejects the default (esolver_type lralone) and the explicit contradiction (esolver_type lr+calculation scf), and accepts the valid combination (esolver_type lr+calculation nscf).read_input_item_test.cpp: update theItem_testesolver_typeblock to assert the newcheck_valuerejection instead of the removed reset-to-nscfbehavior.Verification
check_valueis invoked in the final validation phase after all inputs are read (seeread_input.cpp).parameters.yaml/input-main.mdregeneration is required: this change does not modify any parameter'sdescription,default_value, or legal values; it only adds a cross-parameter validation, which is not represented in the generated documentation.Related
Notes
esolver_type=ks-lris unaffected: it performs its own KS ground state SCF internally and therefore does not requirecalculation=nscf.