Methods, systems, and equipment for determining the short-range force of non-cobonded particle pairs
By using an FPGA module in the molecular dynamics simulation system to calculate the short-range forces of non-cobonded particle pairs, the problem of insufficient computing power of CPU and GPU is solved, and more efficient molecular dynamics simulation calculations are achieved.
Patent Information
- Application Number
- CN202410960379.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-07-17
AI Technical Summary
In existing technologies, CPUs and GPUs cannot meet the computing power requirements for molecular dynamics simulations, resulting in insufficient computing performance.
An FPGA module is used to calculate the short-range force of non-cobonded particle pairs. The particle dataset is preprocessed by the CPU and stored in the HBM module. The RL subsystem is used to configure the interpolation table and coefficient table, select target particle pairs and calculate the short-range force, realizing parallel computing and pipelined processing.
It improves computational efficiency, reduces computational latency, fully leverages the parallel and pipeline capabilities in the computation process, and optimizes the computational efficiency of molecular dynamics simulation.
Smart Images

Figure CN118917072B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of simulation technology, and specifically to a method, system, and device for determining the short-range force of non-cobonded particle pairs. Background Technology
[0002] In molecular dynamics (MD) simulations, matter is considered as fundamental units composed of particles. By simulating the evolution of these units over time, the dynamic properties of matter can be explored, helping researchers better understand and predict its behavior and properties. As a crucial tool in modern scientific research, MD simulations play a vital role in materials science, physics, chemistry, biology, and environmental studies. Molecular dynamics simulation is a molecular simulation method based on Newtonian mechanics for studying molecular systems. It typically involves calculating the potential energy between particles, which can be simply viewed as two-body, three-body, four-body, van der Waals, and electrostatic interactions. MD simulations have a wide range of applications, from complex materials science problems to the study of the structure and function of biological macromolecules and the dynamics of chemical reactions, providing valuable information in each area.
[0003] OpenMM is a molecular dynamics simulation toolkit with a strong emphasis on scalability. It allows users to easily add new features, including new forms of forces, new ensemble algorithms, and new simulation protocols. These features are automatically adapted for both CPUs and GPUs; however, the computational power supported by CPUs and GPUs is often insufficient to meet the computational demands of molecular dynamics simulations. Summary of the Invention
[0004] To address the aforementioned problems in the prior art, this invention provides a method, system, and apparatus for determining the short-range force of non-cobonded particle pairs. Specifically, it includes:
[0005] In a first aspect, the present invention provides a method for determining the short-range force of non-cobonded particle pairs, which is applied to a molecular dynamics simulation system. The simulation system includes a CPU and an FPGA module. The FPGA module includes an RL subsystem, an XDMA module, and an HBM module.
[0006] The CPU preprocesses the particle dataset to be used for molecular dynamics simulation, obtains preprocessed data, and stores the preprocessed data in the HBM module through the XDMA module.
[0007] The CPU configures the pre-determined interpolation table and coefficient table into the RL subsystem;
[0008] The CPU generates an exclusion information data table based on the information of each cobonded particle pair in the preprocessed data, and stores it in the HBM module through the XDMA module;
[0009] The CPU sends a simulation start message to the RL subsystem via the XDMA module;
[0010] In response to the simulation start message, the RL subsystem reads the particle information and preprocessed data from the exclusion information data table in HBM, and filters out the target particle pairs based on the read information.
[0011] The RL subsystem calculates the short-range force based on the selected target particle pairs, interpolation table, and coefficient table. After the calculation is completed, it generates an interrupt message and sends it to the CPU.
[0012] In response to an interrupt message, the CPU retrieves short-range force data from the FPGA, performs integral calculations of velocity and coordinate position based on the short-range force data, and updates the particle information in the FPGA based on the calculation results to proceed to the next iteration, until the predetermined iteration termination condition is met.
[0013] In a second aspect, the present invention also provides a system for determining non-cobonding forces, comprising: a CPU and an FPGA module, wherein the FPGA module includes an RL subsystem, an XDMA module, and an HBM module;
[0014] The CPU is used to preprocess the particle dataset to be used for molecular dynamics simulation, obtain preprocessed data, and store the preprocessed data in the HBM module through the XDMA module.
[0015] The CPU is also used to configure pre-defined interpolation tables and coefficient tables into the RL subsystem;
[0016] The CPU is also used to form an exclusion information data table based on the information of each cobonded particle pair in the preprocessed data, and store it in the HBM module through the XDMA module;
[0017] The CPU is also used to send simulation start messages to the RL subsystem via the XDMA module;
[0018] The RL subsystem is used to respond to the simulation start message, read particle information and preprocessed data from the exclusion information data table in HBM, and filter out target particle pairs based on the read information;
[0019] The RL subsystem is also used to calculate the short-range force based on the selected target particle pairs and interpolation tables and coefficient tables, and to generate an interrupt message to send to the CPU after the calculation is completed.
[0020] The CPU is also used to respond to interrupt messages, retrieve short-range force data from the FPGA, perform integral calculations of velocity and coordinate position based on the short-range force data, and update the particle information in the FPGA based on the calculation results to perform the next iteration until the predetermined iteration termination condition is met.
[0021] Thirdly, the present invention also provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0022] Memory, used to store computer programs;
[0023] The processor, when executing a program stored in memory, implements any of the methods provided in the first aspect.
[0024] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the methods provided in the first aspect.
[0025] Fifthly, the present invention provides a program product comprising computer program instructions that, when executed, can implement any of the methods provided in the first aspect.
[0026] The beneficial effects of this invention are:
[0027] The method, system, and device for determining the short-range force of non-cobonded particle pairs provided by this invention preprocess the particle dataset to be simulated in molecular dynamics using a CPU, obtaining preprocessed data, and storing the preprocessed data in the HBM module via an XDMA module; the CPU configures a pre-determined interpolation table and coefficient table into the RL subsystem; the CPU generates an exclusion information data table based on the information of each cobonded particle pair in the preprocessed data, and stores it in the HBM module via the XDMA module; the CPU sends a simulation start message to the RL subsystem via the XDMA module; the RL subsystem responds to the simulation start message by reading from the HBM... The system retrieves particle information and preprocessed data from the exclusion information table and filters out target particle pairs based on the retrieved information. The RL subsystem calculates the short-range force based on the filtered target particle pairs, interpolation table, and coefficient table. After the calculation is completed, an interrupt message is generated and sent to the CPU. In response to the interrupt message, the CPU retrieves the short-range force data from the FPGA and performs integral calculations of velocity and coordinate position based on the short-range force data. The CPU then updates the particle information in the FPGA based on the calculation results to proceed with the next iteration until the predetermined iteration termination condition is met. This fully leverages the parallel and pipeline capabilities in the calculation process, thereby improving computational efficiency and reducing overall computational latency.
[0028] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0029] Figure 1 A flowchart illustrating a method for determining the short-range force of a non-cobonded particle pair provided by the present invention;
[0030] Figure 2 A data cell topology result diagram provided by the present invention;
[0031] Figure 3 This invention provides a data unit structure diagram that excludes particle pairs;
[0032] Figure 4 A schematic diagram of the storage structure of an interpolation table provided by the present invention;
[0033] Figure 5 A schematic diagram of the storage structure of a coefficient table provided by the present invention;
[0034] Figure 6 A schematic diagram of the internal architecture of an FPGA provided by the present invention;
[0035] Figure 7 A block diagram illustrating the implementation of a short-range force calculation unit provided by the present invention;
[0036] Figure 8 This invention provides a block diagram of a short-range force storage structure that generates storage entries and partial summation units according to particle numbers.
[0037] Figure 9 This invention provides a block diagram of a short-range force storage structure corresponding to a short-range force calculation result storage control unit;
[0038] Figure 10 This invention provides a storage structure diagram of the cell completion progress corresponding to a short-range force calculation progress monitoring unit. Detailed Implementation
[0039] The present invention will be further described in detail below with reference to specific embodiments, but the implementation of the present invention is not limited thereto.
[0040] For molecular dynamics acceleration systems, considering perimeter conditions, the simulated system is generally a cube-shaped simulation box. In molecular dynamics simulations, each new force on a particle arises from the superposition of multiple forces. These forces are generally classified as co-bonding forces and non-co-bonding forces. Co-bonding forces include bond forces, angular forces, dihedral forces, and off-planar forces. Non-co-bonding forces include the Lennard-Jones (LJ) force and the Coulomb (CL) electrostatic force. Several commonly used algorithms have been developed for calculating these forces or energies. The function library provided by openMM supports these common algorithms. The calculation of electrostatic forces uses the PME (Particle Mesh Ewald) algorithm, an optimized upgrade of the EwaldSummation algorithm. The Ewald algorithm divides the energy of the electrostatic force into three parts: the direct space sum, the reciprocal space sum, and the self-energy term. In the direct space sum, the energy terms of all particle pairs exceeding the cutoff distance are recorded as zero. The calculation of the reciprocal space sum uses an FFT algorithm, which reduces computational complexity. The self-energy term is a calibration term that cancels out the interaction between each introduced artificial countercharge and itself. Therefore, the expression for direct space energy calculation can be transformed into the formula for force calculation as shown below (error compensation coefficients are not shown):
[0041]
[0042] Where, q i q represents the charge of class a particles. j r represents the charge of class b particles. ji This represents the actual distance scalar between particle j and particle i. This represents the actual distance vector between particle j and particle i.
[0043] In the calculation of electrostatic forces, the calculation in direct space decays rapidly with increasing distance. Therefore, a truncation distance can be used to simplify the calculation. Since the calculation form is the same as that of LJ forces, they are combined and calculated as (Range-Limited, RL) short-range forces. The reciprocal space calculation of electrostatic forces is calculated separately as long-range forces. The above algorithm can be implemented using software code running on a CPU or a GPU. However, the computing power supported by CPUs and GPUs cannot adequately meet the computational requirements of MD simulations.
[0044] To address this issue, this invention, based on practical application requirements and combined with the OpenMM development framework, provides a method for determining the short-range forces of non-cobonded particle pairs. This method mainly revolves around the FPGA design and implementation of LJ and Coulomb forces.
[0045] Figure 1 This is a flowchart illustrating a method for determining the short-range force of non-cobonded particle pairs provided by the present invention. This method is applied to a molecular dynamics simulation system, which includes a CPU and an FPGA module. The FPGA module includes an RL subsystem, an XDMA module, and an HBM module.
[0046] Specifically, the RL subsystem connects to the XDMA and HBM modules. XDMA is a DMA subsystem supporting the PCIe interface, allowing the CPU to access the RL subsystem's AXI-Lite interface and the HBM's AXI-MM interface. The RL subsystem accesses HBM's storage resources through multiple AXI-MM interfaces, achieving high-bandwidth data transfer. The CPU uses XDMA to input initialization data for MD simulation and start the simulation process.
[0047] Existing technologies primarily utilize software implementations on CPUs or GPUs. While CPUs and GPUs possess powerful computing capabilities, as general-purpose computing chips, they lack specific optimizations for handling MD simulation tasks, resulting in computational performance inferior to specially designed FPGA chips. In this invention, the FPGA acts as a dedicated accelerator for the CPU, implementing the entire RL force (short-range force) calculation process for simulated particle pairs directly on the FPGA, thus improving computational speed and saving simulation time. Compared to the serial operation mode of CPUs, the core computation process in the FPGA is modularized, maximizing parallel computing capabilities through module stacking. Furthermore, while CPUs can achieve thread parallelism based on multi-core processors, they still encounter bandwidth bottlenecks during memory access. In this solution, the FPGA possesses large-capacity HBM storage resources, with access bandwidth far exceeding that of ordinary DDR memory. By rationally allocating data table storage space, parallel computing modules can fully utilize the high-speed access bandwidth provided by HBM to realize the RL force calculation process.
[0048] See Figure 1 The present invention provides a method for determining the short-range force of non-cobonded particle pairs, comprising:
[0049] S101. The CPU preprocesses the particle dataset to be used for molecular dynamics simulation, obtains the preprocessed data, and stores the preprocessed data in the HBM module through the XDMA module.
[0050] In one possible implementation, the CPU preprocesses the particle dataset to be used for molecular dynamics simulation to obtain preprocessed data, and then stores the preprocessed data in the HBM module via the XDMA module, including:
[0051] The CPU divides the three-dimensional space containing the particle dataset into several data cells, and based on the coordinate information of each particle, determines the particle information contained in each data cell and the position information of adjacent data cells, and stores the corresponding information in the HBM module in the form of a preset data table through the XDMA module.
[0052] Specifically, the CPU preprocesses the particle dataset from the MD simulation. The preprocessed data will include, for example, Figure 2 The information shown includes cell numbers obtained after segmenting the original data. Each particle is assigned a unique cell, and particle information is bound to the cell number to form the basic information of the particle to be processed. Other information in the data entries is obtained from the original data file. The side length of each data cell is determined based on the truncation distance. Since the simulation dataset exists in a defined rectangular space, the number of data cells after CPU preprocessing is also fixed. Each data cell contains information about its own particle and the position information of its neighboring data cells, forming a data table stored in HBM. Figure 2 The topology of a data cell is the content of a single data cell. The first row is the data cell information index row, including the cell number, cell length, number of particles within the cell, offset address of the particle information within the cell, and checksum. The second to fifth rows (a fixed length of 4 rows) contain the numbers of neighboring cells and their offset addresses in HBM. This information is grouped into 8-byte sets, arranged continuously, and padded to the end of each row. Starting from the sixth row, the numbers of the particles contained in the cell (determined by the number of particles, no fixed length) are arranged continuously, padded to the end of each row. Particle information within a cell begins to be filled from the position specified by the offset address of the particle information within the cell, with each particle occupying one row of storage space. The length of the data cell is created based on the maximum number of particles after preprocessing, with appropriate margin. Based on the size of the simulation data space, fixed-size data cells are divided and arranged continuously in HBM. Using the data cell number, the starting position of the data cell can be directly located. Excluding paired combinations of particle information, the data cell is directly formed... Figure 3 The structure within the module excludes the number of particles and their storage addresses, which are configured via registers for use by the relevant modules.
[0053] During the data preprocessing process, particle type items were merged and the size of the coefficient table was compressed, creating conditions for improving parallel computing power.
[0054] S102, The CPU configures the pre-determined interpolation table and coefficient table into the RL subsystem.
[0055] For example, the CPU pre-determines the interpolation table and coefficient table according to the following process.
[0056] The formula for calculating the RL force (see below) uses the -14th, -8th, and -3rd powers of the actual distance scalar between particles. If the square of the actual distance scalar between particles is used as input, the powers of the calculated actual distance scalar between particles are reduced to -7, -4, and -3 / 2. Therefore, we create interpolation functions for the above three functions, reduce them to low-order univariate polynomials, and then substitute them into the square of the actual distance scalar between particles to calculate the original function values, thereby simplifying the calculation process and reducing the consumption of DSP resources. The generation of the interpolation function must reduce the computational complexity while ensuring that the calculation accuracy meets the design requirements. We use F(x) = x -7 Taking the function F(x) as an example, this section introduces the generation process of the interpolation function. The F(x) function is monotonically decreasing in the range x > 0, and very steep in the interval x (0, 1]. The required range of F(x) for the design is between x [0.1, 144]. We know that the more interpolation points and the smaller the intervals, the higher the computational accuracy. However, the more piecewise functions formed between the interpolation points, the larger the capacity of the coefficient table required. Furthermore, the higher the order of the interpolation function, the stronger its ability to track changes in the function curve, and the higher its accuracy, but the more computational and storage resources it consumes. Therefore, we need to make a trade-off based on the actual situation. We use Python programming to compare and analyze the order of the interpolation function and the number and distribution of interpolation points. When the relative error is better than one-thousandth, a second-order polynomial is sufficient to meet the design requirements. NumPy's polynomial function library provides... The coefficient calculation function for polynomial fitting can directly specify the required order for calculation, and the fitting results for Legendre and other orthogonal polynomials are almost identical. Our final calculation result is as follows: the x interval is divided into 8 segments: 1-[0.1,0.2], 2-[0.2,0.4], 3-[0.4,0.8], 4-[0.8,1.6], 5-[1.6,3.2], 6-[3.2,6.4], 7-[6.4,16], and 8-[16,144]. The first 6 segments are each further divided into 16 sub-segments, the seventh segment into 32 sub-segments, and the eighth segment into 128 sub-segments, for a total of 256 interpolation functions. Each interpolation function requires 3 coefficients, represented by single-precision floating-point numbers. The interpolation table for each function can be completely stored using 4KB of BRAM. The interpolation table references... Figure 4 .
[0057] The calculation of the RL force also requires coefficient tables for Aab and Bab. These tables need to be combined pairwise for each particle type. If there are N independent particle types, then the length of this table is N. 2Based on the analysis of the simulation dataset, there are currently no more than 32 independent particle types, therefore the depth of this coefficient table will not exceed 1024 items. The coefficients are represented using single-precision floating-point numbers, and the coefficient table can be stored using 8KB of BRAM. See the coefficient table below. Figure 5 .
[0058] The two tables mentioned above are written into the FPGA's storage space by the CPU before simulation calculations. When the FPGA reads the interpolation table and coefficient table, in order to ensure that the table lookup operation is queue-free, it specifically supports a multi-channel table lookup interface. That is, internally, multiple copies of the storage space are made according to the number of ports for parallel table lookup, and each port has an independent table lookup channel, so the lookup is done as soon as it is available.
[0059] This invention reduces the use of BRAM by optimizing the design of the interpolation table and coefficient table, and improves the parallelism of the operation by optimizing the design of the force calculation unit. In the calculation of the RL force, the design of the interpolation table is optimized, reducing its size while maintaining accuracy.
[0060] S103. The CPU forms an exclusion information data table based on the information of each cobonded particle pair in the preprocessed data, and stores it in the HBM module through the XDMA module.
[0061] The information on particle pairs that need to be excluded mainly comes from existing cobonded particle pairs. The CPU combines the information of the two bonded particles to form an exclusion information data table, which is stored in HBM.
[0062] S104. The CPU sends a simulation start message to the RL subsystem through the XDMA module.
[0063] S105 and RL subsystems respond to the simulation start message by reading particle information and preprocessed data from the exclusion information data table in HBM, and then filtering out target particle pairs based on the read information.
[0064] In one possible implementation, the RL subsystem filters target particle pairs based on the read information, including:
[0065] The RL subsystem treats each data cell as a master data cell, extracts the particle information from the master data cell and the particle information from the previous N data cells, takes a particle A from the master data cell, takes a particle from each of the N neighboring cells corresponding to the master data cell, and forms a particle pair with particle A to calculate the distance, obtaining N first distance calculation results; takes another particle B from the master data cell, forms a particle pair with particle A in the master data cell to calculate the distance, obtaining a second distance calculation result; compares the squares of each of the N first distance calculation results and the square of the second distance calculation result with the square of the preset cutoff distance, and determines the particle pair with the square of the preset cutoff distance as the target particle pair.
[0066] For details, see Figure 6 The RL subsystem includes a prefetch particle data unit, a prefetch exclusion particle information unit, and a particle pair distance calculation and screening unit.
[0067] The RL subsystem responds to the simulation start message by reading particle information and preprocessed data from the exclusion information data table in HBM, and filters out target particle pairs based on the read information, including:
[0068] The prefetch particle data unit responds to the simulation start message by reading preprocessed data from the HBM and transmitting the acquired data to the particle pair distance calculation and particle pair filtering unit. The prefetch exclusion particle information unit responds to the simulation start message by reading particle information from the exclusion information data table in the HBM and transmitting the acquired data to the particle pair distance calculation and particle pair filtering unit. The particle pair distance calculation and particle pair filtering unit uses each data cell in the received data as a master data cell, extracts the particle information from the master data cell and the particle information from the related first N data cells. The system retrieves a particle A from the main data cell, and retrieves one particle from each of the N neighboring cells corresponding to the main data cell. These particles are then paired with particle A to form a particle pair, and the distance between them is calculated, resulting in N first distance calculation results. Next, another particle B is retrieved from the main data cell and paired with particle A from the main data cell to form a particle pair, and the distance between them is calculated, resulting in a second distance calculation result. The squares of the N first distance calculation results and the square of the second distance calculation result are compared with the square of a preset cutoff distance, and the particle pair whose square is less than the preset cutoff distance is identified as the target particle pair.
[0069] Optional, N is 13.
[0070] For example, the particle pair information to be calculated includes the three-dimensional coordinates of the two particles. The square of the distance between the particles (i.e., the square of the actual distance scalar between the particles) is equal to the sum of the squares of the differences in the three-dimensional coordinates, denoted as R. 2 =(x1-x2) 2 +(y1-y2) 2 +(z1-z2) 2 Here, (x1, y1, z1) and (x2, y2, z2) represent the coordinates of different particles, and R represents the actual distance scalar between the particles. Particle coordinates are represented using single-precision floating-point numbers, and R... 2 It also uses single-precision floating-point storage. The calculation formula is implemented using floating-point IP provided by the FPGA manufacturer, forming a computational pipeline with auxiliary circuitry, allowing the calculation of the squared distance of a group of particles every clock cycle. Because R... 2 The range of values in the simulation box is limited, and integer comparisons are convenient when comparing distances and looking up coefficients, so R is... 2 The particles are uniformly magnified by a certain factor, and then the integer part is used for particle pair selection. R 2 Particle pairs smaller than the square of the cutoff distance are selected as input for subsequent calculations; otherwise, they are ignored. Since the center-to-center distance between adjacent cells is greater than or equal to the cutoff distance, the selected usable particle pairs exhibit a certain probability distribution. To maximize computational power, we employ a parallel processing and filtering module with simultaneous output from three ports. Related table lookup operations are also allowed to be performed simultaneously according to the number of output ports.
[0071] S106 and the RL subsystem calculate the short-range force based on the selected target particle pairs, interpolation table, and coefficient table. After the calculation is completed, an interrupt message is generated and sent to the CPU.
[0072] In one possible implementation, the formula for calculating the RL short-range force is expressed as:
[0073]
[0074] in, r represents the short-range force between particle j and particle i. ji r represents the unit distance vector between particle j and particle i. ji This represents the actual distance scalar between particle j and particle i. Indicates r ji -3, Indicates r ji -8, Indicates r ji q to the power of -14 a q represents the charge of class a particles. b ε represents the charge of class b particles.ab σ represents the dielectric constant between class a particles and class b particles. ab This represents the distance at which the energy is zero between particles of type a and particles of type b. σ ab 12th power, σ ab 6 to the power of 6.
[0075] The input to the short-range force calculation unit is all the parameters required for the calculation formula, and the output is the three components of the force. A set of calculation parameters can be input each clock cycle, and after internal pipeline processing, a set of calculation results can be output each clock cycle. Figure 7 This is a block diagram of the short-range force calculation unit, where ΔX = x1 - x2, ΔY = y1 - y2, and ΔZ = z1 - z2 (when the particle has a boundary surrounding mirror image, the side length of the simulation box needs to be subtracted).
[0076] Optional, see Figure 6 The RL subsystem includes a parameter query and enqueue unit for particle pairs to be calculated, a short-range force calculation unit, a unit for generating storage entries and partial summation according to particle numbers, a particle pair force cache enqueue control unit, a particle pair force cache dequeue control unit, a short-range force accumulation unit, a short-range force calculation result storage control unit, a short-range force calculation progress monitoring unit, and a short-range force calculation interpolation table and coefficient table unit.
[0077] The RL subsystem calculates the short-range force based on the selected target particle pairs and the interpolation and coefficient tables stored in the short-range force calculation unit. After the calculation is completed, an interrupt message is generated and sent to the CPU. This includes: a parameter query and enqueue unit for the particle pairs to be calculated, which queries the interpolation and coefficient tables to obtain the parameter information for the short-range force and the information of each particle, stores the parameter information, and transmits the parameter information to the short-range force calculation unit; and transmitting the information of each particle to the short-range force calculation progress monitoring unit. The short-range force calculation unit performs short-range force calculation based on the obtained parameter information, obtains the calculation result of the three-dimensional coordinate axis decomposition of the short-range force based on the particle pairs, and transmits the calculation result to the unit that generates storage entries and partial summation according to particle numbers and the short-range force calculation progress monitoring unit. The short-range force meter... The progress monitoring unit increments the corresponding cell's progress counter upon receiving data, then checks if the counter value reaches a preset value. If it does, it controls the short-range force accumulation unit to retrieve the short-range force of each particle from the HBM via the particle pair force cache dequeue control unit. Based on the cobonded particle pairs corresponding to each particle, it determines that each particle's short-range force is accumulated separately, and stores the accumulation result in the HBM after passing through the short-range force calculation result storage control unit. The unit generates storage entries according to particle numbers, and the partial summation unit accumulates and caches the short-range forces of the first 13 neighboring data cells corresponding to each data cell. It then caches the data of the first 13 neighboring data cells according to particle numbers in the HBM via the particle pair force cache enqueue control unit. An exemplary storage structure diagram of the cell completion progress corresponding to the short-range force calculation progress monitoring unit is shown below. Figure 8 As shown.
[0078] Specifically, the particle force (short-range force) calculation results received by the particle are generated according to the particle index. These results represent the forces between the same particle and different particles in a main cell within a continuous clock cycle. Therefore, these forces can be summed first and then cached, reducing the amount of cached data. However, this calculation result is also needed for other particles to calculate their forces, so it needs to be cached and retrieved only when calculating the sum of forces for other particles. Therefore, the forces are accumulated based on the source particle index, and the accumulated result is cached in the force cache area where the source particle resides. All force results are stored separately in the force cache areas where the destination particles reside, based on their respective indexes. The RL force cache is stored contiguously according to the particle index. The force cache area for each particle is the same size, and the storage structure is as follows: Figure 9As shown. The first line is the buffer information index, including type flag, particle number, maximum buffer capacity, number of valid data, and check bit. The second line onwards contains the buffered force vector data, each group occupying 16 bytes, stored contiguously. There are three types of buffered force vector data: the first is partially accumulated sum data, the second is force data calculated from the opposite particle in a particle pair, and the third is force data from excluded particles. The maximum number of buffered force data in each buffer is reserved at twice the maximum number of particles in the largest cell obtained during preprocessing. The number of valid data is initially zero, incremented by one each time data is added. The check bit is used to check for errors in the data in the buffer information index line and is the parity check value of the first 16 bytes. The initialization of the RL force buffer can be implemented by software or FPGA logic, restoring the information index line of each particle force buffer to its initial value. The number of valid data is zero. Each time data is added, the data addition position is calculated based on the number of valid data, and the number of valid data and the check bit value are updated.
[0079] The short-range force accumulation unit is a single-precision floating-point accumulator. Three channels support simultaneous accumulation in three vector directions. Sign selection is supported for the accumulated data; the sign bit of the particle pair forces calculated from neighboring cells needs to be changed during calculation. Forces of excluded cobonded particle pairs are identified with the opposite sign bit, and duplicate cobonded particle pair forces are subtracted during accumulation. Each short-range force accumulator continuously processes the data accumulation of the same particle, and after calculation, it switches to a different particle for calculation. The short-range force calculation progress monitoring unit sends particle information that can be accumulated to the particle pair force cache dequeue control unit. This unit reads the relevant force cache area for that particle and provides the accumulated data to the short-range force accumulation unit for calculation. The calculation result of this unit is sent to the short-range force calculation result storage control unit, which writes it into the RL force result cache area. The definition of the result cache area is as follows... Figure 10 As shown, each row stores the RL force result for one particle. This module only updates 12 bytes of data in the force vector part; the rest is filled by software initialization or by the FPGA logic reading the cell particle information data from the short-range force calculation progress monitoring unit. Multiple parallel modules can exist in the short-range force accumulation unit to accelerate the output speed of the calculation results.
[0080] The short-range force calculation progress monitoring unit looks up the enqueue parameters of the particle pairs to be calculated and obtains the current processing master cell number and related neighbor cell numbers from the enqueue unit. It updates the completion status of each cell to the corresponding counter. Based on whether the counter reaches the expected value, it determines whether the cell has completed the calculation tasks of its related neighbor cells. Internally, this unit maintains a register list, with each cell having a completion progress counter. When the current cell completes its calculation, its corresponding counter is incremented by one. Simultaneously, the completion counters of the 13 neighbor cells related to the current cell are also incremented by one. While updating the counter statistics, if the counter value reaches 14, it indicates that the cell has completed its calculation task. Then, the unit reads the corresponding particle number from the cell and sends it to the particle pair interaction force cache dequeue control unit, triggering the short-range force accumulation unit. The short-range force calculation progress monitoring unit obtains information on the particle pairs to be processed and the particle information that has been calculated from the short-range force calculation unit and the short-range force calculation result storage control unit. It monitors the usage status of the cache and the overall progress of the RL calculation. When all particles have completed the force accumulation, it sends an interrupt to the CPU to report that the force calculation of this round is complete.
[0081] S107. In response to the interrupt message, the CPU retrieves the short-range force data from the FPGA, performs the integral calculation of velocity and coordinate position based on the short-range force data, and updates the particle information in the FPGA according to the calculation results to proceed to the next iteration until the predetermined iteration termination condition is met.
[0082] Furthermore, the calculation of particle pair distances and the selection of particle pair units to be processed, the generation of storage entries and partial summation units according to particle numbers, the short-range force calculation unit, and the short-range force accumulation unit can be performed in parallel by instantiating multiple entities, thereby eliminating the single-point computational bottleneck and improving the overall computing power of the RL module.
[0083] Specifically, the particle pair distance calculation and filtering unit requires calculating the distances between a large number of particle pairs. Since the probability of filtering particle pairs with distances smaller than the cutoff distance is less than a certain value, such as 12.5%, at least 8 parallel units are needed to continuously supply data to subsequent calculation units. For example, at least 18 parallel units are used, divided into three groups (8, 8, 2). Two particles are simultaneously taken from the main data cell and assigned to the first two groups for calculation with data in neighboring data cells. The last two parallel units only calculate the distances between particle pairs in the main data cell and the distances of excluded particle pairs. Each particle has 13 neighboring data cells to calculate. One particle is taken from a neighboring cell each time, paired with data in the main cell, and output to the 8 parallel calculation units. Since the number of particles in each neighboring data cell is different, the 13-to-8 path can reduce the computational power loss caused by uneven particle numbers. The near-field force calculation unit receives the particle pair information to be calculated from the upstream unit and completes the calculation. Particle pairs of the same particle and neighboring cells are continuously transmitted and calculated, and can be directly summed and stored in the downstream unit. Corresponding to the aforementioned units, the near-field force calculation unit can be configured with at least three parallel calculation units that interface with the upstream unit. The third channel calculates particle pairs and excludes particle pairs from the main data cell; no summation operation is required, and the data is directly stored. The particle pair force cache enqueue control unit and particle pair force cache dequeue control unit are both multi-port input / output systems, allowing interface with multiple calculation modules. The near-field force accumulation unit is idle in the initial stages of the computation. However, as the computation progresses into the later stages and the number of particles meeting the accumulation conditions increases significantly, it is advisable to set at least 16 near-field force accumulation units to further reduce the overall computation time.
[0084] The method for determining the short-range force of non-cobonded particle pairs provided by this invention is applied to a molecular dynamics simulation system. The simulation system includes a CPU and an FPGA module. The FPGA module includes an RL subsystem, an XDMA module, and an HBM module. The CPU preprocesses the particle dataset to be simulated in the molecular dynamics simulation to obtain preprocessed data, which is then stored in the HBM module via the XDMA module. The CPU configures a pre-determined interpolation table and coefficient table into the RL subsystem. The CPU generates an exclusion information data table based on the information of each cobonded particle pair in the preprocessed data and stores it in the HBM module via the XDMA module. The CPU sends a simulation start message to the RL subsystem via the XDMA module. In response to the simulation start message, the RL subsystem reads the particle information from the exclusion information data table and the preprocessed data from the HBM. The system reads and selects target particle pairs based on the information read. The RL subsystem calculates the short-range force based on the selected target particle pairs, interpolation table, and coefficient table. After the calculation is completed, an interrupt message is generated and sent to the CPU. In response to the interrupt message, the CPU retrieves the short-range force data from the FPGA and performs integral calculations of velocity and coordinate position based on the short-range force data. It also updates the particle information in the FPGA based on the calculation results to perform the next iteration until the predetermined iteration termination condition is met. This optimizes the short-range force (RL force) calculation framework. The system can directly add or remove key calculation units based on computing power requirements to maximize the use of FPGA resources and avoid design compatibility issues. The system uses HBM resources to cache intermediate calculation data and makes full use of the multiple access interfaces provided by HBM to achieve non-blocking data access. Increasing the simulation dataset has almost no impact on the FPGA design module.
[0085] The present invention provides a system for determining non-cobonding forces, comprising: a CPU and an FPGA module, wherein the FPGA module includes an RL subsystem, an XDMA module, and an HBM module.
[0086] The CPU is used to preprocess the particle dataset to be used for molecular dynamics simulation, obtain preprocessed data, and store the preprocessed data in the HBM module through the XDMA module.
[0087] The CPU is also used to configure pre-defined interpolation tables and coefficient tables into the RL subsystem.
[0088] The CPU is also used to form an exclusion information data table based on the information of each cobonded particle pair in the preprocessed data, and store it in the HBM module through the XDMA module.
[0089] The CPU is also used to send simulation start messages to the RL subsystem via the XDMA module.
[0090] The RL subsystem is used to respond to the simulation start message, read particle information and preprocessed data from the exclusion information data table in HBM, and filter out target particle pairs based on the read information.
[0091] The RL subsystem is also used to calculate the short-range force based on the selected target particle pairs and interpolation and coefficient tables, and to generate an interrupt message to be sent to the CPU after the calculation is completed.
[0092] The CPU is also used to respond to interrupt messages, retrieve short-range force data from the FPGA, perform integral calculations of velocity and coordinate position based on the short-range force data, and update the particle information in the FPGA based on the calculation results to perform the next iteration until the predetermined iteration termination condition is met.
[0093] This invention also provides an electronic device structure, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, communication interface, and memory communicate with each other via the communication bus.
[0094] Memory, used to store computer programs;
[0095] When a processor executes a program stored in memory, it implements the steps provided in the above method embodiments.
[0096] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0097] The method provided in this invention can be applied to electronic devices. Specifically, the electronic device can be a desktop computer, a portable computer, a smart mobile terminal, a server, etc. No limitation is made herein; any electronic device that can implement this invention falls within the protection scope of this invention.
[0098] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps provided in the above-described method embodiments.
[0099] For the embodiments of the device / electronic device / storage medium, since they are basically similar to the method embodiments, the description is relatively simple. For specific details and beneficial effects, please refer to the description of the method embodiments.
[0100] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0101] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A method for determining non-covalent particle pair forces, characterized in that The application is applied to a molecular dynamics simulation system, and the simulation system comprises a CPU and an FPGA module, and the FPGA module comprises an RL subsystem, an XDMA module and an HBM module. The CPU pre-processes a particle data set to be subjected to molecular dynamics simulation to obtain pre-processed data, and stores the pre-processed data in the HBM module through the XDMA module. The CPU configures a predetermined interpolation table and a coefficient table into the RL subsystem. The CPU forms an exclusion information data table according to information of each co-bond particle pair in the pre-processed data, and stores the exclusion information data table in the HBM module through the XDMA module. The CPU sends a simulation start message to the RL subsystem through the XDMA module. The RL subsystem reads particle information in the exclusion information data table and the pre-processed data from the HBM in response to the simulation start message, and screens out target particle pairs according to the read information. The RL subsystem calculates the short-range force according to the screened-out target particle pairs and the interpolation table and the coefficient table, generates an interrupt message to the CPU after the calculation is completed. The CPU takes the short-range force data from the FPGA in response to the interrupt message, and completes integral operation of velocity and coordinate position according to the short-range force data, and updates particle information in the FPGA according to the operation result to perform next iteration until a predetermined iteration termination condition is met.
2. The method of claim 1, wherein, The CPU pre-processes a particle data set to be subjected to molecular dynamics simulation to obtain pre-processed data, and stores the pre-processed data in the HBM module through the XDMA module, comprising: The CPU divides a three-dimensional space where the particle data set is located into a plurality of data cells, and determines particle information contained in each data cell and position information of adjacent data cells based on coordinate information of each particle, and stores the corresponding information in the HBM module in the form of a preset data table through the XDMA module.
3. The method of claim 1, wherein, The RL subsystem screens out target particle pairs according to the read information, comprising: The RL subsystem takes each data cell as a main data cell respectively, takes particle information of the main data cell and particle information of the first N adjacent data cells, takes a particle A from the main data cell, takes a particle from each of the N adjacent data cells corresponding to the main data cell, and calculates a distance of a particle pair composed of the particle A and the particle to obtain N first distance calculation results; takes another particle B from the main data cell, and calculates a distance of a particle pair composed of the particle A and the particle B to obtain a second distance calculation result; compares square values of the N first distance calculation results, the square value of the second distance calculation result and a square value of a preset cutoff distance respectively, and determines a particle pair with a square value smaller than the square value of the preset cutoff distance as a target particle pair.
4. The method of claim 1, wherein, The formula of the short-range force is represented as: in, r represents the short-range force between particle j and particle i. ji r represents the unit distance vector between particle j and particle i. ji This represents the actual distance scalar between particle j and particle i. Indicates r ji -3, Indicates r ji -8 Indicates r ji q to the power of -14 i q represents the charge of particle i. j ε represents the charge of particle j. ab σ represents the dielectric constant between class a particles and class b particles. ab This represents the distance at which the energy is zero between particles of type a and particles of type b. σ ab 12th power, σ ab 6 to the power of 6.
5. The method of claim 1, wherein, The RL subsystem comprises a pre-fetch particle data unit, a pre-fetch excluded particle information unit, a particle pair distance calculation and processed particle pair screening unit; The RL subsystem reads particle information in the exclusion information data table and the pre-processed data from the HBM in response to the simulation start message, and screens target particle pairs according to the read information, comprising: The pre-fetch particle data unit reads the pre-processed data from the HBM in response to the simulation start message, and transmits the obtained data to the particle pair distance calculation and processed particle pair screening unit; The pre-fetch excluded particle information unit reads particle information in the exclusion information data table from the HBM in response to the simulation start message, and transmits the obtained data to the particle pair distance calculation and processed particle pair screening unit; The particle pair distance calculation and processed particle pair screening unit takes each data cell in the received data as a main data cell, takes particle information of the main data cell and particle information of the first N data cells related to the main data cell, takes a particle A from the main data cell, takes a particle from each of the N neighbor cells corresponding to the main data cell, and calculates the distance of the particle pair composed of the particle A and the particle to obtain N first distance calculation results; takes another particle B from the main data cell, and calculates the distance of the particle pair composed of the particle A and the particle B to obtain a second distance calculation result; compares the square of each of the N first distance calculation results, the square of the second distance calculation result, and the square of a preset cutoff distance, and determines a particle pair with a square smaller than the square of the preset cutoff distance as a target particle pair.
6. The method of claim 1, wherein, The RL subsystem comprises a to-be-calculated particle pair parameter query and enqueuing unit, a short-range force calculation unit, a particle sequence number generated storage entry and partial summation unit, a particle pair force cache enqueuing control unit, a particle pair force cache dequeuing control unit, a short-range force accumulation unit, a short-range force calculation result storage control unit, a short-range force calculation progress supervision unit, and a short-range force calculation interpolation table and coefficient table unit; The RL subsystem calculates the short-range force according to the target particle pairs screened out and the interpolation table and the coefficient table stored in the short-range force calculation interpolation table and coefficient table unit, and generates an interrupt message and sends it to the CPU after the calculation is completed, comprising: The to-be-calculated particle pair parameter query and enqueuing unit queries the interpolation table and the coefficient table to obtain parameter information for the short-range force and information of each particle according to the target particle pairs screened out, stores the parameter information, and transmits the parameter information to the short-range force calculation unit and the information of each particle to the short-range force calculation progress supervision unit; The to-be-calculated particle pair parameter query and enqueuing unit queries the interpolation table and the coefficient table to obtain parameter information for the short-range force and information of each particle according to the target particle pairs screened out, stores the parameter information, and transmits the parameter information to the short-range force calculation unit and the information of each particle to the short-range force calculation progress supervision unit; The short-range force calculation unit performs short-range force calculation based on the parameter information, obtains a calculation result of three-dimensional coordinate axis decomposition of the short-range force based on the particle pairs, and transmits the calculation result to the short-range force calculation progress supervision unit and the short-range force accumulation unit; The short-range force calculation progress supervision unit, in response to the received data, increments the corresponding cell completion progress counter by one, checks whether the value of the counter reaches a preset value, and if so, controls the short-range force accumulation unit to obtain the short-range force of each particle from the HBM through the particle pair action force cache dequeue control unit, and according to the corresponding covalent particle pair condition of each particle, determines the short-range force accumulation of each particle, and stores the accumulation result to the HBM through the short-range force calculation result storage control unit; The short-range force calculation progress supervision unit, in response to the received data, increments the corresponding cell completion progress counter by one, checks whether the value of the counter reaches a preset value, and if so, controls the short-range force accumulation unit to obtain the short-range force of each particle from the HBM through the particle pair action force cache dequeue control unit, and according to the corresponding covalent particle pair condition of each particle, determines the short-range force accumulation of each particle, and stores the accumulation result to the HBM through the short-range force calculation result storage control unit; 7. A system for determining non-covalent forces, characterized in that It comprises: CPU and FPGA module, the FPGA module includes RL subsystem, XDMA module, HBM module; The CPU is used for preprocessing particle data set to be simulated by molecular dynamics, obtaining preprocessed data, and storing the preprocessed data in the HBM module through the XDMA module; The CPU is also used to configure the interpolation table and the coefficient table to the RL subsystem in advance; The CPU is also used to form an exclusion information data table according to the information of each covalent particle pair in the preprocessed data, and store it in the HBM module through the XDMA module; The CPU is also used to send a simulation start message to the RL subsystem through the XDMA module; The RL subsystem is used to respond to the simulation start message, read the particle information in the exclusion information data table and the preprocessed data from the HBM, and filter out target particle pairs according to the read information; The RL subsystem is also used to calculate the short-range force according to the filtered target particle pairs and the interpolation table and the coefficient table, generate an interrupt message after the calculation is completed, and send it to the CPU; The CPU is also used to respond to the interrupt message, retrieve the short-range force data from the FPGA, and complete the integral operation of velocity and coordinate position according to the short-range force data, and update the particle information in the FPGA according to the operation result to perform the next iteration until the predetermined iteration termination condition is met.
8. An electronic device, comprising: It comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to execute the programs stored in the memory to realize the method of any one of claims 1-6. The short-range force calculation unit performs short-range force calculation based on the parameter information, obtains a calculation result of three-dimensional coordinate axis decomposition of the short-range force based on the particle pairs, and transmits the calculation result to the short-range force calculation progress supervision unit and the short-range force accumulation unit; 9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method in any one of claims 1-6.
10. A program product, characterized by The program product comprises computer program instructions, and the computer program instructions are executed to implement the method in any one of claims 1-6.
Citation Information
Patent Citations
Optimization mapping method of N-body problem short-range action computation on GPU (graphic processing unit) structure
CN102955686A
Molecular dynamics non-covalent bond calculation method and device
CN118098385A