Closed jaemolihm closed 3 years ago
Nice, thanks for this! Yes I wondered about this and you're right, it should work. Also probably with forces, where we also unfold (see nonlocal.jl). I did the unfolding thing because it's more foolproof. I'm never been very confortable around symmetries, and we've had quite a few tricky bugs with them (and it's not the most pleasant thing in the world to debug) so I'm extra paranoid with it... Plus we needed the unfolding anyway for the wannier90 interface, and the cost is not great. But for MPI the symmetrization approach is definitely the way to go (since unfolding is tricky to make work with MPI), so we should do this. If you've got time to work on this feel free to submit a PR and we'll merge it gratefully!
By the way, it took quite a while to compile compute_stresses_without_unfolding when developing. Is it expected?
Unfortunately yes I've found the same thing, it takes ages to compile, very annoying... Haven't investigated it properly but it's forwarddiff-related. Hopefully we'll move to Diffractor at some point so I'm reluctant to investigate more.
P.S. This autodiff stress functionality is fascinating!
Yes, it works out very nicely! It's @niklasschmitz 's gsoc project, he's been doing a great job! Now the big excitement is seeing if reverse mode can be made to work...
Hey @jaemolihm. Many thanks for this snippet. We would indeed be very grateful if you (or someone else) turned this into a PR!
Thanks for the comments! I'll make a PR in a few days.
Perfect. Thanks @jaemolihm !
Hi, regarding the new stresses functionality, isn't it possible to compute stresses using only irreducible k points - without
unfold_bz
- by symmetrizing the resulting stress tensor?The function
compute_stresses_without_unfolding
is taken fromcompute_stresses
, and two changes are made: 1)unfold_bz
is commented out, and 2) stress tensor is symmetrized based onbasis.symmetries
. Is there any problem with this method?By the way, it took quite a while to compile
compute_stresses_without_unfolding
when developing. Is it natural?P.S. This autodiff stress functionality is fascinating!