SSCHAcode / python-sscha

The python implementation of the Stochastic Self-Consistent Harmonic Approximation (SSCHA).
GNU General Public License v3.0
55 stars 21 forks source link

Q points when symmetries are deactivated #23

Open mesonepigreco opened 4 years ago

mesonepigreco commented 4 years ago

This issue was raised by Francesco Belli

When the minimization is performed without symmetries, the dynamical matrix will break the symmetries present in the beginning. Then the q star division and the number of irreducible q points is broken. However, now, the code ignores this issue and continues to treat and save the dynamical matrices with the wrong star.

Within the python code, it is trivial to reassemble the dynamical matrix into the correct q star, by just executing the command dyn.AdjustQStar(). However, when should this be called by the code? Before the final dynamical matrix is written? Or after each minimization step?

@ionerrea @rafbianco

adenchfi commented 3 years ago

Perhaps related: I tried loading an nqirr=8 set of dyn{1-8} files, but

image

yet I have

image

I suspect it is because I forced QE to not use symmetry for its 2x2x2 q-mesh PHonon calculation, because it was complaining otherwise due to supercell properties. Trying to use nqirr=8 didn't work, but using nqirr=2 (the "proper" amount that QE would've used had I let it use symmetry) successfully didn't crash at least, and it's running. This I presume only reads dyn_1 and dyn2, not dyn{1-8}. It may work for my current case (as dyn_1 and dyn_2 should be fine; we'll see), but maybe not desired behavior for more general cases.

mesonepigreco commented 3 years ago

Hi, You can try a minimal script that just load the dynamical matrices and tries to enforces the symmetries:

import cellconstructor as CC
dyn = CC.Phonons.Phonons("dyn", nqirr = 8)
dyn.Symmetrize()

This should reproduce the same error as before.

If you modify the code in this way:

import cellconstructor as CC
dyn = CC.Phonons.Phonons("dyn", nqirr = 8)
dyn.AdjustQStar()
dyn.Symmetrize()
dyn.save_qe("new_dyn")

Does the code work?

If yes, after loading the dynamical matrix, use dyn.AdjustQStar() to fix the problem (this should reduce the number of irreducible points of the output new_dyn).

Alternatively, you can ask the code to symmetrize everything in real space setting use_spglib = True of the SSCHA_Minimizer object.