Creating supercells with pymatgen

The Pymatgen python library allows to setup solid-state calculations using a flexible set of classes as well as an API to an online data base of structures. Its Structure and Lattice objects are directly supported by the DFTK load_atoms and load_lattice functions, such that DFTK may be readily used to run calculation on systems defined in pymatgen. Using the pymatgen_structure function a conversion from DFTK to pymatgen structures is also possible. In the following we use this to create a silicon supercell and find its LDA ground state using direct minimisation. To run this example Julia's PyCall package needs to be able to find an installation of pymatgen.

First we setup the silicon lattice in DFTK.

In [1]:
using DFTK

a = 10.263141334305942  # Lattice constant in Bohr
lattice = a / 2 .* [[0 1 1.]; [1 0 1.]; [1 1 0.]]
Si = ElementPsp(:Si, psp=load_psp("hgh/lda/Si-q4"))
atoms     = [Si, Si]
positions = [ones(3)/8, -ones(3)/8];

Next we make a [2, 2, 2] supercell using pymatgen

In [2]:
pystruct = pymatgen_structure(lattice, atoms, positions)
pystruct.make_supercell([2, 2, 2])
lattice   = load_lattice(pystruct)
positions = load_positions(pystruct)
atoms     = fill(Si, length(positions));

Setup an LDA model and discretize using a single k-point and a small Ecut of 5 Hartree.

In [3]:
model = model_LDA(lattice, atoms, positions)
basis = PlaneWaveBasis(model; Ecut=5, kgrid=(1, 1, 1))
Out[3]:
PlaneWaveBasis discretization:
    Ecut                 : 5.0 Ha
    fft_size             : (32, 32, 32), 32768 total points
    kgrid type           : Monkhorst-Pack
    kgrid                : [1, 1, 1]
    num. irred. kpoints  : 1

    Discretized Model(lda_x+lda_c_pw, 3D):
        lattice (in Bohr)    : [0         , 10.2631   , 10.2631   ]
                               [10.2631   , 0         , 10.2631   ]
                               [10.2631   , 10.2631   , 0         ]
        unit cell volume     : 2162.1 Bohr³
    
        atoms                : Si₁₆
        atom potentials      : ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
                               ElementPsp(Si, psp="hgh/lda/si-q4")
    
        num. electrons       : 64
        spin polarization    : none
        temperature          : 0 Ha
    
        terms                : Kinetic()
                               AtomicLocal()
                               AtomicNonlocal()
                               Ewald()
                               PspCorrection()
                               Hartree()
                               Xc([:lda_x, :lda_c_pw])

Find the ground state using direct minimisation and newton (always using SCF is boring ...)

