Deep approximation of molecular dynamics: Superconducting quantum computers have been shown to be able to effectively predict two- or three-dimensional molecular dynamics states, bringing new research into quantum computing.

Author: Zen and the Art of Computer Programming

1. Introduction

In the past few decades, the field of scientific research has entered a new period of development due to enhanced computing power, major breakthroughs in bioinformatics, and new discoveries in physics. Humanity’s understanding of the world has evolved from simple “life” to complex molecular systems. The motion laws of complex molecular systems cannot be described by traditional electromagnetic models, and accurate results need to be obtained through numerical simulation of molecular dynamics. As molecular systems become more diverse and complex, laboratory instruments become more complex, and there are more and more researchers in this field. Therefore, researchers have proposed many simulation methods to simulate the dynamic processes of molecular dynamics, such as liquid deposition, protein decomposition, disease transmission, etc. These methods all use different algorithms and computational models, but there are many commonalities and similarities between them. All are based on some form of numerical simulation of molecular dynamics, and the results obtained are credible and accurate. In order to better understand the mechanism of molecular dynamics, people often use various energies released by complex molecular systems to conduct simulations, but such simulations are difficult to produce a global view.

In recent years, physicists have proposed a new type of quantum computer, the superconducting quantum computer, which can achieve highly reliable quantum computing. Its advantage is that it can predict the state of molecular dynamics without relying on specific algorithms and computational models. Instead, it can directly handle quantum states and achieve a complete understanding of the physical behavior of the entire system. However, the performance of superconducting quantum computers is still limited by current algorithms and computational models. Therefore, in order to truly solve the numerical simulation problem of molecular dynamics, we need to improve the ability of deep approximation of molecular dynamics. Currently, the latest research on this problem mainly focuses on two methods, namely machine learning and gradient acceleration methods. Among them, machine learning methods transform the computing task into an optimization problem to find the appropriate parameter configuration to predict the state of molecular dynamics. On the other hand, the gradient acceleration method uses its successful experience in machine learning to change the optimization of fitting parameters to direct solution. In this article, we will review these two methods and explore how to use machine learning and gradient acceleration methods to solve the deep approximation problem of molecular dynamics.

2.Basic concepts and terminology

2.1 Molecular Dynamics

Molecular Dynamics (MD) refers to the use of computers to simulate the motion process of organisms such as fluids, solids, and liquids. Molecular dynamics is an emerging discipline that studies the structure of molecules and their laws of motion. Its purpose is to reveal the phenomenon of material motion at the macro level, and it is of extremely high universality and importance. For example, it has related applications in medicine, agriculture, environmental protection, bioengineering and other fields. Because it involves many complex problems, molecular dynamics has become a basic subject in various directions.

In 1905, Einstein proposed the laws of motion of microscopic particles for the first time, setting a precedent for simulating the motion of microscopic particles. Due to the existence of microscopic particles and the incompleteness of their basic assumptions, the research work on molecular dynamics has also deepened and is still booming today. The research scope of molecular dynamics covers the flow of liquids, the movement of solids, the movement of gases, the process of nuclear reactor reactions, the driving of chemical reactions, the movement of cell nuclei, and a variety of other biological systems. Currently, researchers are developing a new simulation method – time-step molecular dynamics (TSMD) based on time step (time step) to solve the dynamic simulation problem of complex molecular systems.

2.2 Conceptual terms

2.2.1 Molecule

A molecule usually refers to a group of atoms with a common chemical function in inorganic chemistry. Generally speaking, molecules are made up of atoms, each of which has a spin, mass, and position coordinates. Molecules have the property of spatially repelling each other, so atoms within the molecule cannot occupy the same position at the same time, which requires that the structure of the molecule must remain stable. The atoms inside a molecule make up particles of different sizes. In chemistry and biology, a molecule is an organized entity that contains a variety of chemical elements commonly found in nature.

2.2.2 Atom

Atoms are the basic particles that make up molecules. They have indivisible basic characteristics and are the basic units that make up molecules. Atoms can be protons, neutrons, or other low-energy tiny particles, or they can be high-energy level particles such as nuclides and semiconductor electrons. Every substance is made up of different kinds of atoms. For example, water molecules are made up of hydrogen, oxygen, and nitrogen atoms. Chemical elements such as soil, acids, iodine, and sulfur are all made up of atoms.

2.2.3 Proton

Proton is the most basic particle in chemistry and the smallest unit that exists in matter. The properties of protons obey the conservation of mass, which can be seen from the motion of protons. The number of protons is approximately equal to the number of two chemical elements.

