[gpaw-users] Problems running GPAW
Jess Wellendorff Pedersen
jesswe at fysik.dtu.dk
Thu Apr 7 12:40:17 CEST 2011
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
> 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)
More information about the gpaw-users
mailing list