Re: [QE-users] Probable bug in additional_kpoints.f90 subroutine

2022-02-16 Thread Lorenzo Paulatto
Download these two files and replace those in QE7 and recompile:
https://gitlab.com/QEF/q-e/-/raw/develop/Modules/additional_kpoints.f90?inline=false
https://gitlab.com/QEF/q-e/-/raw/develop/PP/src/plotband.f90?inline=false

let me know if it does not compile
cheers

Dr. Lorenzo Paulatto
IdR @ IMPMC - CNRS UMR 7590 & Sorbonne Université
phone: +33 (0)1 442 79822 / skype: paulatz
http://www.impmc.upmc.fr/~paulatto/ - https://anharmonic.github.io/
23-24/423 B115, 4 place Jussieu 75252 Paris CX 05
On Feb 16 2022, at 12:36 pm, Aleksandra Oranskaia 
 wrote:
> Thank you for the corrections!
>
> Where can I get the updated files (additional_kpoints.f90, plotband.f90, 
> ...?) ?
>
> --
> Best wishes,
> Alex (she/her/hers),
> phd candidate in chemical sciences
> 'I.. a universe of atoms, an atom in the universe' (Richard P. Feynman)
> https://cpms.kaust.edu.sa/
>
>
>
>
>
>
>
> This message and its contents, including attachments are intended solely for 
> the original recipient. If you are not the intended recipient or have 
> received this message in error, please notify me immediately and delete this 
> message from your computer system. Any unauthorized use or distribution is 
> prohibited. Please consider the environment before printing this 
> email.___
> Quantum ESPRESSO is supported by MaX (www.max-centre.eu)
> users mailing list users@lists.quantum-espresso.org
> https://lists.quantum-espresso.org/mailman/listinfo/users

___
Quantum ESPRESSO is supported by MaX (www.max-centre.eu)
users mailing list users@lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users

[QE-users] Probable bug in additional_kpoints.f90 subroutine

2022-02-16 Thread Aleksandra Oranskaia
Thank you for the corrections!

Where can I get the updated files (additional_kpoints.f90, plotband.f90,
...?) ?

-- 
Best wishes,
Alex (she/her/hers),
phd candidate in chemical sciences
'I.. a universe of atoms, an atom in the universe' (Richard P. Feynman)
https://cpms.kaust.edu.sa/

-- 

This message and its contents, including attachments are intended solely 
for the original recipient. If you are not the intended recipient or have 
received this message in error, please notify me immediately and delete 
this message from your computer system. Any unauthorized use or 
distribution is prohibited. Please consider the environment before printing 
this email.
___
Quantum ESPRESSO is supported by MaX (www.max-centre.eu)
users mailing list users@lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users

Re: [QE-users] Probable bug in additional_kpoints.f90 subroutine

2022-02-15 Thread Prasenjit Ghosh
On Tue, 15 Feb 2022 at 18:40, Lorenzo Paulatto <
lorenzo.paula...@sorbonne-universite.fr> wrote:

