## Abstract

Mixed quantum-classical dynamics is a set of methods often used to understand systems too complex to treat fully quantum mechanically. Many techniques exist for full quantum mechanical evolution on quantum computers, but mixed quantum-classical dynamics are less explored. We present a modular algorithm for general mixed quantum-classical dynamics where the quantum subsystem is coupled with the classical subsystem. We test it on a modified Shin-Metiu model in the first quantization through Ehrenfest propagation. We find that the Time-Dependent Variational Time Propagation algorithm performs well for short-time evolutions and retains qualitative results for longer-time evolutions.

### Similar content being viewed by others

## Introduction

Quantum computers have found great success in electronic structure theory through the variational quantum eigensolver^{1} and subsequent algorithms known as variational quantum algorithms (VQA)^{2}. Considering the full nuclear dynamics, the problem becomes unmanageable much faster, potentially even for quantum computers^{3}. One way to reconcile this is to partition the system into interacting quantum and classical parts. This is the realm of mixed quantum-classical (MQC) approaches, which are a widely used set of tools for understanding chemical systems^{4,5}. In quantum computing, this area is less researched than the electronic structure problem, but it is actively being explored^{3,6,7}. In this work we propose and explore a noisy intermediate-scale quantum (NISQ) friendly algorithm that can be used to study MQC dynamics.

Using quantum computers alongside classical computers is the backbone of VQAs, but splitting a system into sections treated separately by each machine is not new. An example of this is the density functional theory (DFT) embedding scheme with a quantum computer expansion of the active space^{8} and has been found to outperform certain types of state-of-the-art approximate techniques such as complete active space self-consistent field (CASSCF)^{9} in finding ground state energies. Furthermore, ground state dynamics, geometry relaxation, and force measurements for molecular dynamics applications have been explored with success^{7,10,11}. Ollitraut et al.^{3} explored dynamics in both first and second quantization, but using a time-independent Hamiltonian. This is also the case for various other time propagation techniques^{12,13,14}; we draw inspiration from and use projected variational quantum dynamics (p-VQD)^{13} in this work.

Our contribution is the presentation of a general algorithmic structure to tackle non-adiabatic molecular dynamics (NAMD) by offloading the quantum mechanical (QM) part to a quantum computer and evolving the classical system by the Ehrenfest method. Observables from the QM subsystem are measured and used to update the classical system, which in turn will update the time-dependent Hamiltonian that is used to evolve the QM state in turn. The electronic subsystem is treated in first quantization on a local diabatic basis. The latter saves the algorithm from needing to measure nonadiabatic couplings, as these are treated directly within the wave function and its evolution. The algorithm is demonstrated in the Shin-Metiu model^{15}, which is often used to test non-adiabatic techniques^{16,17,18,19}. We consider the model by partitioning it into a classical nucleus and a quantum electron. Under this framework, the major contribution is establishing how the measurement of observables in the quantum computer affects the update of the classical and quantum states of the system, as well as introducing a general scheme that is suited for the exploration of other time-dependent phenomena under a mixed quantum-classical paradigm on NISQ machines.

The theoretical advantage of using quantum computers relies on the fact that they have access to an exponentially growing computational space for each additional qubit^{20}. Current machines consist of hundreds of qubits, which would ideally allow them to already outperform current supercomputers. This is not the case due to noise arising from interactions with the environment and imperfect gate implementations. As such, NISQ algorithms^{21} have to contend with limits on the number of imperfect operations that can be made. But even if this were not the case and full quantum dynamics could be simulated for larger systems than currently possible, we may still want to tackle even bigger problems, so MQC approximations on quantum computers retain their raison d’être.

Finally, it should be noted that existing supercomputers by far outperform existing quantum computers in handling large quantum-chemistry problems, and applications to hitherto unsolvable chemical systems will have to be deferred until there is a provable quantum advantage in this application domain. Approximations like limiting the simulation to a selected active space^{8} can extend the reach of quantum computers, but analogs of these ideas apply to classical computers as well. For now, quantum algorithms in chemistry mostly study systems that are comfortably computable on current classical hardware, although this state of affairs may change in the future.

## Results

### Time-dependent Hamiltonian variational quantum propagation

The time-dependent variational quantum propagation (TDVQP) algorithm builds on the circuit compression idea of (p-VQD)^{13} by allowing the Hamiltonian to be time-dependent. For many large problems of interest in theoretical chemistry, especially in dynamics applications, it is impossible to simulate the system of interest fully quantum mechanically. A common strategy is to subdivide the system into classical and quantum components. The evolution of both subsystems occurs in locked steps, with the classical subsystem defining the Hamiltonian for the quantum evolution, and the quantum subsystem then feeding back into the classical component in the way of some observable, usually the energy gradient (force).

