Defects play a crucial role in determining the macroscopic properties of materials. The profound significance of defects arises from the coupling between the discrete effects of the lattice, chemical effects of the core and the long-range effects of the elastic field. Defects and their interactions give rise to several interesting phenomena, such as void nucleation, diffusion of solutes, solute clustering, dislocation solute interactions, to name a few. Density functional theory DFT is capable of accurately describing the chemistry of the defect core, but the traditional formulations of DFT are restricted to the use of periodic boundary conditions and small cell sizes, which render them inefficient for studying defects in materials. In this work, we adopt a spectral quadrature formulation and a Coarse Graining strategy of DFT to develop a computational framework that allows us to simulate isolated defects in materials, by overcoming the challenges posed by existing DFT methods to study defects in materials. We use this framework to study defects and their interactions in magnesium alloys.