[gpaw-users] Problems running GPAW

Jess Wellendorff Pedersen jesswe at fysik.dtu.dk
Thu Apr 7 18:19:26 CEST 2011


Hi Augustus,

yeah, so first of all I would like to direct your attention to the GPAW 
wiki pages, which are found at 
https://wiki.fysik.dtu.dk/gpaw/index.html. 
<https://wiki.fysik.dtu.dk/gpaw/index.html>
In that connection we recommend a look at the GPAW tutorials and 
exercises, which are at
https://wiki.fysik.dtu.dk/gpaw/tutorials/tutorials.html
and
https://wiki.fysik.dtu.dk/gpaw/exercises/exercises.html#exercises
You might find the exercise on calculations for bulk aluminum interesting:
https://wiki.fysik.dtu.dk/gpaw/exercises/aluminium/aluminium.html
the bottom text of that exercise tells about the use of k-point sampling 
for extended systems like bulks, i.e. for pbc = (1,1,1).

So yes, you should definitely use pbc = (1,1,1), and not put more atoms 
in the unit cell than those two already created by the BodyCenteredCubic 
function.
This so because the pbc=(1,1,1) makes GPAW match the electronic 
structure in the unit cell (wavefunctions, density, potential) to the 
situation where that electronic structure repeats itself infinitely in 
all directions, i.e. just like in a bulk solid. However, for the 
electronic structure in a single unit cell to match that of an infinity 
of unit cells you have to sample the k-space of the crystal (remember 
from solid state physics that large bulk unit cells in real space leads 
to short G-vectors in reciprocal space and vice versa, i.e. the smaller 
unit cell the larger is the reciprocal space to sample so the more 
k-points one needs).

ASE tip: You can convince yourself that the bcc unit cell with only two 
atoms in it correctly reproduces the full bcc crystal when repeated in 
all directions by using the function "view -> repeat" in the ASE gui 
window that pops up when doing e.g. "view(bcc)" in your python script.

Sincerely,
Jess

