Ab initio study of the gap opening within the graphite into diamond topological transformation