[ase-users] AssertionError upon running slab calculation

Ask Hjorth Larsen asklarsen at gmail.com
Tue Aug 21 17:10:11 CEST 2018


Dear Willem,

2018-08-21 16:29 GMT+02:00 Willem Offermans via ase-users
<ase-users at listserv.fysik.dtu.dk>:
> Dear ASE friends,
>
> Can someone help me to solve the following problem.
>
> My input file is:
>
> <snip>j
>
>         import numpy as np
>         import math
>
>         from ase import Atoms
>         from ase.calculators.abinit import Abinit
>         from ase.io.trajectory import Trajectory
>         from ase.optimize import BFGS
>         from ase.units import Ha
>         from ase.units import Angstrom
>
>         a = 2.789 * Angstrom
>
>         unitcell = [
>                 [ 2.00000,  0.0000000000,  0.000000000000000],
>                 [ 1.00000,  math.sqrt(3),  0.000000000000000],
>                 [ 0.00000,  0.0000000000,  10*math.sqrt(2/3)]
>                 ]
>
>         unitcell = np.multiply(unitcell, a)
>
>         scal_pos = [
>                 [0.0000000000000000,  0.0000000000000000,  0.3000000000000000],
>                 [0.5000000000000000,  1.0000000000000000,  0.3000000000000000],
>                 [0.0000000000000000,  0.5000000000000000,  0.3000000000000000],
>                 [0.5000000000000000,  0.5000000000000000,  0.3000000000000000],
>                 [0.1666666666666667,  0.1666666666666667,  0.4000000000000000],
>                 [0.6666666666666667,  0.1666666666666667,  0.4000000000000000],
>                 [0.1666666666666667,  0.6666666666666667,  0.4000000000000000],
>                 [0.6666666666666667,  0.6666666666666667,  0.4000000000000000],
>                 [0.3333333333333333,  0.3333333333333333,  0.5000000000000000],
>                 [0.8333333333333333,  0.3333333333333333,  0.5000000000000000],
>                 [0.3333333333333333,  0.8333333333333333,  0.5000000000000000],
>                 [0.8333333333333333,  0.8333333333333333,  0.5000000000000000],
>                 [0.5000000000000000,  0.5000000000000000,  0.6000000000000000],
>                 [0.0000000000000000,  0.5000000000000000,  0.6000000000000000],
>                 [0.5000000000000000,  1.0000000000000000,  0.6000000000000000],
>                 [1.0000000000000000,  1.0000000000000000,  0.6000000000000000],
>                 [0.6666666666666666,  0.6666666666666666,  0.7000000000000000],
>                 [0.1666666666666667,  0.6666666666666666,  0.7000000000000000],
>                 [0.6666666666666667,  0.1666666666666667,  0.7000000000000000],
>                 [0.1666666666666667,  0.1666666666666667,  0.7000000000000000]
>                 ]
>
>         slab = Atoms(scaled_positions=scal_pos,
>                 symbols='Pd20',
>                 cell=unitcell,
>                 pbc=[True,True,False]
>                 )
>
>         WorkingDirectory = '/data/users/Public/woffermans/abinit/Pd/Pd_surface_GGA_PBE_PAW/Pd111/5M5V2x2/'
>
>         intKpoints = 14
>         intEcut = 30
>         intPawEcut = 40
>
>         calc = Abinit(command='./abinit.zip/abinit < PREFIX.files > pd.log',
>               label='pd',
>               ixc=11,
>               xc='PBE',
>               pps='pawxml',
>               chksymbreak=0,
>               occopt=3,
>               tsmear=0.005
>               )
>
>         # one can specify abinit keywords also using set
>         calc.set(toldfe=1.0e-6)  # warning - used to speedup the test
>         calc.set(ecut=intEcut * Ha)  # warning - used to speedup the test
>         calc.set(pawecutdg=intPawEcut * Ha)
>         calc.set(kpts=[intKpoints, intKpoints, intKpoints])
>
>         slab.set_calculator(calc)
>
>         dyn = BFGS(slab)
>         dyn = BFGS(slab, trajectory='Pd111_5M5V2x2.traj',restart='Pd111_5M5V2x2.pckl')
>         dyn.run(fmax=0.05,steps=10)
>
> </snip>
>
> Upon running this python script, I got following error:
>
> <snip>
> ….
>     pbc=[True,True,False]
>   File "/home/woffermans/.local/lib/python2.7/site-packages/ase/atoms.py", line 217, in __init__
>     assert self.number_of_lattice_vectors == 3
> AssertionError
> ….
> </snip>

The error happens because one of the cell dimensions is zero.

Notice 10*math.sqrt(2/3).

In Python2, 2/3 is 0 because it uses integer division.  Write 2.0/3 to
get float division.

Best regards
Ask

>
> I assume that something is wrong with the slab definition. However I don’t know what.
>
> Can someone help me out?
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users



More information about the ase-users mailing list