We describe the implementation of a computational scheme for estimating lattice thermal conductivities of ordered and disordered solids using the Einstein diffusion relationship and the energy moment, sampled from first-principles Born–Oppenheimer molecular dynamics employing density functional theory. The efficiency and accuracy of this procedure are validated through calculations on several compositionally diverse systems under different thermodynamic conditions, including MgO at elevated temperatures and pressures, as well as the potential efficient thermoelectric materials of doped Si46 and CoSb3 semiconductors. The results are found to be in good agreement with the available experimental data covering a broad temperature and pressure range. Unlike some of the current methods, no explicit calculation of high-order interplanar force constants or energy density is required. The method is most suitable for low-symmetry crystalline, positionally disordered, and amorphous solids, particularly at high tempe...