  The energetic cost of creating a defect within a host material is given by
the formation energy. Here we present a formulation allowing the calculation of
formation energies in one-dimensional nanostructures, which overcomes the
difficulties involved in defining the chemical potential of the constituent
species and the possible passivation of the surface. We also develop a formula
for the Madelung correction for general dielectric tensors and computational
cell shapes. We apply this formalism to the formation energies of charged Al
impurities in silicon nanowires, obtaining concentrations significantly larger
than in their bulk counterparts.
