Possible bug(s) in m_krank/krank_new time reversal options

Documentation, Web site and code modifications

Moderators: baguetl, routerov

Posts: 1
Joined: Sat May 09, 2020 7:43 pm

Possible bug(s) in m_krank/krank_new time reversal options

Post by nc61 » Wed Jun 10, 2020 11:11 pm

I was going through the code for tetrahedral integration and I think I spotted an issue in the treatment of time reversal at the end of krank_new. The code is below:

Code: Select all

170 if (present(symrec)) then
171    if(.not. present(nsym)) then
172      TETRA_ERROR("need both symrec and nsym arguments together")
173    end if
174    do ikpt=1,nkpt
175      ! itim == 1 for positive, and itim==2 gives Kramers opposite of k-point
176      ! favor the former by looping it last
177      do itim = timrev, 1, -1
178        do isym = 1, nsym
179          symkpt = (-1)**(timrev+1) * matmul(symrec(:,:,isym), kpt(:, ikpt))
180          symkptrank = krank%get_rank(symkpt(:))
181          krank%invrank(symkptrank) = ikpt
182        end do
183      end do
184    end do
185  end if
I believe timrev on line 179 should be itim so that the loop properly covers time reversed and non-time reversed symmetry operations. The only place I see this called is from 78_eph/m_phgamma so it could possibly cause some trouble there if time reversal isn't trivial. Also some minor adjustments to the following might be needed:

Code: Select all

149 timrev = 2
150 krank%time_reversal = .true.
151  if (present(time_reversal)) then
152    if (.not. time_reversal) timrev = 1
153  end if
After line 152 there should maybe be krank%time_reversal = .false. ? Fortunately, as far as I can tell there is no reference to this property anywhere in the codebase.

Posts: 655
Joined: Wed Aug 19, 2009 12:01 pm

Re: Possible bug(s) in m_krank/krank_new time reversal options

Post by mverstra » Fri Jun 19, 2020 2:10 pm

Brilliant! Thank you - we were about to start debugging this. I will test it immediately
It should be in v9.2 if everything goes smoothly


Matthieu Verstraete
University of Liege, Belgium