In [4]:
scfres = direct_minimization(basis; tol=1e-3);
ψ, _ = DFTK.select_occupied_orbitals(basis, scfres.ψ, scfres.occupation)
scfres_newton = newton(basis, ψ; tol=1e-12)
Iter     Function value   Gradient norm 
     0     1.120048e+02     1.525396e+00
 * time: 0.5902152061462402
     1     1.127036e+01     8.189057e-01
 * time: 2.4584741592407227
     2    -1.152890e+01     9.552662e-01
 * time: 2.6955552101135254
     3    -3.401250e+01     7.468641e-01
 * time: 2.878552198410034
     4    -4.741022e+01     5.061573e-01
 * time: 3.025879144668579
     5    -5.703358e+01     2.191844e-01
 * time: 3.1836791038513184
     6    -5.986572e+01     1.394326e-01
 * time: 3.303861141204834
     7    -6.098096e+01     7.152503e-02
 * time: 3.3976900577545166
     8    -6.142734e+01     4.576275e-02
 * time: 3.4935381412506104
     9    -6.167419e+01     4.744640e-02
 * time: 3.591500997543335
    10    -6.185951e+01     2.671711e-02
 * time: 3.7146730422973633
    11    -6.199614e+01     1.930102e-02
 * time: 3.8106980323791504
    12    -6.207808e+01     1.533405e-02
 * time: 3.9066481590270996
    13    -6.212255e+01     1.385274e-02
 * time: 4.004629135131836
    14    -6.216393e+01     1.564542e-02
 * time: 4.103201150894165
    15    -6.218646e+01     1.046991e-02
 * time: 4.2109620571136475
    16    -6.220298e+01     7.399533e-03
 * time: 4.311354160308838
    17    -6.221487e+01     8.491046e-03
 * time: 4.410684108734131
    18    -6.222475e+01     6.712042e-03
 * time: 4.513747215270996
    19    -6.223295e+01     5.006110e-03
 * time: 4.61335015296936
    20    -6.224055e+01     5.654390e-03
 * time: 4.720158100128174
    21    -6.224797e+01     5.854513e-03
 * time: 4.816572189331055
    22    -6.225505e+01     5.276107e-03
 * time: 4.9126410484313965
    23    -6.226149e+01     5.415154e-03
 * time: 5.012861013412476
    24    -6.226682e+01     4.335276e-03
 * time: 5.122275114059448
    25    -6.227045e+01     3.263879e-03
 * time: 5.223003149032593
    26    -6.227291e+01     2.490833e-03
 * time: 5.320082187652588
    27    -6.227455e+01     1.960251e-03
 * time: 5.420716047286987
    28    -6.227562e+01     1.696103e-03
 * time: 5.52124810218811
    29    -6.227635e+01     1.580541e-03
 * time: 5.627503156661987
    30    -6.227685e+01     1.257267e-03
 * time: 5.724213123321533
    31    -6.227719e+01     9.986567e-04
 * time: 5.822373151779175
    32    -6.227741e+01     8.464753e-04
 * time: 5.926659107208252
    33    -6.227755e+01     6.389858e-04
 * time: 6.0268261432647705
    34    -6.227764e+01     3.939855e-04
 * time: 6.134883165359497
    35    -6.227768e+01     3.317042e-04
 * time: 6.233082056045532
n     Energy            log10(ΔE)   log10(Δρ)
---   ---------------   ---------   ---------
  1   -62.27771586100                   -3.08
  2   -62.27771586137       -9.43       -5.24
  3   -62.27771586137   +  -13.85      -10.53
  4   -62.27771586137      -13.85      -15.21