> Thank you Prasenjit, I tested it and it seems correct. I also fixeda
> couple of bugs in plotbands.
>
> Do you want to do a pull request yourself for the file ? (In that case
> I'ld ask you to remove the debug lines) or should I take care to do it?
>
>
Thanks Lorenzo. I think the simplest thing will be that you please go ahead
and take care of it.

With regards,
Prasenjit



> thank you again
>
> Dr. Lorenzo Paulatto
> IdR @ IMPMC - CNRS UMR 7590 & Sorbonne Université
> phone: +33 (0)1 442 79822 / skype: paulatz
> http://www.impmc.upmc.fr/~paulatto/ - https://anharmonic.github.io/
> 23-24/423 B115, 4 place Jussieu 75252 Paris CX 05
> On Feb 15 2022, at 7:29 am, Prasenjit Ghosh 
> wrote:
>
> Dear Lorenzo and others,
>
> I think there is a bug in the above subroutine when either nqx1, nqx2 and
> nqx3, or all of them are greater than 1. The example does not work with the
> original version of the code because a lot of k-points with coordinates
> (0,0,0 are generated as shown below:
>
> k(1) = (  -0.250   0.250   0.250), wk =   0.500
> k(2) = (   0.250  -0.250   0.750), wk =   1.500
> k(3) = (   0.000   0.000   0.000), wk =   0.000
> k(4) = (   0.000   0.000   0.000), wk =   0.000
> k(5) = (   0.000   0.000   0.000), wk =   0.000
> k(6) = (   0.000   0.000   0.000), wk =   0.000
> k(7) = (   0.000   0.000   0.000), wk =   0.000
> k(8) = (   0.000   0.000   0.000), wk =   0.000
> k(9) = (   0.500   0.500   0.500), wk =   0.000
>
> In the above list, k-points #3 to #7 are all (0, 0,0). Because of this,
> when running the bands.x code, it complains and stops.
>
> I was working with QE-6.8. The same problem I think persists also in 7.0.
>
> In line 89 of the subroutine, the value of the counter 'iq' seems to be
> wrongly initialized. With this the array elements are wrongly assigned in
> xk(:,ik). The correct one should be:
>
> iq=nkstot_old
>
> Further the array elements of 'wk', corresponding to the additional
> k-points also need to be set to zero. This can be done right after line 98
> by adding the following line:
> wk(iq)=0.0d0
>
> The modified subroutine is attached.
>
> With regards,
> Prasenjit
>
>
> With regards,
> Prasenjit
> --
> PRASENJIT GHOSH,
> IISER Pune,
> Dr. Homi Bhabha Road, Pashan
> Pune, Maharashtra 411008, India
>
> Phone: +91 (20) 2590 8203
> Fax: +91 (20) 2589 9790
> ___
> Quantum ESPRESSO is supported by MaX (www.max-centre.eu)
> users mailing list users@lists.quantum-espresso.org
> https://lists.quantum-espresso.org/mailman/listinfo/users
>
> [image: Sent from Mailspring]
> ___
> Quantum ESPRESSO is supported by MaX (www.max-centre.eu)
> users mailing list users@lists.quantum-espresso.org
> https://lists.quantum-espresso.org/mailman/listinfo/users



-- 
PRASENJIT GHOSH,
IISER Pune,
Dr. Homi Bhabha Road, Pashan
Pune, Maharashtra 411008, India

Phone: +91 (20) 2590 8203
Fax: +91 (20) 2589 9790
___
Quantum ESPRESSO is supported by MaX (www.max-centre.eu)
users mailing list users@lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users

Re: [QE-users] Probable bug in additional_kpoints.f90 subroutine

2022-02-15 Thread Lorenzo Paulatto
Thank you Prasenjit, I tested it and it seems correct. I also fixeda couple of 
bugs in plotbands.

Do you want to do a pull request yourself for the file ? (In that case I'ld ask 
you to remove the debug lines) or should I take care to do it?
thank you again
Dr. Lorenzo Paulatto
IdR @ IMPMC - CNRS UMR 7590 & Sorbonne Université
phone: +33 (0)1 442 79822 / skype: paulatz
http://www.impmc.upmc.fr/~paulatto/ - https://anharmonic.github.io/
23-24/423 B115, 4 place Jussieu 75252 Paris CX 05
On Feb 15 2022, at 7:29 am, Prasenjit Ghosh  wrote:
> Dear Lorenzo and others,
>
> I think there is a bug in the above subroutine when either nqx1, nqx2 and 
> nqx3, or all of them are greater than 1. The example does not work with the 
> original version of the code because a lot of k-points with coordinates 
> (0,0,0 are generated as shown below:
>
> k( 1) = ( -0.250 0.250 0.250), wk = 0.500
> k( 2) = ( 0.250 -0.250 0.750), wk = 1.500
> k( 3) = ( 0.000 0.000 0.000), wk = 0.000
> k( 4) = ( 0.000 0.000 0.000), wk = 0.000
> k( 5) = ( 0.000 0.000 0.000), wk = 0.000
> k( 6) = ( 0.000 0.000 0.000), wk = 0.000
> k( 7) = ( 0.000 0.000 0.000), wk = 0.000
> k( 8) = ( 0.000 0.000 0.000), wk = 0.000
> k( 9) = ( 0.500 0.500 0.500), wk = 0.000
>
>
> In the above list, k-points #3 to #7 are all (0, 0,0). Because of this, when 
> running the bands.x code, it complains and stops.
>
> I was working with QE-6.8. The same problem I think persists also in 7.0.
>
> In line 89 of the subroutine, the value of the counter 'iq' seems to be 
> wrongly initialized. With this the array elements are wrongly assigned in 
> xk(:,ik). The correct one should be:
>
> iq=nkstot_old
>
> Further the array elements of 'wk', corresponding to the additional k-points 
> also need to be set to zero. This can be done right after line 98 by adding 
> the following line:
> wk(iq)=0.0d0
>
> The modified subroutine is attached.
>
> With regards,
> Prasenjit
>
>
>
> With regards,
> Prasenjit
> --
> PRASENJIT GHOSH,
> IISER Pune,
> Dr. Homi Bhabha Road, Pashan
> Pune, Maharashtra 411008, India
>
> Phone: +91 (20) 2590 8203
> Fax: +91 (20) 2589 9790
>
>
>
>
> ___
> Quantum ESPRESSO is supported by MaX (www.max-centre.eu)
> users mailing list users@lists.quantum-espresso.org
> https://lists.quantum-espresso.org/mailman/listinfo/users

___
Quantum ESPRESSO is supported by MaX (www.max-centre.eu)
users mailing list users@lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users

[QE-users] Probable bug in additional_kpoints.f90 subroutine

2022-02-14 Thread Prasenjit Ghosh
Dear Lorenzo and others,

I think there is a bug in the above subroutine when either nqx1, nqx2 and
nqx3, or all of them are greater than 1. The example does not work with the
original version of the code because a lot of k-points with coordinates
(0,0,0 are generated as shown below:

k(1) = (  -0.250   0.250   0.250), wk =   0.500
k(2) = (   0.250  -0.250   0.750), wk =   1.500
k(3) = (   0.000   0.000   0.000), wk =   0.000
k(4) = (   0.000   0.000   0.000), wk =   0.000
k(5) = (   0.000   0.000   0.000), wk =   0.000
k(6) = (   0.000   0.000   0.000), wk =   0.000
k(7) = (   0.000   0.000   0.000), wk =   0.000
k(8) = (   0.000   0.000   0.000), wk =   0.000
k(9) = (   0.500   0.500   0.500), wk =   0.000

In the above list, k-points #3 to #7 are all (0, 0,0). Because of this,
when running the bands.x code, it complains and stops.

I was working with QE-6.8. The same problem I think persists also in 7.0.

In line 89 of the subroutine, the value of the counter 'iq' seems to be
wrongly initialized. With this the array elements are wrongly assigned in
xk(:,ik). The correct one should be:

iq=nkstot_old

Further the array elements of 'wk', corresponding to the additional
k-points also need to be set to zero. This can be done right after line 98
by adding the following line:
wk(iq)=0.0d0

The modified subroutine is attached.

With regards,
Prasenjit


With regards,
Prasenjit
-- 
PRASENJIT GHOSH,
IISER Pune,
Dr. Homi Bhabha Road, Pashan
Pune, Maharashtra 411008, India

Phone: +91 (20) 2590 8203
Fax: +91 (20) 2589 9790
!
! Copyright (C) 2020-2014 Quantum ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
! Written by Lorenzo Paulatto , July 2020
!
MODULE additional_kpoints
  USE kinds, ONLY : DP
  USE parameters,   ONLY : npk
  IMPLICIT NONE
  REAL(DP),ALLOCATABLE :: xk_add(:,:) !, wk_add(:)
  CHARACTER(len=80) :: k_points_add = 'bogus'
  INTEGER :: nkstot_add=0


  CONTAINS
  !
  SUBROUTINE bcast_additional_kpoints
USE mp, ONLY : mp_bcast
USE io_global,  ONLY : ionode_id
USE mp_images,  ONLY: intra_image_comm
!
IMPLICIT NONE
CALL mp_bcast(nkstot_add, ionode_id, intra_image_comm)
IF(nkstot_add==0) RETURN
CALL mp_bcast(xk_add, ionode_id, intra_image_comm)

  END SUBROUTINE
  !
  SUBROUTINE add_additional_kpoints(nkstot, xk, wk)
 USE input_parameters, ONLY : nqx1, nqx2, nqx3
 USE cell_base,ONLY : bg
 USE io_global,ONLY : stdout
 IMPLICIT NONE
 INTEGER,INTENT(inout)  :: nkstot
 REAL(DP),INTENT(inout) :: xk(3,npk), wk(npk)
 !
 REAL(DP),ALLOCATABLE :: xk_old(:,:), wk_old(:)
 INTEGER :: nkstot_old
 INTEGER :: nk1_old, nk2_old, nk3_old
 INTEGER :: k1_old,  k2_old,  k3_old
 INTEGER :: nqtot, i,j,k, iq, jq
 REAL(DP) :: xq(3), rq(3)
 LOGICAL, EXTERNAL  :: matches
 !
! IF(.not.allocated(xk) .or. .not.allocated(wk))&
!   CALL errore("add_kpoints", "K-points not ready yet",1)
 CALL bcast_additional_kpoints()
 IF(nkstot_add==0) RETURN

 IF(matches("crystal",k_points_add))THEN
 CALL cryst_to_cart(nkstot_add,xk_add,bg,+1)
 ENDIF
 !
 ! Back-up existing points
 nkstot_old = nkstot
 ALLOCATE(xk_old(3,nkstot_old))
 ALLOCATE(wk_old(nkstot_old))
 xk_old = xk(1:3, 1:nkstot)
 wk_old = wk(1:nkstot)
! DEALLOCATE(xk,wk)
 nkstot = 0
 !
 ! Simple case: EXX not used or used with self-exchange only: 
 IF( nqx1<=1 .and. nqx2<=1 .and. nqx3<=1 ) THEN
   nkstot = nkstot_old + nkstot_add
   IF(nkstot>npk) CALL errore("add_kpoint", "Number of k-points exceeded: increase npk in pwcom", 1)
   xk(:,1:nkstot_old) = xk_old
   xk(:,nkstot_old+1:nkstot_old+nkstot_add) = xk_add
   wk(1:nkstot_old) = wk_old
   wk(nkstot_old+1:nkstot_old+nkstot_add) = 0._dp
   nqtot=1
 ELSE
 ! Difficult case: EXX with a finite grid of q-points. Ideally, we would want to use
 ! The grid from module EXX, but it may not have been initialized at this points.
 ! Furthermore, the q-point grid is obtained by opening the k-points one, so this would
 ! be a dog wagging its own tails
   nqtot = nqx1*nqx2*nqx3
   nkstot = nkstot_old + nkstot_add *nqtot
   IF(nkstot>npk) CALL errore("add_kpoint", "Number of k-points exceeded: increase npk in pwcom", 1)
   xk(:,1:nkstot_old) = xk_old
   wk(1:nkstot_old) = wk_old
   
   rq = (/nqx1,nqx2,nqx3/)
   write(stdout,*) rq(1), rq(2), rq(3)
   rq = 1._dp / rq
   write(stdout,*) rq(1), rq(2), rq(3)
!   iq = nqtot
   iq = nkstot_old