-
Notifications
You must be signed in to change notification settings - Fork 90
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
Symmetry Issue with HCP Lattice #307
Comments
Aaaaaaaaaaargh (sorry, it's a reflex when it comes to symmetries and spglib issues). Thanks for the report! I'm indeed not sure what's going on, looks like a tolerance set too low. |
Hm no that's not it; either we messed up in the equations somewhere or it's an spglib bug. |
Yikes ... symmetry again. Well thanks for the report! So I took a brief look into this. So basically it happens directly after Also using Regarding the bug in DFTK, I think what we can do is to explicitly remove the rotation matrices, which we detect to not be unitary. What do you think @antoine-levitt. |
Indeed, that's a good sign we're OK and spglib is not. Should we just open a bug in spglib? I'd rather avoid monkey-patching DFTK further to avoid upstream issues. |
We can. I expect it goes into a similar direction than spglib issue 101, however. |
Could it also be that the |
I went down to a symmetry tolerance 1e-2 and that did not help. It's more substantial than that form looking at the non-orthogonality numbers. |
OK, I'll open an issue at spglib and see what they say. At the very least it's a simpler reproducer than 101. In the meantime @umbriquse you can just disable symmetry or, if that is too slow, discard the non-unitary rotations. |
Seems to be a transpose issue again?
works if I put the transpose in. Did we mess up? |
Are you sure this is the same setup? You only have one atom, but the failing example has two. |
Doesn't change anything |
Did you take care of all the transposes in python versus C versus julia? You remembered that spglib changes the ordering between the C and python interfaces? |
No, I'm always very confused by this, I was hoping you'd remember :-) |
That's why I would go for an example in C ... one less transpose to worry about ... |
wouldn't be too sure about that, C has row major ordering? |
yes, ah ... I get your point. Ok so the lattice definition in the spglib python interface takes lattice vectors as rows that is important to keep in mind. But of course compared to Julia python is row-major. So when you actually do matmuls you need to transpose the lattice to get the same thing we do. |
But then it works? |
Let's be clear about this: DFTK
Spglib
So you do not need to take a transpose when using our lattice vectors in spglib and to get the same algebra we do for comparing things you also need to take a transpose when using the lattice matrix in the comparison to get the same algebra we do. |
(Reason I don't believe it's just a transpose missing is that we have used spglib on non-symmetric lattice matrices) |
I think I'm more confused than before. The correct snippet is
where the lattice gets transposed in the call to |
Actually, I think you are right. I looked at the code again and it seems to me the transpose might be missing here: https://github.com/JuliaMolSim/DFTK.jl/blob/master/src/external/spglib.jl#L56 in the lattice matrix. From the spglib docs it seems that spglib does the lattice vectors in columns, same as we do, but of course you need to transpose once for column major -> row major. If that is indeed the case, it needs fixing here, too: https://github.com/JuliaMolSim/DFTK.jl/blob/master/src/external/spglib.jl#L119 I wonder why we did not spot this before ... we definitely used lattices which are not symmetric. |
https://spglib.github.io/spglib/variable.html#id2 what's the memory layout of this in C? |
|
Then yes it needs to be transposed |
@antoine-levitt Are you fixing it or should I? |
|
Not right now, feel free if you have time |
Me neither, but I put it on the pile. |
Fun fact: Julia's transpose is a lazy wrapper, so if you pass it to a C function it'll get ignored |
There were actually two bugs here: the lattice was passed untransposed, and the rotations were passed untransposed in get_stabilized_reciprocal_mesh. Maybe they compensated each other... |
Should be fixed by #314. Thanks a lot @umbriquse ! It's wonderful having users to actually find bugs for you :-) |
I can only agree 😄 |
This was a pretty serious bug, tag a new release when the current round of PRs are in? |
of course! |
The following code is attempting to obtain the self consistent field for an HCP lattice for Platinum. The error that is produced can be suppressed by setting the symmetry option for the Model to
:off
.I don't understand why an HCP lattice throws this type of error, or why a lattice has to be a Unitary rotation matrix in order to use symmetry operations.
Code
Error
The text was updated successfully, but these errors were encountered: