SURPRISES: when ab initio meets statistics in extended systems