Augustus Low wrote:
> Hi Jess,
>
> Your input has certainly been really helpful for me. In other words, 
> if I want to create a bulk structure, I should use the parameters pbc 
> = (1,1,1)?
> Will this give me a better DFT reading for my structure as well?
>
> Regards,
> Augustus
>
> On Thu, Apr 7, 2011 at 6:40 PM, Jess Wellendorff Pedersen 
> <jesswe at fysik.dtu.dk <mailto:jesswe at fysik.dtu.dk>> wrote:
>
>     Hi augustus,
>
>     I'm not really certain what you are aiming at with this script,
>     but there are at least a few issues with it:
>
>     Augustus Low wrote:
>
>         Hi Jess,
>
>         This is my script:
>
>
>         from ase import Atoms
>         from ase.visualize import view
>         from ase.calculators.emt import EMT
>         from ase.constraints import FixAtoms
>         from ase.optimize import QuasiNewton
>         from ase.lattice.cubic import BodyCenteredCubic
>
>         a = 3.61
>         bcc = BodyCenteredCubic(size=(1,1,1), symbol='Cu',
>         pbc=(1,1,0), latticeconstant=3.61)
>
>     this creates a bcc unit cell for you with two atoms in it and
>     periodic boundary conditions in the x and y directions but not in
>     the z direction. Doesn't really apply for an infinitely extended
>     solid, for which pbc should be (1,1,1). pbc = (1,1,0) is mostly
>     applicable to surface slab models and the likes.
>
>
>         bcc.append(29)
>         bcc.positions[2]=(a,a,a)
>         bcc.append(29)
>         bcc.positions[3]=(a,0,0)
>         bcc.append(29)
>         bcc.positions[4]=(0,0,a)
>         bcc.append(29)
>         bcc.positions[5]=(a,0,a)
>         bcc.append(29)
>         bcc.positions[6]=(0,a,0)
>         bcc.append(29)
>         bcc.positions[7]=(0,a,a)
>         bcc.append(29)
>         bcc.positions[8]=(a,a,0)
>
>     this is where it gets really problematic. All the above appends
>     are bad, because the periodic boundary conditions "translate" the
>     unit cell for you in the pbc=1 directions. Therefore, with a
>     manual translation in say the x direction, you now put two atoms
>     exactly on top of each other in the pbc=True directions.
>
>
>         constraint = FixAtoms(mask=[a.symbol !='Cu' for a in bcc])
>         bcc.set_constraint(constraint)
>
>         view(bcc)
>
>         bcc.set_calculator(EMT())
>         dyn = QuasiNewton(bcc)
>         dyn.run(fmax=0.05)
>
>         print bcc.get_potential_energy()
>
>         from gpaw import GPAW
>         calc = GPAW(nbands= -10)
>         bcc.set_calculator(calc)
>         bcc.get_potential_energy()
>
>     I hope you realize that this would be an extremely crude DFT
>     calculation, with default real-space density grid spacing, LDA
>     exchange-correlation, and only a single k-point (the gamma point)
>     in reciprocal space, meaning that even though you a using periodic
>     boundary conditions such as to model an extended lattice you are
>     not taking this periodicity into account in the electronic
>     structure calculation.
>
>     /Jess
>
>     Augustus Low wrote:
>
>         Hi all,
>
>         I'm new to programming on GPAW and I need some help on this.
>         I'm trying to calculate the potential energy of this simple
>         bcc structure using both EMT and GPAW. Here is my script:
>
>         from ase import Atoms
>         from ase.visualize import view
>         from ase.calculators.emt import EMT
>         from ase.constraints import FixAtoms
>         from ase.optimize import QuasiNewton
>         from ase.lattice.cubic import BodyCenteredCubic
>
>         a = 3.61
>         bcc = BodyCenteredCubic(size=(1,1,1), symbol='Cu',
>         pbc=(1,1,0), latticeconstant=3.61)
>
>         bcc.append(29)
>         bcc.positions[2]=(a,a,a)
>         bcc.append(29)
>         bcc.positions[3]=(a,0,0)
>         bcc.append(29)
>         bcc.positions[4]=(0,0,a)
>         bcc.append(29)
>         bcc.positions[5]=(a,0,a)
>         - Hide quoted text -
>         bcc.append(29)
>         bcc.positions[6]=(0,a,0)
>         bcc.append(29)
>         bcc.positions[7]=(0,a,a)
>         bcc.append(29)
>         bcc.positions[8]=(a,a,0)
>
>         constraint = FixAtoms(mask=[a.symbol !='Cu' for a in bcc])
>         bcc.set_constraint(constraint)
>
>         view(bcc)
>
>         bcc.set_calculator(EMT())
>         dyn = QuasiNewton(bcc)
>         dyn.run(fmax=0.05)
>
>         print bcc.get_potential_energy()
>         - Hide quoted text -
>
>         from gpaw import GPAW
>         calc = GPAW(nbands=-10)
>         bcc.set_calculator(calc)
>         print bcc.get_potential_energy()
>
>         However, this was returned to me:
>
>         Traceback (most recent call last):
>          File "<stdin>", line 1, in <module>
>          File "/home/lowt0008/ase/ase/atoms.py", line 494, in
>         get_potential_energy
>            return self.calc.get_potential_energy(self)
>          File
>         "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/aseinterface.py",
>         line 32, in get_potential_energy
>            self.calculate(atoms, converge=True)
>          File
>         "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/paw.py",
>         line 226, in calculate
>            self.set_positions(atoms)
>          File
>         "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/paw.py",
>         line 301, in set_positions
>            spos_ac = self.initialize_positions(atoms)
>          File
>         "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/paw.py",
>         line 293, in initialize_positions
>            self.wfs.set_positions(spos_ac)
>          File
>         "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/wavefunctions/fd.py",
>         line 45, in set_positions
>            FDPWWaveFunctions.set_positions(self, spos_ac)
>          File
>         "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/wavefunctions/fdpw.py",
>         line 41, in set_positions
>            WaveFunctions.set_positions(self, spos_ac)
>          File
>         "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/wavefunctions/base.py",
>         line 226, in set_positions
>            rank_a = self.gd.get_ranks_from_positions(spos_ac)
>          File
>         "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/domain.py",
>         line 102, in get_ranks_from_positions
>            assert (rnk_ac >= 0).all() and (rnk_ac < self.parsize_c).all()
>         AssertionError
>
>         Anyone had any idea where the problem could lie? Your help is
>         greatly appreciated.
>
>         Regards,
>         Augustus
>         ------------------------------------------------------------------------
>
>         _______________________________________________
>         gpaw-users mailing list
>         gpaw-users at listserv.fysik.dtu.dk
>         <mailto:gpaw-users at listserv.fysik.dtu.dk>
>         https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users
>
>
>     -- 
>     Jess Wellendorff Pedersen
>
>     ph.d student
>     Center for Atomic-scale Materials Design (CAMD)
>     Department of Physics
>     Technical University of Denmark (DTU)
>
>

-- 
Jess Wellendorff Pedersen

ph.d student
Center for Atomic-scale Materials Design (CAMD)
Department of Physics
Technical University of Denmark (DTU)



More information about the gpaw-users mailing list