Skip to content

Fix to IBS force.cpp#1140

Closed
mrm24 wants to merge 1 commit into
electronic-structure:developfrom
mrm24:forces_ibs_lapw
Closed

Fix to IBS force.cpp#1140
mrm24 wants to merge 1 commit into
electronic-structure:developfrom
mrm24:forces_ibs_lapw

Conversation

@mrm24

@mrm24 mrm24 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

For LAPW+lo IBS is giving NaN in the case there in some grid configurations (if more than one process is assigned to the k-point group). See the following output of exciting with SIRIUS:
image
This patch solves it by initializing h1 and o1 (the derivatives) to 0 inside the Cartesian axis loop. The result looks like:
Screenshot from 2026-04-09 14-29-07

The derivative arrays are now initialized to 0.
@toxa81

toxa81 commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

Dear @mrm24
thank you for submitting the fix! If possible, can you please share your input file and MPI grid layout (you can send it to me to antonk@cscs.ch). When time allows, I need to have a look at them. Why I'm concerned: from the code zeroing of h1 and o1 is not required. Each element of those auxiliary matrices will be set explicitly. So while your fix is working, something is still not right

@toxa81

toxa81 commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

cscs-ci run default

Comment thread src/geometry/force.cpp
}

for (int x = 0; x < 3; x++) {

@toxa81 toxa81 May 22, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I found the issue. It's the local orbital - local orbital part of the matrix has to be zeroed, because it doesn't contribute. Correct code is:

            /* zero lo-lo block */
            for (int icol = 0; icol < kp__->num_lo_col(); icol++) {
                for (int irow = 0; irow < kp__->num_lo_row(); irow++) {
                    h1(irow + kp__->num_gkvec_row(), icol + kp__->num_gkvec_col()) = la::constant<std::complex<double>>::zero();
                    o1(irow + kp__->num_gkvec_row(), icol + kp__->num_gkvec_col()) = la::constant<std::complex<double>>::zero();
                }
            }

@toxa81

toxa81 commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

fixed in a different MR

@toxa81 toxa81 closed this Jun 23, 2026
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