Theoretical calculation of positron lifetimes for defects in solids