2.2.4 Neutron

Neutron is the lightest discrete atomic nucleus, which is generally considered to be four times the mass of a proton. When protons collide with neutron masses, new neutrons and protons are synthesized, forming new nuclear atoms or groups. For example, carbon monoxide contains neutrons of three elements.

2.2.5 Electronics

Electrons are negatively charged material particles in molecules. The number of electrons is proportional to the number of protons, neutrons, and atoms, because the electrons of each proton, neutron, and atom compete with each other. The motion of electrons has both particle motion and wave function contribution, so electrons have wave-particle duality.

2.2.6 track

The atoms inside a molecule can be classified according to their position. We call it orbital. An orbital of a molecule is determined by a collection of electrons and wave functions occupying the orbital.

2.2.7 Degrees of Freedom

The degrees of freedom possessed by a molecule refers to the number of vectors that can move freely within the molecule. The degrees of freedom of a molecule is the sum of the degrees of freedom and the degrees of fixation. Degrees of freedom include position, momentum, angle, stretch, twist, etc. If a degree of freedom in the molecule does not change, then this degree of freedom is a fixed degree; otherwise, it is a degree of freedom.

2.2.8 speed

Speed refers to how fast or slowly an object moves. In molecular dynamics, velocity represents the distance an object travels in all directions.

2.2.9 Energy

Energy is a property exhibited by an object. The energy of a molecule consists of three parts: the total energy of the atomic nucleus, the total energy of the electron cloud, and the total energy of the external magnetic field. There are other energies out there, but we will only discuss the above three. The energy of a molecule is conserved, which means that an increase in its total energy does not cause any change in the properties of the system.

2.2.10 Potential Energy

Potential energy is the pull of an object by an external force, represented by $V(r)$. The smaller the potential energy, the smaller the friction between objects, and the higher the efficiency of the movement of the object. Potential energy is an important indicator of molecular dynamics.

2.2.11 Newtonian Dynamics

Newton’s laws of motion are a kind of law of mechanics, which reveal the laws of motion of moving objects when external forces are applied. Newtonian dynamics can be used to describe the motion of particles, charges, and other forms of motion.

2.3 Simulation Algorithm

2.3.1 Mengka-Xinliefa

The Monte Carlo-Metropolis method is an algorithm used to simulate probability distributions in statistical physics. It is a combination of the Monte Carlo method and the Metropolis sampling method. The basic idea of the Monte Carlo-Xinlie method is to generate discrete samples through continuous random sampling, thereby estimating or approximating the probability density function. The Munka-Xinlie method uses two basic rules: one is to move from one state to another according to certain rules, and the other is to accept or reject new moves. Specifically, the Monkar-Xinlie method accepts new moves with a certain probability, that is, the Metropolis rule, thereby ensuring the convergence of the sample.

The Munka-Xinlie method is relatively simple in principle, but encounters some difficulties in practice. First, due to the lack of a well-defined target distribution, simulation results may be biased, resulting in less effective simulations. Secondly, the Monte Carlo-Xinlie method has a relatively slow convergence speed and is not very effective for simulations involving complex systems. Third, although the Munka-Xinlie method can simulate complex systems, it is easy to fall into local optimal solutions in high dimensions.

2.3.2 Quantum simulation based on molecular dynamics

A superconducting quantum computer is a computer made of superconducting materials that has excellent performance in quantum physics, especially in simulating molecular dynamics. This technology is in its infancy and has not yet been fully proven, but it can already achieve excellent results. Superconducting quantum computers can achieve the purpose of accurately simulating molecular dynamics by constructing a corresponding quantum system based on a given distribution function. Quantum simulation can simulate various properties of physical systems, including thermodynamics, acoustics, optics, magnetism, chemistry, physics, etc. Listed below are some of the properties of superconducting quantum computers for simulating molecular dynamics:

  1. Quantized models: Superconducting quantum computers model molecules as a whole, so there is no need to carefully define their breakdown. All atoms can be considered as point particles, so interactions between atoms can be ignored, and interactions between ions can be completely ignored. By utilizing the principles of quantization, a precise and complete model of microscopic molecular motion can be constructed.

  2. Programmable control: Superconducting quantum computers have programmable capabilities and can implement various quantum control logics, such as gate distribution, TMS annealing algorithms, quantum circuit design, superconducting loop design, etc.

  3. Spatial scalability: Superconducting quantum computers can effectively simulate very complex molecular systems, including high-dimensional, high-resolution, multi-particle systems, non-Brillouin zone systems, high Fermi surface systems, plasma systems, etc.

  4. System reliability: Superconducting quantum computers have very strong error correction capabilities and can quickly repair the system when errors occur without affecting the original physical behavior. At the same time, it also has a complete error detection mechanism that can identify abnormal situations.

  5. Computational efficiency: The calculation speed of superconducting quantum computers is very fast. When calculating real-time physical processes, its operating speed can meet real-time requirements.

