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(DftFunctionals.Functional[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.120843e+02     1.570978e+00
 * time: 0.4580521583557129
     1     1.088888e+01     9.316810e-01
 * time: 1.6011152267456055
     2    -1.200713e+01     1.145069e+00
 * time: 1.6901471614837646
     3    -3.414820e+01     7.807491e-01
 * time: 1.8304622173309326
     4    -4.775305e+01     5.071435e-01
 * time: 1.938082218170166
     5    -5.706632e+01     1.930250e-01
 * time: 2.055294990539551
     6    -5.993811e+01     1.172390e-01
 * time: 2.153374195098877
     7    -6.097005e+01     5.245930e-02
 * time: 2.232452154159546
     8    -6.137329e+01     7.671953e-02
 * time: 2.3122060298919678
     9    -6.171104e+01     2.932584e-02
 * time: 2.3918251991271973
    10    -6.193156e+01     2.258408e-02
 * time: 2.4821391105651855
    11    -6.208219e+01     1.777525e-02
 * time: 2.5613460540771484
    12    -6.213549e+01     1.464529e-02
 * time: 2.6407182216644287
    13    -6.218560e+01     1.074323e-02
 * time: 2.7196431159973145
    14    -6.220596e+01     8.111063e-03
 * time: 2.8653671741485596
    15    -6.222296e+01     8.673853e-03
 * time: 2.9441840648651123
    16    -6.223261e+01     7.064146e-03
 * time: 3.0228471755981445
    17    -6.224110e+01     5.831233e-03
 * time: 3.101814031600952
    18    -6.224911e+01     5.296048e-03
 * time: 3.5074992179870605
    19    -6.225627e+01     4.735008e-03
 * time: 3.5873382091522217
    20    -6.226309e+01     4.818545e-03
 * time: 3.6664600372314453
    21    -6.226865e+01     4.255216e-03
 * time: 3.7450780868530273
    22    -6.227249e+01     4.019903e-03
 * time: 4.023064136505127
    23    -6.227474e+01     2.305631e-03
 * time: 4.10247802734375
    24    -6.227593e+01     1.560680e-03
 * time: 4.181384086608887
    25    -6.227657e+01     1.528257e-03
 * time: 4.269355058670044
    26    -6.227694e+01     1.353019e-03
 * time: 4.348351001739502
    27    -6.227719e+01     1.109485e-03
 * time: 4.42737603187561
    28    -6.227736e+01     9.126906e-04
 * time: 4.514843225479126
    29    -6.227749e+01     8.252677e-04
 * time: 4.594225168228149
    30    -6.227757e+01     5.693423e-04
 * time: 4.673152208328247
    31    -6.227763e+01     3.739823e-04
 * time: 4.756359100341797
    32    -6.227767e+01     2.672908e-04
 * time: 4.8353400230407715
    33    -6.227769e+01     2.824982e-04
 * time: 4.91427206993103
n     Energy            log10(ΔE)   log10(Δρ)
---   ---------------   ---------   ---------
  1   -62.27771586125                   -3.20
  2   -62.27771586137       -9.91       -5.47
  3   -62.27771586137   +    -Inf      -11.03
  4   -62.27771586137   +    -Inf      -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.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.4147537431690305 0.3966771734007346 … 0.3515373566324815 0.3966771734007343; 0.3966771734007338 0.37893916766752306 … 0.32946849924034344 0.3773084908157707; … ; 0.3515373566324823 0.32946849924034516 … 0.30553228031466684 0.33692724414617564; 0.39667717340073483 0.37730849081577206 … 0.33692724414617536 0.3789391676675238;;; 0.39667717340073405 0.37893916766752356 … 0.3294684992403437 0.3773084908157709; 0.3789391676675226 0.3562927712405085 … 0.308167233983864 0.3613386510271954; … ; 0.3294684992403447 0.308167233983866 … 0.2925295693553715 0.3213553062036587; 0.3773084908157715 0.361338651027197 … 0.3213553062036583 0.36133865102719653;;; 0.3515373566324813 0.33692724414617525 … 0.27624730570260253 0.32946849924034344; 0.33692724414617425 0.3170936258953346 … 0.26534187531665654 0.32135530620365704; … ; 0.27624730570260375 0.26534187531665865 … 0.2378257613339088 0.2653418753166581; 0.32946849924034427 0.3213553062036589 … 0.26534187531665754 0.3081672339838649;;; … ;;; 0.3043050825406212 0.27477283611458186 … 0.2897747264689476 0.30205476271423287; 0.27477283611458153 0.2424981276459886 … 0.26708985527975987 0.2793703352786084; … ; 0.28977472646894764 0.2670898552797603 … 0.29263539728460597 0.292635397284606; 0.30205476271423304 0.2793703352786088 … 0.29263539728460614 0.298116626654097;;; 0.3515373566324821 0.32946849924034477 … 0.3055322803146662 0.33692724414617525; 0.3294684992403442 0.30816723398386525 … 0.29252956935537094 0.3213553062036582; … ; 0.3055322803146666 0.2925295693553718 … 0.28354300367580487 0.2926353972846067; 0.33692724414617553 0.3213553062036591 … 0.29263539728460664 0.3170936258953351;;; 0.39667717340073466 0.37730849081577184 … 0.33692724414617514 0.37893916766752356; 0.37730849081577106 0.36133865102719637 … 0.3213553062036579 0.3613386510271962; … ; 0.33692724414617575 0.32135530620365926 … 0.2926353972846069 0.31709362589533535; 0.378939167667524 0.36133865102719726 … 0.3170936258953352 0.35629277124050923]), 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.5113149641934652 -0.5025077544820492 … -0.47663248325779056 -0.5025077544820491; -0.5025077544820489 -0.48588487146019244 … -0.4764704240162496 -0.49665680133961115; … ; -0.476632483257791 -0.47647042401625034 … -0.38910353530530556 -0.44527691908406736; -0.5025077544820493 -0.49665680133961165 … -0.4452769190840671 -0.48588487146019266;;; -0.502507754482049 -0.4858848714601925 … -0.47647042401624967 -0.4966568013396111; -0.4858848714601921 -0.4476808861457203 … -0.46911089882616136 -0.4889624560175813; … ; -0.4764704240162503 -0.4691108988261622 … -0.43613878735067557 -0.46613036405018665; -0.4966568013396115 -0.488962456017582 … -0.4661303640501864 -0.48896245601758187;;; -0.4766324832577904 -0.445276919084067 … -0.4562036919120272 -0.47647042401624945; -0.4452769190840663 -0.38057362659163196 … -0.4513650797562179 -0.46613036405018554; … ; -0.45620369191202786 -0.45136507975621903 … -0.4363491190518317 -0.4513650797562188; -0.4764704240162499 -0.46613036405018665 … -0.4513650797562184 -0.4691108988261617;;; … ;;; -0.4421917735594028 -0.4499100439944885 … -0.3545229619998281 -0.40234903539718614; -0.44991004399448836 -0.4416961440262573 … -0.40410681005882704 -0.43555414003768683; … ; -0.3545229619998282 -0.4041068100588274 … -0.2948006187935118 -0.2948006187935119; -0.4023490353971862 -0.4355541400376872 … -0.294800618793512 -0.33757346153793344;;; -0.4766324832577909 -0.4764704240162503 … -0.3891035353053051 -0.4452769190840671; -0.4764704240162501 -0.46911089882616197 … -0.43613878735067513 -0.4661303640501864; … ; -0.38910353530530556 -0.4361387873506758 … -0.21186524619038574 -0.2948006187935128; -0.4452769190840673 -0.46613036405018676 … -0.2948006187935126 -0.38057362659163235;;; -0.5025077544820493 -0.4966568013396116 … -0.4452769190840669 -0.4858848714601926; -0.49665680133961126 -0.48896245601758187 … -0.46613036405018615 -0.4889624560175817; … ; -0.44527691908406747 -0.4661303640501869 … -0.294800618793513 -0.38057362659163263; -0.48588487146019294 -0.48896245601758226 … -0.3805736265916323 -0.4476808861457208])], 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.3966450415088845 -0.49234734184270057 … -0.769325528301241 -0.4923473418427008; -0.4923473418427006 -0.8750778255695595 … -0.39703598961245634 -0.3615310001750589; … ; -0.7693255283012412 -0.3970359896124566 … -3.1047255410992833 -1.5747650238423998; -0.4923473418427011 -0.3615310001750587 … -1.5747650238424 -0.8750778255695598;;; -0.4923473418427013 -0.8750778255695599 … -0.39703598961245673 -0.36153100017505935; -0.8750778255695606 -1.907581785511225 … -0.2979392362734127 -0.44061222548435247; … ; -0.3970359896124568 -0.2979392362734124 … -1.1306602478254453 -0.6725509732311423; -0.36153100017505935 -0.44061222548435164 … -0.6725509732311421 -0.4406122254843516;;; -0.7693255283012419 -1.5747650238424002 … -0.268269956523817 -0.39703598961245756; -1.5747650238424007 -4.178358102394934 … -0.32643212768002294 -0.6725509732311439; … ; -0.2682699565238171 -0.3264321276800222 … -0.4683608601439937 -0.32643212768002106; -0.3970359896124573 -0.672550973231143 … -0.3264321276800213 -0.2979392362734121;;; … ;;; -1.1238730686817568 -0.5333846563960074 … -4.155376042242816 -2.390540908628533; -0.5333846563960076 -0.2855541243910449 … -1.566360229025253 -0.9722209839305798; … ; -4.155376042242817 -1.5663602290252545 … -8.360569189488283 -8.333798930614115; -2.390540908628534 -0.97222098393058 … -8.333798930614117 -5.809925289355629;;; -0.769325528301241 -0.3970359896124565 … -3.104725541099285 -1.5747650238424002; -0.39703598961245684 -0.297939236273412 … -1.1306602478254453 -0.6725509732311428; … ; -3.1047255410992856 -1.1306602478254468 … -12.323880928353622 -8.360577568025041; -1.5747650238424005 -0.6725509732311429 … -8.360577568025041 -4.178358102394933;;; -0.49234734184270074 -0.3615310001750585 … -1.5747650238423994 -0.8750778255695599; -0.36153100017505874 -0.44061222548435114 … -0.6725509732311425 -0.44061222548435147; … ; -1.5747650238424002 -0.6725509732311432 … -8.36057756802504 -4.178358102394933; -0.8750778255695604 -0.4406122254843517 … -4.178358102394932 -1.9075817855112251]), 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.0007720814405804e-6 + 7.237149112463044e-7im 1.4897258247828748e-5 - 6.828296793512291e-6im … -0.15005339401055173 - 0.10567351417144312im -2.442090514435811e-6 + 1.75771242564605e-5im; 8.815763250327496e-6 + 6.987793572420788e-6im 7.705035588396748e-6 - 5.431440310903092e-6im … -1.909519877287026e-5 - 1.2023200091166926e-5im -1.1055111570781184e-6 + 7.445673389529268e-6im; … ; 0.07914852074092675 + 0.07433355877899898im -1.390396484381515e-6 - 1.196554821863178e-5im … -0.08281882232837147 - 0.03660627948392364im -2.6419828836343216e-5 - 7.134748809029728e-6im; 8.953330237769375e-6 + 6.8738401295810395e-6im 5.907186405440395e-6 - 3.956139670468749e-6im … -5.1003017566141486e-5 - 3.3543967839576685e-5im -3.300294996939963e-6 + 8.632508694477256e-6im;;; -1.3485064127565095e-7 + 2.9437935592141394e-6im 4.3083508015981635e-6 + 3.4929002809833877e-6im … -2.3398080513256034e-5 - 1.6562359181704312e-5im 3.863752914950759e-6 + 4.469498507842061e-6im; -2.181138468615691e-6 + 1.2824726091743753e-6im 5.5701726470516275e-6 - 3.407829746537481e-7im … -6.843281841895669e-7 + 6.081226783922354e-7im -2.2017313769966606e-5 + 3.818132252725339e-5im; … ; 8.06326406422132e-6 + 7.998781855485515e-6im 2.6945400657813406e-6 + 2.1175264032102537e-6im … -2.31550932236768e-5 - 1.7319338362788696e-5im -9.317007500893661e-8 + 5.863571905385937e-7im; -4.443598978943003e-6 + 2.8670024781056264e-6im 3.141214394875849e-5 - 3.0757698381441345e-5im … 9.390877972941887e-8 + 2.6402194869970123e-6im 2.947601559906445e-6 + 7.416256008020474e-6im;;; -0.025018900317874616 - 0.03624697253794508im 4.106377525222894e-5 + 1.5399550501994656e-5im … -0.05062083322044565 - 0.04103524230030828im 1.2973252083147966e-5 + 2.00191080124016e-5im; 2.0830682248805863e-5 + 1.1203237026759044e-5im 7.966741707186288e-6 - 6.0488597484559865e-6im … 1.3102005297564881e-5 + 7.871230357539289e-6im 1.8971159068498594e-6 + 2.5181249999317517e-6im; … ; 0.015651233772317787 + 0.011012493909391404im 1.836033800643076e-5 + 8.421031859150663e-6im … -0.029776487014200707 - 0.008571360653919322im -1.0829703539740464e-5 - 3.366573786753736e-6im; 1.2937180172842061e-5 + 7.750892440865543e-6im 6.23453692153065e-6 - 4.5340062420544105e-6im … -1.922616387548364e-5 - 1.2253392494170946e-5im -4.748192056627929e-7 + 3.815832927777912e-6im;;; … ;;; 3.392382883163694e-6 - 9.22770643417951e-7im 2.754957295431517e-6 + 9.73099960617306e-7im … -3.492898973882091e-5 - 2.7416480518341063e-5im 1.7136573929132172e-6 + 1.3389226437507915e-6im; 3.2242923543281645e-6 - 2.842666316773194e-6im 2.709392587730716e-6 - 1.1593677273584878e-6im … 2.015882300461831e-6 + 5.102140879991047e-7im -8.762617586401707e-6 + 1.4874847056834324e-5im; … ; 1.2129127065243632e-5 + 9.320698368912842e-6im -7.955033856391966e-7 - 8.091219562226645e-7im … -1.822267382976807e-5 - 1.1634593581313455e-5im -3.406742854845598e-6 - 1.9743324972097117e-6im; 5.881643243150792e-7 - 7.789512659134342e-7im 1.2081196058456172e-5 - 1.2019532299046808e-5im … 4.6337898477080515e-7 + 2.7809195048982314e-6im 9.863896844285869e-9 + 4.080329180253418e-6im;;; -0.025018900317874574 - 0.036246972537945205im 1.9364157389785313e-5 + 1.102380276653049e-5im … -0.20448733344993197 - 0.16576536269448816im 2.0303640802003913e-5 + 4.4619784160792175e-5im; 1.2886475985559434e-5 + 7.792893191758947e-6im 3.6612538436507097e-6 - 1.4697439107235583e-6im … -2.361039682866672e-5 - 1.7660418304056477e-5im -2.1714447029790962e-6 + 7.717426238868974e-6im; … ; 0.06322262260515285 + 0.04448456319037533im 4.311482753379136e-6 + 7.40905186809953e-6im … -0.0959259561587189 - 0.06758850627111752im -2.326552398750042e-6 + 1.7187366690162938e-5im; 2.0995389078135105e-5 + 1.1066802329990968e-5im 2.1659763115611837e-6 + 6.652949969377136e-7im … -3.949218326578157e-5 - 2.9743586328129592e-5im -4.030337888915283e-6 + 9.282466679977276e-6im;;; 4.570196613878468e-6 + 5.4813489420958013e-8im 5.907072752058678e-6 + 3.081279505537212e-6im … -4.9941482255625626e-5 - 4.158999679787338e-5im 4.654761073333415e-6 + 3.4336861055901543e-6im; 3.3541317506558135e-6 - 3.281888596073921e-6im 6.569221893746615e-6 - 1.0774716410176515e-6im … 4.916880372422344e-6 - 1.1629288911753278e-6im -2.1895320495111376e-5 + 3.709648274836423e-5im; … ; 2.088553657853246e-5 + 1.3703011883137692e-5im 1.17064293308924e-6 - 2.722696387967805e-7im … -3.4219470709346255e-5 - 2.7744179161544552e-5im -1.7223646808696172e-6 - 1.8307202401660833e-6im; 1.181732996061567e-6 - 1.6630618059117182e-6im 3.1534137223761894e-5 - 3.184253816023935e-5im … 5.17732020533269e-6 + 5.827782736369862e-7im 2.3785003908213633e-6 + 5.635083602679688e-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.27771586136828), converged = true, ρ = [0.0961072013164526 0.09085401337903753 … 0.07655587366892047 0.09085401337903745; 0.09085401337903731 0.08147776990938378 … 0.07647151840790525 0.08747433053333149; … ; 0.07655587366892073 0.07647151840790563 … 0.03956580495556615 0.061384247177601305; 0.09085401337903763 0.0874743305333318 … 0.06138424717760122 0.08147776990938391;;; 0.09085401337903738 0.0814777699093838 … 0.07647151840790524 0.08747433053333148; 0.08147776990938359 0.06246757364720448 … 0.0727070789326293 0.08316148815249276; … ; 0.07647151840790557 0.07270707893262972 … 0.05738308452664402 0.07121914197097831; 0.08747433053333169 0.08316148815249318 … 0.07121914197097821 0.0831614881524931;;; 0.07655587366892039 0.06138424717760117 … 0.06641329348308371 0.07647151840790516; 0.061384247177600854 0.036803198325701655 … 0.06415300528581783 0.0712191419709778; … ; 0.06641329348308402 0.06415300528581835 … 0.05747311921178386 0.06415300528581824; 0.07647151840790538 0.07121914197097831 … 0.0641530052858181 0.0727070789326295;;; … ;;; 0.060012815482908544 0.06348370462360776 … 0.029186011399814856 0.04413141881688754; 0.06348370462360768 0.05979446095525284 … 0.044763120215037734 0.057133325566379234; … ; 0.029186011399814884 0.04476312021503786 … 0.015925084145457388 0.0159250841454574; 0.04413141881688758 0.057133325566379387 … 0.015925084145457416 0.024857443207089304;;; 0.07655587366892067 0.07647151840790556 … 0.03956580495556601 0.06138424717760121; 0.07647151840790548 0.07270707893262965 … 0.057383084526643834 0.0712191419709782; … ; 0.03956580495556615 0.05738308452664411 … 0.005337878765042626 0.015925084145457565; 0.06138424717760132 0.07121914197097841 … 0.01592508414545752 0.036803198325701794;;; 0.09085401337903758 0.08747433053333172 … 0.061384247177601124 0.08147776990938388; 0.08747433053333156 0.08316148815249311 … 0.07121914197097806 0.083161488152493; … ; 0.061384247177601374 0.07121914197097846 … 0.015925084145457593 0.03680319832570188; 0.08147776990938403 0.08316148815249333 … 0.03680319832570178 0.0624675736472047;;;;], eigenvalues = Any[[-0.1621759458831722, -0.07512573394494339, -0.07512573394494307, -0.07512573394494254, -0.07512573394494229, -0.010168114055590902, -0.010168114055590524, -0.010168114055590387, -0.010168114055590267, -0.010168114055590172  …  0.22436299901209278, 0.22436299901209286, 0.22436299901209295, 0.2243629990120931, 0.22436299901209314, 0.22436299901209325, 0.22436299901209342, 0.2705989718867611, 0.2705989718867613, 0.27059897188676135]], 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.7754725997924371 - 0.5607881094540166im 6.159555829797492e-16 + 6.167822871362694e-16im … 2.6532671798030517e-17 - 1.2606878397930423e-16im 7.2164242490751e-17 + 2.656909421476245e-16im; -1.0345660417764024e-15 - 7.086819737815719e-16im -0.23695482105595533 - 0.1452477315648985im … -4.0970348383980067e-16 + 3.003189195808012e-16im 1.0723437112239442e-18 - 1.7345688924639332e-16im; … ; 5.4460830376662495e-17 + 2.390835196919988e-17im -3.2201482149177285e-16 + 5.601462761510578e-16im … 8.90743913090769e-15 + 1.4544823712678377e-14im 6.513675423451689e-15 + 6.016786308955411e-15im; 4.48690292819548e-17 + 8.59569034873664e-18im -0.14586653100842686 + 0.6022734418377964im … -1.4446041036303685e-16 + 6.171990273463185e-17im -2.1978810915354585e-17 + 3.031547858882086e-16im]], 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