The algorithm begins with a parameterized circuit initialized to some desired state. This is denoted as \(\left\vert {\psi }_{0}\right\rangle\), which will have been generated according to a Hamiltonian based on an initial vector of classical parameters \({\overrightarrow{q}}_{0}\) of the classical coordinates, which we denote \(H({\overrightarrow{q}}_{0}):= {H}_{0}\). This is done by choosing some sufficiently expressive parameterized circuit ansatz \(\hat{C}(\overrightarrow{\theta })\) which takes the quantum register of the quantum computer from its initial state \(\left\vert 0\right\rangle\) to \(\left\vert {\psi }_{0}\right\rangle\). This can be done using a VQA to find a chosen state with respect to *H*_{0}, which returns the circuit parameters \({\overrightarrow{\theta }}_{0}\). Then \(\left\vert {\psi }_{0}\right\rangle =\hat{C}({\overrightarrow{\theta }}_{0})\left\vert 0\right\rangle\). A chosen set of observables \(\{\hat{{O}^{(s)}}({q}_{0})\}:= \{{\hat{{O}^{(s)}}}_{0}\}\) are measured from \(\left\vert {\psi }_{0}\right\rangle\), which yield a set of expectation values \(\{{O}_{0}^{(s)}\}\). These observables are used to evolve the classical state of the system, generating a new vector of classical parameters \({\overrightarrow{q}}_{1}\). Now, one evolves the state from \(\left\vert {\psi }_{0}\right\rangle\) to \(\left\vert {\psi }_{1}\right\rangle\) by applying the time evolution operator to the state, \(\left\vert {\psi }_{1}\right\rangle =\exp (-i{\hat{H}}_{0}\Delta t)\left\vert {\psi }_{0}\right\rangle\). Thereafter one can generate *H*_{1} and measure \(\{{\hat{{O}^{(s)}}}_{1}\}\), which provides the necessary information for the next classical step. In a physical implementation, measuring the observables destroys the wavefunction, so this has to be done after the parameters defining the wavefunction at the current step, \(\left\vert {\psi }_{1}\right\rangle \approx \hat{C}({\theta }_{1})\left\vert 0\right\rangle\), have been found with a single step of the p-VQD algorithm to some desired threshold. This process is repeated until the desired timestep is reached. The entire process is described in Algorithm 1, and a depiction of the quantum circuit can be seen in Fig. 1. The overall number of circuit evaluations is linear with respect to the number of iterations, circuit parameters, timesteps and Pauli terms of the observables. This is treated in greater depth in Supplementary Note 1. The physical implementation of the quantum time evolution can either be the Trotterized form of the operator or some other approximate time evolution. In this work, we simply use \({\hat{H}}_{0}\) to evolve the quantum state with a first-order Trotter expansion. The Hamiltonian used for the time evolution could be of higher order. For example, \(({\hat{H}}_{0}+{\hat{H}}_{1})/2\) can be used with no extra cost in this scheme, but higher-order integrators will require an additional evolution and observable measurement for each timestep beyond *H*_{1}.

TDVQP should be thought of as a meta-algorithm that has replaceable components. The most directly replaceable part is the choice of ansatz \(\hat{C}(\overrightarrow{\theta })\). At the moment, one uses some heuristic choice for most problems in NISQ devices. More advanced choices, such as the family of adaptive ansatze have been shown to work in this scheme^{22}. The time evolution is currently performed via a Trotterized form of the time evolution operator, as in p-VQD^{13,14}. Alternatives exist in the form of more NISQ-friendly time evolutions as is done in several works^{23,24}. The theoretical limiting factor for \(\hat{C}(\overrightarrow{\theta })\) is the no-fast forwarding theorem^{25,26,27}, which states that one cannot achieve a time evolution of time *t* in a sublinear gate count for a general Hamiltonian. For shorter-time evolutions, limited system sizes, and specific Hamiltonians, including our sparse Hamiltonian, this theorem is likely not to apply strictly^{24}.

In the classical evolution, the choice of integrator and the actual Hamiltonian used in the time evolution will depend on the type of problem and desired accuracy. Integrators like the Velocity Verlet algorithm require no additional resources. TDVQP becomes exact when \(\hat{C}(\overrightarrow{\theta })\) can express the system perfectly for any configuration of classical parameters \(\overrightarrow{q}\), given that the exact parameters \(\overrightarrow{\theta }\) can be found by optimization. Finding more efficient \(\hat{C}(\overrightarrow{\theta })\) ansatze, VQA, and shot-efficient optimizers is at the forefront of dedicated research in this area^{2}, and it is out of scope for this work.

#### Error propagation in TDVQP

The TDVQP algorithm inherits the inaccuracies of its constituent parts. This includes the chosen circuit compression algorithm, time evolution approximation, and the classical propagator. This section illustrates the sources of error in the wavefunction and observables, and their interdependence in the velocity-Verlet integrator. A more thorough derivation and discussion can be found in Supplementary Note 2.

When running the algorithm, any coherent error on the wavefunction representation in the quantum computer \(\left\vert \tilde{\psi }\right\rangle\) can be represented as a superposition of the desired state \(\left\vert \psi \right\rangle\) and some combination of undesired orthogonal states \(\left\vert \phi \right\rangle\), such that \(\left\vert \tilde{\psi }\right\rangle =\sqrt{1-{I}^{2}}\left\vert \psi \right\rangle +I\left\vert \phi \right\rangle\), where *I* is the infidelity. When measuring the expectation value of a Hermitian observable \({{{{{{{\mathcal{O}}}}}}}}\) on \(\left\vert \tilde{\psi }\right\rangle\) one thus gets

How this translates into the actual measured observable is system-dependent. This will lead to an error in the observable, which in the case of the velocity-Verlet integrator with a force error *F*_{i}*ϵ* ∝ *I*^{2} in 1 dimension will give a new position \({\tilde{R}}_{i}\) of

shifted from the expected true position *R*_{i}. This is linear in the error of the force and quadratic with respect to the timestep Δ*t*. The following time evolution Hamiltonian and observable operator will be based on this position with an error, which is again, system dependent. The effect is illustrated by the equations

