Ab initio study of magnetochiral birefringence