The DFT solver, as written
c_it_check.viv
Generated by RUNNING the independent numpy reference at the deck's settings and pinning what it printed; then the published LDA values; then the figure.
# C: what the calculation must reproduce, and the picture of it. # # dft/run.sh c it # # GENERATED by dft/ref/make_deck.py, which RAN dft/ref/pwdft_ref.py -- an independent numpy implementation that diagonalizes H densely -- # at exactly this deck's settings and pinned what it printed. # A disagreement here is a bug in one of the two implementations. GAMMA_P = NSEG LAST = NPTS - 1.0 test "SCF converged: density, energy, and every occupied band's residual" { assert_lt(DRHO, 1.0e-8) assert_lt(EIGRES, EIG_TOL) assert_lt(ITER, MAXIT) } test "every band-path point converged" { assert_lt(BANDRES, EIG_TOL) } test "total energy agrees with the numpy reference" { assert_near(ETOT, 1.398490176994, 1.0e-7) } test "band energies at L, Gamma and X agree with the numpy reference (eV)" { assert_near(EVB[0.0, 0.0], -15.528027225, 1.0e-5) # L, band 1 assert_near(EVB[0.0, 1.0], -13.403838859, 1.0e-5) # L, band 2 assert_near(EVB[0.0, 2.0], -2.776759434, 1.0e-5) # L, band 3 assert_near(EVB[0.0, 3.0], -2.776759434, 1.0e-5) # L, band 4 assert_near(EVB[0.0, 4.0], 8.405368457, 1.0e-5) # L, band 5 assert_near(EVB[0.0, 5.0], 8.405368457, 1.0e-5) # L, band 6 assert_near(EVB[GAMMA_P, 0.0], -21.373975422, 1.0e-5) # Gamma, band 1 assert_near(EVB[GAMMA_P, 1.0], -0.000052280, 1.0e-5) # Gamma, band 2 assert_near(EVB[GAMMA_P, 2.0], -0.000000000, 1.0e-5) # Gamma, band 3 assert_near(EVB[GAMMA_P, 3.0], 0.000000000, 1.0e-5) # Gamma, band 4 assert_near(EVB[GAMMA_P, 4.0], 5.579105299, 1.0e-5) # Gamma, band 5 assert_near(EVB[GAMMA_P, 5.0], 5.579146141, 1.0e-5) # Gamma, band 6 assert_near(EVB[LAST, 0.0], -12.645389675, 1.0e-5) # X, band 1 assert_near(EVB[LAST, 1.0], -12.645389070, 1.0e-5) # X, band 2 assert_near(EVB[LAST, 2.0], -6.304301582, 1.0e-5) # X, band 3 assert_near(EVB[LAST, 3.0], -6.304277827, 1.0e-5) # X, band 4 assert_near(EVB[LAST, 4.0], 4.675080966, 1.0e-5) # X, band 5 assert_near(EVB[LAST, 5.0], 4.675082056, 1.0e-5) # X, band 6 } #: REFPATH the reference's lowest 6 bands at all 61 path points, eV REFPATH = [[-15.5280272, -13.4038389, -2.7767594, -2.7767594, 8.4053685, 8.4053685], [-15.6019513, -13.3010516, -2.7708907, -2.7708907, 8.4105667, 8.4105667], [-15.8149256, -13.0506157, -2.7562706, -2.7562706, 8.4087747, 8.4087747], [-16.1016474, -12.7011294, -2.7319128, -2.7319128, 8.4054158, 8.4054158], [-16.4195717, -12.2928486, -2.6972041, -2.6972041, 8.4039424, 8.4039424], [-16.7524473, -11.8472556, -2.6561062, -2.6561062, 8.3942827, 8.3942827], [-17.0868632, -11.3753438, -2.6029145, -2.6029145, 8.3803509, 8.3803509], [-17.4169018, -10.8834555, -2.5402535, -2.5402535, 8.3600653, 8.3600653], [-17.7392663, -10.3838321, -2.4653324, -2.4653324, 8.3319857, 8.3319857], [-18.0515556, -9.8627474, -2.3841903, -2.3841903, 8.2936337, 8.2936337], [-18.3525198, -9.3301038, -2.2940624, -2.2940624, 8.2434812, 8.2434812], [-18.6412041, -8.7875209, -2.1951967, -2.1951967, 8.1797922, 8.1797922], [-18.9169249, -8.2364569, -2.0878993, -2.0878993, 8.1010700, 8.1010700], [-19.1799365, -7.6802324, -1.9730936, -1.9730936, 8.0027361, 8.0027361], [-19.4253287, -7.1144332, -1.8494115, -1.8494115, 7.8961076, 7.8961076], [-19.6597643, -6.5448331, -1.7186231, -1.7186231, 7.7674554, 7.7674554], [-19.8763141, -5.9739761, -1.5793680, -1.5793680, 7.6228089, 7.6228089], [-20.0819749, -5.4036521, -1.4424694, -1.4424694, 7.4611074, 7.4611074], [-20.2723573, -4.8319107, -1.2963302, -1.2963302, 7.2882101, 7.2882101], [-20.4434823, -4.2652689, -1.1459409, -1.1459409, 7.1124004, 7.1124004], [-20.6046425, -3.7060533, -0.9949121, -0.9949121, 6.9218609, 6.9218609], [-20.7506668, -3.1573784, -0.8439687, -0.8439687, 6.7277844, 6.7277844], [-20.8828191, -2.6245240, -0.7013191, -0.7013191, 6.5328105, 6.5328105], [-20.9936686, -2.1090903, -0.5570535, -0.5570535, 6.3476757, 6.3476757], [-21.0942339, -1.6236881, -0.4210583, -0.4210583, 6.1688233, 6.1688233], [-21.1793928, -1.1870998, -0.3155986, -0.3155986, 6.0030530, 6.0030530], [-21.2498152, -0.7944568, -0.2069140, -0.2069140, 5.8589108, 5.8589108], [-21.3041174, -0.4692956, -0.1232128, -0.1232128, 5.7404875, 5.7404875], [-21.3429222, -0.2215464, -0.0560420, -0.0560420, 5.6522533, 5.6522533], [-21.3662113, -0.0567053, -0.0141952, -0.0141952, 5.5976426, 5.5976426], [-21.3739754, -0.0000523, -0.0000000, 0.0000000, 5.5791053, 5.5791461], [-21.3636233, -0.0442056, -0.0441709, -0.0248990, 5.5705319, 5.6320528], [-21.3325723, -0.1711985, -0.1711643, -0.0808971, 5.5449910, 5.7858303], [-21.2808371, -0.3655144, -0.3654811, -0.1921611, 5.5032985, 6.0279793], [-21.2084450, -0.6069075, -0.6068754, -0.3483778, 5.4467283, 6.3437426], [-21.1146056, -0.8970348, -0.8970034, -0.5519295, 5.3833587, 6.7131468], [-21.0045678, -1.2139536, -1.2139230, -0.8030715, 5.2933859, 7.1237069], [-20.8708826, -1.5457476, -1.5457177, -1.0915114, 5.2030239, 7.5666537], [-20.7201438, -1.8805929, -1.8805638, -1.4107223, 5.1022206, 8.0336152], [-20.5459349, -2.2217773, -2.2217487, -1.7642856, 5.0000114, 8.5179346], [-20.3496219, -2.5511585, -2.5511308, -2.1415457, 4.9033806, 9.0175292], [-20.1352389, -2.8834799, -2.8834527, -2.5493866, 4.7973586, 9.5231371], [-19.9008964, -3.2069982, -3.2069715, -2.9809238, 4.6925376, 10.0343536], [-19.6467523, -3.5196611, -3.5196348, -3.4340744, 4.5908051, 10.5484846], [-19.3777327, -3.9088666, -3.8216163, -3.8215903, 4.4924494, 10.7239559], [-19.0848740, -4.3992878, -4.1079698, -4.1079441, 4.4023229, 10.1703357], [-18.7728418, -4.9057869, -4.3793943, -4.3793690, 4.3201627, 9.6242063], [-18.4418938, -5.4265836, -4.6349778, -4.6349528, 4.2473714, 9.0939351], [-18.0923196, -5.9598785, -4.8739554, -4.8739307, 4.1852521, 8.5853462], [-17.7244472, -6.5043135, -5.1001680, -5.1001434, 4.1349822, 8.0921716], [-17.3452912, -7.0569358, -5.3126751, -5.3126504, 4.0977155, 7.6315895], [-16.9421571, -7.6030772, -5.4980790, -5.4980546, 4.0874062, 7.2064218], [-16.5289605, -8.1684971, -5.6659408, -5.6659165, 4.0784033, 6.8113535], [-16.0927920, -8.7369680, -5.8140965, -5.8140723, 4.0858880, 6.4466469], [-15.6406513, -9.3066052, -5.9429893, -5.9429652, 4.1104983, 6.1120683], [-15.1775277, -9.8760444, -6.0525701, -6.0525461, 4.1531389, 5.8025493], [-14.6957572, -10.4425110, -6.1422829, -6.1422590, 4.2148950, 5.5262338], [-14.2001609, -11.0048717, -6.2121550, -6.2121312, 4.2966335, 5.2779021], [-13.6915730, -11.5540537, -6.2566399, -6.2566164, 4.4055011, 5.0566412], [-13.1710403, -12.1039576, -6.2866463, -6.2866228, 4.5297591, 4.8613924], [-12.6453897, -12.6453891, -6.3043016, -6.3042778, 4.6750810, 4.6750821]] test "every band at every point of the path agrees with the numpy reference (eV)" { assert_lt(max(abs(EVB[:, 0:shape(REFPATH)[1]] - REFPATH)), 1.0e-5) } # --- the physics: published LDA values, loose on purpose ----------------------- NV = NELEC / 2.0 GAP = 1.0e9 KGAP = 0.0 for p to NPTS { if EVB[p, NV] < GAP { GAP = EVB[p, NV] KGAP = p } } show GAP test "the valence-band top at Gamma is a TRIPLET: the density has the crystal's full symmetry" { assert_near(EVB[GAMMA_P, NV - 1.0] - EVB[GAMMA_P, NV - 3.0], 0.0, 1.0e-4) } test "diamond's valence band is about 21.5 eV wide" { assert_near(EVB[GAMMA_P, 0.0], -21.5, 0.4) } test "the direct gap at Gamma is about 5.55 eV" { assert_near(EVB[GAMMA_P, NV], 5.55, 0.2) } test "the gap is INDIRECT, about 4.0 eV, with its minimum along Gamma-X" { assert_near(GAP, 4.05, 0.3) assert_gt(KGAP, GAMMA_P) assert_lt(KGAP, LAST) } figure("Diamond: LDA band structure", "wavevector along the path", "energy from the valence-band maximum (eV)") for b to NBANDS { plot(PATHX, EVB[:, b], "band") } xtick("L", PATHX[0]) xtick("Γ", PATHX[GAMMA_P]) xtick("X", PATHX[LAST])