A molecular dynamics non-bonded calculation method and device
Patent Information
- Application Number
- CN202410259844.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-07
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2044-03-07
AI Technical Summary
[0004]综上所述,目前的分子动力学虽然能够得到有价值的非共价键参数,但是其受到硬件计算平台的限制导致整体的计算量较大,计算效率低下
本申请实施例通过在模拟盒子中设置主叫区域以及每一主叫区域的相邻区域,从而在进行计算时只计算主叫区域与相邻区域之间的分子作用力,减少计算量;本方案在对主叫区域与相邻区域之间的粒子进行计算时,从相邻区域中进一步选取出一半的计算区域与主叫区域进行计算,再通过牛顿第三定理对剩余的区域进行推理从而进一步减少了计算时间;本方案通过FPGA进行大量的并行计算,并且在FPGA中设置HBM2存储设备以及RAM存储设备分别存储粒子信息以及计算得到的粒子间信息;本方案通过设置一维计算矩阵与二维计算矩阵,从而更好的判断主叫区域与每一计算区域的计算进展。
Smart Images

Figure CN118098385B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of molecular dynamics, and in particular to a method and apparatus for calculating non-covalent bonds in molecular dynamics. Background Technology
[0002] Molecular dynamics is a simulation technique that uses the principles of statistical physics to study the dynamic rheology of atoms and molecules in molecular systems through calculations, thereby simulating the effects of intermolecular interactions and the laws of gravity, quantum mechanics, and other physical laws.
[0003] Non-covalent bonds refer to ionic bonds, metallic bonds, and intermolecular forces. A non-covalent bond is formed when two or more atoms do not share their outer electrons, reaching an electron saturation state under ideal conditions, thus forming a relatively stable chemical structure called a non-covalent bond. Non-covalent bond calculations in molecular dynamics require processing a large number of atoms and molecules and calculating their interactions, which usually requires a lot of computing resources. However, due to the limitations of hardware computing platforms, simulating complex systems or performing long-term simulations often requires experiments involving large computing clusters that run for months at a time.
[0004] In summary, while current molecular dynamics methods can obtain valuable non-covalent parameters, they are limited by hardware computing platforms, resulting in a large overall computational load and low computational efficiency. Summary of the Invention
[0005] This application provides a method and apparatus for calculating non-covalent bonds in molecular dynamics. By constructing a pipeline based on DSP resources in an FPGA and calculating interparticle forces by defining a calling region and a computational region, the computational efficiency of non-covalent bonds is improved.
[0006] In a first aspect, embodiments of this application provide a method for calculating non-covalent bonds in molecular dynamics, the method comprising: The CPU acquires the molecular structure and constructs a simulation box based on the molecular structure. In the simulation box, multiple regions of the same size are configured by a grid division method, and the region containing particles is set as the main region. The CPU acquires data information of each particle in the molecular structure and stores it in the FPGA. It acquires half of the adjacent regions of each calling region as the calculation region of that calling region. The adjacent regions other than the calculation region are symmetrical regions, and the current calculation region is symmetrical with the symmetrical region. The adjacent regions are regions that are directly adjacent to the current calling region. The FPGA performs parallel calculations on the interaction force between each calling region and each adjacent region of the corresponding calculation region, constructing a one-dimensional record matrix and a two-dimensional record matrix that correspond one-to-one with the calling region. Each column of the one-dimensional record matrix represents each adjacent region in the calculation region of the calling region corresponding to the one-dimensional record matrix. The default value in each one-dimensional record matrix is 0. When the calling region and its corresponding adjacent region have completed the calculation, the value of the position corresponding to the adjacent region that has completed the calculation is changed to 1 in the one-dimensional record matrix corresponding to the calling region. The rows of the two-dimensional record matrix represent each calling region, and the columns represent all regions in the simulation box. When the region represented by the column is an adjacent region in the calculation region of the calling region represented by the row, the value of the corresponding position is changed to 1; otherwise, it is 0. The value corresponding to each one-dimensional record matrix is compared with the value of the row of the corresponding calling region in the two-dimensional record matrix. If they are the same, the interaction force between the calling region and the symmetrical region is further calculated. The calculation results of the interaction forces between each calling region and all adjacent regions are integrated to complete the calculation of non-covalent bonds.
[0007] Secondly, embodiments of this application provide a molecular dynamics non-covalent bond calculation device, comprising: The first acquisition module is used to acquire molecular structure through the CPU and construct a simulation box based on the molecular structure. In the simulation box, multiple regions of the same size are configured by a grid division method, and the region containing particles is set as the main region. The second acquisition module is used to acquire data information of each particle in the molecular structure through the CPU and store it in the FPGA. It acquires half of the adjacent regions of each calling region as the calculation region of the calling region. The adjacent regions other than the calculation region are symmetrical regions, and the current calculation region is symmetrical with the symmetrical region. The adjacent regions are regions that are directly adjacent to the current calling region. The calculation module is used to perform parallel calculations on the interaction force between each calling region and each adjacent region of the corresponding calculation region using the FPGA. It constructs a one-dimensional record matrix and a two-dimensional record matrix that correspond one-to-one with the calling regions. Each column of the one-dimensional record matrix represents each adjacent region in the calculation region of the calling region corresponding to the one-dimensional record matrix. The default value in each one-dimensional record matrix is 0. When the calling region and its corresponding adjacent region have completed the calculation, the value of the position corresponding to the adjacent region that has completed the calculation is changed to 1 in the one-dimensional record matrix corresponding to the calling region. The rows of the two-dimensional record matrix represent each calling region, and the columns represent all regions in the simulation box. When the region represented by the column is an adjacent region in the calculation region of the calling region represented by the row, the value of the corresponding position is changed to 1; otherwise, it is 0. The value corresponding to each one-dimensional record matrix is compared with the value of the row of the same calling region in the two-dimensional record matrix. If they are the same, the interaction force between the calling region and the symmetrical region is further calculated. The integration module is used to integrate the force calculation results of each calling region with all adjacent regions to complete the calculation of non-covalent bonds.
[0008] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform a molecular dynamics non-covalent bond calculation method.
[0009] Fourthly, embodiments of this application provide a readable storage medium storing a computer program, the computer program including program code for controlling a process to execute the process, the process including a molecular dynamics non-covalent bond calculation method.
[0010] The main contributions and innovations of this invention are as follows: This application embodiment reduces computational load by setting a calling region and adjacent regions within a simulation box, thereby calculating only the molecular forces between the calling region and adjacent regions. When calculating particles between the calling region and adjacent regions, this scheme further selects half of the calculation region from the adjacent regions and performs calculations with the calling region, then uses Newton's third theorem to infer the remaining region, further reducing computation time. This scheme utilizes an FPGA for extensive parallel computation, and sets up HBM2 and RAM storage devices within the FPGA to store particle information and the calculated inter-particle information, respectively. By setting up one-dimensional and two-dimensional computation matrices, this scheme better judges the computational progress between the calling region and each calculation region.
[0011] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description
[0012] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart of a molecular dynamics non-covalent bond calculation method according to an embodiment of this application; Figure 2 This is a schematic diagram showing the cube structure formed by the calling area and its adjacent areas in this scheme; Figure 3 This is a schematic diagram of the central tower structure formed by the calling area and its adjacent areas in this scheme; Figure 4 This is a schematic diagram of the one-dimensional and two-dimensional record matrices in this scheme; Figure 5 This is the top-level structure diagram of the calculation based on the scoring board module of this solution using a single FPGA; Figure 6 This is a schematic diagram of each one-dimensional record matrix in this scheme when the FPGA includes multiple parallel nodes; Figure 7 This is a schematic diagram of each one-dimensional record matrix in this solution with multiple FPGAs and multiple nodes; Figure 8 This is the top-level structure diagram of each FPGA performing calculations based on the scoring board module when using two FPGA accelerator cards in this solution; Figure 9 This is a structural block diagram of a molecular dynamics non-covalent calculation device according to an embodiment of this application; Figure 10 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0013] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0014] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.
[0015] Example 1 This application provides a method for calculating non-covalent bonds in molecular dynamics. By optimizing the calculation of non-covalent bonds in molecular dynamics, the computational efficiency of molecular dynamics is improved. Specifically, refer to... Figure 1 The method includes: The CPU acquires the molecular structure and constructs a simulation box based on the molecular structure. In the simulation box, multiple regions of the same size are configured by a grid division method, and the region containing particles is set as the main region. The CPU acquires data information of each particle in the molecular structure and stores it in the FPGA. It acquires half of the adjacent regions of each calling region as the calculation region of that calling region. The adjacent regions other than the calculation region are symmetrical regions, and the current calculation region is symmetrical with the symmetrical region. The adjacent regions are regions that are directly adjacent to the current calling region. The FPGA performs parallel calculations on the interaction force between each calling region and each adjacent region of the corresponding calculation region, constructing a one-dimensional record matrix and a two-dimensional record matrix that correspond one-to-one with the calling region. Each column of the one-dimensional record matrix represents each adjacent region in the calculation region of the calling region corresponding to the one-dimensional record matrix. The default value in each one-dimensional record matrix is 0. When the calling region and its corresponding adjacent region have completed the calculation, the value of the position corresponding to the adjacent region that has completed the calculation is changed to 1 in the one-dimensional record matrix corresponding to the calling region. The rows of the two-dimensional record matrix represent each calling region, and the columns represent all regions in the simulation box. When the region represented by the column is an adjacent region in the calculation region of the calling region represented by the row, the value of the corresponding position is changed to 1; otherwise, it is 0. The value corresponding to each one-dimensional record matrix is compared with the value of the row of the corresponding calling region in the two-dimensional record matrix. If they are the same, the interaction force between the calling region and the symmetrical region is further calculated. The calculation results of the interaction forces between each calling region and all adjacent regions are integrated to complete the calculation of non-covalent bonds.
[0016] In this scheme, the size of the region in the simulation box is greater than or equal to the distance between the particles interacting.
[0017] In the acceleration system of molecular dynamics, considering periodic boundary conditions, the simulated system is divided into various forms. In this scheme, a cube-shaped simulation box is used. This is because the acceleration circuit can be parallelized in subsequent work. In molecular dynamics simulation, the force of each particle renewal comes from the superposition of multiple forces. The superimposed forces are different in different simulation systems. This scheme mainly designs the van der Waals forces and coulombic forces in parallel.
[0018] Van der Waals forces are used to calculate the interaction between two molecules. This part of the calculation is extremely computationally intensive in molecular dynamics simulations. Each particle needs to be calculated multiple times with other particles in the simulation system. As can be seen from the calculation formula of van der Waals forces, it is necessary to calculate the multiplication of R to the power of 12 and R to the power of 6. This part requires calling multiple DSP computing units, thus occupying a huge amount of storage space.
[0019] Coulombic force is calculated using each particle to calculate other particles within the simulation box. Since the force exerted by a particle at infinity on the particle being calculated is weak, the computational load can be reduced by constructing simulation boxes containing regions of the same size and ignoring particles outside a certain range when calculating non-covalent bonds between particles.
[0020] In the step of “acquiring data information of each particle in the molecular structure on the CPU and storing it in the FPGA”, the data information includes the real-time position information and calculation parameters of the particles, and the data information of each particle is stored in the HBM2 storage device in the FPGA.
[0021] Specifically, the calculation parameters for each particle are different, but the calculation parameters for each particle are used to calculate non-covalent bond forces. The calculation parameters for the particles include values such as dielectric constant, Q, and M.
[0022] Furthermore, the FPGA accesses the HBM2 storage device via the AXI interface to retrieve data information for each particle.
[0023] Specifically, HBM2 storage devices have higher memory bandwidth and smaller size. Because HBM2 can transmit multiple data blocks simultaneously, it can perform more operations at the same clock speed, thereby reducing power consumption. Therefore, HBM2 performs better in large-scale parallel computing, and FPGAs can quickly obtain particle data information in HBM2.
[0024] In the step of “obtaining half of the adjacent areas of each calling area as the calculation area of that calling area”, half of the adjacent areas are selected as the calculation area with the calling area as the center point of symmetry.
[0025] In this scheme, since molecular dynamics is calculated according to Newtonian classical mechanics, Newton's third theorem is considered during the calculation, that is, force is the interaction between objects. Therefore, in this scheme, half of the adjacent regions are selected as the calculation region with the main region as the center of symmetry. So, only half of the adjacent regions need to be calculated, and then the interaction force between the particles in the main region and all the adjacent regions can be obtained according to Newton's third theorem.
[0026] Specifically, since molecular dynamics generates a large amount of data in calculations, this approach reduces redundant calculations by only performing calculations on particles in the main region and the computational region.
[0027] Furthermore, if the FPGA has sufficient computing resources, it can perform parallel computation on the particles in the calling region and the particles in each of the corresponding adjacent regions.
[0028] Specifically, since the FPGA in this solution uses parallel computing, the theoretical maximum computing efficiency is to perform parallel computing on all the content that needs to be calculated, that is, to simultaneously calculate the interaction force between the particles in the main region and the particles in each adjacent region. The solution calculates half of the adjacent regions, which reduces the total amount of computation. However, this solution needs to consider Newton's third law at the end of the calculation, so each calculation region needs to perform address search with the remaining adjacent regions, and then read the corresponding values and accumulate them to obtain the result.
[0029] In the step of "FPGA parallel computing of the force between each calling region and each corresponding computing region", the FPGA constructs a non-covalent bond computing pipeline, transfers the data information of each particle to the RAM storage device in the FPGA and generates a particle information lookup table. The identifier of the region where each particle is located is used as an index in the particle information lookup table. The non-covalent bond computing pipeline obtains the data information of each particle based on the index in the particle information lookup table.
[0030] In this scheme, the calculation results of each step in the non-covalent bond calculation pipeline are cached in the RAM storage device in the FPGA.
[0031] For example, the calling area and its adjacent areas in this scheme are as follows: Figure 2The cube structure shown includes a main region and 26 adjacent regions. Thirteen adjacent regions are selected as computation regions, with the main region as the center of symmetry. This scheme uses an FPGA to perform parallel computation on particles in each adjacent region of the main region and computation regions. This can be viewed as a single-command, multi-channel data stream processing. First, the particle data information in HBM2 is transferred to RAM, and each particle is distinguished and marked according to the identifier of its region. Each particle in the main region performs computations with other particles in the main region and particles in each adjacent region of the computation region. The results of each computation are cached in Force RAM and Energy RAM. Force RAM is used to cache the computation results of particles in the main region and other particles in the main region, while Energy RAM is used to cache the computation results of particles in the main region and particles in each adjacent region of each computation region.
[0032] In this scheme, the number of parallel operations is controlled according to the performance and quantity of the FPGA used. The maximum number of parallel operations is to perform parallel calculations on all particles in the calling region, but this consumes a lot of resources. Therefore, in this scheme, a multi-path loop calculation method is used to calculate non-covalent bonds. For example, the calling region contains 1000 particles, and the particles form a pipeline for calculation. The first particle is transmitted to the pipeline connected to other particles. In this process, the coefficients R-12, R-6, and R-2 need to be calculated. Since the parameters of each particle are different, the data information of each particle needs to be obtained based on the index during the calculation. Here, R is the distance between particles.
[0033] Specifically, this solution uses a multi-level FLOAT POINT IP (floating IP) core to calculate the values of R-14, R-8, and R-3. This calculation method has a relatively balanced calculation speed and resource consumption. Alternatively, the calculation method that supports the maximum speed can be used to calculate floating-point numbers, or high-accuracy double-precision floating-point numbers can be used for calculation.
[0034] In this solution, the FPGA uses 32-bit floating-point single-precision storage for data.
[0035] Specifically, since this scheme aims to explore the parallelism of molecular dynamics, it uses 32-bit floating-point single-precision storage to save more storage resources.
[0036] In some embodiments, to better serve large clusters, reduce the computational load of parallel computing, and thus improve data transmission efficiency, the structure of the calling region and its adjacent regions can be as follows: Figure 3The central tower structure shown selects the regions adjacent to each face of the calling region as adjacent regions. The central tower structure reduces the amount of computation by half compared to the cube structure, thus further shortening the computation time required compared to the cube structure.
[0037] In this scheme, the non-covalent bond computation pipeline is constructed using DSP resources in the FPGA.
[0038] Specifically, DSP refers to the digital signal processor on an FPGA, which can perform complex digital signal processing functions such as filtering, encoding, decoding, modulation and demodulation. Therefore, DSP resources are suitable for adjusting parallel algorithm architectures. With the continuous advancement of integrated circuit technology, FPGAs can now support higher-precision DSP calculations. Their internal DSP resources are very abundant and sufficient to meet the needs of data-intensive computing physical models. Therefore, this solution uses the DSP resources in the FPGA to build a non-covalent pipeline to improve computing efficiency.
[0039] Specifically, in the non-covalent bond computation pipeline, assuming there are 100 particles in the calling region, the particles form a pipeline for computation. The first particle is transferred to the pipeline connected to other particles. This requires calculating the coefficients of R-12, R-6, and R-2. Since the parameters of each particle are different, the dielectric constant, charge, and mass of each particle need to be looked up in the particle lookup table in the RAM storage device. In this scheme, when calculating the true values of R-12, R-6, and R-2, a multi-level FLOAT POINT IP (floating IP) core calculation method can be used. That is, the values of R-12 and R-6 are calculated first, and then multiplied by the coefficients of R-12 and R-6 to obtain the true values of R-12 and R-6. The underlying layer of the non-covalent bond computation pipeline calls the DSP computing resources in the FPGA for computation. Similarly, this scheme is not limited to this calculation method. The maximum supported calculation method can also be used to perform floating-point calculations, or double-precision floating-point numbers can be used to improve the calculation accuracy.
[0040] Specifically, the non-covalent pipeline in this scheme is designed based on the computational objective (van der Waals force, Coulomb force, or other forces that affect non-covalent bonds) to improve computational efficiency.
[0041] In this scheme, a one-dimensional record matrix and a two-dimensional record matrix are set up to better record the progress of covalent bond calculation.
[0042] In this scheme, if the FPGA includes multiple nodes, a one-dimensional record matrix is set for each node in the FPGA. The one-dimensional record matrices of multiple nodes jointly record the computation progress of a calling region, thereby achieving the effect of parallel computing.
[0043] In this scheme, the one-dimensional recording matrix and the two-dimensional recording matrix in the scoreboard module are as follows: Figure 4 As shown, the colored part represents 1, and the uncolored part represents 0.
[0044] In this solution, the top-level structure diagram of a single FPGA performing calculations based on the scoring board module is as follows: Figure 5 As shown, the FPGA obtains particle information from the HBM2 storage device, performs various force calculations between particles based on the scoreboard module, and records the calculation results between different particles through the integrator before storing them in the FPGA.
[0045] Specifically, when the corresponding row in the one-dimensional record matrix and the two-dimensional record matrix are the same as the one-dimensional record matrix corresponding to the same calling region, it means that the calling region has completed the calculation of all adjacent regions in the calculation region. Then, the calculation of the calling region and other adjacent regions can be completed according to Newton's third law, because for the non-covalent bond force on a calling region, the forces exerted on the calling region by two symmetrical adjacent regions are opposite.
[0046] In some embodiments, when the FPGA includes multiple parallel nodes, the one-dimensional recording matrix is as follows: Figure 6 As shown, this means that multiple nodes equally share all the computing tasks and each node has a one-dimensional record matrix corresponding to the same calling region. When the sum of all one-dimensional record matrices corresponding to the same calling region is the same as the corresponding row in the two-dimensional record matrix, it indicates that the calling region has completed the computing region.
[0047] Specifically, each FPGA accelerator card in this solution only needs one particle information lookup table.
[0048] In some embodiments, when multiple FPGA accelerator cards are used, the area in the simulation box is evenly distributed to each accelerator card for computation.
[0049] In some embodiments, when multiple FPGA accelerator cards are used and each accelerator card contains multiple nodes, the one-dimensional recording matrix is as follows: Figure 7 As shown, each FPGA accelerator card is divided into half of the region. Similarly, in each FPGA accelerator card, each node has a one-dimensional record matrix corresponding to the same calling region. When the sum of all one-dimensional record matrices corresponding to the same calling region is the same as the corresponding row in the two-dimensional record matrix, it means that the calling region has completed the calculation with the calculation region.
[0050] For example, when using two FPGA accelerator cards, the top-level architecture diagram of each FPGA performing calculations based on the scoring board module is as follows: Figure 8As shown, the particle information lookup table needs to be backed up to each FPGA accelerator card. The simulation box is evenly divided into two parts and transmitted to the corresponding FPGA accelerator cards. The intermediate variables calculated by each FPGA accelerator card are statistically analyzed by the integrator and stored in the HBM2 storage device to facilitate the accumulation of the calculation results of each FPGA accelerator card.
[0051] In this solution, a transceiver module is configured for the network communication link of each FPGA accelerator card. Information stored in the HBM2 is transmitted to the HBM2 of other FPGA accelerator cards via a fiber optic network. During transmission, the corresponding calling area number is also synchronously sent to the corresponding accelerator card. This is because when processing calculations across multiple accelerator cards, it cannot be guaranteed that the calculation results of all calling areas are pre-accumulated. However, in the final calculation stage, pre-accumulated data of the calculation results of all calling areas is required, such as those located on the boundary. Considering the periodic boundary conditions, data is only transmitted to the accelerator card belonging to the boundary area after other accelerator cards have performed calculations, thus completing the summation operation of all calculation results of the calling areas.
[0052] Specifically, the integrator module is used to read the van der Waals force, covalent bond force and coulomb force calculation data of each particle obtained by the FPGA. The reason for using an integrator is that only after we have calculated the three forces of each particle can we accumulate these three forces of each particle to obtain the particle's force.
[0053] Furthermore, calculating the forces acting on covalent bonds requires minimal data and relatively short computation time. To avoid redundant calculations, the results of two-body, three-body, and four-body force calculations should be stored separately in designated memory areas. During the calculation of the forces acting on each particle, it is necessary to iterate through the covalent bonds of the particles to find the relevant tables. After comparing the pairing tables, we need to exclude bonding forces from the Coulomb force calculations because the results of these forces are not included in the final accumulation; instead, the accumulation is made up of the pairing forces of the covalent bonds.
[0054] In this scheme, the non-covalent bond calculation includes three parts of forces: van der Waals force, bonding force, and Coulomb force. Only after these three parts of forces for each particle are calculated can they be added together to obtain the non-covalent bond force.
[0055] In this scheme, a step accumulator is set in the FPGA. After the step accumulator records the first number of time steps, the region to which each particle belongs in the simulation box is reconfigured, and the reconfigured result is rewritten into the FPGA.
[0056] In some specific embodiments, after ten calculations, the region to which each particle belongs in the simulation box is reconfigured, and the interruption information is notified to the CPU so that the CPU can rewrite the reconfigured result into the FPGA.
[0057] Specifically, as the computation time gradually increases, the position coordinates of each particle may change, and the particle may migrate from one region to another. Therefore, the position of the particles needs to be reconfigured after a certain time step.
[0058] Specifically, when the calling region is an NVT system (the NVT system has a defined number of particles N, volume V, and temperature T), then each particle in the calling region corresponds to a particle in the adjacent region. For example, if the range of a region is (0~10A, 0~10A, 0~10A), when a particle in that region moves to (11, 9, 8), its position in that region is (10A, 10A, 10A), and then its position in the new region is (10A~20A, 0~10A, 0~10A).
[0059] Specifically, when the calling region is a non-NVT system, in a simulation box, the cell and sub-cell range of each particle correspond. Taking sub-cell 1 as an example, its range is (0~10A, 0~10A, 0~10A), and its position will change (11A, 9A, 8A). For non-NVT series ensembles, the particle's range from sub-cell 1 is (10A, 10A, 10A). Throughout the simulation box integration process, it is necessary to clearly define the exact boundaries of the sub-cells. Under the current step division, the particle moves to the new cell storage area, moving to the sub-cell 11 region (10A~22A, 0~12A, 0~12A). In the original cell 1 storage area, a "write data address progress counter" needs to be configured. Taking cell 1 as an example, if 10 data points need to be written to the cell, "write data address progress counter == 10". And when the eleventh particle is written to the cell, "write data address progress counter == 11".
[0060] In this solution, the most suitable hardware settings are selected based on the application scenarios of the features to improve computational efficiency.
[0061] In this scheme, the computational data generated by each particle must be transmitted to other FPGA accelerator cards by selecting an appropriate communication method.
[0062] For example, in this solution, the FPGA transmits particle computing data through a PCIe interface or fiber optic transmission technology. When a PCIe interface is used, the CPU is responsible for distributing the computing content to different FPGA accelerator cards. If fiber optic transmission technology is used, the computing content is distributed directly through routing.
[0063] Example 2 Based on the same concept, referencing Figure 9 This application also proposes a molecular dynamics non-covalent bond calculation device, comprising: The first acquisition module is used to acquire molecular structure through the CPU and construct a simulation box based on the molecular structure. In the simulation box, multiple regions of the same size are configured by a grid division method, and the region containing particles is set as the main region. The second acquisition module is used to acquire data information of each particle in the molecular structure through the CPU and store it in the FPGA. It acquires half of the adjacent regions of each calling region as the calculation region of the calling region. The adjacent regions other than the calculation region are symmetrical regions, and the current calculation region is symmetrical with the symmetrical region. The adjacent regions are regions that are directly adjacent to the current calling region. The calculation module is used to perform parallel calculations on the interaction force between each calling region and each adjacent region of the corresponding calculation region using the FPGA. It constructs a one-dimensional record matrix and a two-dimensional record matrix that correspond one-to-one with the calling regions. Each column of the one-dimensional record matrix represents each adjacent region in the calculation region of the calling region corresponding to the one-dimensional record matrix. The default value in each one-dimensional record matrix is 0. When the calling region and its corresponding adjacent region have completed the calculation, the value of the position corresponding to the adjacent region that has completed the calculation is changed to 1 in the one-dimensional record matrix corresponding to the calling region. The rows of the two-dimensional record matrix represent each calling region, and the columns represent all regions in the simulation box. When the region represented by the column is an adjacent region in the calculation region of the calling region represented by the row, the value of the corresponding position is changed to 1; otherwise, it is 0. The value corresponding to each one-dimensional record matrix is compared with the value of the row of the same calling region in the two-dimensional record matrix. If they are the same, the interaction force between the calling region and the symmetrical region is further calculated. The integration module is used to integrate the force calculation results of each calling region with all adjacent regions to complete the calculation of non-covalent bonds.
[0064] Example 3 This embodiment also provides an electronic device, see reference. Figure 10 It includes a memory 404 and a processor 402, wherein the memory 404 stores a computer program and the processor 402 is configured to run the computer program to perform the steps in any of the above method embodiments.
[0065] Specifically, the processor 402 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0066] Memory 404 may include a mass storage device for data or instructions. For example, and not limitingly, memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), flash memory, an optical disk drive, a magneto-optical disk drive, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 404 may include removable or non-removable (or fixed) media. Where appropriate, memory 404 may be internal or external to a data processing device. In a particular embodiment, memory 404 is non-volatile memory. In a particular embodiment, memory 404 includes read-only memory (ROM) and random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable read-only memory (PROM), an erasable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), an electrically alterable read-only memory (EAROM), or flash memory, or a combination of two or more of these. Where appropriate, the RAM can be Static Random-Access Memory (SRAM) or Dynamic Random-Access Memory (DRAM). DRAM can be Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), Extended Data Out Dynamic Random-Access Memory (EDODRAM), Synchronous Dynamic Random-Access Memory (SDRAM), etc.
[0067] The memory 404 can be used to store or cache various data files that need to be processed and / or communicated, as well as possible computer program instructions executed by the processor 402.
[0068] The processor 402 reads and executes computer program instructions stored in the memory 404 to implement any of the molecular dynamics non-covalent bond calculation methods in the above embodiments.
[0069] Optionally, the electronic device may further include a transmission device 406 and an input / output device 408, wherein the transmission device 406 is connected to the processor 402, and the input / output device 408 is connected to the processor 402.
[0070] The transmission device 406 can be used to receive or send data via a network. Specific examples of the network described above may include wired or wireless networks provided by the communication provider of the electronic device. In one example, the transmission device includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 406 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0071] The input / output device 408 is used to input or output information. In this embodiment, the input information may be molecular structure, etc., and the output information may be non-covalent bond calculation results, etc.
[0072] Optionally, in this embodiment, the processor 402 can be configured to perform the following steps via a computer program: S101. The CPU acquires the molecular structure and constructs a simulation box based on the molecular structure. In the simulation box, multiple regions of the same size are configured by a grid division method, and the region containing particles is set as the main region. S102. The CPU acquires the data information of each particle in the molecular structure and stores it in the FPGA. It acquires half of the adjacent regions of each calling region as the calculation region of the calling region. The adjacent regions other than the calculation region are symmetrical regions, and the current calculation region is symmetrical with the symmetrical region. The adjacent regions are the regions directly adjacent to the current calling region. S103. The FPGA performs parallel calculations on the interaction force between each calling region and each adjacent region of the corresponding calculation region, constructing a one-dimensional record matrix and a two-dimensional record matrix that correspond one-to-one with the calling region. Each column of the one-dimensional record matrix represents each adjacent region in the calculation region of the calling region corresponding to the one-dimensional record matrix. The default value in each one-dimensional record matrix is 0. When the calling region and its corresponding adjacent region have completed the calculation, the value of the position corresponding to the adjacent region that has completed the calculation is changed to 1 in the one-dimensional record matrix corresponding to the calling region. The rows of the two-dimensional record matrix represent each calling region, and the columns represent all regions in the simulation box. When the region represented by the column is an adjacent region in the calculation region of the calling region represented by the row, the value of the corresponding position is changed to 1; otherwise, it is 0. The value corresponding to each one-dimensional record matrix is compared with the value of the row of the same calling region in the two-dimensional record matrix. If they are the same, the interaction force between the calling region and the symmetrical region is further calculated. S104. Integrate the force calculation results of each calling region and all adjacent regions to complete the calculation of non-covalent bonds.
[0073] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0074] Generally, various embodiments can be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. Some aspects of the invention can be implemented in hardware, while others can be implemented in firmware or software that can be executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flowcharts, or using some other graphical representation, it should be understood that, by way of non-limiting example, these blocks, apparatuses, systems, techniques, or methods described herein can be implemented in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.
[0075] Embodiments of the present invention can be implemented by computer software, which may be executable by a data processor of a mobile device, such as a processor entity, or by hardware, or by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets, and / or macros can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. The computer program product may include one or more computer-executable components configured to perform the embodiments when the program is run. The one or more computer-executable components may be at least one piece of software code or a portion thereof. Additionally, it should be noted in this respect that, as Figure 10Any box in the logical flow can represent a program step, or interconnected logic circuits, boxes and functions, or a combination of program steps and logic circuits, boxes and functions. Software can be stored on physical media such as memory chips or blocks of storage implemented within a processor, magnetic media such as hard disks or floppy disks, and optical media such as DVDs and their data variants, CDs, etc. The physical medium is a non-transient medium.
[0076] Those skilled in the art should understand that the technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0077] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for calculating non-covalent bonds in molecular dynamics, characterized in that, include: The CPU acquires the molecular structure and constructs a simulation box based on the molecular structure. In the simulation box, multiple regions of the same size are configured by a grid division method, and the region containing particles is set as the main region. The CPU acquires data information of each particle in the molecular structure and stores it in the FPGA. It acquires half of the adjacent regions of each calling region as the calculation region of that calling region. The adjacent regions other than the calculation region are symmetrical regions, and the current calculation region is symmetrical with the symmetrical region. The adjacent regions are regions that are directly adjacent to the current calling region. The FPGA performs parallel calculations on the interaction force between each calling region and each adjacent region of the corresponding calculation region, constructing a one-dimensional record matrix and a two-dimensional record matrix that correspond one-to-one with the calling region. Each column of the one-dimensional record matrix represents each adjacent region in the calculation region of the calling region corresponding to the one-dimensional record matrix. The default value in each one-dimensional record matrix is 0. When the calling region and its corresponding adjacent region have completed the calculation, the value of the position corresponding to the adjacent region that has completed the calculation is changed to 1 in the one-dimensional record matrix corresponding to the calling region. The rows of the two-dimensional record matrix represent each calling region, and the columns represent all regions in the simulation box. When the region represented by the column is an adjacent region in the calculation region of the calling region represented by the row, the value of the corresponding position is changed to 1; otherwise, it is 0. The value corresponding to each one-dimensional record matrix is compared with the value of the row of the corresponding calling region in the two-dimensional record matrix. If they are the same, the interaction force between the calling region and the symmetrical region is further calculated. The calculation results of the interaction forces between each calling region and all adjacent regions are integrated to complete the calculation of non-covalent bonds.
2. The molecular dynamics non-covalent bond calculation method according to claim 1, characterized in that, The size of the region in the simulation box is greater than or equal to the distance between the particles interacting.
3. The molecular dynamics non-covalent bond calculation method according to claim 1, characterized in that, In the step of "acquiring data information of each particle in the molecular structure on the CPU and storing it in the FPGA", the data information includes the real-time position information and calculation parameters of the particles, and the data information of each particle is stored in the HBM2 storage device in the FPGA.
4. The molecular dynamics non-covalent bond calculation method according to claim 1, characterized in that, In the step of "obtaining half of the adjacent areas of each calling area as the calculation area of that calling area", half of the adjacent areas are selected as the calculation area with the calling area as the center point of symmetry.
5. The molecular dynamics non-covalent bond calculation method according to claim 1, characterized in that, In the step of "FPGA parallel computing of the interaction force between each calling region and each adjacent region of the corresponding computing region", the FPGA constructs a non-covalent bond computing pipeline, transfers the data information of each particle to the RAM storage device in the FPGA and generates a particle information lookup table. The identifier of the region where each particle is located is used as an index in the particle information lookup table, and the non-covalent bond computing pipeline obtains the data information of each particle based on the index in the particle information lookup table.
6. The molecular dynamics non-covalent bond calculation method according to claim 1, characterized in that, The FPGA uses 32-bit floating-point single-precision storage for data.
7. The molecular dynamics non-covalent bond calculation method according to claim 1, characterized in that, A step accumulator is set in the FPGA. After the step accumulator records the first number of time steps, the region to which each particle belongs in the simulation box is reconfigured, and the reconfigured result is rewritten into the FPGA.
8. A molecular dynamics non-covalent bond calculation device, characterized in that, include: The first acquisition module is used to acquire molecular structure through the CPU and construct a simulation box based on the molecular structure. In the simulation box, multiple regions of the same size are configured by a grid division method, and the region containing particles is set as the main region. The second acquisition module is used to acquire data information of each particle in the molecular structure through the CPU and store it in the FPGA. It acquires half of the adjacent regions of each calling region as the calculation region of the calling region. The adjacent regions other than the calculation region are symmetrical regions, and the current calculation region is symmetrical with the symmetrical region. The adjacent regions are regions that are directly adjacent to the current calling region. The calculation module is used to perform parallel calculations on the interaction force between each calling region and each adjacent region of the corresponding calculation region using the FPGA. It constructs a one-dimensional record matrix and a two-dimensional record matrix that correspond one-to-one with the calling regions. Each column of the one-dimensional record matrix represents each adjacent region in the calculation region of the calling region corresponding to the one-dimensional record matrix. The default value in each one-dimensional record matrix is 0. When the calling region and its corresponding adjacent region have completed the calculation, the value of the position corresponding to the adjacent region that has completed the calculation is changed to 1 in the one-dimensional record matrix corresponding to the calling region. The rows of the two-dimensional record matrix represent each calling region, and the columns represent all regions in the simulation box. When the region represented by the column is an adjacent region in the calculation region of the calling region represented by the row, the value of the corresponding position is changed to 1; otherwise, it is 0. The value corresponding to each one-dimensional record matrix is compared with the value of the row of the same calling region in the two-dimensional record matrix. If they are the same, the interaction force between the calling region and the symmetrical region is further calculated. The integration module is used to integrate the force calculation results of each calling region with all adjacent regions to complete the calculation of non-covalent bonds.
9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform a molecular dynamics non-covalent bond calculation method according to any one of claims 1-7.
10. A readable storage medium, characterized in that, The readable storage medium stores a computer program, the computer program including program code for controlling the process to execute the process, the process including a molecular dynamics non-covalent bond calculation method according to any one of claims 1-7.
Citation Information
Patent Citations
Molecular dynamics simulation method and program
JP2013211006A
Parallel algorithm for molecular dynamics simulation
US20140257769A1