Skip to content

Conversation

@dyzheng
Copy link
Collaborator

@dyzheng dyzheng commented Aug 7, 2024

Reminder

  • Have you linked an issue with this pull request?
  • Have you added adequate unit tests and/or case tests for your pull request?
  • Have you noticed possible changes of behavior below or in the linked issue?
  • Have you explained the changes of codes in core modules of ESolver, HSolver, ElecState, Hamilt, Operator or Psi? (ignore if not applicable)

Linked Issue

Fix #4890

Unit Tests and/or Case Tests for my changes

  • A unit test is added for each new feature or bug fix.

What's changed?

  • Example: My changes might affect the performance of the application under certain conditions, and I have tested the impact on various scenarios...

Any changes of core modules? (ignore if not applicable)

  • Example: I have added a new virtual function in the esolver base class in order to ...

{
const int ib2 = ib*2;
FPTYPE local_force[3] = {0, 0, 0};
FPTYPE fac = d_wg[ik * wg_nc + ib] * 2.0 * tpiba;
Copy link
Collaborator

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;
Copy link
Collaborator

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];
Copy link
Collaborator

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];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
int ip1 = ii / Nprojs, ip2 = ii % Nprojs;
int ip1 = ii / Nprojs;
int ip2 = ii % Nprojs;

@dyzheng
Copy link
Collaborator Author

dyzheng commented Oct 11, 2024

It will be replaced by another PR for whole noncollinear spin and DFT+U feature for PW.

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.

The stress of PW SOC is wrong

3 participants