  Magnetism and superconductivity are closely entangled, elucidating the
magnetic interactions in nickelate superconductors is at the heart of
understanding the pairing mechanism. Our first-principles and spin-wave theory
calculations highlight that NdNiO$_2$ is in the vicinity of a transition
between a quasi-two-dimensional (2D) antiferromagnetic (AFM) state and a
three-dimensional (3D) C-AFM state. Both states could accurately reproduce the
experimentally measured magnetic excitation spectra, which was previously
explained in terms of a 2D model. We further reveal that hole doping stabilizes
an incommensurate (IC) spin state and the IC wave vector increases
continuously. Direct links between hole doping, magnetization, exchange
constants, and magnetic order are established, revealing that the competition
between first-neighbor and third-neighbor in-plane magnetic interactions is the
key for the IC magnetic order.
