-
Notifications
You must be signed in to change notification settings - Fork 116
Take absolute value for calculating nubmer of lattice points #517
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #517 +/- ##
===========================================
+ Coverage 83.96% 84.12% +0.16%
===========================================
Files 26 26
Lines 8122 8122
Branches 1702 1698 -4
===========================================
+ Hits 6820 6833 +13
+ Misses 1302 1289 -13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Can you do a quick review of the other usages of determinant to see if something similar was missed somewhere else?
I've checked the other parts properly take absolute values of determinants. |
Here are a few ones that should be investigated: Line 1316 in e13a16f
Line 1366 in e13a16f
Line 1517 in e13a16f
Line 1661 in e13a16f
|
I am not confident with the |
Depending on symmetry, spglib might result in permutations like (b, c, a), etc., but it tries to align to (a, b, c). If the input basis vectors are in a left-handed coordinate system, spglib does not attempt to align them. |
I see. I understand abs are not required for these parts. |
I am still lost on this, probably because the naming |
I may not understand your question fully, but it happens. The determinant is mostly used for calculating the volume of the unit cell (primitive cell, conventional unit cell, some cell that arises intermediately, etc), for which we take absolute. The volume can be used for various check for consistency check. For example, volume is not around zero, ratio of volumes of two cells is about integer, etc. When we want to check right handed or left handed, we don't take absolute. Positive or negative is checked. If negative, in some routine, the basis vectors are changed to right handed. |
Ok, but what about in the context of the 4 snippets above? According to the explanation it is only checking if the basis set is right-handed, but then why does it completely throw away the left-handed ones? Is it always supposed to be right-handed in that case, and if so an |
It is not theoretical. It is just for letting users feel better. This is not a mandatory procedure. So we don't need to be strict. Spglib returns transformation matrix, which suggest basis vectors of a conventinal unit cell (a_s, b_s, c_s) as written athttps://spglib.readthedocs.io/en/latest/definition.html#transformation-matrix-boldsymbol-p-and-origin-shift-boldsymbol-p. If the user input cell (a, b, c) is right handed and conventional unit cell, I wanted to return similar basis vectors in Cartesian coordinates, (a, b, c) ~ (a_s, b_s, c_s). But since the returned basis vectors must be right handed per definition, if the user input cell is left handed, these never become similar. So searching similar basis vectors is not performed. |
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.
Ok, I guess that clarifies that point
Closes #515
We need to take absolute value for a determinant of a transformation matrix to calculate cell size.