Accurate prediction of second-order elastic constants from first principles: PETN and TATB