Commit d55d9e8f authored by Marco Govoni's avatar Marco Govoni
Browse files

Proposed changes II. Untested.

parent 01b546ae
...@@ -113,7 +113,8 @@ MODULE wstat_center ...@@ -113,7 +113,8 @@ MODULE wstat_center
LOGICAL :: l_kinetic_only LOGICAL :: l_kinetic_only
LOGICAL :: l_minimize_exx_if_active LOGICAL :: l_minimize_exx_if_active
LOGICAL :: l_use_ecutrho LOGICAL :: l_use_ecutrho
INTEGER :: nq(3) !INTEGER :: nq(3)
INTEGER, ALLOCATABLE :: qlist(:)
! !
! Common workspace ! Common workspace
! !
......
...@@ -23,7 +23,7 @@ MODULE class_bz_grid ...@@ -23,7 +23,7 @@ MODULE class_bz_grid
TYPE, PUBLIC :: bz_grid TYPE, PUBLIC :: bz_grid
! !
INTEGER :: ngrid(3) = (/ 1, 1, 1 /) ! number of points in each direction INTEGER :: ngrid(3) = (/ 1, 1, 1 /) ! number of points in each direction
INTEGER :: np = 1 ! total number of points = ngrid(1) * ngrid(2) * ngrid(3) INTEGER :: np = 1 ! total number of points = ngrid(1) * ngrid(2) * ngrid(3) **** NOOOOOO ******
INTEGER :: ns = 1 ! total number of spin = nspin INTEGER :: ns = 1 ! total number of spin = nspin
INTEGER :: nps = 1 ! total number of points and spins = np * ns INTEGER :: nps = 1 ! total number of points and spins = np * ns
INTEGER,ALLOCATABLE :: ip(:) ! given ips --> ip INTEGER,ALLOCATABLE :: ip(:) ! given ips --> ip
...@@ -53,8 +53,9 @@ MODULE class_bz_grid ...@@ -53,8 +53,9 @@ MODULE class_bz_grid
USE start_k, ONLY : nk1, nk2, nk3 USE start_k, ONLY : nk1, nk2, nk3
USE pwcom, ONLY : nspin USE pwcom, ONLY : nspin
USE control_flags, ONLY : gamma_only USE control_flags, ONLY : gamma_only
USE westcom, ONLY : nq !USE westcom, ONLY : nq
USE constants, ONLY : eps8 USE constants, ONLY : eps8
USE westcom, ONLY : qlist
! !
IMPLICIT NONE IMPLICIT NONE
! !
...@@ -67,6 +68,7 @@ MODULE class_bz_grid ...@@ -67,6 +68,7 @@ MODULE class_bz_grid
! !
INTEGER :: ip, iq1, iq2, iq3, ips INTEGER :: ip, iq1, iq2, iq3, ips
INTEGER :: i, j, k INTEGER :: i, j, k
INTEGER :: iqlist
! !
SELECT CASE( grid_type ) SELECT CASE( grid_type )
CASE ( 'K', 'k') CASE ( 'K', 'k')
...@@ -99,22 +101,29 @@ MODULE class_bz_grid ...@@ -99,22 +101,29 @@ MODULE class_bz_grid
! !
CASE ( 'Q', 'q') CASE ( 'Q', 'q')
! !
this%ngrid(1:3) = nq(1:3) !this%ngrid(1:3) = nq(1:3)
this%np = this%ngrid(1) * this%ngrid(2) * this%ngrid(3) IF ( .NOT. gamma_only ) this%ngrid(1:3) = (/ nk1, nk2, nk3 /)
!this%ngrid(1:3) = nq(1:3)
!this%np = this%ngrid(1) * this%ngrid(2) * this%ngrid(3)
this%np = SIZE(qlist)
this%ns = 1 this%ns = 1
this%nps = this%np this%nps = this%np
! !
! generate p-vectors in cryst ! generate p-vectors in cryst
! !
ALLOCATE ( this%p_cryst (3,this%np) ) ALLOCATE ( this%p_cryst (3,this%np) )
iqlist = 0
ip = 0 ip = 0
DO iq1 = 1, nq(1) DO iq1 = 1, this%ngrid(1)
DO iq2 = 1, nq(2) DO iq2 = 1, this%ngrid(2)
DO iq3 = 1, nq(3) DO iq3 = 1, this%ngrid(3)
ip = ip + 1 ip = ip + 1
this%p_cryst(1,ip) = DBLE( iq1 - 1 ) / DBLE( this%ngrid(1) ) IF ( ANY(qlist(:)) == ip ) THEN
this%p_cryst(2,ip) = DBLE( iq2 - 1 ) / DBLE( this%ngrid(2) ) iqlist = iqlist + 1
this%p_cryst(3,ip) = DBLE( iq3 - 1 ) / DBLE( this%ngrid(3) ) this%p_cryst(1,iqlist) = DBLE( iq1 - 1 ) / DBLE( this%ngrid(1) )
this%p_cryst(2,iqlist) = DBLE( iq2 - 1 ) / DBLE( this%ngrid(2) )
this%p_cryst(3,iqlist) = DBLE( iq3 - 1 ) / DBLE( this%ngrid(3) )
ENDIF
ENDDO ENDDO
ENDDO ENDDO
ENDDO ENDDO
...@@ -123,11 +132,11 @@ MODULE class_bz_grid ...@@ -123,11 +132,11 @@ MODULE class_bz_grid
! !
ALLOCATE ( this%p_cart (3,this%np) ) ALLOCATE ( this%p_cart (3,this%np) )
this%p_cart(:,:) = this%p_cryst(:,:) this%p_cart(:,:) = this%p_cryst(:,:)
CALL cryst_to_cart( this%nps, this%p_cart, bg, +1 ) CALL cryst_to_cart( this%np, this%p_cart, bg, +1 )
! !
! set weights ! set weights
! !
ALLOCATE ( this%weight (this%nps) ) ALLOCATE ( this%weight (this%np) )
! !
this%weight = 1._DP / DBLE(this%np) this%weight = 1._DP / DBLE(this%np)
! !
......
...@@ -23,6 +23,8 @@ SUBROUTINE fetch_input( driver, verbose ) ...@@ -23,6 +23,8 @@ SUBROUTINE fetch_input( driver, verbose )
USE mp_global, ONLY : nimage USE mp_global, ONLY : nimage
USE io_push, ONLY : io_push_title,io_push_value,io_push_bar,io_push_es0,io_push_c512 USE io_push, ONLY : io_push_title,io_push_value,io_push_bar,io_push_es0,io_push_c512
USE gvect, ONLY : ecutrho USE gvect, ONLY : ecutrho
USE start_k, ONLY : nk1, nk2, nk3
USE control_flags, ONLY : gamma_only
! !
IMPLICIT NONE IMPLICIT NONE
! !
...@@ -81,7 +83,13 @@ SUBROUTINE fetch_input( driver, verbose ) ...@@ -81,7 +83,13 @@ SUBROUTINE fetch_input( driver, verbose )
l_kinetic_only = .FALSE. l_kinetic_only = .FALSE.
l_minimize_exx_if_active = .FALSE. l_minimize_exx_if_active = .FALSE.
l_use_ecutrho = .FALSE. l_use_ecutrho = .FALSE.
nq = (/ 1, 1, 1 /) IF( ALLOCATED(qlist) ) DEALLOCATE(qlist)
ALLOCATE( qlist(1) )
qlist(1) = 1
IF( .NOT. gamma_only ) THEN
ALLOCATE(qlist(nk1*nk2*nk3))
qlist = (/ (i, i=1,nk1*nk2*nk3,1) /)
ENDIF
ENDIF ENDIF
! !
! ** wfreq_control ** ! ** wfreq_control **
...@@ -166,8 +174,14 @@ SUBROUTINE fetch_input( driver, verbose ) ...@@ -166,8 +174,14 @@ SUBROUTINE fetch_input( driver, verbose )
IF( found ) l_minimize_exx_if_active = lval IF( found ) l_minimize_exx_if_active = lval
CALL json%get('wstat_control.l_use_ecutrho', lval, found) CALL json%get('wstat_control.l_use_ecutrho', lval, found)
IF( found ) l_use_ecutrho = lval IF( found ) l_use_ecutrho = lval
CALL json%get('wstat_control.nq', ivec, found) !CALL json%get('wstat_control.nq', ivec, found)
IF( found ) nq(1:3) = ivec(:) !IF( found ) nq(1:3) = ivec(:)
CALL json%get('wstat_control.qlist', ivec, found)
IF( found ) THEN
IF( ALLOCATED(qlist) ) DEALLOCATE(qlist)
ALLOCATE(qlist(SIZE(ivec)))
qlist = ivec
ENDIF
ENDIF ENDIF
! !
IF ( ANY(driver(:)==3) ) THEN IF ( ANY(driver(:)==3) ) THEN
...@@ -268,7 +282,8 @@ SUBROUTINE fetch_input( driver, verbose ) ...@@ -268,7 +282,8 @@ SUBROUTINE fetch_input( driver, verbose )
CALL mp_bcast(l_kinetic_only,root,world_comm) CALL mp_bcast(l_kinetic_only,root,world_comm)
CALL mp_bcast(l_minimize_exx_if_active,root,world_comm) CALL mp_bcast(l_minimize_exx_if_active,root,world_comm)
CALL mp_bcast(l_use_ecutrho,root,world_comm) CALL mp_bcast(l_use_ecutrho,root,world_comm)
CALL mp_bcast(nq,root,world_comm) !CALL mp_bcast(nq,root,world_comm)
CALL mp_bcast(qlist,root,world_comm)
! !
! CHECKS ! CHECKS
! !
...@@ -398,9 +413,12 @@ SUBROUTINE fetch_input( driver, verbose ) ...@@ -398,9 +413,12 @@ SUBROUTINE fetch_input( driver, verbose )
CALL io_push_value('l_kinetic_only',l_kinetic_only,numsp) CALL io_push_value('l_kinetic_only',l_kinetic_only,numsp)
CALL io_push_value('l_minimize_exx_if_active',l_minimize_exx_if_active,numsp) CALL io_push_value('l_minimize_exx_if_active',l_minimize_exx_if_active,numsp)
CALL io_push_value('l_use_ecutrho',l_use_ecutrho,numsp) CALL io_push_value('l_use_ecutrho',l_use_ecutrho,numsp)
CALL io_push_value('nq(1)',nq(1),numsp) !CALL io_push_value('nq(1)',nq(1),numsp)
CALL io_push_value('nq(2)',nq(2),numsp) !CALL io_push_value('nq(2)',nq(2),numsp)
CALL io_push_value('nq(3)',nq(3),numsp) !CALL io_push_value('nq(3)',nq(3),numsp)
DO i = 1, SIZE(qlist)
CALL io_push_value('qlist',qlist(i),numsp)
ENDDO
! !
CALL io_push_bar() CALL io_push_bar()
! !
...@@ -527,7 +545,8 @@ SUBROUTINE add_intput_parameters_to_json_file( driver, json ) ...@@ -527,7 +545,8 @@ SUBROUTINE add_intput_parameters_to_json_file( driver, json )
CALL json%add('input.wstat_control.l_kinetic_only',l_kinetic_only) CALL json%add('input.wstat_control.l_kinetic_only',l_kinetic_only)
CALL json%add('input.wstat_control.l_minimize_exx_if_active',l_minimize_exx_if_active) CALL json%add('input.wstat_control.l_minimize_exx_if_active',l_minimize_exx_if_active)
CALL json%add('input.wstat_control.l_use_ecutrho',l_use_ecutrho) CALL json%add('input.wstat_control.l_use_ecutrho',l_use_ecutrho)
CALL json%add('input.wstat_control.nq', nq) !CALL json%add('input.wstat_control.nq', nq)
CALL json%add('input.wstat_control.qlist', qlist)
! !
ENDIF ENDIF
! !
......
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