Oxidation of graphite by atomic oxygen: a first-principles approach