Quantum electronic mechanisms of atomic rearrangements during growth of hard carbon films