-- the exchange-correlation energy of the uniform electron gas in LDA -- rs is the Wigner-Seitz radius in bohr, n = 3/(4 pi rs^3) the density in bohr^-3 print(" rs n eps_xc eps_x eps_c eps_c(VWN) v_xc") for _, rs in ipairs({0.5, 1, 2, 5, 10}) do local n = 3/(4*math.pi*rs^3) local e, dedn = XCFunctional("LDA", n) local eVWN = XCFunctional("LDA-VWN", n) local epsx = -3/(4*math.pi)*(9*math.pi/4)^(1/3)/rs -- Slater exchange per electron print(string.format("%5.1f %9.6f %9.6f %9.6f %9.6f %9.6f %9.6f", rs, n, e/n, epsx, e/n - epsx, eVWN/n - epsx, dedn)) end