Out[4]:
(ham = Hamiltonian(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), HamiltonianBlock[DFTK.DftHamiltonianBlock(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139), Any[DFTK.FourierMultiplication{Float64, Vector{Float64}}(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139), [0.0, 0.14054984958423578, 0.5621993983369431, 1.264948646258122, 2.2487975933477724, 3.513746239605895, 3.513746239605895, 2.2487975933477724, 1.264948646258122, 0.5621993983369431  …  1.1243987966738864, 2.014547844040713, 3.185796590576011, 4.638145036279781, 4.12279558780425, 2.7641470418233043, 1.6865981950108295, 0.8901490473668268, 0.37479959889129544, 0.14054984958423578]), DFTK.RealSpaceMultiplication{Float64, Array{Float64, 3}}(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139), [-0.3000838204844399 -0.38651676076137903 … -0.6442304016759204 -0.38651676076137265; -0.38651676076137914 -0.768132121776889 … -0.2500340648365427 -0.24218268965121173; … ; -0.6442304016759205 -0.25003406483654256 … -3.0211542861086325 -1.4664153489044962; -0.3865167607613723 -0.24218268965121167 … -1.466415348904496 -0.7681321217768756;;; -0.3865167607613794 -0.7681321217768898 … -0.25003406483654234 -0.24218268965121173; -0.7681321217768898 -1.8161936706060218 … -0.13699557143111138 -0.312988420493962; … ; -0.25003406483654256 -0.1369955714311113 … -0.9870510298301364 -0.5277759153846058; -0.24218268965121126 -0.3129884204939619 … -0.5277759153846058 -0.3129884204939551;;; -0.6442304016759322 -1.4664153489045144 … -0.08831357031438808 -0.25003406483654783; -1.4664153489045144 -4.114878101698644 … -0.14040892324045914 -0.5277759153846148; … ; -0.08831357031438869 -0.14040892324045884 … -0.26983750242606713 -0.14040892324045487; -0.2500340648365478 -0.5277759153846147 … -0.14040892324045426 -0.1369955714311098;;; … ;;; -0.9859863776629684 -0.35824744851609447 … -4.090627806711926 -2.29024663594557; -0.3582474485160943 -0.08635610801077073 … -1.4293432742461814 -0.8160371791714962; … ; -4.090627806711926 -1.4293432742461816 … -8.358403967979397 -8.33163370910521; -2.29024663594557 -0.8160371791714959 … -8.33163370910521 -5.7704684544717795;;; -0.6442304016759217 -0.25003406483654367 … -3.021154286108632 -1.466415348904497; -0.25003406483654367 -0.13699557143111163 … -0.9870510298301353 -0.5277759153846068; … ; -3.021154286108632 -0.9870510298301354 … -12.395558685839045 -8.358412346516113; -1.4664153489044969 -0.5277759153846068 … -8.358412346516113 -4.114878101698615;;; -0.3865167607613733 -0.24218268965121195 … -1.4664153489044964 -0.7681321217768768; -0.24218268965121206 -0.31298842049396153 … -0.5277759153846063 -0.3129884204939567; … ; -1.4664153489044964 -0.5277759153846062 … -8.358412346516115 -4.114878101698615; -0.7681321217768764 -0.3129884204939567 … -4.114878101698615 -1.8161936706059967]), DFTK.NonlocalOperator{Float64, Matrix{ComplexF64}, Matrix{Float64}}(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139), ComplexF64[0.039452912441695784 + 0.0im 0.061120189138426866 + 0.0im … 0.0 + 0.0im 0.0 + 0.0im; 0.035545620743758055 - 0.014723478195035009im 0.05414494805835375 - 0.022427571819756905im … 0.0037550740153000865 - 0.009065550615452249im -0.0037550740153000865 + 0.009065550615452249im; … ; 2.259285387562093e-18 + 0.036896930431453305im 3.3437812305071837e-18 + 0.054608091620134955im … -0.018575895426229238 + 4.09595376946258e-17im 0.0 - 0.0im; 0.014723478195035012 + 0.035545620743758055im 0.022427571819756905 + 0.05414494805835375im … 0.009065550615452257 + 0.003755074015300066im 0.009065550615452257 + 0.003755074015300066im], [5.90692831 -1.26189397 … 0.0 0.0; -1.26189397 3.25819622 … 0.0 0.0; … ; 0.0 0.0 … 2.72701346 0.0; 0.0 0.0 … 0.0 2.72701346]), DFTK.NoopOperator{Float64}(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139)), DFTK.NoopOperator{Float64}(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139)), DFTK.RealSpaceMultiplication{Float64, Array{Float64, 3}}(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139), [0.4147537431601285 0.39667717338960506 … 0.35153735662859137 0.39667717339458536; 0.39667717339330577 0.37893916765846397 … 0.3294684992372255 0.3773084908105953; … ; 0.35153735662196295 0.32946849922619353 … 0.30553228030982693 0.3369272441391602; 0.39667717339058933 0.3773084908026543 … 0.33692724414166875 0.37893916766064983;;; 0.3966771733934139 0.37893916765825414 … 0.3294684992379557 0.3773084908110106; 0.3789391676612153 0.35629277123274355 … 0.3081672339818286 0.3613386510230137; … ; 0.32946849923120775 0.3081672339714399 … 0.29252956935236996 0.32135530619805697; 0.3773084908072684 0.3613386510160949 … 0.3213553062008781 0.3613386510218078;;; 0.3515373566262716 0.3369272441381847 … 0.27624730570110845 0.3294684992365056; 0.3369272441405568 0.31709362588840406 … 0.26534187531521597 0.3213553062000594; … ; 0.27624730569469264 0.26534187530590037 … 0.2378257613320207 0.2653418753120197; 0.329468499233171 0.3213553061942061 … 0.2653418753149201 0.30816723397951834;;; … ;;; 0.30430508252886523 0.27477283610074327 … 0.2897747264588373 0.30205476270388143; 0.27477283610452613 0.2424981276341722 … 0.2670898552715597 0.27937033526996125; … ; 0.28977472645691993 0.2670898552655353 … 0.29263539727334376 0.29263539727343924; 0.30205476270181125 0.27937033526388455 … 0.2926353972734571 0.29811662664292704;;; 0.3515373566211503 0.3294684992265127 … 0.3055322803067739 0.3369272441371277; 0.329468499230809 0.30816723397237067 … 0.29252956934908125 0.3213553061961512; … ; 0.3055322803026618 0.2925295693401773 … 0.2835430036666111 0.2926353972747244; 0.33692724413393677 0.32135530618842306 … 0.29263539727573296 0.31709362588547635;;; 0.3966771733903586 0.3773084908029082 … 0.33692724414037684 0.3789391676598667; 0.37730849080714546 0.3613386510167192 … 0.32135530619907765 0.36133865102084806; … ; 0.33692724413460146 0.3213553061884389 … 0.2926353972775805 0.31709362588679413; 0.3789391676560116 0.3613386510125088 … 0.31709362588869466 0.35629277123205694]), DFTK.RealSpaceMultiplication{Float64, SubArray{Float64, 3, Array{Float64, 4}, Tuple{Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Int64}, true}}(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139), [-0.5113149641930446 -0.5025077544811749 … -0.47663248325900287 -0.5025077544824738; -0.5025077544821575 -0.4858848714601015 … -0.47647042401748374 -0.4966568013402769; … ; -0.4766324832569685 -0.47647042401397965 … -0.38910353530761327 -0.4452769190849671; -0.5025077544811976 -0.4966568013378562 … -0.44527691908561695 -0.4858848714606189;;; -0.5025077544823896 -0.4858848714602907 … -0.47647042401784606 -0.4966568013405366; -0.48588487146081694 -0.4476808861462245 … -0.4691108988276793 -0.48896245601859456; … ; -0.4764704240159939 -0.469110898824774 … -0.4361387873531781 -0.4661303640514194; -0.4966568013395036 -0.48896245601688837 … -0.4661303640520593 -0.48896245601846816;;; -0.4766324832587162 -0.44527691908471895 … -0.45620369191388777 -0.4764704240175994; -0.4452769190849322 -0.3805736265922534 … -0.45136507975788503 -0.4661303640514213; … ; -0.4562036919122644 -0.45136507975564666 … -0.43634911905428786 -0.45136507975760853; -0.4764704240168066 -0.4661303640503063 … -0.45136507975825113 -0.4691108988274261;;; … ;;; -0.44219177355819195 -0.44991004399224693 … -0.35452296199832806 -0.4023490353965544; -0.44991004399384515 -0.4416961440247727 … -0.40410681005838 -0.4355541400376005; … ; -0.35452296199982225 -0.4041068100570904 … -0.29480061879025804 -0.2948006187936935; -0.40234903539598105 -0.43555414003519766 … -0.2948006187907688 -0.33757346153732937;;; -0.47663248325647184 -0.4764704240139376 … -0.3891035353052453 -0.4452769190837256; -0.4764704240156247 -0.46911089882483825 … -0.4361387873510857 -0.46613036405033637; … ; -0.38910353530391273 -0.4361387873477027 … -0.21186524618927577 -0.2948006187936985; -0.44527691908235595 -0.4661303640472074 … -0.2948006187931423 -0.3805736265911404;;; -0.5025077544810255 -0.4966568013378302 … -0.4452769190847822 -0.4858848714601872; -0.4966568013392508 -0.4889624560167937 … -0.4661303640510691 -0.4889624560179477; … ; -0.4452769190827068 -0.4661303640472664 … -0.2948006187951943 -0.3805736265920204; -0.4858848714587431 -0.4889624560149636 … -0.38057362659258787 -0.4476808861456463])], DFTK.FourierMultiplication{Float64, Vector{Float64}}(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139), [0.0, 0.14054984958423578, 0.5621993983369431, 1.264948646258122, 2.2487975933477724, 3.513746239605895, 3.513746239605895, 2.2487975933477724, 1.264948646258122, 0.5621993983369431  …  1.1243987966738864, 2.014547844040713, 3.185796590576011, 4.638145036279781, 4.12279558780425, 2.7641470418233043, 1.6865981950108295, 0.8901490473668268, 0.37479959889129544, 0.14054984958423578]), DFTK.RealSpaceMultiplication{Float64, Array{Float64, 3}}(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139), [-0.39664504151735597 -0.49234734185294887 … -0.7693255283063318 -0.49234734184926104; -0.4923473418502308 -0.8750778255785265 … -0.397035989616801 -0.36153100018089335; … ; -0.769325528310926 -0.3970359896243287 … -3.104725541106419 -1.574765023850303; -0.49234734185198054 -0.3615310001864136 … -1.574765023848444 -0.8750778255768447;;; -0.4923473418503551 -0.8750778255789264 … -0.3970359896164327 -0.3615310001807377; -0.8750778255764915 -1.9075817855195027 … -0.29793923627696206 -0.4406122254895429; … ; -0.3970359896213287 -0.2979392362844454 … -1.1306602478309444 -0.6725509732379682; -0.3615310001834464 -0.44061222549475537 … -0.672550973235787 -0.44061222549061546;;; -0.7693255283083767 -1.5747650238510487 … -0.2682699565271674 -0.39703598961764164; -1.5747650238488897 -4.178358102402494 … -0.32643212768312824 -0.6725509732359767; … ; -0.26826995653196045 -0.32643212769020513 … -0.4683608601483343 -0.3264321276860437; -0.3970359896201834 -0.6725509732407149 … -0.32643212768378527 -0.2979392362790176;;; … ;;; -1.123873068692295 -0.5333846564075981 … -4.155376042251417 -2.3905409086382434; -0.5333846564054133 -0.28555412440137123 … -1.5663602290330016 -0.9722209839391355; … ; -4.1553760422548285 -1.5663602290377368 … -8.360569189496312 -8.333798930625465; -2.39054090863974 -0.972220983942809 … -8.333798930622521 -5.8099252893661815;;; -0.7693255283112432 -0.3970359896239685 … -3.1047255411071037 -1.5747650238510948; -0.3970359896213594 -0.2979392362835792 … -1.1306602478321397 -0.672550973238792; … ; -3.104725541109883 -1.1306602478376608 … -12.32388092836171 -8.360577568035088; -1.574765023852916 -0.6725509732433912 … -8.360577568033522 -4.178358102404279;;; -0.4923473418520402 -0.36153100018613393 … -1.5747650238489017 -0.8750778255771974; -0.3615310001833174 -0.44061222549403606 … -0.6725509732365977 -0.44061222549105633; … ; -1.5747650238526019 -0.6725509732434337 … -8.36057756803373 -4.178358102403841; -0.8750778255796079 -0.4406122254964115 … -4.178358102402508 -1.907581785519586]), DFTK.NonlocalOperator{Float64, Matrix{ComplexF64}, Matrix{Float64}}(PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), KPoint([     0,      0,      0], spin = 1, num. G vectors =  1139), ComplexF64[0.039452912441695784 + 0.0im 0.061120189138426866 + 0.0im … 0.0 + 0.0im 0.0 + 0.0im; 0.035545620743758055 - 0.014723478195035009im 0.05414494805835375 - 0.022427571819756905im … 0.0037550740153000865 - 0.009065550615452249im -0.0037550740153000865 + 0.009065550615452249im; … ; 2.259285387562093e-18 + 0.036896930431453305im 3.3437812305071837e-18 + 0.054608091620134955im … -0.018575895426229238 + 4.09595376946258e-17im 0.0 - 0.0im; 0.014723478195035012 + 0.035545620743758055im 0.022427571819756905 + 0.05414494805835375im … 0.009065550615452257 + 0.003755074015300066im 0.009065550615452257 + 0.003755074015300066im], [5.90692831 -1.26189397 … 0.0 0.0; -1.26189397 3.25819622 … 0.0 0.0; … ; 0.0 0.0 … 2.72701346 0.0; 0.0 0.0 … 0.0 2.72701346]), nothing, (ψ_reals = Array{ComplexF64, 3}[[1.3391769811479937e-7 - 8.004978247540956e-9im 7.976836053228819e-6 + 1.0594844241663661e-5im … -0.02519333546877771 - 0.026468195386318533im 1.0243568324859201e-5 + 9.184537073330788e-6im; -2.942106216763621e-6 - 3.403976966399166e-6im -8.030418190267069e-6 - 3.37994060170398e-6im … 2.9119806472528893e-6 - 2.270723609505468e-6im -8.417549472658504e-6 - 4.947097192742218e-6im; … ; 0.06906016703475343 + 0.13195349671482307im 2.2346343117140096e-6 - 9.056825306471002e-6im … 0.05123669437690002 + 0.12320781765492397im -1.0336145818666744e-6 - 3.08956154334971e-5im; 4.344282215524337e-6 - 6.169643281892731e-6im -4.018914014276669e-6 - 8.971506825129465e-6im … 1.3296982387792135e-5 - 3.5214896944601356e-6im -3.3779380226630883e-6 - 9.388138403817113e-6im;;; 5.129122667738359e-6 + 1.4055848544958023e-6im 3.1376428074600865e-5 - 9.549760639677396e-7im … 5.965297123354256e-6 + 8.643161759785591e-6im 3.019299164856306e-5 - 9.290100929783507e-6im; -2.249494557409456e-5 + 5.170007270718227e-6im 7.69695094992603e-6 - 6.8286086707744164e-6im … -1.3561696504898523e-5 + 5.281884773151983e-6im 2.458371262089459e-5 - 6.2650954240855765e-6im; … ; 2.0389885509006125e-7 - 1.3882551663924378e-5im 1.948036498107553e-5 - 1.839737979160075e-6im … 1.2863575926963735e-6 - 1.0945945892289089e-5im 1.4289929230841399e-5 - 3.429481010513554e-5im; 1.867678093808818e-5 - 2.34071086905849e-5im 1.1901786333953814e-5 - 1.720910215411146e-5im … 6.316520570701756e-6 - 9.798277806035907e-6im 2.690528384068057e-5 - 1.5258223282122475e-5im;;; -0.1464091364079772 - 0.044020252955297455im -1.4006468495463138e-5 + 1.4677529655003667e-5im … -0.04961760054854131 - 0.02038122265576376im -1.4869100209366266e-6 + 9.916887292955509e-6im; 5.9710005251790575e-5 - 5.9730359577517165e-6im 2.453891551925239e-5 + 2.6167341220438413e-6im … 2.289668366145056e-5 - 3.2481956258800543e-6im 1.2416942669592907e-5 - 4.119207713379239e-7im; … ; -0.022364885666532885 + 0.0254252576364076im -3.3557472453817646e-6 + 9.664311893340911e-6im … 0.04792115658889589 + 0.059102027577891146im 2.3277316776896477e-6 - 1.0744319527942466e-5im; 3.008938427499784e-5 - 5.849939432860053e-6im 1.513754118013534e-5 - 2.9010577688679184e-6im … 1.5225275192963351e-6 - 1.9583307627397646e-6im -6.290333593233589e-7 - 5.335762178273844e-6im;;; … ;;; -9.577447477116919e-7 + 7.095847060476027e-6im 7.073753609773432e-6 + 2.0914249986613573e-5im … 4.306562917736276e-6 + 1.154758050657004e-5im 5.782696947225734e-6 + 8.068111321559512e-6im; -2.6181990795137136e-5 + 3.027010339897243e-5im -6.3319671490836825e-6 + 2.2167545147810203e-6im … -6.011023855604013e-6 + 5.5965003476004475e-6im 4.737339283173632e-6 + 3.7609218248860196e-7im; … ; -4.3110086049642295e-6 - 2.2145127561972733e-5im 2.0967582801040955e-6 - 1.8139907517413008e-5im … 2.3073771537809823e-7 - 1.3518762310299615e-5im -4.4275981075914244e-6 - 4.0765408985892e-5im; 4.457475251476984e-6 + 3.429343652758142e-6im -2.101151628820252e-7 - 3.893361183430286e-6im … 1.554347229027578e-5 - 1.6660598607225152e-5im 1.1336181989624301e-5 - 5.733575411322052e-6im;;; -0.14640913642183123 - 0.044020252948499934im -2.3223795726809772e-6 + 1.0436705770708512e-5im … -0.20043344467711283 - 0.0823311493371332im -1.12925453944756e-5 + 1.2988997199269489e-5im; 2.7403771851509446e-5 - 4.830578914833841e-6im -2.37764526374575e-6 - 3.0777846511267076e-6im … 4.9443818114400614e-5 - 4.839032109732876e-6im 1.4136845454746722e-5 - 2.6331302459773707e-6im; … ; -0.09034448211878379 + 0.1027068521071012im -1.329088853208871e-5 - 1.5004074749626123e-5im … -0.10254259691061238 + 0.06146506582367923im -2.3324123300144196e-5 - 2.7528260000096544e-5im; 6.843388025430932e-5 - 9.284327392748916e-6im 1.685744341311382e-5 - 5.122266086871678e-6im … 7.66269844701876e-5 - 6.0844622715617065e-6im 2.9610609545841308e-5 - 3.93291897903268e-6im;;; 9.827820548885135e-7 + 1.031298311039605e-5im 2.4999985469582062e-5 + 2.83701046057733e-5im … 6.422016598577271e-6 + 2.310776947351667e-5im 1.92539911455405e-5 + 1.8457704855462987e-5im; -4.5884637917818676e-5 + 4.364235915432198e-5im -2.19110896336639e-6 - 1.785738529388947e-6im … -3.361533928281765e-5 + 3.167246415078735e-5im 1.2812381150027976e-5 + 1.6514797588806913e-7im; … ; -6.548264468025344e-6 - 2.7603013408511094e-5im 1.1078005331455844e-5 - 1.1001609985017868e-5im … -8.780923437425224e-7 - 1.6028274435721445e-5im 2.3916017226655767e-6 - 3.706875830267485e-5im; -2.4637713711556284e-6 + 1.3392511498464693e-5im 1.304523960704532e-7 - 1.0778853409438557e-5im … -9.677513467493192e-6 + 1.4159903252664566e-5im 1.2944908376786808e-5 - 7.4069069031308974e-6im]],))]), basis = PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), energies = Energies(total = -62.27771586136885), converged = true, ρ = [0.09610720131619689 0.09085401337852599 … 0.07655587366955173 0.09085401337928593; 0.09085401337910089 0.08147776990933436 … 0.07647151840854736 0.0874743305337111; … ; 0.07655587366849241 0.0764715184067241 … 0.03956580495633214 0.06138424717800436; 0.09085401337853927 0.08747433053233086 … 0.0613842471782955 0.08147776990961544;;; 0.09085401337923671 0.08147776990943713 … 0.07647151840873594 0.08747433053385915; 0.08147776990972305 0.06246757364743302 … 0.07270707893339244 0.083161488153051; … ; 0.07647151840777217 0.07270707893193186 … 0.0573830845277147 0.07121914197158939; 0.0874743305332702 0.08316148815211102 … 0.07121914197190664 0.08316148815298136;;; 0.07655587366940243 0.061384247177893224 … 0.06641329348396313 0.07647151840860758; 0.06138424717798875 0.036803198325897984 … 0.06415300528658743 0.07121914197159036; … ; 0.06641329348319583 0.06415300528555415 … 0.05747311921283578 0.0641530052864598; 0.07647151840819508 0.07121914197103764 … 0.06415300528675645 0.07270707893326515;;; … ;;; 0.060012815482374415 0.06348370462258032 … 0.029186011399410516 0.04413141881666163; 0.0634837046233129 0.059794460954599615 … 0.04476312021487628 0.05713332556634244; … ; 0.029186011399813278 0.0447631202144106 … 0.01592508414487852 0.01592508414548971; 0.04413141881645656 0.05713332556531744 … 0.015925084144969376 0.024857443206943414;;; 0.07655587366823377 0.07647151840670226 … 0.03956580495554615 0.06138424717744822; 0.07647151840758006 0.07270707893196414 … 0.057383084526819485 0.07121914197105259; … ; 0.03956580495510385 0.05738308452537215 … 0.005337878764949694 0.0159250841454906; 0.061384247176834675 0.07121914196950153 … 0.015925084145391646 0.036803198325546405;;; 0.09085401337843854 0.08747433053231599 … 0.06138424717792153 0.08147776990938092; 0.087474330533126 0.08316148815205889 … 0.07121914197141581 0.08316148815269464; … ; 0.061384247176991855 0.07121914196953076 … 0.01592508414575671 0.03680319832582437; 0.08147776990859634 0.08316148815105066 … 0.03680319832600365 0.0624675736471709;;;;], eigenvalues = Any[[-0.16217594588300605, -0.07512573394692346, -0.07512573394523242, -0.07512573394506447, -0.0751257339417111, -0.010168114057323274, -0.010168114056802287, -0.010168114056117762, -0.010168114055539636, -0.010168114054287329  …  0.2243629990110029, 0.22436299901148388, 0.224362999011748, 0.22436299901213255, 0.2243629990133334, 0.22436299901373333, 0.22436299901537826, 0.2705989718869052, 0.27059897188695636, 0.2705989718871794]], occupation = [[2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0  …  2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]], εF = nothing, n_iter = 4, ψ = Matrix{ComplexF64}[[-0.9552905938720355 + 0.05710462323731505im -9.220409491679089e-12 - 6.516999885820216e-12im … -6.353450854286853e-13 - 6.233586173750712e-13im 2.6764562816860245e-14 - 3.738651092951896e-14im; -1.4041946102007158e-11 - 8.503709379928899e-12im 0.36055880384214145 + 0.2549047995286975im … 1.2706678845377612e-11 - 3.0249125304162277e-12im 7.53971101250992e-12 + 2.143506609391505e-12im; … ; -4.965107582876303e-14 - 3.415624154181619e-12im 2.1532845320989465e-12 - 1.393933396230558e-12im … -1.930503259725861e-11 + 1.9656932325081127e-11im 8.316053977779352e-11 - 2.6540592938445115e-11im; -3.743366443101186e-12 + 8.678273807139261e-12im 0.02173578785417042 - 0.030767672957253522im … 7.774427687723667e-12 + 4.711632105791012e-12im -2.962714131305214e-12 + 5.268392099225976e-12im]], stage = :finalize, algorithm = "Newton")
In [5]:
scfres_newton.energies
Out[5]:
Energy breakdown (in Ha):
    Kinetic             25.7697876
    AtomicLocal         -18.8616201
    AtomicNonlocal      14.8540134
    Ewald               -67.1831486
    PspCorrection       -2.3569765
    Hartree             4.8508714 
    Xc                  -19.3506430

    total               -62.277715861369