Even in the one-dimensional model used in this work, this effect is not analytically computable, but it is small if the timesteps are sufficiently small. This then enters the velocity \((\dot{R})\) update as

which is linear in the error and timestep. Assuming for simplicity a constant error over all times of *F*_{ϵ}, that is to say, that the force deviates from the correct one by a constant offset, this has the overall effect on the position at iteration *i* of

This expression is quadratic in *i* and quadratic in timestep. The effect on the fidelity of the TDVQP wavefunction compared to an exact propagation is nontrivial, but numerical examples are provided in Supplementary Note 2.

The other source of error inherent to the p-VQD algorithm is that the optimizer does not converge to a perfect representation of the time-evolved wavefunction, but rather to an approximation that meets some fidelity threshold *T* < 1. If at least this threshold is met at each p-VQD step, assuming all observable measurements are unaffected, then the decrease in the fidelity is modeled by

When the algorithm is run under limited quantum resources and thus subject to finite sampling noise, both the observable and p-VQD step fidelity measurements will have some Gaussian distribution, which will feed into the errors above on a simulation-by-simulation basis. The effect of this has been analyzed numerically in the case of our modified Shin-Metiu Model.

### The Shin Metiu model

The Shin-Metiu model is a numerically exactly solvable minimal model which captures essential nonadiabatic effects^{15}. It is often used as a benchmark system for new techniques and physical effects, for example in polaritonic dynamics, and to study the effect of electromagnetic fields from first principles^{16,17,18,28}. Its parameters can be chosen to exhibit adiabatic to strongly non-adiabatic dynamics.

In its simplest and original conception, the model shown in Fig. 2a consists of two stationary ions separated by a distance of *L*, specifically located at \(\frac{L}{2}\) and \(\frac{-L}{2}\). These enclose a mobile ion *p* of mass *M* at distance *R* from the origin and an electron *e*^{−} at distance *r*. The modified Coulomb potential is parameterized by the constants *R*_{l}, *R*_{r} and *R*_{f}, as shown in Eq. (8). This avoids singularities and renders the system numerically stable to simulate.

The Hamiltonian of the system reads

with the electronic part being

The Hamiltonian above is defined using atomic units, *m* = *e* = *ℏ* = 1, and we also take *Z* = 1, *M* = 1836. The constants *R*_{l}, *R*_{r} and *R*_{f} are given in Fig. 2 and are designed to create a sharp avoided crossing between the ground and first excited adiabatic electronic states at *R* = − 1.9 a.u.. These parameters were chosen to be similar to those used in several studies of the model^{16,19}. The shape of the Born-Oppenheimer potential energy surfaces (BOPES) can be seen in Fig. 2b

#### Ehrenfest propagation

In the Ehrenfest propagation of the Shin-Metiu model the electron subsystem is treated as a quantum particle described by Hamiltonian (8), where *H*_{e} is parameterized by the nuclear position (*R*), while the nuclear subsystem is described classically by the position (*R*) and velocity (\(\dot{R}\)).

For initial coordinates \({R}_{0}\,{{{{{{{\rm{and}}}}}}}}\,{\dot{R}}_{0}\), we first prepare the electronic Hamiltonian *H*_{e}(*R*_{0}), which is used to compute the initial state of the electron \(\left\vert {\psi }_{0}\right\rangle\). Thanks to the simplicity of the model, one can use exact diagonalization to compute the eigenvectors and choose any arbitrary superposition of eigenvectors as the initial state.

The nucleus is evolved using the velocity-Verlet method^{29} with the acceleration being computed from the Coulombic repulsion from the fixed ions and the force from the electronic state. The electronic state is propagated by unitary time evolution with the Hamiltonian at the nuclear position. We use a timestep Δ*t*, and subscripts *i* denote the specific step. We set our initial conditions at timestep 0, and for the *i*^{th} step, we compute

### Numerical results

We consider two situations in the following: first, we consider a single set of initial conditions meant to illustrate the accuracy of the algorithm in reproducing the numerically exact evolution of the quantum-classical system. Although a single trajectory is not likely to be the intended use case of TDVQP in most applications, it is nonetheless most instructive to determine its behavior. Second, we consider the molecular dynamics-like (MD) use case, where initial conditions are sampled from a distribution and where we use a single TDVQP evolution per trajectory. The initial classical conditions are picked as random pairs of position and velocity from a thermally averaged distribution centered around the same initial value as the (single) simulations. The specific initial conditions are shown in the “Numerical Simulations” subsection of the Method section. Their average dynamics are taken as an approximation to the true system evolution. For NISQ devices, one can consider different approaches to MD such as those mentioned by Kuroiwa et al.^{30}.

The quality of the simulations of closed Hamiltonian systems can be gauged in their energy conservation. We use a symplectic integrator in the classical system (velocity-Verlet), and in the exact diagonalization case, we see energy conservation for up to 50,000 timesteps. However, as can be seen in Fig. 3a, the TDVQP algorithm does not conserve energy. This is because the populations are not preserved in the diagonal basis in the p-VQD step, as the optimization of the quantum state is limited to a finite number of iterations and the circuit ansatz is not complete. The effect of this population leak can be seen clearly in Fig. 3b, where one observes how the population in higher states increases much faster than in the exact case. The population plot is shown at the infinite shot limit for clarity, but the finite shot cases can be found in Supplementary Note 3.

