Skip to content
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

A question about the code for reading pseudopotentials #5757

Open
16 tasks
A-006 opened this issue Dec 24, 2024 · 3 comments
Open
16 tasks

A question about the code for reading pseudopotentials #5757

A-006 opened this issue Dec 24, 2024 · 3 comments
Assignees
Labels
non-collinear/SOC Issues related to SOC Questions Raise your quesiton! We will answer it.

Comments

@A-006
Copy link
Collaborator

A-006 commented Dec 24, 2024

Describe the bug

Image
in this expression,the pp.lchi[nw] - pp.jchi[nw] - 0.5,The result of this expression is always false. Should we calculate the absolute value of pp.lchi[nw] - pp.jchi[nw] to be around 0.5

Expected behavior

No response

To Reproduce

No response

Environment

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

  • Verify the issue is not a duplicate.
  • Describe the bug.
  • Steps to reproduce.
  • Expected behavior.
  • Error message.
  • Environment details.
  • Additional context.
  • Assign a priority level (low, medium, high, urgent).
  • Assign the issue to a team member.
  • Label the issue with relevant tags.
  • Identify possible related issues.
  • Create a unit test or automated test to reproduce the bug (if applicable).
  • Fix the bug.
  • Test the fix.
  • Update documentation (if necessary).
  • Close the issue and inform the reporter (if applicable).
@mohanchen mohanchen changed the title The expression is not valid A question about the code for reading pseudopotentials Dec 24, 2024
@mohanchen mohanchen added the Questions Raise your quesiton! We will answer it. label Dec 24, 2024
@dyzheng
Copy link
Collaborator

dyzheng commented Dec 24, 2024

@A-006 This code block try to dismiss SOC part of pseudopotential if the check of j == l + 0.5 or j == l - 0.5 fail, but there is a bug in it.
I'm interested that can you find a upf100 pseudopotential file with SOC but not comply with this j-l rule?

@A-006
Copy link
Collaborator Author

A-006 commented Dec 24, 2024

Thanks for your relpy,does it means that we can use the code as bellow
(abs(abs(pp.lchi[nw]-pp.jchi[nw])-0.5)<1e-7)
My understanding is that the rounding error range for single precision (float) is actually around 10e-7, while the rounding error range for double precision (double) is around 10e-14. Choosing a smaller range helps to reduce numerical errors?

I found it with TscanCode, which is a static code analysis tool. According to research on static code analysis, we can solve 30%-70% of the bugs in our program before we debug it when the problems happen. So, it's strongly recommended to use static code check tools. Actually, we can use three open-source code check tools: flawfinder, cppcheck, and TscanCode (most recommended!!!, [https://github.com/Tencent/TscanCode]

@mohanchen
Copy link
Collaborator

@A-006 This code block try to dismiss SOC part of pseudopotential if the check of j == l + 0.5 or j == l - 0.5 fail, but there is a bug in it. I'm interested that can you find a upf100 pseudopotential file with SOC but not comply with this j-l rule?

He has a background of computer science, he cannot understand your comment.

@mohanchen mohanchen added the non-collinear/SOC Issues related to SOC label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
non-collinear/SOC Issues related to SOC Questions Raise your quesiton! We will answer it.
Projects
None yet
Development

No branches or pull requests

3 participants