Line data Source code
1 : module m_ex_to_vx
2 : USE m_judft
3 : USE m_types
4 : USE m_symmetrizeh
5 :
6 : contains
7 24 : subroutine ex_to_vx(fi, nk, jsp, nsymop, psym, hybdat, lapw, z, ex, v_x)
8 : use m_juDFT
9 : use m_eig66_io
10 : implicit none
11 :
12 : type(t_fleurinput), intent(in) :: fi
13 :
14 : TYPE(t_hybdat), INTENT(inout) :: hybdat
15 : type(t_lapw), intent(in) :: lapw
16 : integer, intent(in) :: nk, jsp, nsymop, psym(fi%sym%nsym)
17 : TYPE(t_mat), intent(in) :: z
18 : type(t_mat), intent(inout) :: ex
19 : type(t_mat), intent(inout) :: v_x
20 :
21 : integer :: nbasfcn, ierr, tempI, tempJ
22 24 : type(t_mat) :: trafo, tmp, olap
23 :
24 24 : CALL timestart("T^-1*mat_ex*T^-1*")
25 : nbasfcn = lapw%hyb_num_bas_fun(fi)
26 :
27 : !calculate trafo from wavefunctions to APW basis
28 24 : IF (fi%input%neig < hybdat%nbands(nk,jsp)) call judft_error(' mhsfock: neigd < nbands(nk) ;trafo from wavefunctions to APW requires at least nbands(nk)')
29 :
30 24 : call ex%u2l()
31 :
32 24 : call olap%init(z%l_real, z%matsize1, z%matsize1)
33 24 : CALL read_eig(hybdat%eig_id,nk,jsp, smat=olap)
34 : #ifdef CPP_MPI
35 24 : call MPI_Barrier(MPI_COMM_WORLD, ierr)
36 24 : hybdat%max_q = hybdat%max_q - 1
37 : #endif
38 24 : call olap%u2l()
39 24 : call olap%conjugate()
40 :
41 24 : call trafo%init(z%l_real, olap%matsize1, z%matsize2)
42 24 : call tmp%init(z%l_real, ex%matsize1, trafo%matsize1)
43 24 : call v_x%init(z%l_real, trafo%matsize1, tmp%matsize2)
44 :
45 : !$acc data copyin(olap, olap%data_r, olap%data_c, z, z%data_r, z%data_c, ex, ex%data_r, ex%data_c, trafo, tmp, v_x) &
46 : !$acc create(trafo%data_r, trafo%data_c, tmp%data_r, tmp%data_c)&
47 : !$acc copyout(v_x%data_r, v_x%data_c)
48 24 : call olap%multiply(z, res=trafo)
49 24 : CALL ex%multiply(trafo, res=tmp, transB="C")
50 24 : CALL trafo%multiply(tmp, res=v_x)
51 : !$acc end data
52 :
53 24 : CALL timestop("T^-1*mat_ex*T^-1*")
54 :
55 24 : call timestart("symmetrizeh")
56 24 : CALL symmetrizeh(fi%atoms, fi%kpts%bkf(:, nk), jsp, lapw, fi%sym, fi%cell, nsymop, psym, v_x)
57 24 : call timestop("symmetrizeh")
58 24 : end subroutine ex_to_vx
59 : end module
|