The electronic structure of nitrogen-doped tetrahedral carbon clusters, both amorphous and crystalline, with 21, 57 and 59 carbon atoms and various ring topologies, were studied using the self-consistent ab initio density functional theory-local density approximation (DFT-LDA). All clusters were hydrogen saturated. Clusters with n = 0, 1 and 4 nitrogen atoms were analyzed for each structure using an initial interatomic distance of 0.154 nm as in the bulk. All clusters were energy optimized maintaining tetrahedral symmetry and the position of the outermost atoms in order to simulate the inertia of the bulk. For all the clusters the energy gap increases with one N. For the 21-atom cluster which contains only 6-atom boat-rings the gap remains practically constant as n increases from 1, 6.60 to 4, 6.51 eV, unlike the other clusters. The Fermi energy varies from the top of the valence band to the bottom of the conduction band as the nitrogen concentration increases. In the forced fourfold coordinated environment N is a shallow donor as is P in Si; however, when N becomes essentially threefold coordinated, states appear in the middle of the gap. (C) 1998 Elsevier Science B.V. All rights reserved.