The atomic structure of carbon materials is studied using the example of pyrocarbon and boronrich pyrocarbon by means of the method of reconstruction of the wave function in transmission electron microscopy. It is shown that the digital processing of the phase distributions of these functions allows us to find the average distance between the basal planes. Using the method of molecular dynamics for the formation of the test structures and obtaining for them the calculated phase distributions, the effect of depletion of the basal planes of the carbon atoms on the interplanar distance in the pyrocarbon materials is quantified.