irreducible-representations / irrep

GNU General Public License v3.0
62 stars 31 forks source link

* new method for symsep - #82

Closed stepan-tsirkin closed 3 months ago

stepan-tsirkin commented 4 months ago

works much more precisely, including for norm-NOT-conserving pseudos

also allows transformations between different k-points, which allows to create the .dmn file for symmetry-adapted Wannier functions. (coming soon in WannierBerri)

Other changes:

The idea of is simple.

We assume that under a symmetry operations

$$ g\circ\Psi{n\mathbf{k}}(\mathbf{r}) = \Psi{n\mathbf{k}}(g^{-1}\mathbf{r}) = \summ \Psi{m,g\mathbf{k}}(\mathbf{r}) U^g_{mn}(\mathbf{k}) \quad\quad (1) $$

, where $U^g_{mn}(\mathbf{k})$ is a unitary matrix. Previously, to evaluate it were computing the scalar product

$$ \langle \Psi{n\mathbf{k}(g^{-1}\mathbf{r})} | \Psi{m,g\mathbf{k}(\mathbf{r})} \rangle \quad\quad (2) $$

However, such a scalar product requires the knowledge of the full-electron wave function (unless norm-conserving potentials are used) , therefore we had inaccuracies

Instead, now we solve the equation (1) directly - find such matrix that transforms the wavefunctions (in this case we do not care if that are actually pseudo-wavefunctions, whjch are not orthonormal)

Thus, the essence is here

https://github.com/irreducible-representations/irrep/blob/6aced8a193de8a2ce71f7879abda0360a78086b6/irrep/gvectors.py#L423-L433

and the right inverse of a rectangular matrix is

https://github.com/irreducible-representations/irrep/blob/6aced8a193de8a2ce71f7879abda0360a78086b6/irrep/gvectors.py#L458-L459

stepan-tsirkin commented 4 months ago

Example.Bi-Hoti, from tests (VASP, with SOC), separating by 3rd symmetry (C3z rotation)

Old method : eigenvaues are not precise