As a consequence of the higher energy levels becoming increasingly populated, there is an error in the measured observables. Figure 4 shows the mean of the electron force measurements from TDVQP compared to the ideal measurements at different per-circuit shot counts. It is clear that the mean value slowly deviates from the ideal evolution, even in the infinite shot limit, and that one requires 10^{5} shots per circuit to reach qualitatively relevant results at longer times. Efficiently estimating energy gradients is a demanding task, and this work does not implement some of the NISQ-friendly techniques that have been developed^{31,32}, but this is expected to be a problem even in the fault-tolerant regime^{33}.

Another consequence of the progressive and unphysical population of higher energy levels is that the fidelity decreases gradually, as can be seen in Fig. 5a. This general degradation of quality could be mitigated with dedicated strategies, such as measuring the energy and allowing the cost function to penalize when the system is not conserving energy. However, this would require measuring the expectation value of the system Hamiltonian, which would increase the cost of this algorithm.

We see in Fig. 5a that the fidelity decays in all cases over time and that for long-term time evolutions, one requires more than 10^{5} shots per step. At lower shot counts the fidelity falls quickly, following Eq. (7) until an equal superposition is approached. In this final state of the quantum register there is a residual overlap with the true physical state, which sets a higher floor than zero for the decay of the fidelity. The potential effects of other noise sources are described in more detail in Supplementary Note 2.

Figure 5b zooms into the two more reasonable fidelity lines, those of the infinite and 10^{5} shot simulations. Here we can see that using the multiple trajectories in an MD sense somewhat improves the simulation fidelity compared to the single trajectory case, and more quantum-tailored algorithms like^{30} may improve this further. In the infinite shot case, the difference is minimal - but due to the larger variance of the MD simulations compared to the ideal trajectory, the performance tends to be minimally worse.

The relationship between shots and fidelity is also illustrated in Fig. 5c, where one can more clearly see that the MD simulation slightly improves the results at longer time evolutions when using finite shots. However, this improvement is not very large. It also highlights the large improvement in fidelity when using higher shot counts. The p-VQD implementation (see Ref. ^{13}) on which we base our time evolution evolves the system for 40 iterations (20 a.u. here), where we see very high compression fidelities beyond 10^{4} shots per circuit evaluation.

Finally, Fig. 6 illustrates that in the simulation the maximum number of iterations of the quantum state optimizer (100) is quickly reached before the 200^{th} timestep at the infinite shot limit. The overall mean final infidelity is 10^{−5}, although the fitted threshold of Eq. (7) for the overall algorithm is slightly lower at 3 ⋅ 10^{5}. The infidelity is defined as \(I=1-{{{{{{{\mathcal{F}}}}}}}}\), where \({{{{{{{\mathcal{F}}}}}}}}\) is the fidelity. This implies there is an additional error, likely due to the drift of the exact simulation from the TDVQP case. This is consistent with a 10^{−6} to 10^{−7} shift in the force as described in the numerical simulations in Supplementary Note 2, which is also roughly the difference in the force observable seen in Fig. 4.

Overall the results show some interesting behavior. The number of timesteps modeled in this work compared to previous studies is very large^{13}. This results in a qualitative agreement in the region of interest where there is a significant population transfer, but high qualitative accuracy is missing. Furthermore in this simple model, the energy levels are well separated and we begin in the ground state. This results in a strong unidirectional contribution from population leakage to higher energy levels. In a more complex molecule, one would begin, for example, from a thermal ensemble of not only velocities but also states. In turn, the leakage would then result in deviations towards both higher and lower energy levels and might be less detrimental to the ensemble average than here.

## Discussion

Time-dependent evolution is an exceptionally interesting problem that can be well explored through quantum computers. Many techniques can be used for full quantum systems^{13,14,23,24,34,35} which are suitable to both near term and fault-tolerant machines.

Algorithms that are suitable for MQC dynamics do require efficient and accurate full quantum dynamics, but the interplay between the classical and quantum systems brings a new spate of challenges. To exchange information, one must measure observables from the quantum system, which is expensive and destroys the state, requiring at minimum an efficient way to measure energy gradients, which is an area of active research^{31,32,36}. This is a disadvantage, but it also means that one is limited to short-time evolutions between measurements. This makes it possible that a single Trotter step is accurate enough^{37,38}, which is beneficial to near-term devices.

Even though larger timesteps may be possible, the longer the time evolution, the longer the quantum-state optimizer takes to find the time-evolved ansatz parameters. This is because the previous timestep parameters are no longer as close to the evolved ones. At the same time, most classical MQC methods do not update the parameters that govern the classical system’s evolution at the small time intervals we use^{4}. It would be advantageous to use the largest possible classical timestep for a given integrator. To do this, one could do multiple compression steps with short-time Trotterizations using a constant Hamiltonian and only measuring the desired observables after the quantum system has evolved for the standard timestep of the classical problem, performing updates after this point. This will leverage the underlying compression algorithm to its fullest and reduce the overall number of measurements required.

The algorithm we present takes advantage of the above facts and is highly modular. Although the results are shown using an algorithm like p-VQD^{13} with Trotterization of the operator, there is no reason that other efficient time evolution algorithms couldn’t be used. This is especially true if the time evolution operator could be efficiently represented by techniques other than the Trotterization of the Hamiltonian. The update step used here measures the Pauli string decomposition of the \(\frac{dH}{dR}\) matrix to compute forces, but other techniques exist in the fault-tolerant regime^{33,36}, as well as in the NISQ regime^{31,32}. The main constraint with TDVQP is the fact that throughout the time evolution, there are inevitable inaccuracies in optimization, due to the compression step not preserving the populations in the diagonal basis as would have been expected as shown in Fig. 3b. This has the direct consequence that energy is not conserved, even though in the ideal simulation this is the case as shown in Fig. 3a. Due to this accumulated error, fidelity falls continuously, and the effect is compounded when quantum resources are finite.

