!respect to vectorial (serial) program I changed ngwx to ngw :-) ! this subroutine prepare the correspondence array to ! compute the operator exp(iG_ipol.r) subroutine gtable( ipol, ctable) ! ctable : output coorespondence table ! in (ig,1) correspondence for g+1 ! in (ig,2) correspondence for (-g)+1 ! we use the rule: if non point ngw+1 ! if found positive = normal ! negative = conjugate ! ipol : input polarization direction ! a orthorombic primitive cell is supposed use gvec use elct implicit none integer ctable(ngw,2), ipol !local variables integer i,j,k, ig, jg logical found real(kind=8) test test=0. do ig=1,ngw!loop on g vectors ! first +g i=in1p(ig) j=in2p(ig) k=in3p(ig) if(ipol.eq.1) i=i+1 if(ipol.eq.2) j=j+1 if(ipol.eq.3) k=k+1 found = .false. !#ifdef NEC ! *vdir nodep(ctable) !#endif do jg=1,ngw if(in1p(jg).eq.i .and. in2p(jg).eq.j .and. in3p(jg).eq.k) then found=.true. ctable(ig,1)=jg ! jg=ngw endif enddo if(.not. found) then !#ifdef NEC ! *vdir nodep !#endif do jg=1,ngw if(-in1p(jg).eq.i .and. -in2p(jg).eq.j .and. -in3p(jg).eq.k) then found=.true. ctable(ig,1)=-jg ! jg=ngw endif enddo if(.not. found) then ctable(ig,1)= ngw+1 test=test+1. endif endif ! now -g i=-in1p(ig) j=-in2p(ig) k=-in3p(ig) if(ipol.eq.1) i=i+1 if(ipol.eq.2) j=j+1 if(ipol.eq.3) k=k+1 found = .false. !#ifdef NEC ! *vdir nodep !#endif do jg=1,ngw if (-in1p(jg).eq.i .and. -in2p(jg).eq.j .and. -in3p(jg).eq.k)then found=.true. ctable(ig,2)=-jg ! jg=ngw endif enddo if(.not.found) then !#ifdef NEC ! *vdir nodep !#endif do jg=1,ngw if(in1p(jg).eq.i .and. in2p(jg).eq.j .and. in3p(jg).eq.k)then found=.true. ctable(ig,2)=jg ! jg=ngw endif enddo if(.not.found) then ctable(ig,2)=ngw+1 test=test+1. endif endif enddo !ATTENZIONE #ifdef PARA call reduce(1,test) #endif write(6,*) '#not found, gtable: ', test return end subroutine gtable ! this subroutine prepare the inverse correspondence array to ! compute the operator exp(iG_ipol.r) subroutine gtablein( ipol, ctabin) ! ctabin(ngw,2) : output coorespondence table ! if negative to take complex conjugate, 1 g'+1, 2 g' -1 ! if not found = ngw+1 ! ipol : input polarization direction ! a orthorombic primitive cell is supposed use gvec use elct implicit none integer ctabin(ngw,2), ipol !local variables integer i,j,k, ig, jg logical found real(kind=8) test test=0. do ig=1,ngw!loop on g vectors i=in1p(ig) j=in2p(ig) k=in3p(ig) if(ipol.eq.1) i=i+1 if(ipol.eq.2) j=j+1 if(ipol.eq.3) k=k+1 found = .false. !#ifdef NEC ! *vdir nodep !#endif do jg=1,ngw if(i.eq.in1p(jg).and. j.eq.in2p(jg) .and. k.eq.in3p(jg))then found = .true. ctabin(ig,1)=jg ! jg=ngw else if(i.eq.-in1p(jg).and. j.eq.-in2p(jg) .and. k.eq.-in3p(jg))then found=.true. ctabin(ig,1)=-jg ! jg=ngw endif enddo if(.not.found) then ctabin(ig,1)=ngw+1 test=test+1 endif enddo do ig=1,ngw!loop on g vectors i=in1p(ig) j=in2p(ig) k=in3p(ig) if(ipol.eq.1) i=i-1 if(ipol.eq.2) j=j-1 if(ipol.eq.3) k=k-1 found = .false. !#ifdef NEC ! *vdir nodep !#endif do jg=1,ngw if(i.eq.in1p(jg).and. j.eq.in2p(jg) .and. k.eq.in3p(jg))then found = .true. ctabin(ig,2)=jg ! jg=ngw else if(i.eq.-in1p(jg).and. j.eq.-in2p(jg) .and. k.eq.-in3p(jg))then found=.true. ctabin(ig,2)=-jg ! jg=ngw endif enddo if(.not.found) then ctabin(ig,2)=ngw+1 test=test+1 endif !ATTENZIONE enddo #ifdef PARA call reduce(1,test) #endif write(6,*) '#not found, gtabin: ', test return end subroutine gtablein