  We propose a quantum algorithm for inferring the molecular nuclear spin
Hamiltonian from time-resolved measurements of spin-spin correlators, which can
be obtained via nuclear magnetic resonance (NMR). We focus on learning the
anisotropic dipolar term of the Hamiltonian, which generates dynamics that are
challenging-to-classically-simulate in some contexts. We demonstrate the
ability to directly estimate the Jacobian and Hessian of the corresponding
learning problem on a quantum computer, allowing us to learn the Hamiltonian
parameters. We develop algorithms for performing this computation on both noisy
near-term and future fault-tolerant quantum computers. We argue that the former
is promising as an early beyond-classical quantum application since it only
requires evolution of a local spin Hamiltonian. We investigate the example of a
protein (ubiquitin) confined in a membrane as a benchmark of our method. We
isolate small spin clusters, demonstrate the convergence of our learning
algorithm on one such example, and then investigate the learnability of these
clusters as we cross the ergodic to non-ergodic phase transition by suppressing
the dipolar interaction. We see a clear correspondence between a drop in the
multifractal dimension measured across many-body eigenstates of these clusters,
and a transition in the structure of the Hessian of the learning cost-function
(from degenerate to learnable). Our hope is that such quantum computations
might enable the interpretation and development of new NMR techniques for
analyzing molecular structure.
