-
Notifications
You must be signed in to change notification settings - Fork 145
Feature: force and stress can be calculated with PW code #4894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… into pw_soc_force
| { | ||
| const int ib2 = ib*2; | ||
| FPTYPE local_force[3] = {0, 0, 0}; | ||
| FPTYPE fac = d_wg[ik * wg_nc + ib] * 2.0 * tpiba; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ik * wg_nc can be calculated only once
| const int ib2 = ib * 2; | ||
| const int it = blockIdx.x % ntype; | ||
|
|
||
| int iat = 0, sum = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one variable for a line
| sum += atom_na[ii] * atom_nh[ii]; | ||
| } | ||
|
|
||
| FPTYPE stress_var = 0, fac = d_wg[ik * wg_nc + ib] * 1.0, ekb_now = d_ekb[ik * wg_nc + ib]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one line for a variable
| sum += atom_na[ii] * atom_nh[ii]; | ||
| } | ||
|
|
||
| FPTYPE stress_var = 0, fac = d_wg[ik * wg_nc + ib] * 1.0, ekb_now = d_ekb[ik * wg_nc + ib]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| FPTYPE stress_var = 0, fac = d_wg[ik * wg_nc + ib] * 1.0, ekb_now = d_ekb[ik * wg_nc + ib]; | |
| FPTYPE stress_var = 0; | |
| FPTYPE fac = d_wg[ik * wg_nc + ib] * 1.0; | |
| FPTYPE ekb_now = d_ekb[ik * wg_nc + ib]; |
| const int ib2 = ib * 2; | ||
| const int it = blockIdx.x % ntype; | ||
|
|
||
| int iat = 0, sum = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| int iat = 0, sum = 0; | |
| int iat = 0; | |
| int sum = 0; |
| for (int ia = 0; ia < atom_na[it]; ia++) | ||
| { | ||
| for (int ii = threadIdx.x; ii < Nprojs * Nprojs; ii += blockDim.x) { | ||
| int ip1 = ii / Nprojs, ip2 = ii % Nprojs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| int ip1 = ii / Nprojs, ip2 = ii % Nprojs; | |
| int ip1 = ii / Nprojs; | |
| int ip2 = ii % Nprojs; |
|
It will be replaced by another PR for whole noncollinear spin and DFT+U feature for PW. |
Reminder
Linked Issue
Fix #4890
Unit Tests and/or Case Tests for my changes
What's changed?
Any changes of core modules? (ignore if not applicable)