Repository navigation
cipsi: assign each state its own eigenvector's eigenvalue in do_diag (qp3) - #435
Merged
Merged
Conversation
In fill_buffer_$DOUBLE, after DSYEV on the (N_states+1)x(N_states+1) matrix [E0 | mat; mat' | Hii+E_shift], the eigenvectors sit in pt2_matrix by columns: column j is the eigenvector of eigvalues(j). The old code computed iwork(j) = maxloc(pt2_matrix, DIM=1), the dominant ROW of eigenvector j, and then used iwork(k) as an eigenvalue index for state k, mixing eigenvector and state indices. The dimensionally correct reading: state k takes the eigenvalue of the eigenvector whose largest component lies in row k. The two readings coincide for N_states=2 whenever the dominant-row map is an involution (the typical case), which is why 2-state runs looked healthy; for N_states=3 a state can be assigned the external-determinant eigenvalue ~ Hii + E_shift - E0, producing the O(1e4) Ha PT2 values reported in issue QuantumPackage#433 (17160.5 / -46231.3 / 16045.9977 instead of -0.78691012 / -0.86549405 / -0.81739619). Fixes QuantumPackage#433
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.
Fix
fill_buffer_$DOUBLE(src/cipsi/selection.irp.f), the per-candidatedo_diagblock that runs for multi-state runs: afterDSYEVon the (N_states+1)x(N_states+1) matrix[E0 | mat; mat' | Hii+E_shift], the eigenvectors sit inpt2_matrixby columns (column j is the eigenvector ofeigvalues(j)). The old code computediwork(j) = maxloc(pt2_matrix, DIM=1)— the dominant row of eigenvector j — and then usediwork(k)as an eigenvalue index for state k, mixing eigenvector and state indices. A state could be assigned the external-determinant eigenvalue (≈Hii + E_shift − E0), corrupting the reported PT2 to O(1e4) Ha for N_states ≥ 3 (issue #433: 17160.5 / −46231.3 / 16045.9977 instead of −0.78691 / −0.86549 / −0.81740).The dimensionally correct reading: state k takes the eigenvalue of the eigenvector whose largest component lies in row k. The two readings coincide for N_states=2 whenever the dominant-row map is an involution, which is why 2-state runs looked healthy.
Single hunk, F90 only, no declaration change.
Verification (Ampere, 3-state + 2-state matrix, both arms)
Fixture: 3-state wavefunction, 3500 determinants (truncated from 156417, ranked by max |c| over the 3 state columns, renormalized), state order (2,3,1), 128 MOs.
pt2program, OMP_NUM_THREADS=1, QP_NTHREADS_PT2=2, pt2_relative_error=5e-2 (stochastic), fresh EZFIO copy per run. Final per-state PT2 values, Ha:Both arms (dev-stable tip
45d4cb5b; qp3 tipc2d4ac2b) agree to ~1e-8 on every value.Binaries (sha256):
Note: the dev-stable arm was built with gfortran 7.5.0 + MKL because the current dev-stable tip does not compile with ifort 2021.9 (separate upstream build regression,
0ee7e5f8symmetry_det character-provider rewrite,error #6401); the hunk is plain F90 and the compiler does not affect its semantics.Cherry-pick of dev-stable commit 760b177 (PR #434); identical single hunk (hunk header line 830 here vs 807 on dev-stable). Verified on qp3 tip c2d4ac2, which is an ancestor of the current qp3 tip 0a9ad26; the do_diag block is byte-identical at both, and none of the intermediate commits touch it.