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.

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

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.

model = model_LDA(lattice, atoms, positions)
basis = PlaneWaveBasis(model; Ecut=5, kgrid=(1, 1, 1))
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 ...)

scfres = direct_minimization(basis; tol=1e-3);
ψ, _ = DFTK.select_occupied_orbitals(basis, scfres.ψ, scfres.occupation)
scfres_newton = newton(basis, ψ; tol=1e-12)
(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.3000838204844498 -0.38651676076138597 … -0.6442304016759319 -0.38651676076138597; -0.3865167607613855 -0.7681321217768902 … -0.25003406483655016 -0.24218268965121845; … ; -0.6442304016759325 -0.25003406483655144 … -3.021154286108645 -1.4664153489045082; -0.38651676076138664 -0.24218268965121906 … -1.4664153489045082 -0.7681321217768909;;; -0.38651676076138636 -0.768132121776891 … -0.2500340648365508 -0.24218268965121917; -0.768132121776891 -1.8161936706060129 … -0.13699557143111532 -0.3129884204939666; … ; -0.2500340648365512 -0.13699557143111618 … -0.9870510298301413 -0.5277759153846143; -0.2421826896512194 -0.31298842049396663 … -0.527775915384614 -0.31298842049396625;;; -0.6442304016759328 -1.4664153489045084 … -0.08831357031439235 -0.25003406483655155; -1.4664153489045086 -4.114878101698636 … -0.14040892324046153 -0.5277759153846154; … ; -0.08831357031439296 -0.14040892324046184 … -0.2698375024260708 -0.14040892324046036; -0.25003406483655166 -0.5277759153846152 … -0.14040892324046036 -0.13699557143111532;;; … ;;; -0.9859863776629753 -0.35824744851610085 … -4.090627806711935 -2.29024663594558; -0.35824744851610074 -0.08635610801077623 … -1.4293432742461858 -0.8160371791715014; … ; -4.090627806711936 -1.4293432742461873 … -8.358403967979378 -8.33163370910521; -2.290246635945581 -0.8160371791715015 … -8.33163370910521 -5.770468454471793;;; -0.6442304016759323 -0.250034064836551 … -3.0211542861086462 -1.4664153489045084; -0.25003406483655094 -0.13699557143111532 … -0.9870510298301413 -0.5277759153846147; … ; -3.0211542861086467 -0.9870510298301428 … -12.395558685839042 -8.358412346516134; -1.4664153489045086 -0.5277759153846152 … -8.358412346516134 -4.114878101698635;;; -0.3865167607613861 -0.24218268965121875 … -1.4664153489045078 -0.7681321217768909; -0.24218268965121853 -0.31298842049396564 … -0.5277759153846142 -0.31298842049396597; … ; -1.4664153489045084 -0.5277759153846157 … -8.358412346516134 -4.114878101698635; -0.7681321217768915 -0.3129884204939667 … -4.114878101698635 -1.8161936706060136]), 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.014723478195035007im 0.05414494805835375 - 0.0224275718197569im … 0.0037550740153000813 - 0.00906555061545225im -0.0037550740153000813 + 0.00906555061545225im; … ; 0.0 + 0.036896930431453305im 0.0 + 0.054608091620134955im … -0.018575895426229238 + 0.0im 0.0 + 0.0im; 0.014723478195035009 + 0.035545620743758055im 0.022427571819756905 + 0.05414494805835375im … 0.00906555061545225 + 0.0037550740153000813im 0.00906555061545225 + 0.0037550740153000813im], [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.41475374316561453 0.39667717339733616 … 0.35153735663026525 0.3966771733975369; 0.39667717340334624 0.3789391676693678 … 0.32946849924319965 0.377308490818607; … ; 0.3515373566181759 0.3294684992269345 … 0.3055322803060768 0.3369272441333835; 0.3966771733914992 0.3773084908072613 … 0.336927244139906 0.37893916765883773;;; 0.39667717339756614 0.3789391676642264 … 0.32946849923804095 0.377308490812791; 0.3789391676698928 0.35629277124182734 … 0.3081672339869235 0.3613386510301069; … ; 0.32946849922653837 0.3081672339715156 … 0.29252956934507574 0.3213553061902439; 0.3773084908070859 0.36133865101933565 … 0.32135530619660435 0.3613386510185202;;; 0.3515373566293567 0.33692724414281244 … 0.27624730570044953 0.3294684992375798; 0.33692724414744357 0.3170936258954595 … 0.2653418753193734 0.32135530620585534; … ; 0.27624730569042 0.2653418753059909 … 0.23782576132334038 0.26534187530420633; 0.3294684992326233 0.32135530619664876 … 0.26534187530980047 0.30816723397601514;;; … ;;; 0.30430508253808053 0.2747728361117635 … 0.2897747264675414 0.30205476271222753; 0.2747728361159241 0.2424981276472218 … 0.2670898552804407 0.2793703352797859; … ; 0.28977472646072205 0.2670898552703966 … 0.2926353972810001 0.29263539727848337; 0.302054762708519 0.27937033527222926 … 0.2926353972819485 0.29811662664974764;;; 0.35153735662930413 0.3294684992370022 … 0.30553228031321983 0.33692724414367925; 0.3294684992421389 0.30816723398538143 … 0.2925295693570362 0.32135530620549035; … ; 0.30553228030388185 0.29252956934363106 … 0.2835430036713217 0.2926353972765311; 0.33692724413868125 0.321355306195794 … 0.29263539728118415 0.3170936258894812;;; 0.39667717339722613 0.3773084908122754 … 0.33692724414436953 0.3789391676644979; 0.37730849081805257 0.361338651029003 … 0.3213553062060438 0.36133865102957774; … ; 0.33692724413300784 0.32135530619039077 … 0.2926353972783432 0.31709362588468365; 0.3789391676586651 0.3613386510185871 … 0.3170936258905572 0.35629277123293196]), 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.5113149641926482 -0.5025077544809903 … -0.47663248325718116 -0.5025077544812517; -0.5025077544826246 -0.48588487146003934 … -0.4764704240172064 -0.49665680134047807; … ; -0.47663248325309787 -0.4764704240128327 … -0.3891035353009513 -0.44527691907867145; -0.5025077544796209 -0.49665680133770573 … -0.44527691908168326 -0.48588487145738635;;; -0.502507754481137 -0.4858848714588353 … -0.47647042401540385 -0.4966568013388017; -0.48588487146074905 -0.44768088614542056 … -0.46911089882716056 -0.48896245601853955; … ; -0.47647042401211376 -0.46911089882325807 … -0.4361387873457262 -0.46613036404502867; -0.49665680133736456 -0.4889624560156626 … -0.4661303640473361 -0.48896245601482946;;; -0.4766324832566101 -0.4452769190823922 … -0.4562036919112564 -0.47647042401542944; -0.44527691908425604 -0.3805736265909459 … -0.45136507975724616 -0.4661303640509873; … ; -0.45620369190861415 -0.4513650797537784 … -0.4363491190470814 -0.4513650797517924; -0.47647042401412254 -0.46613036404818387 … -0.4513650797535205 -0.4691108988237475;;; … ;;; -0.44219177355948525 -0.44991004399404794 … -0.3545229620000562 -0.4023490353978514; -0.44991004399504764 -0.441696144026268 … -0.4041068100591702 -0.4355541400385918; … ; -0.3545229619981994 -0.4041068100568615 … -0.2948006187933165 -0.29480061879279157; -0.4023490353967618 -0.4355541400366686 … -0.29480061879411573 -0.3375734615385109;;; -0.4766324832573787 -0.4764704240155188 … -0.38910353530606867 -0.4452769190842905; -0.47647042401675493 -0.4691108988260976 … -0.4361387873518252 -0.4661303640511775; … ; -0.38910353530169023 -0.43613878734739686 … -0.21186524619138603 -0.29480061879063907; -0.4452769190824275 -0.46613036404845126 … -0.294800618794393 -0.38057362659088784;;; -0.502507754481322 -0.4966568013387292 … -0.4452769190841443 -0.4858848714597245; -0.4966568013401088 -0.48896245601747684 … -0.4661303640512904 -0.4889624560184318; … ; -0.4452769190794142 -0.46613036404649905 … -0.2948006187909984 -0.38057362658686045; -0.48588487145785597 -0.488962456015637 … -0.38057362659056926 -0.4476808861435377])], 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.3966450415114835 -0.4923473418450401 … -0.7693255283028478 -0.4923473418451008; -0.4923473418406639 -0.8750778255675618 … -0.3970359896105569 -0.3615310001730895; … ; -0.7693255283108544 -0.3970359896224496 … -3.1047255411035195 -1.574765023849796; -0.49234734184950835 -0.3615310001816635 … -1.5747650238462854 -0.8750778255754396;;; -0.49234734184495726 -0.8750778255714999 … -0.3970359896139137 -0.36153100017722983; -0.8750778255677474 -1.9075817855096062 … -0.2979392362713523 -0.4406122254823992; … ; -0.3970359896221266 -0.2979392362828587 … -1.1306602478307917 -0.672550973239399; -0.3615310001814981 -0.4406122254902936 … -0.6725509732353457 -0.4406122254902755;;; -0.7693255283031862 -1.5747650238440882 … -0.26826995652519925 -0.3970359896144012; -1.574765023841321 -4.178358102394123 … -0.3264321276783343 -0.6725509732297474; … ; -0.2682699565325871 -0.3264321276882493 … -0.4683608601498118 -0.3264321276880464; -0.3970359896180509 -0.6725509732361503 … -0.3264321276841804 -0.29793923627884766;;; … ;;; -1.12387306868438 -0.5333846563983853 … -4.15537604224445 -2.3905409086312037; -0.5333846563952243 -0.2855541243898224 … -1.5663602290249152 -0.9722209839303073; … ; -4.155376042249413 -1.5663602290326522 … -8.360569189491693 -8.333798930619519; -2.390540908633824 -0.9722209839359409 … -8.333798930617377 -5.809925289360557;;; -0.7693255283040068 -0.3970359896150676 … -3.1047255411014953 -1.5747650238451196; -0.397035989611167 -0.2979392362718315 … -1.1306602478249301 -0.6725509732303019; … ; -3.104725541106455 -1.1306602478339087 … -12.323880928359108 -8.360577568030243; -1.574765023848255 -0.6725509732372725 … -8.360577568029342 -4.178358102400042;;; -0.49234734184548196 -0.36153100017767253 … -1.5747650238442825 -0.8750778255721174; -0.3615310001732748 -0.4406122254824395 … -0.6725509732298608 -0.44061222548282003; … ; -1.5747650238509148 -0.672550973240724 … -8.360577568028791 -4.1783581024008125; -0.8750778255760824 -0.4406122254910166 … -4.178358102398647 -1.9075817855166193]), 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.014723478195035007im 0.05414494805835375 - 0.0224275718197569im … 0.0037550740153000813 - 0.00906555061545225im -0.0037550740153000813 + 0.00906555061545225im; … ; 0.0 + 0.036896930431453305im 0.0 + 0.054608091620134955im … -0.018575895426229238 + 0.0im 0.0 + 0.0im; 0.014723478195035009 + 0.035545620743758055im 0.022427571819756905 + 0.05414494805835375im … 0.00906555061545225 + 0.0037550740153000813im 0.00906555061545225 + 0.0037550740153000813im], [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}[[-3.469155569668994e-6 + 2.2923387424647265e-6im 1.1031765785710356e-7 - 5.6825880870852896e-6im … 0.11799028155437619 - 0.05411304207807933im 2.9940860378893625e-6 + 1.5135890478466708e-6im; -6.722351180631113e-6 + 2.3954923675699593e-6im 4.817587698963301e-5 - 3.584222605466798e-7im … -8.045708325825408e-6 + 3.5450979924281583e-6im 3.472306011948244e-5 - 3.2404158259628076e-5im; … ; 0.010729915447604058 + 0.04023606385450679im 3.1937861062174783e-6 - 6.8063413136920825e-6im … 0.15035079897477285 - 0.016211358523728826im 8.68807193011255e-6 - 6.115991631329069e-6im; -6.306174664481453e-6 + 1.5023133235300092e-6im 6.254467708907558e-5 + 2.4917983429634696e-7im … -1.1711969842431316e-5 + 5.286830382138974e-6im 4.105114835713822e-5 - 2.913841581422289e-5im;;; 9.231900593421588e-6 + 8.629588531648997e-7im -5.818984387875332e-6 - 1.8721223214924327e-5im … -7.587322979162346e-6 + 7.00702691069607e-6im -3.21546430023078e-5 - 7.931274221013113e-5im; 2.9374037887410864e-5 + 6.679924425072396e-5im -3.915373087561405e-6 - 4.9140539646179855e-6im … 1.0922108733691648e-5 + 2.589333058142825e-5im -3.573794478767893e-5 - 6.254003095172181e-5im; … ; 1.3100373364318612e-5 - 9.758945324245963e-6im -1.424489912360717e-6 - 6.446001043776714e-6im … -6.429215047010044e-6 - 4.813466613763961e-6im -1.7635977699491035e-5 - 4.535551159080561e-5im; 3.215710257529735e-5 + 9.098407243144152e-5im 7.855561651120794e-6 - 3.045946168109528e-5im … 4.0857644025844825e-6 + 3.5683415535507225e-5im -2.3798904120306208e-5 - 8.776069315957645e-5im;;; -0.17924149525674402 + 0.06948345393477456im 2.5424443593842708e-5 - 2.0997480212234746e-5im … -0.01771050817480072 + 0.0044443519314878105im 1.3224658945120234e-5 - 6.937175228671047e-6im; 2.8100645207193918e-5 - 1.6991105611716614e-5im -7.010139401587276e-5 + 4.86856008055036e-5im … 1.0268261402630306e-5 - 6.553397736535043e-6im -3.655413715574847e-5 + 1.0179378290311946e-5im; … ; -0.04872406308393713 + 0.031724709843606855im 9.832134511509722e-6 - 8.033436067535916e-6im … 0.09499455754151115 - 0.019381845023598306im 2.1073693804477126e-6 - 1.82433659813368e-6im; 1.0013776877111628e-5 - 7.154982886933174e-6im -1.9346197386323395e-5 + 3.0375781869494834e-5im … -7.672050371985998e-6 + 3.5300770739994333e-6im 2.1652121503474276e-5 - 1.2312141753131819e-5im;;; … ;;; 1.2895941870059124e-6 - 5.199312971969169e-6im 3.0190403357644032e-5 + 7.097232199748367e-5im … -1.9704255261091337e-5 + 9.783112301175779e-6im 3.8027440987166726e-6 + 9.285965189970994e-6im; -3.0224722654278093e-5 - 8.770401072807794e-5im 2.2055260750105032e-5 + 7.422517521404901e-5im … -1.225169432668531e-5 - 1.7798664996104757e-5im -2.655645736884351e-7 + 1.78541100573653e-5im; … ; 1.1239245092065663e-5 - 1.5294489626084105e-5im 2.6546600796442955e-6 + 4.5888435716554466e-6im … -7.899712182864469e-6 + 8.035195026948374e-7im -1.9717240596267587e-5 - 4.817391810743998e-5im; -1.46047509178764e-5 - 3.51657884767183e-5im 1.6741061759277008e-5 + 3.0369333218861094e-5im … 2.6010727207437005e-6 + 3.499568778776962e-5im -8.869622420477386e-6 - 3.704736499583928e-5im;;; -0.17924149526459857 + 0.0694834539280007im 1.2161767051992177e-5 - 9.5895229029312e-6im … -0.07153756556771868 + 0.01794986355271405im 2.8877136005229348e-5 - 1.2381604519515525e-5im; 9.860380522856332e-6 - 6.825780305877536e-6im 2.4329755556820332e-5 - 1.4959113542634466e-6im … 1.3588273323247196e-5 - 8.712784784148254e-6im -3.918808678067712e-5 - 4.6029551011416615e-7im; … ; -0.19681866510627916 + 0.1281504918122971im 2.2521029454243843e-5 - 1.5967698708885357e-5im … -0.0505137324144776 + 0.055601476381322144im 3.4196223132136367e-5 - 2.0599581744648836e-5im; 2.859892561786456e-5 - 1.8060496736987047e-5im -2.198015029098811e-5 + 1.9736108839833144e-5im … 2.3531629479296483e-5 - 1.4301424926194658e-5im -7.786817697284547e-5 + 1.7312090817942288e-5im;;; 5.882069232187831e-6 - 6.711465454795885e-6im 3.8291695134159113e-5 + 8.762344529741919e-5im … -2.741209755682408e-5 + 1.0781648938302082e-5im 1.1448705131836444e-5 + 2.634491286893305e-5im; -2.777909212581393e-5 - 8.895616388794418e-5im 2.4832729380054837e-5 + 8.709878627460444e-5im … -3.2985344056455164e-5 - 7.561135607465417e-5im -6.821735736700116e-6 + 2.9797553322163112e-5im; … ; 1.9160863146691053e-5 - 2.6962568377668638e-5im 2.5935761461650788e-5 + 5.789612840885693e-5im … -1.4243171685520912e-5 - 8.551915478378894e-6im 9.278353839047111e-6 + 1.895476115648644e-5im; -2.535792876018741e-5 - 6.493897547462526e-5im 3.67717686415348e-5 + 6.187812646583765e-5im … -3.803761639072219e-5 - 6.526774071535363e-5im 4.7788439530773066e-6 + 4.361218321722674e-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.277715861368875), converged = true, ρ = [0.0961072013159559 0.09085401337841797 … 0.07655587366860316 0.09085401337857095; 0.0908540133793742 0.08147776990930061 … 0.0764715184084031 0.08747433053382583; … ; 0.0765558736664769 0.07647151840612733 … 0.039565804954120896 0.06138424717518419; 0.09085401337761675 0.08747433053224503 … 0.061384247176533346 0.08147776990785928;;; 0.09085401337850381 0.08147776990864644 … 0.07647151840746516 0.08747433053286993; 0.08147776990968615 0.062467573647068564 … 0.07270707893313165 0.08316148815302069; … ; 0.07647151840575327 0.0727070789311697 … 0.05738308452452654 0.0712191419684215; 0.08747433053205053 0.08316148815143577 … 0.07121914196956532 0.08316148815097678;;; 0.07655587366830578 0.061384247176850926 … 0.06641329348271939 0.07647151840747848; 0.06138424717768585 0.03680319832548494 … 0.06415300528629252 0.07121914197137524; … ; 0.06641329348147051 0.06415300528469169 … 0.05747311920974934 0.06415300528377485; 0.07647151840679847 0.07121914196998554 … 0.06415300528457264 0.07270707893141579;;; … ;;; 0.06001281548294491 0.06348370462340581 … 0.029186011399876324 0.044131418817125456; 0.06348370462386403 0.059794460955257575 … 0.04476312021516166 0.05713332556676524; … ; 0.02918601139937584 0.04476312021432792 … 0.01592508414542263 0.015925084145329248; 0.04413141881673578 0.05713332556594488 … 0.01592508414556482 0.02485744320722874;;; 0.076555873668706 0.07647151840752502 … 0.03956580495581947 0.06138424717770127; 0.07647151840816818 0.07270707893259724 … 0.05738308452713587 0.07121914197146953; … ; 0.039565804954366166 0.05738308452524132 … 0.005337878765126372 0.015925084144946308; 0.06138424717686673 0.07121914197011808 … 0.01592508414561416 0.036803198325466614;;; 0.09085401337861211 0.08747433053282863 … 0.06138424717763582 0.08147776990912951; 0.08747433053361528 0.08316148815243524 … 0.07121914197152547 0.08316148815296136; … ; 0.061384247175516916 0.07121914196915038 … 0.01592508414501023 0.03680319832419436; 0.08147776990811438 0.08316148815142163 … 0.03680319832536596 0.06246757364621503;;;;], eigenvalues = Any[[-0.1621759458833527, -0.07512573394629946, -0.0751257339455049, -0.07512573394493662, -0.07512573394392638, -0.010168114056368716, -0.010168114056162417, -0.010168114056014182, -0.01016811405576871, -0.010168114055595858  …  0.22436299901031465, 0.22436299901164466, 0.22436299901174264, 0.22436299901194381, 0.22436299901222304, 0.22436299901331547, 0.22436299901364026, 0.2705989718862913, 0.27059897188651, 0.2705989718866873]], 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.7984323491222117 + 0.5275858608877267im -5.99063722619194e-12 - 5.222836188057203e-13im … -2.3332989905527747e-13 - 1.6849342758262244e-14im 1.5173125647897304e-13 + 5.42668174800939e-15im; 1.511586049472019e-12 - 7.688377053264423e-12im -0.49461162994391766 - 0.04230343406638519im … 1.0631612142370417e-12 + 1.8712350517595194e-12im -2.191159253212417e-12 - 2.221630888254295e-12im; … ; 4.473789855284974e-12 + 4.9495568369773216e-12im -1.8262044437430958e-12 + 1.1897036636991317e-12im … -1.8374330987389227e-12 + 6.603843196229301e-11im 1.2410509871225886e-10 + 1.9358183352607755e-10im; 1.0874565219005733e-12 + 8.575045305880354e-13im 0.031125739835612478 - 0.3636312637961112im … -1.1852954678647893e-12 + 5.655994116533233e-12im 2.774838883003733e-12 + 2.5179341239834325e-13im]], stage = :finalize, algorithm = "Newton")
scfres_newton.energies
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