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.124454e+02     1.491060e+00
 * time: 0.4586191177368164
     1     9.886006e+00     8.400627e-01
 * time: 1.6235570907592773
     2    -1.152950e+01     9.294772e-01
 * time: 1.7259149551391602
     3    -3.400627e+01     7.193806e-01
 * time: 1.8317270278930664
     4    -4.717681e+01     5.392369e-01
 * time: 1.956968069076538
     5    -5.660104e+01     2.404542e-01
 * time: 2.052298069000244
     6    -5.959149e+01     1.813345e-01
 * time: 2.1219780445098877
     7    -6.078908e+01     5.098543e-02
 * time: 2.207474946975708
     8    -6.127874e+01     8.069288e-02
 * time: 2.2764649391174316
     9    -6.154961e+01     4.485597e-02
 * time: 2.345931053161621
    10    -6.178620e+01     2.931876e-02
 * time: 2.422783136367798
    11    -6.195648e+01     2.330523e-02
 * time: 2.4924769401550293
    12    -6.204228e+01     1.763864e-02
 * time: 2.5620810985565186
    13    -6.210847e+01     1.518681e-02
 * time: 2.6392951011657715
    14    -6.214847e+01     1.327201e-02
 * time: 2.7090539932250977
    15    -6.217891e+01     1.092921e-02
 * time: 2.779017925262451
    16    -6.219828e+01     9.284336e-03
 * time: 2.8556859493255615
    17    -6.221298e+01     6.606425e-03
 * time: 2.9251160621643066
    18    -6.222327e+01     6.378292e-03
 * time: 2.9944851398468018
    19    -6.223086e+01     6.840442e-03
 * time: 3.063915967941284
    20    -6.223755e+01     6.259856e-03
 * time: 3.140449047088623
    21    -6.224447e+01     6.055672e-03
 * time: 3.210099935531616
    22    -6.225191e+01     5.872794e-03
 * time: 3.2799811363220215
    23    -6.225917e+01     6.655294e-03
 * time: 3.357002019882202
    24    -6.226560e+01     4.987709e-03
 * time: 3.427215099334717
    25    -6.227019e+01     3.935643e-03
 * time: 3.4973459243774414
    26    -6.227284e+01     2.947136e-03
 * time: 3.5746591091156006
    27    -6.227451e+01     2.608139e-03
 * time: 3.64451003074646
    28    -6.227552e+01     1.730046e-03
 * time: 3.7137739658355713
    29    -6.227624e+01     1.528166e-03
 * time: 3.789989948272705
    30    -6.227677e+01     1.187702e-03
 * time: 3.8592209815979004
    31    -6.227715e+01     1.034173e-03
 * time: 3.928415060043335
    32    -6.227738e+01     7.301344e-04
 * time: 4.005417108535767
    33    -6.227754e+01     7.282833e-04
 * time: 4.075222015380859
    34    -6.227762e+01     5.129118e-04
 * time: 4.144911050796509
    35    -6.227767e+01     4.045435e-04
 * time: 4.221821069717407
