The characterization of magnetic materials necessitates a deep understanding of their magnetic phase. Knowledge of the magnetic ground state is essential to study magnetic excitations and other magnetic properties. In this work,
we present a self-consistent method based on first-principles calculations to determine the magnetic ground state of materials, regardless of their dimensionality. Our methodology is founded on satisfying the stability conditions derived from the linear spin wave theory (LSWT) by optimizing the magnetic structure iteratively. We demonstrate the effectiveness of our method by successfully predicting the experimental magnetic structures of NiO, FePS3, and FeP. In each case, we compared our results with available experimental data and existing theoretical calculations reported in the literature. Furthermore, our methodology can be easily combined with phonon calculations, enabling a comprehensive approach to investigate magnons' influence on materials' thermal properties by computing the magnon/phonon coupling. Finally, we discuss the validity of the method and the possible extensions.