Predicting Quantum Potentials by Deep Neural Network and Metropolis Sampling

The hybridizations of machine learning and quantum physics have caused essential impacts to the methodology in both fields. Inspired by quantum potential neural network, we here propose to solve the potential in the Schrodinger equation provided the eigenstate, by combining Metropolis sampling with deep neural network, which we dub as Metropolis potential neural network (MPNN). A loss function is proposed to explicitly involve the energy in the optimization for its accurate evaluation. Benchmarking on the harmonic oscillator and hydrogen atom, MPNN shows excellent accuracy and stability on predicting not just the potential to satisfy the Schrodinger equation, but also the eigen-energy. Our proposal could be potentially applied to the ab-initio simulations, and to inversely solving other partial differential equations in physics and beyond.


I. INTRODUCTION
In recent years, machine learning (ML) has been increasingly applied to the field of quantum physics [1]. On one hand, it provides alternative or more powerful tools to solve the problems that are challenging for the conventional approaches. For instance, neural network (NN), which is widely accepted as the most powerful ML model, is utilized to design functional materials with much higher efficiency than human experts [2][3][4][5][6][7]. One popular way is to apply to ML model to fit the relations between the experimental or numerical data and the target physical quantities. There are also some works that are directly aimed to solve physical equations, such as Schrödinger equation [8][9][10][11][12] or those in the ab-initio simulations [13,14], using ML. For the strongly correlated systems, NN has also been used as efficient state ansatz to solve the eigenstates of given Hamiltonians [15,16].
On the other hand, the hybridizations with ML bring powerful numerical tools to investigate the inverse problems. These problems are critical in many numerical and experimental setups, such as designing the exchange-correlation potentials in the ab-initio simulations of material [17,18], the analytic continuation of the imaginary Green's function into the real frequency domain [19], and designing quantum simulators [20]. One topic that currently attracts wide interests is to estimate the Hamiltonian given the states or their properties [21][22][23][24][25][26]. Considering the quantum lattice models, for example, it has been proposed to predict the coupling constants from the measurements of the target states [27][28][29] or the local reduced density matrices [30]. Sehanobish et al consider the Schrödinger equation and propose the quantum potential NN (QPNN) to predict the potential term provided the eigen wave-function [31]. These works indicate the feasibility of using ML to investigate quantum phenomena by reformulating the quantum mechanical systems as the solutions of certain inverse problems.
In this work, we propose to combine Metropolis sampling with deep NN to gain higher accuracy and efficiency on the predictions of quantum potential, which we dub as Metropolis potential neural network (MPNN). The goal is to estimate the potential in the continuous space. The data to train the NN contain multiple coordinates with the labels as the expected values of the potential function. Metropolis sampling [32] allows to efficiently obtain the training data (see some applications of Metropolis sampling to ML and quantum computation in, e.g., [15,[33][34][35][36], to name but a few) and evaluate the energies of the given wave-functions, same as the quantum Monte Carlo approaches [37][38][39]. A loss function that explicitly involves the energy is proposed to characterize the violation of the Schrödinger equation. The variational parameters in the NN are optimized by minimizing the loss function using back propagation [40]. Benchmarking on the harmonic oscillator and hydrogen atom, MPNN exhibits higher accuracy and stability on predicting the potential and evaluating the eigen-energy.
with the coordinates r = (x 1 , · · · , x D ) and m = 1 as the energy scale. Normally, the task is to solve the eigenstates and energies given the potential V (r). Here, we considered an inverse problem, which is to solve the potential so that the given wave-function Ψ(r) is the eigenstate of the Hamiltonian. In Ref. [31], the authors propose to use a deep neural network named as quantum potential neural network (QPNN) to predict the unknown potential V (r). In detail, the QPNN maps the coordinates to the values of the potential, denoted as U θ (r) with θ the variational parameters of the QPNN. With a trial potential, a spatial-dependent energy is introduced as or One can see that E(r) and E (r) is the same if Ψ(r) is real for any r. The authors of Ref. [31] proposed to use E (r), considering that the square root of the probability density is much easier to access in experiments.
To characterize the extent of how the Schrödinger equation is satisfied, the loss function is defined as with r 0 a given coordinate at which the value of potential V (r 0 ) is previous known. In the practical simulations, one should choose a finite region and discretize the space into pieces with identical width. The loss function is then approximated as where {r n } are sampled randomly from the discretized positions. The loss minimally takes L = 0. In this case, one has E(r) = E as a constant independent on r, and U θ (r 0 ) = V (r 0 ). Then Ψ(r) is strictly the eigenstate of the Hamiltonian given by the QPNN and E the eigen-energy. With a nonzero loss, one normally has E as a function of the coordinates r, and possibly a deviation between U θ (r 0 ) and its expected value V (r 0 ). In general, the loss function L in Eq. (5) characterizes how well the potential from the QPNN gives the target wave-function as an eigenstate, and should be minimized. The QPNN can be updated using the gradient decent method as with η the learning rate.

III. METROPOLIS POTENTIAL NEURAL NETWORK METHOD
The MPNN method is illustrated in Fig. 1. Our goal is solving the potential V (r) while knowing the target wave-function Ψ(r) as the eigenstate of the Hamiltonian. The first step is sampling N positions {r n } according to the probability distribution The sampling process can be implemented on a quantum platform if one can make sufficiently many copies of the state Ψ(r), or on a classical computer when Ψ(r) is analytically or numerically accessible. Then a neural network (NN) is applied to predict the values of potential at these positions To estimate how the potential predicted by the NN satisfies the Schrödinger equation, we define the loss function as meansquare error of the deviations that reads Since any global constant shift of the potential (i.e. V (r) ← V (r) + const.) would only cause a shift on the energy, a Lagrangian multiplier is added to fix the constant. In other words, we need to know the value of the ground-true potential V (r 0 ) at one certain coordinate r 0 . The λ is a tunable hyper-parameter to control the strength of this constraint. In H θ = − ∇ 2 2 + U θ , the kinetic energy can be estimated while knowing Ψ(r), and U θ is given by the NN.
In L, we explicitly evaluate the energyẼ of the target state given U θ (r n ) as with E(r n ) given by Eq.
(2) and the positions {r n } sampled from the probability distribution P (r) in Eq. (7). With the loss L → 0, the NN would give a potential U θ (r n ) → V (r) satisfying the Schrödinger equation (note V (r) denotes the "correct" potential that we expect the NN to give). Meanwhile, the constraint is satisfied, i.e., |U θ (r 0 ) − V (r 0 )| → 0, with L → 0.

IV. NUMERICAL RESULTS
To benchmark the performance of MPNN, we take the ground states of the hydrogen atom and 1D harmonic oscillator (HO) as examples. Note for the hydrogen atom, we do not use the spherical coordinate to transform the Schrödinger equation in three spatial dimensions to a 1D radial equation, just to test the performance on predicting the 3D potentials.
To compare with QPNN, here we use the same architecture of the NN. There are three hidden layers in the NN, where the (a) Error of potential  [31]. See more details about the evaluations of the error and energy for these three methods in the main text.
number of the hidden variables in each layer is no more than 128. A residual channel is added between second and third layers. We use Adam as the optimizer to control the learning rate η [see Eq. (6)]. The testing set are sampled independently from the training set. In other words, the coordinates in the testing set are different from those in the training set.
To show the accuracy, we demonstrate in Table I (a) the error of potential as (2) as a constant. Therefore, it is a reasonable evaluation of the energy for QPNN using the average of E(r) as A more reasonable choice to evaluate the average of the Hamiltonian Ĥ θ for Ψ(r), for which the correct way is to calculate a weighted average as Eq. (9). For this reason, we use Metropolis sampling to get the positions {r n } in QPNN+MS. Another potential advantage of using Metropolis sampling is that the positions with |Ψ(r)| → 0 will be avoided since the probability of having these positions will be vanishing. For the nonzero {r n }, we have E(r n ) = E (r n ). From our results, we do not see obvious improvement on evaluating the energy by introducing Metropolis sampling to the QPNN. The error compared with the exact solution is around O(10 −1 ). One possible reason is that the energy is not explicitly involved in the loss function, i.e., in the optimization. The MPNN method gives the most accurate among these three approaches, with the error around O(10 −3 ).
MPNN also shows its advantage on the sampling efficiency. Compared with the expected potential V (r), the best result is obtained by the MPNN, illustrated in Fig. 3 (a). By changing the initialization strategy of the NN, say without multiplying the initial θ with δ, one may obtain a different energy with a similar loss, as shown in Fig. 3 (b). Our simulation results indicate an effective initialization strategy by letting the initial potential be near the hyper-surface of V = 0. This can be done by first randomly initializing all θ in the NN and then multiplying them with a small factor, e.g., δ = 0.01.
In Fig. 3 (c), we set λ = 0, then an extra degree of We take the numbers of hidden variables to be the same values as those in Fig. 2. freedom will appear. It can be easily seen that a potential V (r) = V (r) + C will be the solution of our inverse problem for any constant C if V (r) is the solution. The penalty term 2 is to fix this degrees of freedom to give the correct energy. Fig. 3 (d) shows the U θ obtained by the QPNN. The dominant error is the data that are taken near the center of the potential. For the MPNN, the positions with larger |Ψ(r)| are taken more frequently in the Metropolis sampling. Bet-ter prediction is obtained since such data contribute more to the physical properties, such as the observables and the gradients in optimizing the NN, compared with those that have small |Ψ(r)|.
The penalty term λ [U θ (r 0 ) − V (r 0 )] 2 is to fix the degrees of freedom with a global shift of the potential. The coefficient determines how strictly we require the NN to give the correct value at the position r 0 . Fig. 4 shows the error ε in Eq. (10) of the hydrogen atom with different values of λ. For λ = 0, meaning we do not require U θ (r 0 ) = V (r 0 ), the predicted potential can be shifted determined by the initial values of θ. Thus one cannot correctly give the energyĒ, and the error ε is significant. But the loss is small with L ∼ O(10 −4 ). This means without knowing the potential at some position, we cannot uniquely give the eigen-energy of Ψ but can still give the potential U θ so that Ψ is the eigenstate ofĤ θ .
As λ increases to certain extent, we are able to obtain the expected potential V (r) with small ε. Note the loss is still small, which fluctuates around L ∼ O(10 −4 ) − O(10 −5 ). In such cases, we obtain accurate predictions of the eigen-energȳ E −0.5.

V. SUMMARY
The hybridization of machine learning with quantum physics brings new possibility to solve the important problems that are challenging using the conventional approaches. Stimulated by the quantum potential neural network, we consider to predict the potential in Schrödinger equation, with which the target state Ψ is the eigenstate of the Hamiltonian. The Metropolis potential neural network (MPNN) is proposed to predict the potential by combining deep neural network and Metropolis sampling. With the benchmark on the harmonic oscillator and hydrogen atom, MPNN exhibits excellent precision and stability on both predicting the potential and evaluating the eigen-energy. Our proposal can be readily generalized to inversely solving the Schrödinger equation of multiple electrons, and the differentiation equations for other physical problems.