These problems might be tackled by either increasing the threshold of the compression step or by measuring the energy and penalizing the optimizer when energy is not conserved. Another option that may be possible is designing an ansatz with problem-specific constraints^{39}. Such an ansatz considers properties such as particle preservation within their structure (not relevant in our first quantization treatment here), which may remove the need for expensive additional iteration steps or measurements. Furthermore, it may be possible to replace the p-VQD propagation with other compression methods^{14}.

We have also found that the inaccuracy of the propagation mostly originates from the compression step and due to finite sampling effects rather than from the discretization of the classical timesteps. Although we did not consider noise effects, we refer the reader to^{14}, where the performance of p-VQD under noise was explored for full quantum dynamics.

Overall we have introduced the TDVQP algorithm for MQC dynamics with the quantum subsystem computed on a quantum computer and have explored it on the Shin-Metiu model as an example of Ehrenfest dynamics in first quantization. The approach reproduces the expected observables and state evolution quantitatively at short times and qualitatively afterwards. The algorithm is modular and refinements to it may be tackled in future research. Inaccuracies of the quantum computer can also be mitigated when computing ensemble averages of the classical properties. This work shows that MQC simulations may be practically feasible on noisy quantum computers if it is proven that variational quantum algorithms can have an advantage in chemical problems.

## Method

### Numerical simulations

To gauge the performance of the scheme we implement the Shin-Metiu model as described in the Results section. The BOPES presents an avoided crossing at around *R* = − 1.9 a.u. We initialize the system with the nucleus at an initial position of *R* = − 2 a.u. and an initial velocity of *v*_{0} = 1.14 ⋅ 10^{−3} a.u., the average nuclear velocity from the Boltzmann distribution at 300K. The electronic system is initialized through the VQE with a random set of parameters and is allowed 300 iterations to approximate the ground state. The system is then evolved through the TDVQP algorithm with a timestep of Δ*t* = 0.5 a.u. Each quantum time evolution step attempts to reach a fidelity threshold of 1 − 10^{−5} using up to 100 iterations of stochastic gradient descent^{40} to find the optimal circuit parameters to approximate the previous time evolved state. Gradients were computed through the parameter shift rule^{41}. All simulations are done on 16 grid points that can be represented by 4 qubits.

We examine two different situations. First, we keep the initial conditions constant but sample different VQE ground state approximations, which we call the single case. In the second case, we examine the MD-type approach in depth, where we sample a normal distribution of initial conditions for the initial velocity of the nucleus and allow one TDVQP evolution per sample. The velocity distribution is sampled from the Boltzmann distribution, only keeping positive velocities so that the nuclei approach the avoided crossing. The results shown are 100 samples that are evolved for 1000 timesteps which bring the classical trajectory beyond the avoided crossing point.

Additional examples are provided for longer-time evolutions as well as for non-ground state evolution in Supplementary Note 4. Excited states and superpositions are prepared by using the uncomputation step of the TDVQP, but instead of starting the state with a known circuit from the VQE, the simulator is simply initialized to a desired arbitrary state, and the optimizer attempts to uncompute it with the ansatz and then those parameters are used as the initial step in place of the VQE. Various techniques to prepare excited states exist^{42,43}, but are not the focus of this work.

We use two different metrics to establish the accuracy of the TDVQP algorithm: the ideal evolution begins at the desired state to numerical precision and is evolved by exact diagonalization. But, precise state preparation is another area of intense study^{44}. To better gauge the performance of the TDVQP in isolation, we also perform an exact evolution, which uses the VQE-optimized initial state for evolution via exact diagonalization. This allows us to remove any bias from a poorly optimized ground state.

The VQE uses an ansatz of the form shown in Fig. 7, which was heuristically chosen as it can achieve ground state infidelities of up to 10^{−5} on this system with 4 layers. We use the same ansatz as in the p-VQD paper^{13}, but various ansatze can be used, and for first quantization problems, in particular, there are some examples of how several different heuristic ansatze perform in^{45}. The number of repetitions of the Trotterization layer is another choosable parameter, but as the decomposition of the Trotterized operator into native gates is deep, we limit ourselves to one. Although for full quantum dynamics, this would be very inaccurate for larger timesteps, the interaction with a classical system necessitates that we use short time steps, so that the Hamiltonian of the system is kept up to date with the classical state of the system. This means that a single Trotter step is all that is needed, and the number of layers of the ansatz can compensate as shown in Supplementary Note 5.

The simulations were run on the Qiskit state vector simulator (version 0.28)^{46} using the parameter-shift rule^{41,47} to determine the analytic gradients required for gradient-descent based optimization. Numpy^{48} was used for the exact numerical simulations, to prepare the Hamiltonian and to compute the velocity Verlet steps.

### Grid-based mapping to qubits

We treat the Shin-Metiu system on the quantum computer in first quantization. We use a finite difference method on an equidistant grid. This renders the kinetic energy matrix tri-diagonal and the potential energy matrix diagonal. If the grid is fine enough, this is an appropriate approximation, but in general discrete variable representations (DVR) are a better choice. In quantum computing, DVRs have been used to explore first quantization simulations^{34} using the Colbert and Miller DVR^{49}. Issues exist with using DVRs on quantum computers as the corresponding kinetic energy matrix is generally full, which is costly to measure and implement on the quantum computer, and alternatives have been proposed^{45}.

