Bug in grid_generator.F

Anything regarding the post-processing utility (e.g. excitonic wavefunction analysis) is dealt with in this forum.

Moderators: Davide Sangalli, andrea marini, Daniele Varsano

Post Reply
User avatar
claudio
Posts: 526
Joined: Tue Mar 31, 2009 11:33 pm
Location: Marseille
Contact:

Bug in grid_generator.F

Post by claudio » Mon Nov 06, 2017 12:33 pm

Dear developers

I found a bug in grid_generator.F when symmetries are present.

Here the correct version

best
Claudio
You do not have the required permissions to view the files attached to this post.
Claudio Attaccalite
[CNRS/ Aix-Marseille Université/ CINaM laborarory / TSN department
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09
web site: http://www.attaccalite.com

User avatar
Davide Sangalli
Posts: 640
Joined: Tue May 29, 2012 4:49 pm
Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
Contact:

Re: Bug in grid_generator.F

Post by Davide Sangalli » Sat Nov 11, 2017 5:44 pm

Ciao Claudio,
I had a look to the file.
The only difference compared to the previous version is that you erased some lines.
Is that correct ?

Best,
D.

Code: Select all

diff --git a/ypp/interpolate/grid_generator.F b/ypp/interpolate/grid_generator.F
index c7b1d56..49ae4ea 100644
--- a/ypp/interpolate/grid_generator.F
+++ b/ypp/interpolate/grid_generator.F
@@ -40,8 +40,6 @@ subroutine grid_generator(USER_k,units,grid_dim)
  !
  integer  :: i1,i2,i3,ic
  character(schlen) :: ch
- real(SP), allocatable :: k_bz(:,:)
- logical :: found
  !
  if(any(grid_dim(:)<1)) call error("Wrong grid dimension")
  !
@@ -82,47 +80,8 @@ subroutine grid_generator(USER_k,units,grid_dim)
   call k_ibz2bz(USER_k,'d',.TRUE.)
   call k_ibz2bz(USER_k,'a',.TRUE.)
   !
-  ! Map in the positive BZ between [0,1)
-  !
-  where(USER_k%ptbz(:,:)<-zero_dfl)
-    USER_k%ptbz(:,:)=1._SP+USER_k%ptbz(:,:)
-  end where
-  !
-  ! Reorder in such a way to have the IBZ point at the beginning
-  ! of the list
-  !
-  allocate(k_bz(USER_k%nbz,3))
-  !
-  k_bz=USER_k%ptbz
-  !
-  do ic=1,USER_k%nibz ! Copy the IBZ points in the BZ list
-    call c2a(v_in=USER_k%pt(ic,:),v_out=USER_k%ptbz(ic,:),mode="ki2a")
-    USER_k%ptbz(ic,1:3)=USER_k%ptbz(ic,1:3)-nint(USER_k%ptbz(ic,1:3))     
-    where(USER_k%ptbz(ic,:)<-zero_dfl)
-      USER_k%ptbz(ic,:)=1._SP+USER_k%ptbz(ic,:)
-    end where
-  enddo  
-  !
-  ! Add the remaining points
-  !
-  ic=USER_k%nibz+1
-  do i1=1,USER_k%nbz 
-    found=.false.
-    i2=1
-    do while(.not.found.and.i2<=USER_k%nibz)
-      if(v_is_zero(USER_k%ptbz(i2,:)-k_bz(i1,:))) found=.true.
-      i2=i2+1
-    enddo
-    !
-    if(.not.found) then
-     USER_k%ptbz(ic,:)=k_bz(i1,:)
-     ic=ic+1
-    endif
-  enddo
-  !
   do ic=1,USER_k%nbz
     call c2a(v_in=USER_k%ptbz(ic,:),mode="ka2"//units)
   enddo
- 
   !
 end subroutine grid_generator
Davide Sangalli, PhD
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

User avatar
claudio
Posts: 526
Joined: Tue Mar 31, 2009 11:33 pm
Location: Marseille
Contact:

Re: Bug in grid_generator.F

Post by claudio » Sun Nov 12, 2017 8:05 am

Ciao Davide

yes, it is correct. I removed a part that reorder points in the BZ.
The problem is that if you change the BZ k-points order you break the relation between IBZ and BZ points.
Probably at the beginning this subroutine was working only without symmetries and it was fine,
but with symmetries it is a mess. Interpolation is done in the IBZ and then the mapping on BZ is wrong.
But if you remove the reorder (that is useless just aesthetic) everything is fine

best
Claudio
Claudio Attaccalite
[CNRS/ Aix-Marseille Université/ CINaM laborarory / TSN department
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09
web site: http://www.attaccalite.com

Post Reply