A novel method to predict the thermal conductivity of nanoporous materials from atomistic simulations