Quantum computing in first quantization has the advantage that *n*_{g} grid points can be represented by \(N={\log }_{2}({n}_{g})\) qubits. We choose *n*_{g} = 2^{N} to maximize the use of the *N* available qubits. In the simplest finite differences method each position is given by *x*_{g} = *g**L*/*n*_{g} with 0 ≤ *g* ≤ *n*_{g} − 1. The grid point *g* is encoded by the quantum state \(\left\vert g\right\rangle\) and mapped as

where *j*_{k} is the k^{th} bit value of the binary representation of *g*. The potential operator \(\hat{V}\) is diagonal in this representation, simply sampling the potential at each grid point. The kinetic energy Hamiltonian is not diagonal in the position representation, and although one could use the split operator method^{50} to make it diagonal in momentum space would require a quantum Fourier transform implementation, which, as far as we know, cannot be effectively implemented on existing quantum devices.

We sidestep all of the issues by using the finite differences method, in which the one-dimensional potential and the Laplacian form of the kinetic energy can be written as

The tridiagonal matrix that results has the same value on the off-diagonal terms, which allows them to be decomposed into fewer Pauli strings than a full matrix via an elegant recursive form that is described in Supplementary Note 6 following from^{51}. This is beneficial because the number of non-zero entries is related to the number of terms in the Pauli decomposition, which should be kept minimal to reduce the length of the Trotterized time evolution operator and observable measurements. The finite difference method does require high grid densities to be accurate (although this depends on how oscillatory the system in question is), but this requirement will likely be met by the doubling of grid points per additional qubit.

Although not implemented in this paper, some algorithms can make the time evolution of Hamiltonians with this form more efficient on near-term devices^{52}. Depending on the particular Hamiltonian one chooses to study in this way, different efficient algorithms exist to lessen the cost of the time evolution such as variational fast forwarding and qubitization^{23,24}. It is also possible to efficiently solve for the eigenstates of tridiagonal matrices on quantum computers^{53}.

### Circuit compression

A key building block of the presented algorithm and a fundamental aspect of quantum circuit optimization is the concept of circuit compression^{54}. Any operation on a quantum computer must be a unitary operation \(\hat{U}\), but the quantum computer only has a finite set of few-qubit gates. An arbitrary \(\hat{U}\) must be expressed, or compiled, into a set of native gates^{20}. This can always be done, but it is an NP-hard problem. If one implements an approximation of \(\hat{U}\) within some threshold, one may find \(\tilde{U}\) with a shorter circuit length than even an optimal decomposition of \(\hat{U}\). This latter definition is generally known as circuit compression, although the term is sometimes used to refer to more optimal perfect decompositions^{55}.

With an error-corrected quantum computer, one could use arbitrary circuit depths, but NISQ hardware benefits from using short circuits to minimize errors. But designing hardware-efficient ansatze for VQAs is an unsolved problem^{56}. This means that for most purposes we use a heuristic ansatz \(\hat{C}\) parameterized by some vector \(\overrightarrow{\theta }\), which brings the initial computational state \(\left\vert 0\right\rangle\) to a desired state \(\left\vert \psi \right\rangle\) via \(\hat{C}(\theta )\left\vert 0\right\rangle =\left\vert \psi \right\rangle\). The defining property of unitary matrices, namely

ensures that *C*(*θ*)^{†} reverses the action of *C*(*θ*). If we add a unitary \(\hat{U}\), then it may be possible to find some parameters \({\theta }^{{\prime} }\) such that \(\hat{U}\hat{C}(\theta )\left\vert 0\right\rangle \approx \hat{C}({\theta }^{{\prime} })\left\vert 0\right\rangle\), thus compressing the action of the unitary back into the same quantum circuit, at least approximately. This approach has been used in other works^{12,13,14}.

Another approach consists of approximating an initial state with such an ansatz and then performing a short-time evolution via Trotterization of the time-evolved operator as is often done^{28,29,39}. The adjoint of the ansatz is appended to the circuit and its parameters varied such that the machine state is ‘uncomputed’ to its initial state. If one assumes that the chosen circuit ansatz is expressive enough to capture the entire state’s time evolution, then such an approach is guaranteed to work. One then needs this new set of parameters and the original ansatz to express the new timestep without the time evolution operator, hence compressing the circuit. This idea has been implemented almost concurrently by Lin et al.^{12}, and by Barison et al.’s projected variational quantum dynamics (p-VQD) algorithm^{13}. Subsequent works^{14}, have built on the circuit compression idea.

## Data availability

The data generated for the plots can be found at https://zenodo.org/record/8238985.

## Code availability

The code required for the simulation and subsequent plotting can be found at https://zenodo.org/record/8238985.

## Change history

### 05 December 2023

A Correction to this paper has been published: https://doi.org/10.1038/s42005-023-01475-8

## References

Peruzzo, A. et al. A variational eigenvalue solver on a photonic quantum processor.

*Nat. Commun.***5**, 4213–4213 (2014).Cerezo, M. et al. Variational quantum algorithms.

*Nat. Rev. Phys.***3**, 625–644 (2021).Ollitrault, P. J., Miessen, A. & Tavernelli, I. Molecular quantum dynamics: A quantum computing perspective.

*Accounts of Chemical Research***54**, 4229–4238 (2021).Curchod, B. F. E. & Martínez, T. J. Ab initio nonadiabatic quantum molecular dynamics.

*Chem. Rev.***118**, 3305–3336 (2018).Kirrander, A. & Vacher, M. Ehrenfest methods for electron and nuclear dynamics. In

*Quantum Chemistry and Dynamics of Excited States*, chap. 15, 469–497 (John Wiley & Sons, Ltd, 2020).Ollitrault, P. J., Mazzola, G. & Tavernelli, I. Nonadiabatic molecular quantum dynamics with quantum computers.

*Phys. Rev. Lett.***125**, 260511 (2020).Sokolov, I. O. et al. Microcanonical and finite-temperature ab initio molecular dynamics simulations on quantum computers.

*Phys. Rev. Res.***3**, 013125 (2021).Rossmannek, M., Barkoutsos, P. Kl., Ollitrault, P. J. & Tavernelli, I. Quantum HF/DFT-embedding algorithms for electronic structure calculations: Scaling up to complex molecular systems.

*J. Chem. Phys.***154**, 114105 (2021).Levine, D. S. et al. CASSCF with extremely large active spaces using the adaptive sampling configuration interaction method.

*J. Chem. Theory Comput.***16**, 2340–2354 (2020).Mitarai, K., Nakagawa, Y. O. & Mizukami, W. Theory of analytical energy derivatives for the variational quantum eigensolver.

*Phys. Rev. Res.***2**, 013129 (2020).Delgado, A. et al. Variational quantum algorithm for molecular geometry optimization.

*Phys. Rev. A***104**, 052402 (2021).Lin, S.-H., Dilip, R., Green, A. G., Smith, A. & Pollmann, F. Real- and imaginary-time evolution with compressed quantum circuits.

*PRX Quantum***2**, 010342 (2021).Barison, S., Vicentini, F. & Carleo, G. An efficient quantum algorithm for the time evolution of parameterized circuits.

*Quantum***5**, 512 (2021).Berthusen, N. F., Trevisan, T. V., Iadecola, T. & Orth, P. P. Quantum dynamics simulations beyond the coherence time on noisy intermediate-scale quantum hardware by variational Trotter compression.

*Phys. Rev. Res.***4**, 023097 (2022).Shin, S. & Metiu, H. Nonadiabatic effects on the charge transfer rate constant: A numerical study of a simple model system.

*J. Chem. Phys.***102**, 9285–9295 (1995).Albareda, G., Abedi, A., Tavernelli, I. & Rubio, A. Universal steps in quantum dynamics with time-dependent potential-energy surfaces: Beyond the Born-Oppenheimer picture.

*Phys. Rev. A***94**, 062511 (2016).Erdmann, M., Marquetand, P. & Engel, V. Combined electronic and nuclear dynamics in a simple model system.

*J. Chem. Phys.***119**, 672–679 (2003).Falge, M. et al. Quantum wave-packet dynamics in spin-coupled vibronic states.

*J. Phys. Chem. A***116**, 11427–11433 (2012).Gossel, G. H., Lacombe, L. & Maitra, N. T. On the numerical solution of the exact factorization equations.

*J. Chem. Phys.***150**, 154112 (2019).Nielsen, M. A. & Chuang, I. L. Quantum Computation and Quantum Information. (Cambridge University Press, 2010).

Bharti, K. et al. Noisy intermediate-scale quantum algorithms.

*Rev. Mod. Phys***94**, (2022).Linteau, D., Barison, S., Lindner, N. & Carleo, G. Adaptive projected variational quantum dynamics

*arXiv preprint arXiv:*2307.03229 (2023).Low, G. H. & Chuang, I. L. Hamiltonian simulation by qubitization.

*Quantum***3**, 163 (2019).Cîrstoiu, C. et al. Variational fast forwarding for quantum simulation beyond the coherence time.

*npj Quantum Inform.***6**, 1–10 (2020).Atia, Y. & Aharonov, D. Fast-forwarding of Hamiltonians and exponentially precise measurements.

*Nat. Commun.***8**, 1572 (2017).Berry, D. W., Ahokas, G., Cleve, R. & Sanders, B. C. Efficient quantum algorithms for simulating sparse hamiltonians.

*Commun. Math. Phys.***270**, 359–371 (2007).Childs, A. M. & Kothari, R. Limitations on the simulation of non-sparse Hamiltonians.

*Quantum Inform. Comput.***10**, 0908.4398 (2010).Flick, J., Appel, H., Ruggenthaler, M. & Rubio, A. Cavity Born–Oppenheimer approximation for correlated electron–nuclear-photon systems.

*J. Chem. Theory Comput.***13**, 1616–1625 (2017).Swope, W. C., Andersen, H. C., Berens, P. H. & Wilson, K. R. A computer simulation method for the calculation of equilibrium constants for the formation of physical clusters of molecules: Application to small water clusters.

*J. Chem. Phys.***76**, 637–649 (1982).Kuroiwa, K., Ohkuma, T., Sato, H. & Imai, R. Quantum Car-Parrinello Molecular Dynamics: A Cost-Efficient Molecular Simulation Method on Near-Term Quantum Computers

*arXiv preprint arXiv:*2212.11921 (2022).Azad, U. & Singh, H. Quantum chemistry calculations using energy derivatives on quantum computers.

*Chem. Phys.***558**, 111506 (2022).Ceroni, J., Delgado, A., Jahangiri, S. & Arrazola, J. M. Tailgating quantum circuits for high-order energy derivatives.

*arXiv preprint arXiv:*2207.11274 (2022).O’Brien, T. E. et al. Efficient quantum computation of molecular forces and other energy gradients.

*Phys. Rev. Res.***4**, 043210 (2022).Lee, C.-K., Hsieh, C.-Y., Zhang, S. & Shi, L. Variational quantum simulation of chemical dynamics with quantum computers.

*J. Chem. Theory Comput.***18**, 2105–2113 (2022).Yao, Y.-X. et al. Adaptive variational quantum dynamics simulations.

*PRX Quantum***2**, 030307 (2021).O’Brien, T. E. et al. Calculating energy derivatives for quantum chemistry on a quantum computer.

*npj Quantum Inform.***5**, 1–12 (2019).Babbush, R., McClean, J., Wecker, D., Aspuru-Guzik, A. & Wiebe, N. Chemical basis of Trotter-Suzuki errors in quantum chemistry simulation.

*Phys. Rev. A***91**, 022311–022311 (2015).Trotter, H. F. On the product of semi-groups of operators.

*Proc. Am. Math. Soc.***10**, 545–545 (1959).Gard, B. T. et al. Efficient symmetry-preserving state preparation circuits for the variational quantum eigensolver algorithm.

*npj Quantum Inform.***6**, 1–9 (2020).Robbins, H. & Monro, S. A stochastic approximation method.

*Annals Math. Stat.***22**, 400–407 (1951).Wierichs, D., Izaac, J., Wang, C. & Lin, C. Y.-Y. General parameter-shift rules for quantum gradients.

*Quantum***6**, 677 (2022).Gocho, S. et al. Excited state calculations using variational quantum eigensolver with spin-restricted ansätze and automatically-adjusted constraints.

*npj Comput. Mater.***9**, 1–9 (2023).McClean, J. R., Kimchi-Schwartz, M. E., Carter, J. & de Jong, W. A. Hybrid quantum-classical hierarchy for mitigation of decoherence and determination of excited states.

*Phys. Rev. A***95**, 042308 (2017).Aulicino, J. C., Keen, T. & Peng, B. State preparation and evolution in quantum computing: A perspective from Hamiltonian moments.

*Int. J. Quantum Chem.***122**, e26853 (2022).Ollitrault, P. J. et al. Quantum algorithms for grid-based variational time evolution.

*Quantum***7**, 1139 (2023).Qiskit contributors. Qiskit: An Open-source Framework for Quantum Computing.

*Zenodo 2573505*(2023).Crooks, G. E. Gradients of parameterized quantum gates using the parameter-shift rule and gate decomposition.

*arXiv preprint arXiv:*1905.13311 (2019).Harris, C. R. et al. Array programming with NumPy.

*Nature***585**, 357–362 (2020).Colbert, D. T. & Miller, W. H. A novel discrete variable representation for quantum mechanical reactive scattering via the S-matrix Kohn method.

*J. Chem. Phys.***96**, 1982–1991 (1992).Hermann, M. R. & Fleck, J. A. Split-operator spectral method for solving the time-dependent Schrodinger equation in spherical coordinates.

*Phys. Rev. A***38**, 6000–6012 (1988).Gühne, O., Lu, C.-Y., Gao, W.-B. & Pan, J.-W. Toolbox for entanglement detection and fidelity estimation.

*Phys. Rev. A***76**, 030305 (2007).Kalev, A. & Hen, I. Quantum algorithm for simulating hamiltonian dynamics with an off-diagonal series expansion.

*Quantum***5**, 426 (2021).Wang, H. & Xiang, H. A quantum eigensolver for symmetric tridiagonal matrices.

*Quantum Inform. Processing***18**, 93 (2019).Rakyta, P. & Zimborás, Z. Efficient quantum gate decomposition via adaptive circuit compression.

*arXiv preprint arXiv:2203.04426*(2022).Kökcü, E. et al. Algebraic compression of quantum circuits for Hamiltonian evolution.

*Phys. Rev. A***105**, 032420 (2022).Fedorov, D. A., Peng, B., Govind, N. & Alexeev, Y. VQE method: A short survey and recent developments.

*Mater. Theory***6**, 2 (2022).

## Acknowledgements

This work was supported by the European Union’s Horizon 2020 research and innovation program under the Marie Skłodowska-Curie grant agreement No. 955479. Computing resources were provided by the state of Baden-Württemberg through bwHPC and the German Research Foundation (DFG) through grant INST 35/1597-1 FUGG. For the publication fee, we acknowledge financial support by Deutsche Forschungsgemeinschaft within the funding programme “Open Access Publikationskosten” as well as by Heidelberg University.

## Funding

Open Access funding enabled and organized by Projekt DEAL.

## Author information

### Authors and Affiliations

### Contributions

D.B. Conceptualization – Investigation – Methodology – Software – Writing original draft – Writing review & editing; O.V. Conceptualization – Supervision – Writing review & editting

### Corresponding authors

## Ethics declarations

### Competing interests

The authors declare no competing interests.

## Peer review

### Peer review information

: *Communications Physics* thanks Filippo Vicentini and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. A peer review file is available.

## Additional information

**Publisher’s note** Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Supplementary information

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

### Cite this article

Bultrini, D., Vendrell, O. Mixed quantum-classical dynamics for near term quantum computers.
*Commun Phys* **6**, 328 (2023). https://doi.org/10.1038/s42005-023-01451-2

Received:

Accepted:

Published:

DOI: https://doi.org/10.1038/s42005-023-01451-2