[gpaw-users] Unable to Run GPAW Tutorial Code "PBE0 calculations for bulk silicon"

Jens Jørgen Mortensen jjmo at dtu.dk
Mon Aug 20 12:39:19 CEST 2018


On 08/06/2018 11:14 PM, Keenan Lyon via gpaw-users wrote:
> Running the code below, which can be found in the GPAW tutorials here:
>
> https://wiki.fysik.dtu.dk/gpaw/tutorials/pbe0/pbe0.html
> # Creates: si-gaps.csv
> from  __future__  import  print_function
> import  numpy  as  np
> from  ase.build  import  bulk
> from  ase.parallel  import  paropen
> from  gpaw.xc.exx  import  EXX
> from  gpaw.xc.tools  import  vxc
> from  gpaw  import  GPAW,  PW
>
> a  =  5.43
> si  =  bulk('Si',  'diamond',  a)
>
> fd  =  paropen('si-gaps.csv',  'w')
>
> for  k  in  range(2,  9,  2):
>      name  =  'Si-{0}'.format(k)
>      si.calc  =  GPAW(kpts={'size':  (k,  k,  k),  'gamma':  True},
>                     mode=PW(200),
>                     xc='PBE',
>                     convergence={'bands':  5},
>                     txt=name  +  '.txt')
>      si.get_potential_energy()
>      si.calc.write(name  +  '.gpw',  mode='all')
>      
>      # Range of eigenvalues:
>      n1  =  3
>      n2  =  5
>      
>      ibzkpts  =  si.calc.get_ibz_k_points()
>      kpt_indices  =  []
>      pbeeigs  =  []
>      for  kpt  in  [(0,  0,  0),  (0.5,  0.5,  0)]:
>          # Find k-point index:
>          i  =  abs(ibzkpts  -  kpt).sum(1).argmin()
>          kpt_indices.append(i)
>          pbeeigs.append(si.calc.get_eigenvalues(i)[n1:n2])
>
>      # DFT eigenvalues:
>      pbeeigs  =  np.array(pbeeigs)
>      
>      # PBE contribution:
>      dpbeeigs  =  vxc(si.calc,  'PBE')[0,  kpt_indices,  n1:n2]
>          
>      # Do PBE0 calculation:
>      pbe0  =  EXX(name  +  '.gpw',
>                 'PBE0',
>                 kpts=kpt_indices,
>                 bands=[n1,  n2],
>                 txt=name  +  '.pbe0.txt')
>      pbe0.calculate()
>      
>      dpbe0eigs  =  pbe0.get_eigenvalue_contributions()[0]
>      pbe0eigs  =  pbeeigs  -  dpbeeigs  +  dpbe0eigs
>
>      print('{0}, {1:.3f}, {2:.3f}, {3:.3f}, {4:.3f}'
>            .format(k,
>                    pbeeigs[0,  1]  -  pbeeigs[0,  0],
>                    pbeeigs[1,  1]  -  pbeeigs[0,  0],
>                    pbe0eigs[0,  1]  -  pbe0eigs[0,  0],
>                    pbe0eigs[1,  1]  -  pbe0eigs[0,  0]),
>            file=fd)
>      fd.flush()
> yields the following error on my system:
>
> rank=0 L2:     pbe0eigs = pbeeigs - dpbeeigs + dpbe0eigs
> rank=0 L3: ValueError: operands could not be broadcast together with 
> shapes (2,2) (2,0)
> GPAW CLEANUP (node 0): <type 'exceptions.ValueError'> occurred.  
> Calling MPI_Abort!
>
> I've read that there can be issues regarding the EXX functional 
> working self-consistently, but I'm not sure if that's the issue here. 
> Thank you for your help.

That script only works in serial.  Should be fixed now in master. Thanks 
for your feedback!

Jens Jørgen

>
> KL
>
>
>
> _______________________________________________
> gpaw-users mailing list
> gpaw-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/gpaw-users/attachments/20180820/94b22fb5/attachment-0001.html>


More information about the gpaw-users mailing list