2.4 Machine Learning Method

Machine learning is a probabilistic statistical method that uses training data to learn the mapping relationship of input variables to predict unknown data. Machine learning is widely used in fields such as multivariate statistical analysis, bioinformatics, financial markets, image recognition, and language understanding. Machine learning methods can be divided into two categories: supervised learning and unsupervised learning.

2.4.1 Supervised Learning

Supervised learning is a learning method in machine learning. Its goal is to learn a conversion relationship from input to output, and predict the corresponding output for new inputs based on this model. Supervised learning can be divided into two types: regression learning and classification learning.

2.4.1.1 Regression Learning

Regression analysis is a type of supervised learning whose goal is to predict the values of continuous variables. Commonly used loss functions in regression analysis include squared error and absolute value error. Squared error is often used in linear regression, and absolute error is often used in nonlinear regression in linear regression.

2.4.1.2 Classification Learning

Classification learning is also a type of supervised learning. Its goal is to predict the category to which a given input variable belongs. Commonly used classification algorithms for classification learning include logistic regression, naive Bayes, support vector machine, decision tree, etc.

2.4.2 Unsupervised Learning

Unsupervised learning is a learning method in machine learning. Its goal is to find the unordered structure of the input data and cluster the similarities of the input data together. Unsupervised learning can be divided into clustering learning and association rule learning.

2.4.2.1 Clustering Learning

Clustering is a type of unsupervised learning. The goal is to divide the input data into multiple clusters so that the similarity of data points within the same cluster is high and the similarity of data points between different clusters is low. Commonly used clustering algorithms include K-means, DBSCAN, spectral clustering, agglomerative hierarchical clustering, bipartite graph partitioning algorithm, etc.

2.4.2.2 Association Rule Learning

Association rules are also a type of unsupervised learning. The goal is to find sets of items that frequently appear together. Commonly used association rule algorithms include Apriori, Eclat, etc.

2.4.3 Mixed Model

Mixture model is a classic concept in statistics. It divides data samples into several limited clusters. The probability of each cluster is different, and these probabilities are not certain. In other words, it is a probability distribution to be found. Hybrid models are widely used in pattern recognition, signal processing, bioinformatics, machine learning, computer vision, image analysis, pattern recognition, financial markets and other fields.

2.5 Gradient acceleration method

Gradient acceleration is an optimization algorithm that uses information from historical optimal points to accelerate the search direction of the current point, thereby accelerating the convergence rate. Gradient acceleration algorithms are roughly divided into two categories: one is the gradient acceleration method based on the quasi-Newton method, such as Newton’s method, conjugate gradient method, etc.; the other is the gradient acceleration method based on local optimal point search, such as stochastic gradient descent. method, small batch gradient descent method, etc.

The recommender system is an application of computer information retrieval. It uses the user’s interactive behavior, behavioral habits, interests and preferences and other information to automatically provide a recommended list of products. Recommendation systems were originally derived from book recommendation systems, and are now widely used in web searches, social networks, video websites, music players, etc.

3. Core algorithm principles and specific operating steps

The advantage of combining superconducting quantum computers with machine learning methods is that it can improve the deep approximation capabilities of molecular dynamics. We use a gradient acceleration-based method to first describe the molecular dynamics system, then use training data to fit the molecular dynamics system parameters, and finally use the molecular dynamics system parameters to generate impurities to simulate the non-equilibrium motion of the molecular dynamics system. Below we introduce three key steps:

3.1 Molecular Dynamics System Description

Superconducting quantum computers simulate a two- or three-dimensional molecular dynamics system. The system consists of several molecules, each of which is composed of several atoms, and each atom has spin, mass and position coordinates. These atoms repel each other in space, so the structure of the molecule must remain stable. The atoms inside a molecule make up particles of different sizes. The energy of a molecule consists of three parts: the total energy of the atomic nucleus, the total energy of the electron cloud, and the total energy of the external magnetic field. There are other energies out there, but we will only discuss the above three. Potential energy is an important indicator of molecular dynamics.

3.2 Parameter fitting

