This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

The DFT solver, as written

gaas_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.

View on GitHub
# GaAs: what the calculation must reproduce, and the picture of it.
#
# dft/run.sh gaas 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, -0.229334663297, 1.0e-7)
}
test "band energies at L, Gamma and X agree with the numpy reference (eV)" {
assert_near(EVB[0.0, 0.0], -11.069016955, 1.0e-5) # L, band 1
assert_near(EVB[0.0, 1.0], -6.646251949, 1.0e-5) # L, band 2
assert_near(EVB[0.0, 2.0], -1.121372912, 1.0e-5) # L, band 3
assert_near(EVB[0.0, 3.0], -1.121372912, 1.0e-5) # L, band 4
assert_near(EVB[0.0, 4.0], 0.943700056, 1.0e-5) # L, band 5
assert_near(EVB[0.0, 5.0], 4.640512266, 1.0e-5) # L, band 6
assert_near(EVB[GAMMA_P, 0.0], -12.699482333, 1.0e-5) # Gamma, band 1
assert_near(EVB[GAMMA_P, 1.0], -0.000001441, 1.0e-5) # Gamma, band 2
assert_near(EVB[GAMMA_P, 2.0], -0.000001441, 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], 0.454444775, 1.0e-5) # Gamma, band 5
assert_near(EVB[GAMMA_P, 5.0], 3.751081312, 1.0e-5) # Gamma, band 6
assert_near(EVB[LAST, 0.0], -10.351104236, 1.0e-5) # X, band 1
assert_near(EVB[LAST, 1.0], -6.840734292, 1.0e-5) # X, band 2
assert_near(EVB[LAST, 2.0], -2.640749514, 1.0e-5) # X, band 3
assert_near(EVB[LAST, 3.0], -2.640749030, 1.0e-5) # X, band 4
assert_near(EVB[LAST, 4.0], 1.382204201, 1.0e-5) # X, band 5
assert_near(EVB[LAST, 5.0], 1.604391901, 1.0e-5) # X, band 6
}
 
