Electronic structure and magnetism of transition metal oxides : the case of Fe3O4