Line data Source code
1 : !--------------------------------------------------------------------------------
2 : ! Copyright (c) 2022 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
3 : ! This file is part of FLEUR and available as free software under the conditions
4 : ! of the MIT license as expressed in the LICENSE file in more detail.
5 : !--------------------------------------------------------------------------------
6 : MODULE m_dfpt_vgen_finalize
7 : USE m_juDFT
8 : USE m_xcBfield
9 : USE m_plot
10 : USE m_constants
11 : USE m_lattHarmsSphHarmsConv
12 :
13 : CONTAINS
14 :
15 0 : SUBROUTINE dfpt_vgen_finalize(fmpi,atoms,stars,sym,juphon,noco,nococonv,input,sphhar,vTot,vTot1,vTot1imag,denRot,den1Rot,den1imRot,starsq,killcont)
16 : !! Collinear case: put V1Theta+VTheta1 into V1%pw_w together
17 : !! Noco case: Correctly rotate back the potential into a 2x2 matrix (TODO)
18 : USE m_types
19 : USE m_constants
20 : USE m_get_int_perturbation
21 : USE m_get_mt_perturbation
22 : !USE m_rotate_mt_den_tofrom_local
23 :
24 : IMPLICIT NONE
25 :
26 : TYPE(t_mpi), INTENT(IN) :: fmpi
27 : TYPE(t_noco), INTENT(IN) :: noco
28 : TYPE(t_nococonv), INTENT(IN) :: nococonv
29 : TYPE(t_sym), INTENT(IN) :: sym
30 : TYPE(t_juphon), INTENT(IN) :: juphon
31 : TYPE(t_stars), INTENT(IN) :: stars, starsq
32 : TYPE(t_atoms), INTENT(IN) :: atoms
33 : TYPE(t_input), INTENT(IN) :: input
34 : TYPE(t_sphhar), INTENT(IN) :: sphhar
35 : TYPE(t_potden), INTENT(IN) :: vTot
36 : TYPE(t_potden), INTENT(INOUT) :: vTot1, vTot1imag, denRot, den1Rot, den1imRot
37 : INTEGER, INTENT(IN) :: killcont(2)
38 :
39 : INTEGER :: i, js, ifft3, iPhonon
40 0 : REAL, ALLOCATABLE :: fftwork(:), vre(:), v1re(:), v1im(:)
41 0 : COMPLEX, ALLOCATABLE :: v1full(:)
42 :
43 0 : iPhonon = 0
44 0 : IF (juphon%l_phonon) iPhonon = 1
45 :
46 0 : ifft3 = 27*stars%mx1*stars%mx2*stars%mx3 !TODO: What if starsq/=stars in that regard?
47 :
48 0 : ALLOCATE(vre(ifft3),v1re(ifft3),v1im(ifft3),v1full(ifft3),fftwork(ifft3))
49 :
50 0 : vTot1%pw_w = CMPLX(0.0,0.0)
51 :
52 0 : IF (.NOT.noco%l_noco) THEN
53 0 : DO js = 1, input%jspins
54 0 : vre = 0.0; v1re = 0.0; v1im = 0.0
55 0 : CALL fft3d(v1re, v1im, vTot1%pw(:, js), starsq, +1)
56 0 : CALL fft3d(vre, fftwork, vTot%pw(:, js), stars, +1)
57 0 : v1full = killcont(1)*CMPLX(v1re,v1im) * stars%ufft + iPhonon * killcont(2) * vre * starsq%ufft1!-q
58 0 : v1re = REAL(v1full)
59 0 : v1im = AIMAG(v1full)
60 0 : CALL fft3d(v1re, v1im, vTot1%pw_w(:, js), starsq, -1)
61 : END DO
62 : ELSE IF(noco%l_noco) THEN
63 0 : CALL get_int_global_perturbation(stars,atoms,sym,input,denRot,den1Rot,den1imRot,vTot,vTot1,starsq)
64 0 : IF (any(noco%l_unrestrictMT)) CALL get_mt_global_perturbation(atoms,sphhar,sym,denRot,den1Rot,den1imRot,noco,vTot,vTot1,vTot1imag)
65 : END IF
66 :
67 0 : END SUBROUTINE dfpt_vgen_finalize
68 :
69 : END MODULE m_dfpt_vgen_finalize
|