Machine learning methods are used for parameter fitting. For a two-dimensional or three-dimensional molecular dynamics system, its parameters can be divided into position, velocity, angle, size, shape, etc. Parameters can be fitted to training data to obtain a good description of a particular system.

3.3 Generated Impurities

Impurities are generated according to molecular dynamics system parameters to simulate non-equilibrium molecular motion. Impurities can be generated in various ways, such as Doppler effect, spin quantum vibration, electron flow diffusion, ion diffusion, photon flow diffusion, etc.

4. Specific code examples and explanations

Specific code examples are as follows:

import numpy as np
from scipy.integrate import odeint

class Molecule:
    def __init__(self):
        self.N = N # number of atoms
        self.masses = masses # atomic mass array (1xN)
        self.coordinates = coordinates # atom positions (Nx2 or Nx3)

    @staticmethod
    def Lennard_Jones(r, epsilon=1, sigma=1):
        """Lennard Jones potential."""
        return 4*epsilon*((sigma/r)**12 - (sigma/r)**6)

    @staticmethod
    def forces(X, t, epsilons, sigmas, Ds):
        """Calculate forces acting on the molecules."""
        # unpack X to get positions and velocities
        q = X[:2*N].reshape((N, 2))
        p = X[2*N:].reshape((N, 2))

        # calculate distance matrix
        R = cdist(q, q)

        # calculate pairwise distances between atoms
        r = np.linalg.norm(R, axis=-1).reshape((-1,))

        # calculate force using Lennard Jones potential
        f = -epsilons*(sigmas**2/r**12 - sigmas**2/r**6)*R/(r[:,np.newaxis]**3)

        # add drag term if D > 0
        for i in range(N):
            if abs(Ds[i]) > 0:
                v = p[i]/masses[i]
                df = -abs(v)/max(abs(v), Ds[i])*f[i,:]
                f[i,:] + = df

        # forces combine into single vector
        F = np.zeros_like(p)
        for i in range(N):
            for j in range(N):
                F[i,:] + = f[j,:]*masses[j]/masses[i]

        # compute acceleration from force
        a = F/masses[:,np.newaxis]

        # pack results back into flat vector
        ydot = np.concatenate([p.flatten(),a.flatten()])
        return ydot

    def simulate(self, X0, timesteps, dt, **kwargs):
        """Simulate the molecule."""
        T = len(timesteps)
        sol = np.empty((T + 1, X0.size))
        sol[0,:] = X0

        epsilons = kwargs.get('epsilons', np.ones(N))*1
        sigmas = kwargs.get('sigmas', np.ones(N))*1
        Ds = kwargs.get('Ds', np.zeros(N))*1

        for t_idx, t in enumerate(dt):
            solution = solve_ivp(lambda t,y: self.forces(y,t,epsilons,sigmas,Ds), [0,t],
                                  sol[t_idx,:], t_eval=[t])

            sol[t_idx + 1,:] = solution.y[-1,:]

        self.trajectory = sol

def generate_data():
    pass

if __name__ == '__main__':
    # create initial configuration with two distinct clusters
    N = 10
    masses = np.array([1]*N)
    random_state = np.random.RandomState(seed=0)
    x = np.concatenate([random_state.uniform(-1,1,(N//2,2)),
                        random_state.uniform(1,-1,(N//2,2))])
    coordinates = x/np.linalg.norm(x, axis=-1)[...,np.newaxis]

    # set up simulation parameters
    timestep = 1e-3
    duration=10
    times = np.arange(0,duration + timestep,timestep)

    # run simulation
    mol = Molecule()
    traj = mol.simulate(coordiantes.flatten(), times, dt=timestep)

Here, we define a molecule object, which contains basic information about the molecule. We also provide two static methods to calculate the potential energy and potential field of molecules, which correspond to the Lennard-Jones potential and the ical-like potential respectively. In order to speed up the convergence, we introduce the drag parameter, which determines the damping force of the tether. We also provide a simulation function to complete the simulation. Here, we define a system with two kinds of molecules, and the initial conditions are randomly generated.

The current development of superconducting quantum computers is far from reaching the ideal state. It also has many shortcomings, including consumption of computing resources, efficiency and reliability of error correction, etc. Future development directions include establishing more accurate physical models, improving performance, increasing computing efficiency, and enhancing system reliability. In addition, superconducting quantum computers still have a lot to do in simulating molecular dynamics systems. As more researchers turn their attention to quantum simulation technology, quantum computing will receive more and more attention. Quantum computing allows us to see the development direction of future computers in many aspects.

6. Appendix Frequently Asked Questions and Answers