-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
3,871 additions
and
6,690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
program main!wannier | ||
call wanplot() | ||
use m_wanplot,only:wanplot | ||
call wanplot() | ||
end program main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,142 +0,0 @@ | ||
!> mpi utility for wannier part R. Sakuma 2007 | ||
module rsmpi | ||
implicit none | ||
include "mpif.h" | ||
! S: FILES | ||
! S: | ||
! S: nrsin: contains additional parameters | ||
! S: nrphistar: contains wavefunctions | ||
! integer,parameter:: nrsin=1001,nrsj2gsmall=1002 | ||
|
||
! MPI parameters | ||
integer :: myrank_rsmpi ! rank of the calling process | ||
integer :: nproc_rsmpi ! number of processes | ||
integer :: io_root_rsmpi | ||
parameter (io_root_rsmpi = 0) | ||
integer :: ierror_rsmpi | ||
|
||
! ID of the current process (ex. 0000012, 0123456) | ||
! used mainly for output filename (ex. VCCFP.RSMPI0000012 ) | ||
! if # of processes >= 10^8, increase the size of the array | ||
character(7) :: myrank_id_rsmpi ! | ||
integer :: ifile_rsmpi ! file id | ||
! used for collective I/O | ||
integer :: bufsize_rsmpi | ||
parameter (bufsize_rsmpi=1024) | ||
character*(bufsize_rsmpi) :: buf_rsmpi | ||
|
||
! measure elapsed time | ||
double precision :: t1,t2 | ||
contains | ||
!------------------------------------------------------ | ||
subroutine RSMPI_Init() | ||
implicit none | ||
! call MPI_INIT(ierror_rsmpi) | ||
t1 = MPI_WTIME() | ||
call MPI_COMM_SIZE(MPI_COMM_WORLD,nproc_rsmpi,ierror_rsmpi) | ||
call MPI_COMM_RANK(MPI_COMM_WORLD,myrank_rsmpi,ierror_rsmpi) | ||
if (Is_IO_Root_RSMPI()) then | ||
write(6,*) "RS: --- RSMPI_Init ---" | ||
write(6,*) "RS: Number of processes : ",nproc_rsmpi | ||
end if | ||
call RSMPI_Set_ID() | ||
write(buf_rsmpi,*) "RS: RANKID = ",myrank_id_rsmpi | ||
call RSMPI_Write(6) | ||
if (Is_IO_Root_RSMPI()) then | ||
write(6,*) "RS: --- end of RSMPI_Init ---" | ||
end if | ||
end subroutine RSMPI_Init | ||
!-------------------------------------------------------- | ||
subroutine RSMPI_Set_ID | ||
implicit none | ||
if (myrank_rsmpi/1000000 >= 10) then | ||
! RS: I don't expect this will happen.. | ||
call RSMPI_Stop("RSMPI_Set_ID: # of processes exceeds 10^6: Modify RSMPI_mod.F!") | ||
endif | ||
write(myrank_id_rsmpi,'(i7.7)') myrank_rsmpi | ||
end subroutine RSMPI_Set_ID | ||
!-------------------------------------------------------- | ||
! subroutine RSMPI_Check(func,ierror_in) | ||
! implicit none | ||
! character*(*) :: func | ||
! integer,intent(in) :: ierror_in | ||
! integer :: ireturn | ||
! if ((ierror_in /= MPI_SUCCESS)) then | ||
! ! if (Is_IO_Root_RSMPI()) then | ||
! write(6,*) "RS: MPI ERROR :", func," PROCID = ",myrank_id_rsmpi," ierror =",ierror_in,".Aborted." | ||
! ireturn = 99 | ||
! call MPI_ABORT(MPI_COMM_WORLD,ireturn,ierror_rsmpi) | ||
! endif | ||
! end subroutine RSMPI_Check | ||
!-------------------------------------------------------- | ||
|
||
subroutine RSMPI_Stop(msg) | ||
implicit none | ||
character*(*) :: msg | ||
! if (Is_IO_Root_RSMPI()) then | ||
write(6,*) "RS: Error: ",msg, " Aborted." | ||
! endif | ||
call MPI_ABORT(MPI_COMM_WORLD,99,ierror_rsmpi) | ||
end subroutine RSMPI_Stop | ||
!-------------------------------------------------------- | ||
subroutine RSMPI_Print_WTime() | ||
implicit none | ||
t2 = MPI_WTIME() | ||
if (Is_IO_Root_RSMPI()) then | ||
write(6,*) "RS: Elapsed time: ",t2-t1,"sec" | ||
write(6,*) "RS: Precision : ",MPI_WTICK() | ||
endif | ||
end subroutine RSMPI_Print_WTime | ||
!-------------------------------------------------------- | ||
subroutine RSMPI_Finalize() | ||
implicit none | ||
call MPI_Barrier(MPI_COMM_WORLD,ierror_rsmpi) | ||
! call RSMPI_Check("MPI_Barrier",ierror_rsmpi) | ||
|
||
call RSMPI_Print_WTime() | ||
|
||
call MPI_FINALIZE(ierror_rsmpi) | ||
if (ierror_rsmpi /= MPI_SUCCESS) then | ||
write(6,*) "RS: MPI ERROR in RSMPI_Finalize(), ierror =", & | ||
ierror_rsmpi, "PROCID = ",myrank_id_rsmpi | ||
endif | ||
end subroutine RSMPI_Finalize | ||
!-------------------------------------------------------- | ||
logical function Is_IO_Root_RSMPI() | ||
implicit none | ||
Is_IO_Root_RSMPI = (myrank_rsmpi .eq. io_root_rsmpi) | ||
end function Is_IO_Root_RSMPI | ||
!-------------------------------------------------------- | ||
! Gather information and Write | ||
|
||
subroutine RSMPI_Write(if_in) | ||
implicit none | ||
integer,intent(in) :: if_in | ||
! function | ||
integer :: get_non_blank_rsmpi | ||
! local | ||
integer :: ip !process | ||
integer :: tag | ||
integer :: status(MPI_STATUS_SIZE) ! MPI_Status | ||
integer :: isize | ||
tag = 0 | ||
|
||
if ( .NOT. Is_IO_Root_RSMPI()) then | ||
call MPI_Send(buf_rsmpi,bufsize_rsmpi,MPI_CHARACTER, & | ||
io_root_rsmpi,tag,MPI_COMM_WORLD,ierror_rsmpi) | ||
! call RSMPI_Check("RSMPI_Write",ierror_rsmpi) | ||
else | ||
do ip=0,nproc_rsmpi-1 | ||
if (ip /= myrank_rsmpi) then | ||
call MPI_Recv(buf_rsmpi,bufsize_rsmpi,MPI_CHARACTER, & | ||
ip,tag,MPI_COMM_WORLD,status,ierror_rsmpi) | ||
! call RSMPI_Check("RSMPI_Write",ierror_rsmpi) | ||
endif | ||
isize = get_non_blank_rsmpi(bufsize_rsmpi,buf_rsmpi) | ||
if (isize /= 0) write(if_in,*) buf_rsmpi(1:isize) | ||
enddo | ||
endif | ||
|
||
end subroutine RSMPI_Write | ||
!-------------------------------------------------------- | ||
end module RSMPI | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +0,0 @@ | ||
module rsmpi_qkgroup | ||
use rsmpi,only:mpi_comm_world,myrank_rsmpi,nproc_rsmpi | ||
implicit none | ||
public rsmpi_qkgroup_init | ||
integer,public :: nk_local_qkgroup ! number of k-points treated in the process | ||
integer,allocatable,public :: ik_index_qkgroup(:) | ||
|
||
private | ||
integer :: nqkgroup ! number of subgroups | ||
! it is equivalent to the number of q-points calculated at the same time | ||
! integer :: iqkgroup ! the subgroup the current process belongs | ||
integer :: nproc_qkgroup ! number of processes in the subgroup | ||
integer :: myrank_qkgroup ! rank of the calling process in the subgroup | ||
! logical :: file_io_qkgroup ! The processes with this value .true. | ||
integer :: nq_local_qkgroup ! number of q-points treated in the subgroup | ||
integer,allocatable :: iq_index_qkgroup(:) ! index | ||
integer :: ierror_qkgroup ! error check | ||
integer :: comm_qkgroup ! new communicator | ||
character(7) :: qkgroup_id ! | ||
integer :: ifile_qkgroup ! file id | ||
contains | ||
subroutine RSMPI_qkgroup_Init(Nq,Nk) | ||
implicit none | ||
integer,intent(in) :: Nq,Nk | ||
integer:: iqkgroup | ||
nqkgroup = merge(nq,nproc_rsmpi,Nq <= nproc_rsmpi) | ||
iqkgroup = get_my_qkgroup(myrank_rsmpi,nproc_rsmpi) | ||
call MPI_COMM_SPLIT(MPI_COMM_WORLD,iqkgroup, myrank_rsmpi,comm_qkgroup,ierror_qkgroup) | ||
call MPI_COMM_SIZE(comm_qkgroup,nproc_qkgroup,ierror_qkgroup) | ||
call MPI_COMM_RANK(comm_qkgroup,myrank_qkgroup,ierror_qkgroup) | ||
! call set_q_local_qkgroup(Nq) | ||
call set_k_local_qkgroup(Nk) | ||
end subroutine RSMPI_qkgroup_Init | ||
subroutine set_k_local_qkgroup(Nk) | ||
implicit none | ||
integer,intent(in) :: Nk ! total number of k-points in full BZ | ||
integer,allocatable :: nk_local_all(:),ik_index_all(:,:) | ||
allocate(nk_local_all(nproc_qkgroup), ik_index_all(nproc_qkgroup,Nk/nproc_qkgroup+1)) | ||
call set_index_rsmpi(Nk,nproc_qkgroup,nk_local_all,ik_index_all) | ||
nk_local_qkgroup = nk_local_all(myrank_qkgroup+1) ! rank is 0,1,..,N-1 | ||
allocate(ik_index_qkgroup(nk_local_qkgroup)) | ||
ik_index_qkgroup(1:nk_local_qkgroup) = ik_index_all(myrank_qkgroup+1,1:nk_local_qkgroup) | ||
deallocate(nk_local_all,ik_index_all) | ||
end subroutine set_k_local_qkgroup | ||
integer function get_my_qkgroup(myrank_world,nproc_world) | ||
implicit none | ||
integer,intent(in) :: myrank_world,nproc_world | ||
integer :: iqkg,red,iproc_local,iproc_world | ||
iproc_world=0 | ||
do iqkg=1,nqkgroup | ||
if (iqkg <= mod(nproc_world,nqkgroup)) then | ||
red = 1 | ||
else | ||
red = 0 | ||
endif | ||
do iproc_local=1,nproc_world/nqkgroup+red | ||
if (myrank_world == iproc_world) then | ||
get_my_qkgroup = iqkg | ||
return | ||
endif | ||
iproc_world = iproc_world + 1 | ||
enddo | ||
enddo | ||
end function get_my_qkgroup | ||
! subroutine set_q_local_qkgroup(Nq) | ||
! implicit none | ||
! integer,intent(in) :: Nq ! total number of q-points in irr.BZ | ||
! integer,allocatable :: nq_local_all(:),iq_index_all(:,:) | ||
! allocate(nq_local_all(nqkgroup), iq_index_all(nqkgroup,Nq/nqkgroup+1)) | ||
! call set_index_rsmpi(Nq,nqkgroup,nq_local_all,iq_index_all) | ||
! nq_local_qkgroup = nq_local_all(iqkgroup) | ||
! allocate(iq_index_qkgroup(nq_local_qkgroup)) | ||
! iq_index_qkgroup(1:nq_local_qkgroup) = iq_index_all(iqkgroup,1:nq_local_qkgroup) | ||
! deallocate(nq_local_all,iq_index_all) | ||
! end subroutine set_q_local_qkgroup | ||
end module RSMPI_qkgroup | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,115 +0,0 @@ | ||
! MPI version of FPLMTO-GW code | ||
! R. Sakuma 2007 | ||
|
||
! In program hsfp0, k-points in FULL B.Z. are generated by | ||
! performing symmetry operations(rotations) | ||
! to k'-points which lie in irreducible B.Z. | ||
|
||
|
||
! For each k-point (in F.B.Z.) this module calculates the correct indexes | ||
! of correspoinding irot(rotation index) and k'-point (in ir.B.Z.), | ||
! which is used for k-point parallelization in program hsfp0 | ||
! with "module RSMPI_qkgroup" | ||
! without modifying gwsrc/RSMPI_qkgroup_mod.F. | ||
|
||
|
||
module rsmpi_rotkindex | ||
use rsmpi | ||
use rsmpi_qkgroup,only: RSMPI_qkgroup_Init,nk_local_qkgroup,ik_index_qkgroup | ||
implicit none | ||
|
||
! number of rotation operators for the current process | ||
integer :: nrot_local_rotk | ||
integer,allocatable :: irot_index_rotk(:) ! irot index | ||
|
||
|
||
! number of k-points (in irr. BZ) for the current process | ||
! used in gwsrc/sxcf_fal2_RSMPI.F | ||
integer,allocatable :: nk_local_rotk(:) ! nk_local_rotk(ngrp) | ||
integer,allocatable :: ik_index_rotk(:,:) | ||
|
||
contains | ||
|
||
subroutine setup_rotkindex(ngrp,irk,wgt0, bzcase_in,nqibz,nq0i,nq_calc) | ||
implicit none | ||
integer,intent(in) :: ngrp,bzcase_in,nqibz,nq0i,nq_calc | ||
integer,intent(in) :: irk(nqibz,ngrp) | ||
real(8),intent(in) :: wgt0(nq0i,ngrp) | ||
! local | ||
integer :: iqini,iqend | ||
integer :: nrotk_total | ||
integer :: kr | ||
integer,allocatable :: nrotktmp(:,:) | ||
! counter | ||
integer :: i,j,irot,kx | ||
iqini=1 | ||
iqend = nqibz + nq0i | ||
allocate(nrotktmp(ngrp*(iqend-iqini+1),2)) | ||
nrotk_total = 0 | ||
do irot=1,ngrp ! from main/hsfp0.m.F | ||
if( sum(abs( irk(:,irot) )) ==0 .AND. & | ||
sum(abs( wgt0(:,irot))) == 0d0 ) then | ||
cycle | ||
endif | ||
do kx=iqini,iqend | ||
if( kx <= nqibz ) then | ||
kr = irk(kx,irot) | ||
if (kr == 0) then | ||
cycle | ||
endif | ||
else | ||
if( wgt0(kx-nqibz,irot) == 0d0 ) then | ||
cycle | ||
endif | ||
endif | ||
nrotk_total = nrotk_total + 1 | ||
nrotktmp(nrotk_total,1)=irot | ||
nrotktmp(nrotk_total,2)=kx | ||
enddo ! do kx | ||
enddo ! do irot | ||
! calculate correct indexes of q- and k-point parallelization ! for each process ! (nq_local,iq_index, nk_local, ik_index) | ||
call RSMPI_qkgroup_Init(nq_calc,nrotk_total) ! For each ik_index(calculated above) ! correspoinding irot and ik'-index is set | ||
call set_nrot_nk_local(nrotk_total, nrotktmp(1:nrotk_total,1:2),ngrp,iqend-iqini+1) | ||
end subroutine setup_rotkindex | ||
|
||
subroutine set_nrot_nk_local(nrotk_total,nrotktmp,ngrp,nk) | ||
implicit none | ||
integer,intent(in) :: nrotk_total | ||
integer,intent(in) :: nrotktmp(nrotk_total,2) | ||
integer,intent(in) :: ngrp,nk | ||
integer,allocatable :: irot_index_tmp(:) | ||
integer :: irotk,irot_tmp,ir | ||
logical :: newrot ! nk_local_qkgroup is defined in module RSMPI_qkgroup | ||
if (nk_local_qkgroup > 0) then | ||
allocate(irot_index_tmp(nk_local_qkgroup)) | ||
endif | ||
allocate(nk_local_rotk(ngrp)) | ||
allocate(ik_index_rotk(ngrp,nk)) ! set nrot_local_rotk and nk_local_rotk(1:ngrp),ik_index_rotk(1:ngrp,1:nk) | ||
nrot_local_rotk = 0 | ||
if (nk_local_qkgroup > 0) irot_index_tmp(:) = 0 | ||
nk_local_rotk(:) = 0 | ||
ik_index_rotk(:,:) = 0 | ||
do irotk=1,nk_local_qkgroup | ||
irot_tmp = nrotktmp(ik_index_qkgroup(irotk),1) | ||
nk_local_rotk(irot_tmp) = nk_local_rotk(irot_tmp) + 1 | ||
ik_index_rotk(irot_tmp,nk_local_rotk(irot_tmp)) = nrotktmp(ik_index_qkgroup(irotk),2) | ||
newrot = .true. | ||
do ir=1,nrot_local_rotk | ||
if (nrotktmp(ik_index_qkgroup(irotk),1) == irot_index_tmp(ir)) then | ||
newrot = .false. | ||
endif | ||
enddo | ||
if (newrot) then | ||
nrot_local_rotk = nrot_local_rotk + 1 | ||
irot_index_tmp(nrot_local_rotk) = nrotktmp(ik_index_qkgroup(irotk),1) | ||
endif | ||
enddo ! set irot_index_rotk(1:nrot_local) ! and ik_index_rotk(1:ngrp,1:nk_local) | ||
if (nrot_local_rotk > 0) then | ||
allocate(irot_index_rotk(nrot_local_rotk)) | ||
irot_index_rotk(1:nrot_local_rotk) = irot_index_tmp(1:nrot_local_rotk) | ||
endif | ||
if (nk_local_qkgroup > 0) deallocate(irot_index_tmp) | ||
write(buf_rsmpi,*) "RS: ", myrank_id_rsmpi, " nrot_local = ",nrot_local_rotk | ||
call RSMPI_Write(6) | ||
end subroutine set_nrot_nk_local | ||
end module RSMPI_rotkindex | ||
Oops, something went wrong.