JuliaMolSim / DFTK.jl

Density-functional toolkit
https://docs.dftk.org
MIT License
441 stars 90 forks source link

Document symmetries differences wrt other codes #952

Open antoine-levitt opened 9 months ago

antoine-levitt commented 9 months ago

Getting the forces on Silicon with a 2x1x1 kgrid gets a nonzero result (irrespective of symmetries settings). This is consistent with finite differences. OTOH abinit gives zero by default. Setting nsym to 1 in abinit (ie deactivating the symmetries) does give a nonzero result. Basically what's happening is that abinit symmetrizes everything wrt the model symmetries, and we symmetrize wrt the basis symmetries. I like what we do better, because the symmetries are then a pure optimization (unlike abinit, where switching off symmetries gives a different result, even for the ground state energy). Not sure what other codes do. We should document it, though.

antoine-levitt commented 9 months ago

We can get abinit-type behavior by commenting out

    symmetries = symmetries_preserving_kgrid(symmetries, kgrid)

in the pwbasis constructor. Not completely sure if it gives the same behavior as abinit (we only use the symmetries for symmetrizing the density and the forces, not sure what abinit does)

mfherbst commented 9 months ago

Basically what's happening is that abinit symmetrizes everything wrt the model symmetries, and we symmetrize wrt the basis symmetries.

Yes I recall having stumbled upon this at some point. I also like our behaviour better, but I could imagine that this might lead to artifacts when optimising structures. E.g. you expect a symmetry in the structure to be kept during the optimisation as the original structure has it, but then this is broken because your kgrid does not keep that symmetry, thus the forces don't.

We can get abinit-type behavior by commenting out

Can't you just explicitly forward the model symmetries to the basis symmetries ?