Modelling a gallium arsenide surface

This example shows how to use the atomistic simulation environment or ASE for short, to set up and run a particular calculation of a gallium arsenide surface. ASE is a Python package to simplify the process of setting up, running and analysing results from atomistic simulations across different simulation codes. For more details on the integration DFTK provides with ASE, see Atomistic simulation environment.

In this example we will consider modelling the (1, 1, 0) GaAs surface separated by vacuum.

Parameters of the calculation. Since this surface is far from easy to converge, we made the problem simpler by choosing a smaller Ecut and smaller values for n_GaAs and n_vacuum. More interesting settings are Ecut = 15 and n_GaAs = n_vacuum = 20.

miller = (1, 1, 0)   # Surface Miller indices
n_GaAs = 2           # Number of GaAs layers
n_vacuum = 4         # Number of vacuum layers
Ecut = 5             # Hartree
kgrid = (4, 4, 1);   # Monkhorst-Pack mesh

Use ASE to build the structure:

using ASEconvert

a = 5.6537  # GaAs lattice parameter in Ångström (because ASE uses Å as length unit)
gaas = ase.build.bulk("GaAs", "zincblende"; a)
surface = ase.build.surface(gaas, miller, n_GaAs, 0, periodic=true);

Get the amount of vacuum in Ångström we need to add

d_vacuum = maximum(maximum, surface.cell) / n_GaAs * n_vacuum
surface = ase.build.surface(gaas, miller, n_GaAs, d_vacuum, periodic=true);

Write an image of the surface and embed it as a nice illustration:

ase.io.write("surface.png", surface * pytuple((3, 3, 1)), rotation="-90x, 30y, -75z")
Python: None

Use the pyconvert function from PythonCall to convert the ASE atoms to an AtomsBase-compatible system. This can then be used in the same way as other AtomsBase systems (see AtomsBase integration for details) to construct a DFTK model:

using DFTK

pseudopotentials = Dict(:Ga => "hgh/pbe/ga-q3.hgh",
                        :As => "hgh/pbe/as-q5.hgh")
model = model_DFT(pyconvert(AbstractSystem, surface);
                  functionals=PBE(),
                  temperature=1e-3,
                  smearing=DFTK.Smearing.Gaussian(),
                  pseudopotentials)
Model(gga_x_pbe+gga_c_pbe, 3D):
    lattice (in Bohr)    : [7.55469   , 0         , 0         ]
                           [0         , 7.55469   , 0         ]
                           [0         , 0         , 40.0648   ]
    unit cell volume     : 2286.6 Bohr³

    atoms                : As₂Ga₂
    atom potentials      : ElementPsp(Ga, "hgh/pbe/ga-q3.hgh")
                           ElementPsp(As, "hgh/pbe/as-q5.hgh")
                           ElementPsp(Ga, "hgh/pbe/ga-q3.hgh")
                           ElementPsp(As, "hgh/pbe/as-q5.hgh")

    num. electrons       : 16
    spin polarization    : none
    temperature          : 0.001 Ha
    smearing             : DFTK.Smearing.Gaussian()

    terms                : Kinetic()
                           AtomicLocal()
                           AtomicNonlocal()
                           Ewald(nothing)
                           PspCorrection()
                           Hartree()
                           Xc(gga_x_pbe, gga_c_pbe)
                           Entropy()

In the above we use the pseudopotential keyword argument to assign the respective pseudopotentials to the imported model.atoms. Try lowering the SCF convergence tolerance (tol) or try mixing=KerkerMixing() to see the full challenge of this system.

basis  = PlaneWaveBasis(model; Ecut, kgrid)
scfres = self_consistent_field(basis; tol=1e-6, mixing=LdosMixing());
n     Energy            log10(ΔE)   log10(Δρ)   Diag   Δtime
---   ---------------   ---------   ---------   ----   ------
  1   -16.58915101740                   -0.58    5.3    507ms
  2   -16.72537205183       -0.87       -1.01    1.0    283ms
  3   -16.73068577706       -2.27       -1.57    2.3    320ms
  4   -16.73125673096       -3.24       -2.16    1.0    258ms
  5   -16.73132499398       -4.17       -2.59    1.7    267ms
  6   -16.73133426683       -5.03       -2.88    2.1    337ms
  7   -16.73110163974   +   -3.63       -2.62    2.0    316ms
  8   -16.73111101053       -5.03       -2.60    2.2    306ms
  9   -16.73113873479       -4.56       -2.64    2.1    321ms
 10   -16.73130163371       -3.79       -2.98    1.0    237ms
 11   -16.73133531456       -4.47       -3.38    1.2    248ms
 12   -16.73133887934       -5.45       -3.70    1.3    250ms
 13   -16.73133999101       -5.95       -4.07    1.8    295ms
 14   -16.73134019038       -6.70       -4.51    1.0    239ms
 15   -16.73134019616       -8.24       -4.73    1.9    268ms
 16   -16.73134019694       -9.11       -5.04    1.2    249ms
 17   -16.73134020037       -8.46       -5.40    1.4    262ms
 18   -16.73134020040      -10.51       -5.82    1.1    241ms
 19   -16.73134020041      -10.92       -5.99    1.6    260ms
 20   -16.73134020043      -10.76       -6.33    1.4    252ms
scfres.energies
Energy breakdown (in Ha):
    Kinetic             5.8593979 
    AtomicLocal         -105.6100194
    AtomicNonlocal      2.3494813 
    Ewald               35.5044300
    PspCorrection       0.2016043 
    Hartree             49.5614332
    Xc                  -4.5976639
    Entropy             -0.0000035

    total               -16.731340200432