n     Energy            log10(ΔE)   log10(Δρ)
---   ---------------   ---------   ---------
  1   -62.27771586072                   -3.03
  2   -62.27771586137       -9.19       -5.14
  3   -62.27771586137      -13.85      -10.12
  4   -62.27771586137   +  -13.85      -15.13
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.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.4147537431690294 0.3966771734007336 … 0.3515373566324805 0.3966771734007332; 0.39667717340073344 0.3789391676675228 … 0.32946849924034305 0.37730849081577034; … ; 0.3515373566324809 0.32946849924034355 … 0.3055322803146656 0.33692724414617437; 0.39667717340073355 0.37730849081577067 … 0.33692724414617414 0.37893916766752245;;; 0.39667717340073344 0.37893916766752295 … 0.32946849924034305 0.37730849081577034; 0.3789391676675226 0.35629277124050834 … 0.3081672339838641 0.3613386510271956; … ; 0.32946849924034344 0.3081672339838645 … 0.2925295693553704 0.32135530620365754; 0.3773084908157705 0.3613386510271958 … 0.32135530620365726 0.3613386510271954;;; 0.35153735663248104 0.3369272441461747 … 0.2762473057026025 0.3294684992403434; 0.3369272441461746 0.3170936258953346 … 0.26534187531665704 0.3213553062036576; … ; 0.27624730570260275 0.26534187531665737 … 0.23782576133390787 0.26534187531665715; 0.3294684992403436 0.32135530620365776 … 0.265341875316657 0.30816723398386425;;; … ;;; 0.3043050825406204 0.2747728361145808 … 0.2897747264689474 0.30205476271423237; 0.2747728361145807 0.24249812764598766 … 0.2670898552797595 0.2793703352786077; … ; 0.28977472646894753 0.26708985527975976 … 0.29263539728460636 0.29263539728460625; 0.30205476271423265 0.2793703352786079 … 0.29263539728460625 0.29811662665409683;;; 0.35153735663248087 0.32946849924034344 … 0.30553228031466556 0.33692724414617425; 0.3294684992403433 0.30816723398386436 … 0.2925295693553702 0.3213553062036574; … ; 0.3055322803146658 0.2925295693553706 … 0.28354300367580454 0.29263539728460625; 0.3369272441461745 0.32135530620365765 … 0.29263539728460614 0.31709362589533424;;; 0.39667717340073333 0.3773084908157706 … 0.3369272441461741 0.3789391676675224; 0.3773084908157703 0.36133865102719576 … 0.3213553062036572 0.3613386510271954; … ; 0.3369272441461745 0.32135530620365765 … 0.29263539728460625 0.31709362589533435; 0.37893916766752267 0.3613386510271958 … 0.31709362589533413 0.356292771240508]), 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.5113149641934649 -0.502507754482049 … -0.4766324832577903 -0.5025077544820489; -0.502507754482049 -0.48588487146019244 … -0.47647042401624956 -0.4966568013396111; … ; -0.4766324832577905 -0.4764704240162498 … -0.38910353530530495 -0.44527691908406686; -0.502507754482049 -0.4966568013396112 … -0.44527691908406664 -0.4858848714601923;;; -0.5025077544820491 -0.48588487146019244 … -0.4764704240162496 -0.49665680133961104; -0.4858848714601923 -0.4476808861457204 … -0.4691108988261616 -0.4889624560175816; … ; -0.4764704240162497 -0.46911089882616175 … -0.4361387873506751 -0.4661303640501862; -0.4966568013396112 -0.48896245601758165 … -0.46613036405018604 -0.48896245601758154;;; -0.47663248325779056 -0.4452769190840669 … -0.4562036919120275 -0.4764704240162497; -0.44527691908406686 -0.3805736265916321 … -0.4513650797562184 -0.46613036405018615; … ; -0.45620369191202753 -0.45136507975621865 … -0.4363491190518314 -0.45136507975621865; -0.4764704240162497 -0.46613036405018615 … -0.4513650797562184 -0.4691108988261617;;; … ;;; -0.4421917735594027 -0.4499100439944882 … -0.35452296199982825 -0.4023490353971862; -0.4499100439944881 -0.4416961440262569 … -0.4041068100588271 -0.43555414003768667; … ; -0.3545229619998284 -0.40410681005882726 … -0.29480061879351255 -0.2948006187935126; -0.40234903539718625 -0.43555414003768694 … -0.29480061879351255 -0.33757346153793366;;; -0.47663248325779056 -0.4764704240162498 … -0.3891035353053049 -0.44527691908406675; -0.4764704240162497 -0.4691108988261617 … -0.43613878735067496 -0.46613036405018615; … ; -0.3891035353053051 -0.4361387873506752 … -0.2118652461903857 -0.29480061879351277; -0.44527691908406686 -0.46613036405018626 … -0.29480061879351255 -0.38057362659163213;;; -0.502507754482049 -0.49665680133961126 … -0.44527691908406664 -0.4858848714601922; -0.4966568013396111 -0.48896245601758165 … -0.46613036405018593 -0.48896245601758154; … ; -0.4452769190840669 -0.46613036405018626 … -0.29480061879351255 -0.38057362659163213; -0.4858848714601923 -0.4889624560175817 … -0.38057362659163196 -0.4476808861457203])], 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.3966450415088853 -0.49234734184270135 … -0.7693255283012417 -0.4923473418427016; -0.49234734184270107 -0.8750778255695598 … -0.3970359896124567 -0.36153100017505924; … ; -0.7693255283012421 -0.3970359896124577 … -3.1047255410992842 -1.5747650238424007; -0.49234734184270207 -0.36153100017505957 … -1.5747650238424007 -0.8750778255695608;;; -0.492347341842702 -0.8750778255695606 … -0.39703598961245734 -0.3615310001750599; -0.8750778255695608 -1.907581785511225 … -0.2979392362734128 -0.4406122254843526; … ; -0.3970359896124575 -0.29793923627341345 … -1.130660247825446 -0.672550973231143; -0.3615310001750601 -0.44061222548435247 … -0.6725509732311428 -0.44061222548435236;;; -0.7693255283012423 -1.5747650238424007 … -0.26826995652381735 -0.3970359896124579; -1.574765023842401 -4.178358102394934 … -0.32643212768002294 -0.672550973231144; … ; -0.26826995652381774 -0.3264321276800231 … -0.4683608601439943 -0.32643212768002183; -0.3970359896124578 -0.6725509732311437 … -0.32643212768002183 -0.2979392362734128;;; … ;;; -1.1238730686817575 -0.5333846563960083 … -4.155376042242816 -2.390540908628534; -0.5333846563960081 -0.28555412439104544 … -1.5663602290252534 -0.9722209839305803; … ; -4.155376042242817 -1.5663602290252547 … -8.360569189488285 -8.333798930614117; -2.3905409086285343 -0.9722209839305807 … -8.333798930614117 -5.80992528935563;;; -0.7693255283012419 -0.39703598961245734 … -3.1047255410992856 -1.5747650238424011; -0.39703598961245734 -0.2979392362734127 … -1.130660247825446 -0.6725509732311434; … ; -3.104725541099286 -1.1306602478254475 … -12.323880928353622 -8.360577568025041; -1.5747650238424011 -0.6725509732311439 … -8.360577568025041 -4.178358102394934;;; -0.49234734184270174 -0.3615310001750594 … -1.5747650238424002 -0.8750778255695608; -0.36153100017505935 -0.4406122254843515 … -0.672550973231143 -0.4406122254843521; … ; -1.5747650238424007 -0.6725509732311443 … -8.360577568025041 -4.178358102394933; -0.8750778255695612 -0.4406122254843526 … -4.178358102394933 -1.9075817855112258]), 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}[[-1.7800255879257126e-7 + 1.4100630578214174e-6im -2.2309276965432e-5 + 3.7679349907794736e-6im … 0.03186869570477454 + 0.13296771658819356im 6.637944016139557e-6 - 3.17709926876854e-6im; 1.8984758329272952e-6 - 1.9443779946301452e-5im 7.098264112984533e-6 + 1.1204229176865875e-6im … 2.3896959654753242e-5 + 9.920150499307605e-6im -2.4361166249571272e-5 + 6.1317198117023284e-6im; … ; 0.06651761774214845 - 0.12645450217911147im -2.501315836988437e-5 + 1.669601846095773e-5im … 0.11491635068072012 + 0.007605698738599734im -1.978011038792801e-5 + 3.027664992863274e-5im; -4.110255411638145e-6 - 2.307058788148155e-5im 2.7962609441544357e-5 + 5.560813834972618e-6im … 4.872282977252841e-5 + 3.8167452760514426e-5im -3.794537351650111e-6 + 9.605537275553432e-6im;;; -4.443829400399308e-5 - 2.8144051142217665e-5im 2.360819959467505e-5 + 1.3525579569807326e-5im … -1.3763308781391424e-5 + 5.9686113405270306e-5im -2.3317668336474756e-5 + 3.530929719521119e-5im; -7.084254939667411e-6 - 4.847496948226604e-6im 2.390215197269644e-6 + 9.81066524835557e-6im … -2.160116489022194e-6 - 1.2794088812428362e-6im -4.263881711739382e-5 + 2.4639148746801872e-5im; … ; 1.2061554953652224e-6 - 5.040475422423342e-5im 7.833358614204051e-6 + 7.755498594998306e-6im … 4.628224328298886e-5 + 5.2654723860116664e-5im -1.8370404642818793e-5 + 1.1259858597428447e-5im; 4.749826333541109e-5 + 2.6773093867122523e-5im 7.293866058203163e-5 + 3.5963920172677144e-5im … 3.202225796999859e-5 + 2.5730719266595884e-5im 2.7624668987901742e-5 + 4.878922879287608e-5im;;; -0.08041081828027696 + 0.0840977406496401im 2.534679484727026e-5 - 8.79206531080403e-5im … -0.014035610237776802 + 0.06276296566931018im 2.1096617594763236e-5 - 4.206058476504834e-5im; -3.305554835481168e-5 - 2.325999957209328e-5im 3.6696429666919783e-6 + 9.696463521594659e-6im … -1.6251069604351224e-5 - 1.60756609569256e-5im -1.495973142609909e-5 + 9.448651442315515e-6im; … ; -0.004017126382710847 - 0.012247082480592024im 1.0354573839147076e-5 - 3.6280591002858846e-5im … 0.0622955947592706 - 0.01217084297570288im -1.1904628210973475e-5 + 1.7367139049815456e-5im; -1.7839307802055704e-5 - 2.063152911122748e-5im 1.740302801489688e-5 + 9.095540594513627e-6im … 2.0948065291814236e-5 + 1.1806386342923265e-5im -1.1571589448624462e-6 + 6.250987244161041e-6im;;; … ;;; 3.7772183324894514e-5 + 4.312814040697542e-5im -7.660766869094733e-8 - 1.056832223905968e-5im … 1.8943820771070485e-5 + 0.00011400953753792048im -2.31394075721578e-5 + 6.083800472781071e-6im; -3.010627646387407e-5 - 2.0880257262701353e-5im -2.1923262884078726e-5 - 2.5352889240876955e-5im … 2.7466078245510323e-6 + 6.39710441746791e-6im -2.9338496366811903e-5 - 6.444051117420337e-6im; … ; 4.1334306870744914e-5 - 5.065821514597849e-5im -5.6625101799588415e-6 - 4.837848711913521e-6im … 1.224785070441637e-5 + 7.628724840278199e-6im -1.3732948859899798e-5 + 1.792590792373667e-6im; 1.0239115370709473e-5 + 3.8204797451837975e-6im 1.575040233348976e-5 - 2.026049601951326e-6im … 3.0635917894164485e-5 + 2.6926307695402753e-5im 1.1552556045829592e-5 + 2.0189530253728763e-5im;;; -0.08041081828027755 + 0.08409774064964043im 1.0427304075574158e-5 - 3.950079679882066e-5im … -0.056697421365885875 + 0.25353266551853604im 6.000485541188657e-5 - 9.623583535437368e-5im; -1.56246206817805e-5 - 1.9294766907908528e-5im 2.9366229067572685e-6 + 3.0620732375601294e-6im … 9.849572649279451e-6 + 1.7878676938728533e-5im -1.8986691142229467e-5 + 1.2585513324974452e-5im; … ; -0.016227159998134386 - 0.04947488509992937im 1.1709935102098155e-5 - 3.95816304163037e-5im … 0.0179758833701831 + 0.09060787986997092im 3.118792323923796e-5 - 6.211422456898043e-5im; -4.024970946413135e-5 - 2.760232069444249e-5im 1.3376068298627779e-5 + 1.223240247738769e-5im … 1.324052488568582e-5 + 3.523201799512962e-5im -8.204766907506251e-6 + 1.89462167686759e-5im;;; 3.171606683528476e-5 + 4.630167024439372e-5im 9.643071465755296e-6 - 7.392897177077657e-6im … 5.203802595732285e-5 + 0.0002014871591929257im -3.615237403337944e-5 + 1.2083086984532708e-5im; -4.341032319098429e-5 - 3.0298559239858822e-5im -2.511513598358335e-5 - 2.413111175412078e-5im … -2.4205578763956912e-5 - 9.568648105150273e-6im -7.042912757761633e-5 - 1.1305803134004083e-5im; … ; 8.573787389818291e-5 - 4.6353740800576117e-5im 2.016130524568003e-6 - 1.515186008714568e-5im … 9.891842124000583e-5 + 0.00010095927940911368im -2.4184999034749754e-5 - 1.115470922681002e-5im; 1.0834261959976668e-5 + 1.6134672342387627e-6im 4.514835012178162e-5 + 1.8968291898758296e-8im … 9.609830918667285e-6 + 1.5622545971249395e-5im -2.9419466749658736e-7 + 1.07843695366115e-5im]],))]), basis = PlaneWaveBasis(model = Model(lda_x+lda_c_pw, spin_polarization = :none), Ecut = 5.0 Ha, kgrid = [1, 1, 1]), energies = Energies(total = -62.27771586136825), converged = true, ρ = [0.09610720131645245 0.09085401337903742 … 0.07655587366892032 0.09085401337903731; 0.09085401337903738 0.08147776990938375 … 0.07647151840790521 0.08747433053333145; … ; 0.07655587366892044 0.07647151840790535 … 0.039565804955565956 0.061384247177601076; 0.09085401337903741 0.08747433053333153 … 0.061384247177601 0.0814777699093837;;; 0.09085401337903745 0.08147776990938374 … 0.07647151840790523 0.08747433053333144; 0.0814777699093837 0.0624675736472045 … 0.07270707893262943 0.08316148815249293; … ; 0.07647151840790532 0.07270707893262952 … 0.057383084526643806 0.07121914197097809; 0.08747433053333153 0.08316148815249298 … 0.07121914197097803 0.08316148815249291;;; 0.07655587366892047 0.061384247177601145 … 0.06641329348308385 0.07647151840790532; 0.061384247177601076 0.03680319832570171 … 0.06415300528581809 0.07121914197097806; … ; 0.06641329348308388 0.06415300528581816 … 0.05747311921178371 0.06415300528581815; 0.0764715184079053 0.07121914197097812 … 0.0641530052858181 0.07270707893262947;;; … ;;; 0.060012815482908495 0.06348370462360761 … 0.0291860113998149 0.04413141881688756; 0.06348370462360756 0.05979446095525269 … 0.04476312021503774 0.05713332556637916; … ; 0.02918601139981495 0.04476312021503782 … 0.015925084145457513 0.01592508414545753; 0.04413141881688759 0.05713332556637925 … 0.015925084145457513 0.024857443207089363;;; 0.07655587366892047 0.07647151840790534 … 0.03956580495556593 0.06138424717760107; 0.0764715184079053 0.07270707893262948 … 0.05738308452664378 0.07121914197097806; … ; 0.03956580495556601 0.05738308452664388 … 0.005337878765042622 0.01592508414545755; 0.0613842471776011 0.07121914197097813 … 0.015925084145457513 0.03680319832570172;;; 0.09085401337903741 0.08747433053333155 … 0.061384247177601006 0.08147776990938366; 0.08747433053333145 0.08316148815249297 … 0.07121914197097798 0.08316148815249289; … ; 0.061384247177601145 0.07121914197097817 … 0.015925084145457513 0.03680319832570172; 0.08147776990938373 0.08316148815249302 … 0.03680319832570166 0.06246757364720448;;;;], eigenvalues = Any[[-0.16217594588317197, -0.07512573394494336, -0.07512573394494328, -0.07512573394494312, -0.07512573394494287, -0.010168114055590633, -0.010168114055590496, -0.010168114055590413, -0.010168114055590392, -0.01016811405559012  …  0.22436299901209286, 0.22436299901209292, 0.22436299901209295, 0.22436299901209303, 0.22436299901209317, 0.2243629990120933, 0.22436299901209336, 0.2705989718867612, 0.2705989718867613, 0.2705989718867614]], 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.11985733600917425 + 0.9494605182621524im -7.39019305820432e-17 - 6.961933200072545e-16im … 9.667441136897506e-17 + 4.2096902203828286e-17im -1.3300958370734278e-17 + 1.0663636586163289e-16im; -1.8084322830468763e-16 + 3.983900882797986e-16im 0.12997892470630495 + 0.057409647699676075im … 5.654791955869709e-17 - 2.8725258933645637e-16im -8.328027937404281e-17 - 8.047761675816778e-16im; … ; -2.0989476432961562e-16 - 1.1024980841461973e-17im -2.216109240560371e-16 + 1.7001645317288316e-17im … 7.724601665780317e-16 - 8.279984228636017e-16im 4.961173616022108e-16 + 4.007956618500008e-16im; -3.251554771693369e-16 - 2.533419955918421e-17im -0.07935170095528253 - 0.23896688786308362im … 5.320785039274329e-16 + 2.974095383177789e-16im 4.010967368177996e-16 + 5.3746566978643633e-17im]], 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.277715861368