Commit ba313707 authored by ua741532's avatar ua741532

MPI+OpenMP parallelization of the vgen/vmtxcg.F90

parent fbcfc476
......@@ -288,6 +288,9 @@
input%total = .TRUE.
ENDIF!(obsolete%pot8)
ENDIF !mpi%irank.eq.0
#ifdef CPP_MPI
CALL MPI_BCAST(input%total,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
#endif
!--- J<
IF(jij%l_jenerg) GOTO 234
......
......@@ -105,6 +105,10 @@ CONTAINS
!.....energy density
REAL, ALLOCATABLE :: excz(:,:),excr(:,:,:)
#ifdef CPP_MPI
include 'mpif.h'
integer:: ierr
#endif
!
! if you want to calculate potential gradients
!
......@@ -395,7 +399,6 @@ CONTAINS
ENDIF
END IF
!ENDIF !irank==0
!
!==========END TOTAL===================================================
!
......@@ -431,6 +434,7 @@ CONTAINS
11, iter,vr,vpw,vz,vxy)
CLOSE(11)
END IF
ENDIF !irank==0
! ******** exchange correlation potential******************
!+ta
......@@ -448,6 +452,7 @@ CONTAINS
excr(:,:,:) = 0.0
! ---> vacuum region
IF (mpi%irank == 0) THEN
IF (input%film) THEN
CALL timestart("Vxc in vacuum")
......@@ -574,15 +579,24 @@ CONTAINS
WRITE (6,FMT=8040) (vbar(js),js=1,input%jspins)
WRITE (16,FMT=8040) (vbar(js),js=1,input%jspins)
8040 FORMAT (/,5x,'interstitial potential average (vbar) =',2f10.6)
ENDIF !irank==0
!
! ------------------------------------------
! ----> muffin tin spheres region
CALL timestart ("Vxc in MT")
#ifdef CPP_MPI
CALL MPI_BCAST(atoms%vr0,atoms%ntype,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
CALL MPI_BCAST(input%efield%vslope,1,MPI_DOUBLE_COMPLEX,0,mpi%mpi_comm,ierr)
CALL MPI_BCAST(rho,atoms%jmtd*(1+sphhar%nlhd)*atoms%ntype*dimension%jspd,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
CALL MPI_BCAST(vr,atoms%jmtd*(1+sphhar%nlhd)*atoms%ntype*dimension%jspd,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
CALL MPI_BCAST(rhmn,1,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
CALL MPI_BCAST(ichsmrg,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
#endif
IF ((xcpot%igrd.EQ.0).AND.(xcpot%icorr.NE.-1)) THEN
CALL vmtxc(dimension,sphhar,atoms, rho,xcpot,input,sym, vr, excr,vxr)
ELSEIF ((xcpot%igrd.GT.0).OR.(xcpot%icorr.EQ.-1)) THEN
CALL vmtxcg(dimension,sphhar,atoms, rho,xcpot,input,sym,&
CALL vmtxcg(dimension,mpi,sphhar,atoms, rho,xcpot,input,sym,&
obsolete, vxr,vr,rhmn,ichsmrg, excr)
ELSE
CALL juDFT_error("something wrong with xcpot before vmtxc" ,calledby ="vgen")
......@@ -593,6 +607,7 @@ CONTAINS
! add MT EXX potential to vr
!
IF (mpi%irank == 0) THEN
INQUIRE(file='vr_exx',exist=exi)
IF( exi ) THEN
ALLOCATE( vr_exx(atoms%jmtd,0:sphhar%nlhd,atoms%ntype,dimension%jspd) )
......
......@@ -40,7 +40,7 @@ CONTAINS
INTEGER n
REAL rdum
! .. Local Arrays ..
INTEGER i(36),ierr(3)
INTEGER i(37),ierr(3)
REAL r(29)
LOGICAL l(43)
! ..
......@@ -52,10 +52,10 @@ CONTAINS
i(7)=stars%ng2 ; i(8)=stars%ng3 ; i(9)=vacuum%nmz ; i(10)=vacuum%nmzxy ; i(11)=obsolete%lepr
i(12)=input%jspins ; i(13)=vacuum%nvac ; i(14)=input%itmax ; i(15)=sliceplot%kk ; i(16)=vacuum%layers
i(17)=sliceplot%nnne ; i(18)=banddos%ndir ; i(19)=stars%mx1 ; i(20)=stars%mx2 ; i(21)=stars%mx3
i(22)=atoms%n_u ; i(23) = sym%nop2 ; i(24) = sym%nsymt ; i(25) = xcpot%icorr
i(26)=vacuum%nstars ; i(27)=vacuum%nstm ; i(28)=oneD%odd%nq2 ; i(29)=oneD%odd%nop
i(30)=input%gw ; i(31)=input%gw_neigd ; i(32)=hybrid%ewaldlambda ; i(33)=hybrid%lexp
i(34)=hybrid%bands1 ; i(35)=hybrid%bands2 ; i(36)=input%imix
i(22)=atoms%n_u ; i(23) = sym%nop2 ; i(24) = sym%nsymt ; i(25) = xcpot%icorr ; i(26) = xcpot%igrd
i(27)=vacuum%nstars ; i(28)=vacuum%nstm ; i(29)=oneD%odd%nq2 ; i(30)=oneD%odd%nop
i(31)=input%gw ; i(32)=input%gw_neigd ; i(33)=hybrid%ewaldlambda ; i(34)=hybrid%lexp
i(35)=hybrid%bands1 ; i(36)=hybrid%bands2 ; i(37)=input%imix
r(1)=cell%omtil ; r(2)=cell%area ; r(3)=vacuum%delz ; r(4)=cell%z1 ; r(5)=input%alpha
r(6)=sliceplot%e1s ; r(7)=sliceplot%e2s ; r(8)=noco%theta ; r(9)=noco%phi ; r(10)=vacuum%tworkf
r(11)=vacuum%locx(1) ; r(12)=vacuum%locx(2); r(13)=vacuum%locy(1) ; r(14)=vacuum%locy(2)
......@@ -77,10 +77,10 @@ CONTAINS
ENDIF
!
CALL MPI_BCAST(i,SIZE(i),MPI_INTEGER,0,mpi%mpi_comm,ierr)
hybrid%bands1=i(34) ; hybrid%bands2=i(35) ; input%imix=i(36)
input%gw=i(30) ; input%gw_neigd=i(31) ; hybrid%ewaldlambda=i(32) ; hybrid%lexp=i(33)
vacuum%nstars=i(26) ; vacuum%nstm=i(27) ; oneD%odd%nq2=i(28) ; oneD%odd%nop=i(29)
atoms%n_u=i(22) ; sym%nop2=i(23) ; sym%nsymt = i(24) ; xcpot%icorr=i(25)
hybrid%bands1=i(35) ; hybrid%bands2=i(36) ; input%imix=i(37)
input%gw=i(31) ; input%gw_neigd=i(32) ; hybrid%ewaldlambda=i(33) ; hybrid%lexp=i(34)
vacuum%nstars=i(27) ; vacuum%nstm=i(28) ; oneD%odd%nq2=i(29) ; oneD%odd%nop=i(30)
atoms%n_u=i(22) ; sym%nop2=i(23) ; sym%nsymt = i(24) ; xcpot%icorr=i(25) ; xcpot%igrd=i(26)
sliceplot%nnne=i(17) ; banddos%ndir=i(18) ; stars%mx1=i(19) ; stars%mx2=i(20) ; stars%mx3=i(21)
input%jspins=i(12) ; vacuum%nvac=i(13) ; input%itmax=i(14) ; sliceplot%kk=i(15) ; vacuum%layers=i(16)
stars%ng2=i(7) ; stars%ng3=i(8) ; vacuum%nmz=i(9) ; vacuum%nmzxy=i(10) ; obsolete%lepr=i(11)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment