DNA can assume various structures as a result of interactions at atomic and molecular levels (e.g., hydrogen bonds, π–π stacking interactions, and electrostatic potentials), so understanding of the consequences of these interactions could guide development of ways to produce elaborate programmable DNA for applications in bio- and nanotechnology. We conducted advanced ab initio calculations to investigate nucleobase model structures by componentizing their donor-acceptor interactions. By unifying computational conditions, we compared the independent interactions of DNA duplexes, triplexes, and quadruplexes, which led us to evaluate a stability trend among Watson–Crick and Hoogsteen base pairing, stacking, and even ion binding. For a realistic solution-like environment, the influence of water molecules was carefully considered, and the potassium-ion preference of G-quadruplex was first analyzed at an ab initio level by considering both base-base and ion-water interactions. We devised new structure factors including hydrogen bond length, glycosidic vector angle, and twist angle, which were highly effective for comparison between computationally-predicted and experimentally-determined structures; we clarified the function of phosphate backbone during nucleobase ordering. The simulated tendency of net interaction energies agreed well with that of real world, and this agreement validates the potential of ab initio study to guide programming of complicated DNA constructs.