#: REFPATH the reference's lowest 6 bands at all 61 path points, eV
REFPATH = [[-11.0690170, -6.6462519, -1.1213729, -1.1213729, 0.9437001, 4.6405123],
[-11.0766097, -6.6314261, -1.1186306, -1.1186306, 0.9462365, 4.6420471],
[-11.0991180, -6.5888034, -1.1121911, -1.1121911, 0.9532944, 4.6460169],
[-11.1355717, -6.5188462, -1.1014697, -1.1014697, 0.9650347, 4.6523782],
[-11.1845475, -6.4232090, -1.0865107, -1.0865107, 0.9813049, 4.6607381],
[-11.2442826, -6.3033462, -1.0673354, -1.0673354, 1.0022483, 4.6705437],
[-11.3128813, -6.1611844, -1.0437059, -1.0437059, 1.0278060, 4.6811101],
[-11.3884426, -5.9991851, -1.0163318, -1.0163318, 1.0575839, 4.6914452],
[-11.4691539, -5.8190473, -0.9849877, -0.9849877, 1.0915594, 4.7005165],
[-11.5534164, -5.6229275, -0.9499610, -0.9499610, 1.1293933, 4.7070329],
[-11.6396592, -5.4117387, -0.9110616, -0.9110616, 1.1710518, 4.7097195],
[-11.7266469, -5.1873095, -0.8686224, -0.8686224, 1.2160563, 4.7070732],
[-11.8132771, -4.9509585, -0.8228455, -0.8228455, 1.2639352, 4.6976427],
[-11.8986096, -4.7038714, -0.7739703, -0.7739703, 1.3140710, 4.6800936],
[-11.9818461, -4.4469964, -0.7216021, -0.7216021, 1.3656630, 4.6534696],
[-12.0623490, -4.1818002, -0.6677846, -0.6677846, 1.4175016, 4.6168136],
[-12.1394899, -3.9087349, -0.6117478, -0.6117478, 1.4683003, 4.5701276],
[-12.2128343, -3.6288255, -0.5533166, -0.5533166, 1.5160572, 4.5139021],
[-12.2819386, -3.3428169, -0.4943297, -0.4943297, 1.5585197, 4.4490233],
[-12.3464889, -3.0517366, -0.4348373, -0.4348373, 1.5922162, 4.3770928],
[-12.4061950, -2.7565580, -0.3755942, -0.3755942, 1.6127644, 4.3000680],
[-12.4608088, -2.4572394, -0.3165216, -0.3165216, 1.6154567, 4.2203673],
[-12.5101374, -2.1560955, -0.2600941, -0.2600941, 1.5939880, 4.1400543],
[-12.5540064, -1.8531270, -0.2054838, -0.2054838, 1.5426299, 4.0618769],
[-12.5922984, -1.5497926, -0.1562551, -0.1562551, 1.4565997, 3.9824449],
[-12.6248652, -1.2485229, -0.1114932, -0.1114932, 1.3339214, 3.8894311],
[-12.6516288, -0.9500057, -0.0729797, -0.0729797, 1.1765760, 3.8261414],
[-12.6725184, -0.6588902, -0.0417495, -0.0417495, 0.9890583, 3.7867293],
[-12.6874918, -0.3804950, -0.0189389, -0.0189389, 0.7805607, 3.7645901],
[-12.6964828, -0.1315591, -0.0047774, -0.0047774, 0.5725968, 3.7541037],
[-12.6994823, -0.0000014, -0.0000014, 0.0000000, 0.4544448, 3.7510813],
[-12.6954828, -0.1531055, -0.0149676, -0.0149667, 0.6070759, 3.7333020],
[-12.6834827, -0.4229286, -0.0587253, -0.0587244, 0.8759052, 3.6818459],
[-12.6635245, -0.7134824, -0.1285659, -0.1285650, 1.1626155, 3.6010772],
[-12.6356294, -1.0094924, -0.2200140, -0.2200132, 1.4501921, 3.4975196],
[-12.5998717, -1.3065514, -0.3296382, -0.3296374, 1.7318633, 3.3784967],
[-12.5563135, -1.6032945, -0.4522123, -0.4522115, 2.0013321, 3.2518848],
[-12.5050521, -1.8977300, -0.5843905, -0.5843897, 2.2493031, 3.1278049],
[-12.4461991, -2.1897456, -0.7217893, -0.7217886, 2.4529236, 3.0273895],
[-12.3798968, -2.4793758, -0.8623376, -0.8623369, 2.5536032, 3.0051823],
[-12.3063140, -2.7663332, -1.0038092, -1.0038086, 2.5156990, 3.0909028],
[-12.2256522, -3.0503528, -1.1444022, -1.1444015, 2.4130058, 3.2034831],
[-12.1381397, -3.3310062, -1.2830424, -1.2830417, 2.2941114, 3.2884884],
[-12.0440515, -3.6082251, -1.4182370, -1.4182364, 2.1736262, 3.3264091],
[-11.9437930, -3.8816717, -1.5485283, -1.5485277, 2.0566060, 3.3130518],
[-11.8377307, -4.1508342, -1.6735364, -1.6735358, 1.9457360, 3.2539785],
[-11.7263545, -4.4152053, -1.7926040, -1.7926035, 1.8424156, 3.1585012],
[-11.6101530, -4.6736709, -1.9044850, -1.9044845, 1.7477704, 3.0378247],
[-11.4900600, -4.9271987, -2.0102311, -2.0102306, 1.6616666, 2.8996703],
[-11.3668331, -5.1731512, -2.1089907, -2.1089901, 1.5853034, 2.7531217],
[-11.2415480, -5.4106677, -2.1996774, -2.1996769, 1.5191153, 2.6040144],
[-11.1155263, -5.6385698, -2.2824306, -2.2824301, 1.4632030, 2.4566300],
[-10.9903615, -5.8550099, -2.3568675, -2.3568670, 1.4178271, 2.3143023],
[-10.8681416, -6.0581778, -2.4230977, -2.4230972, 1.3830456, 2.1792512],
[-10.7512706, -6.2451729, -2.4807828, -2.4807823, 1.3589760, 2.0537456],
[-10.6427260, -6.4134134, -2.5298228, -2.5298224, 1.3454352, 1.9385696],
[-10.5459408, -6.5591508, -2.5700878, -2.5700873, 1.3420685, 1.8354937],
[-10.4647405, -6.6784950, -2.6014893, -2.6014889, 1.3479096, 1.7462120],
[-10.4030204, -6.7672621, -2.6238584, -2.6238579, 1.3607059, 1.6737067],
[-10.3643138, -6.8223172, -2.6366889, -2.6366884, 1.3752481, 1.6230815],
[-10.3511042, -6.8407343, -2.6407495, -2.6407490, 1.3822042, 1.6043919]]
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
GGAP = EVB[GAMMA_P, NV]
LGAP = EVB[0.0, NV]
XGAP = EVB[LAST, NV]
show GGAP
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 "gallium arsenide is a DIRECT-gap semiconductor: Gamma below L below X" {
assert_lt(GGAP, LGAP)
assert_lt(LGAP, XGAP)
}
test "the LDA gap is about 0.45 eV -- under a third of the measured 1.52 eV" {
assert_near(GGAP, 0.45, 0.2)
assert_lt(GGAP, 1.52 / 3.0 + 0.1)
}
test "valence band width is about 12.7 eV" {
assert_near(EVB[GAMMA_P, 0.0], -12.7, 0.3)
}
 
figure("Gallium arsenide: 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])