Density-functional-theory calculations have been performed to study the effect of doping and growth stoichiometry on the core structure of a threading edge dislocation in GaN. Four candidate structures were examined and their formation energies were found to depend strongly on Fermi level and growth stoichiometry. A structure having gallium vacancies at the dislocation core is predicted to be most stable in n-type material grown under nitrogen-rich conditions, while a structure without vacancies is most stable in p-type material grown under these conditions. In material grown under gallium-rich conditions, a structure having nitrogen vacancies at the dislocation core is predicted to be most stable in p-type material, whereas a variety of core structures should be present in n-type material. Edge dislocations are predicted to behave as electron traps in n-type material and may act as hole traps in p-type material depending on the growth conditions. (C) 1998 American Institute of Physics. [S0003-6951(98)02545-5].