################################################ 

 NEXT SUBSPACE:   sym # 3 -> eigenvalue +0.500-0.866j

 k-point   2 : [0. 0. 0.] (in DFT cell)
               [0. 0. 0.] (after cell trasformation)

 number of states : 6

   Energy  |   degeneracy  |  irreps   | sym. operations  
           |               |           |        1                2                3                4                5                6                7                8                9               10               11               12        
  -7.7304  |        1      | -GM8(0.5) |   1.0000+0.0000j   0.5000-0.7932j   0.5000+0.7932j  -0.0000-0.3782j   0.0000-0.0726j  -0.0000-0.3056j   1.0000+0.0000j   0.5000-0.7932j   0.5000+0.7932j  -0.0000+0.3782j   0.0000-0.0726j  -0.0000+0.3056j
           |               |           |   1.0000+0.0000j   0.5000-0.7932j   0.5000+0.7932j  -0.0000-0.3782j   0.0000-0.0726j   0.0000+0.3056j   1.0000+0.0000j   0.5000-0.7932j   0.5000+0.7932j   0.0000-0.3782j   0.0000-0.0726j  -0.0000+0.3056j
  -2.1845  |        1      | -GM9(0.5) |   1.0000+0.0000j   0.5000+0.8232j   0.5000-0.8232j   0.0000+0.0707j   0.0000-0.2265j   0.0000+0.2973j  -1.0000+0.0000j  -0.5000-0.8232j  -0.5000+0.8232j  -0.0000+0.0707j   0.0000+0.2265j   0.0000+0.2973j
           |               |           |   1.0000+0.0000j   0.5000+0.8232j   0.5000-0.8232j   0.0000+0.0707j   0.0000-0.2265j  -0.0000-0.2973j  -1.0000+0.0000j  -0.5000-0.8232j  -0.5000+0.8232j   0.0000-0.0707j   0.0000+0.2265j   0.0000+0.2973j
   2.4850  |        1      | -GM8(0.5) |   1.0000+0.0000j   0.5000+0.6086j   0.5000-0.6086j  -0.0000+0.4289j   0.0000+0.7060j  -0.0000-0.2771j   1.0000+0.0000j   0.5000+0.6086j   0.5000-0.6086j   0.0000-0.4289j   0.0000+0.7060j  -0.0000+0.2771j
           |               |           |   1.0000+0.0000j   0.5000+0.6086j   0.5000-0.6086j  -0.0000+0.4289j   0.0000+0.7060j   0.0000+0.2771j   1.0000+0.0000j   0.5000+0.6086j   0.5000-0.6086j  -0.0000+0.4289j   0.0000+0.7060j  -0.0000+0.2771j
   4.4394  |        1      | -GM8(0.5) |   1.0000+0.0000j   0.5000-0.6614j   0.5000+0.6614j  -0.0000-0.4902j   0.0000-0.6088j  -0.0000+0.1186j   1.0000+0.0000j   0.5000-0.6614j   0.5000+0.6614j   0.0000+0.4902j   0.0000-0.6088j  -0.0000-0.1186j
           |               |           |   1.0000+0.0000j   0.5000-0.6614j   0.5000+0.6614j  -0.0000-0.4902j   0.0000-0.6088j   0.0000-0.1186j   1.0000+0.0000j   0.5000-0.6614j   0.5000+0.6614j  -0.0000-0.4902j   0.0000-0.6088j  -0.0000-0.1186j
   6.4811  |        1      | -GM9(0.5) |   1.0000+0.0000j   0.5000+0.5937j   0.5000-0.5937j  -0.0000+0.7105j   0.0000+0.4929j  -0.0000+0.2176j  -1.0000+0.0000j  -0.5000-0.5937j  -0.5000+0.5937j  -0.0000+0.7105j   0.0000-0.4929j   0.0000+0.2176j
           |               |           |   1.0000+0.0000j   0.5000+0.5937j   0.5000-0.5937j  -0.0000+0.7105j   0.0000+0.4929j   0.0000-0.2176j  -1.0000+0.0000j  -0.5000-0.5937j  -0.5000+0.5937j   0.0000-0.7105j   0.0000-0.4929j   0.0000+0.2176j
   8.6554  |        1      | -GM9(0.5) |   1.0000+0.0000j   0.5000+0.6987j   0.5000-0.6987j   0.0000-0.5906j   0.0000-0.3067j  -0.0000-0.2839j  -1.0000+0.0000j  -0.5000-0.6987j  -0.5000+0.6987j   0.0000-0.5906j   0.0000+0.3067j  -0.0000-0.2839j
           |               |           |   1.0000+0.0000j   0.5000+0.6987j   0.5000-0.6987j   0.0000-0.5906j   0.0000-0.3067j   0.0000+0.2839j  -1.0000+0.0000j  -0.5000-0.6987j  -0.5000+0.6987j  -0.0000+0.5906j   0.0000+0.3067j  -0.0000-0.2839j

