[gpaw-users] Unable to Run GPAW Tutorial Code "PBE0 calculations for bulk silicon"
Keenan Lyon
lyon.keenan at gmail.com
Mon Aug 6 23:14:10 CEST 2018
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.csvfrom __future__ import print_functionimport
numpy as npfrom ase.build import bulkfrom ase.parallel import
paropenfrom gpaw.xc.exx import EXXfrom gpaw.xc.tools import vxcfrom
gpaw import GPAW, PW
a = 5.43si = 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.
KL
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/gpaw-users/attachments/20180806/c8cb6c1d/attachment-0001.html>
More information about the gpaw-users
mailing list