[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
...
if (mod(istep,ngio)==0) then
    do ikpt=1,nkpt_per_proc
        kpt=proc_kpt_list(ikpt)
        filename = TRIM(dir) //'.save/'// label //TRIM(int_to_char(ikpt))//'_'//TRIM(int_to_char(starting_skip_step+istep))//'.dat'
        if (proc_id==0) write(6,*) 'extracted istep of MD from wfc file is ', istep_t, 'read filename is ', filename
        call MPI_BARRIER(MPI_COMM_WORLD,ierr)
        call read_wfcn(filename,wf)
        call MPI_BARRIER(MPI_COMM_WORLD,ierr)
        npol=wf%npol_
        nbnd=wf%nbnd_
        ng(kpt)=wf%igwx_
        if (proc_id==0) write(600+kpt+color,*) 'kpt is', kpt
        do ig=1,ng(kpt)
                gkk_vec(:,ig,kpt)=matmul(transpose(RL),wf%g(:,ig)) !unit: 1/Bohr
                if (proc_id==0) write(600+kpt+color,'(I,3F12.8)') ig, gkk_vec(:,ig,kpt)
        end do
        ug_tot=zero_cmp
        call MPI_BARRIER(MPI_COMM_WORLD,ierr)
        do istate=1,nstate_tot
                iistate=st1+istate-1
                do ig=1,ng(kpt)
                        ug_tot(ig,1,istate)=wf%bands(ig,1,iistate) !ug_tot(1:ngrid/2,:): up, ug_tot(ngrid/2+1:,:): dw
                end do  
                if (npol==2) then
                       do ig=1,ng(kpt)
                               ug_tot(ig,2,istate)=wf%bands(ig,2,iistate) !ug_tot(1:ngrid/2,:): up, ug_tot(ngrid/2+1:,:): dw
                       end do  
                end if
        end do
        if (proc_id==0) write(6,*) 'start to do FFT'
        call MPI_BARRIER(MPI_COMM_WORLD,ierr)
        if (color==0) then
            ug_r=zero_cmp
                write(900+kpt+color,*) 'kpt is', kpt
                do ig=1,ng(kpt)
                        write(900+kpt+color,'(I,3F12.8)') ig, gkk_vec(:,ig,kpt)
                end do
            call fft_states(n1, n2, n3, nstate, ng(kpt), ngrid, AL, gkk_vec(:,:,kpt), ug_tot(:,:,:nstate_h), ug_r,color,vol, kpt, npol) !up
            ug_r_up(:,:,:,:,kpt)=ug_r!(:,:,:,:)
            !call fft_states(n1, n2, n3, nstate, ng(kpt), ngrid, AL, gkk_vec(:,:,kpt), ug_tot(:,2,:nstate_h), ug_r_dw(:,:,:,:,kpt),color) !dw
        else if (color==1) then
            ug_r=zero_cmp
                write(1000+kpt+color,*) 'kpt is', kpt
                do ig=1,ng(kpt)
                        write(1000+kpt+color,'(I,3F12.8)')ig, gkk_vec(:,ig,kpt)
                end do
            call fft_states(n1, n2, n3, nstate, ng(kpt), ngrid, AL, gkk_vec(:,:,kpt), ug_tot(:,:,nstate_h+1:), ug_r,color,vol,kpt, npol) !up
            ug_r_up(:,:,:,:,kpt)=ug_r!(:,:,:,:)
            !call fft_states(n1, n2, n3, nstate, ng(kpt), ngrid, AL, gkk_vec(:,:,kpt), ug_tot(:,2,nstate_h+1:), ug_r_dw(:,:,:,:,kpt),color) !dw
        end if
...