  Pendlebury $\textit{et al.}$ [Phys. Rev. A $\textbf{70}$, 032102 (2004)] were
the first to investigate the role of geometric phases in searches for an
electric dipole moment (EDM) of elementary particles based on Ramsey-separated
oscillatory field magnetic resonance with trapped ultracold neutrons and
comagnetometer atoms. Their work was based on the Bloch equation and later work
using the density matrix corroborated the results and extended the scope to
describe the dynamics of spins in general fields and in bounded geometries. We
solve the Schr\"odinger equation directly for cylindrical trap geometry and
obtain a full description of EDM-relevant spin behavior in general fields,
including the short-time transients and vertical spin oscillation in the entire
range of particle velocities. We apply this method to general macroscopic
fields and to the field of a microscopic magnetic dipole.