new method : eigenvalues are all same for a chosen subsace

 ################################################ 

 NEXT SUBSPACE:   sym # 3 -> eigenvalue +0.500-0.866j

 k-point   2 : [0. 0. 0.] (in DFT cell)
               [0. 0. 0.] (after cell trasformation)

 number of states : 6

   Energy  |   degeneracy  |  irreps   | sym. operations  
           |               |           |        1                2                3                4                5                6                7                8                9               10               11               12        
  -7.7304  |        1      | -GM8(0.5) |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j  -0.0000+0.0000j  -0.0000+0.0000j  -0.0000+0.0000j   1.0000-0.0000j   0.5000+0.8660j   0.5000-0.8660j  -0.0000-0.0000j   0.0000+0.0000j  -0.0000-0.0000j
           |               |           |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j   0.0000-0.0000j   0.0000-0.0000j  -0.0000+0.0000j   1.0000-0.0000j   0.5000+0.8660j   0.5000-0.8660j  -0.0000-0.0000j  -0.0000-0.0000j   0.0000+0.0000j
  -2.1845  |        1      | -GM9(0.5) |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j   0.0000-0.0000j   0.0000+0.0000j  -0.0000-0.0000j  -1.0000-0.0000j  -0.5000-0.8660j  -0.5000+0.8660j   0.0000-0.0000j   0.0000-0.0000j   0.0000-0.0000j
           |               |           |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j  -0.0000+0.0000j  -0.0000-0.0000j  -0.0000-0.0000j  -1.0000-0.0000j  -0.5000-0.8660j  -0.5000+0.8660j   0.0000-0.0000j   0.0000+0.0000j  -0.0000+0.0000j
   2.4850  |        1      | -GM8(0.5) |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j   0.0000+0.0000j   0.0000-0.0000j  -0.0000+0.0000j   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j  -0.0000-0.0000j   0.0000-0.0000j  -0.0000-0.0000j
           |               |           |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j  -0.0000-0.0000j   0.0000+0.0000j  -0.0000+0.0000j   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j  -0.0000-0.0000j   0.0000+0.0000j   0.0000+0.0000j
   4.4394  |        1      | -GM8(0.5) |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j  -0.0000-0.0000j   0.0000+0.0000j   0.0000-0.0000j   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j   0.0000+0.0000j   0.0000+0.0000j  -0.0000+0.0000j
           |               |           |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j   0.0000+0.0000j  -0.0000-0.0000j   0.0000-0.0000j   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j   0.0000+0.0000j  -0.0000-0.0000j   0.0000-0.0000j
   6.4811  |        1      | -GM9(0.5) |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j  -0.0000-0.0000j  -0.0000+0.0000j  -0.0000-0.0000j  -1.0000+0.0000j  -0.5000-0.8660j  -0.5000+0.8660j  -0.0000-0.0000j   0.0000-0.0000j  -0.0000-0.0000j
           |               |           |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j   0.0000+0.0000j   0.0000-0.0000j  -0.0000-0.0000j  -1.0000+0.0000j  -0.5000-0.8660j  -0.5000+0.8660j  -0.0000-0.0000j   0.0000+0.0000j   0.0000+0.0000j
   8.6554  |        1      | -GM9(0.5) |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j  -0.0000-0.0000j   0.0000+0.0000j   0.0000-0.0000j  -1.0000+0.0000j  -0.5000-0.8660j  -0.5000+0.8660j  -0.0000-0.0000j   0.0000-0.0000j  -0.0000-0.0000j
           |               |           |   1.0000+0.0000j   0.5000+0.8660j   0.5000-0.8660j   0.0000+0.0000j  -0.0000-0.0000j   0.0000-0.0000j  -1.0000+0.0000j  -0.5000-0.8660j  -0.5000+0.8660j  -0.0000-0.0000j   0.0000+0.0000j   0.0000+0.0000j
stepan-tsirkin commented 4 months ago

@bmondal94 , I think it should not break compatibility with banduppy, but if it does, please let me know.

bmondal94 commented 3 months ago

@bmondal94 , I think it should not break compatibility with banduppy, but if it does, please let me know.

Works perfectly. No issues.

stepan-tsirkin commented 3 months ago

@MIraola , do you have any idea why the test is failing now ? according to the logs irreptables were succesfully installed, and on my computer it works fine.

bmondal94 commented 3 months ago

@stepan-tsirkin I have a quick suggestion on the test failed: (if not resolved yet)

How about adding the python path explicitly in the test.yaml?

- name: Set PYTHONPATH
  run: echo "PYTHONPATH=$(pwd):$(pwd)/irreptables" >> $GITHUB_ENV

- name: Run tests
  run: pytest
  env:
    PYTHONPATH: ${{ env.PYTHONPATH }}
stepan-tsirkin commented 3 months ago

@bmondal94 , Thanks, it worked!