Particle action pair correction method and device, equipment and storage medium
Through parallel calculation and correction of particle action pairs, the correction efficiency of particle action pairs is improved, and the problem of low simulation performance caused by low correction efficiency in the prior art is solved, and a more efficient simulation of particle operation trajectory is achieved.
Patent Information
- Application Number
- CN202411758489.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-25
AI Technical Summary
When simulating particle trajectory, the corrective efficiency of particle action pairs is low, resulting in low simulation performance.
By obtaining the combination of multiple particle pairs of action pairs, compute the relative distances of each group of particle pairs in parallel, determine the switching flags according to the relative distance and distance constraint conditions, update the combination of action pairs, and correct the new combination of action pairs in the combination through the particle constraint algorithm until the iteration termination condition is reached.
The correction efficiency of particle action pairs is improved, the performance of simulated particles is improved, and the problem of low simulation performance caused by low correction efficiency in the prior art is solved.
Smart Images

Figure CN119692142A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of molecular dynamics technology, and in particular to a method, device, equipment and storage medium for correcting particle action pairs. Background Art
[0002] In molecular dynamics simulation, the motion trajectories of a large number of particles need to be simulated. Due to the complexity of the molecular structure, the constraint algorithm between particles is a complex algorithm. The constraint algorithm is used to limit the relative motion between particles to maintain a specific geometric relationship or constraint condition. Due to the bond / angle relationship of the molecule, the particles are affected by the force, and the position and velocity of the particles will change within a certain time interval. Specifically, the relative distance between particles with bonds / angles must be within a certain range and cannot be too large or too small to destroy the chemical bonds between atoms. The constraint algorithm corrects the velocity and position of the atoms through calculation so that the velocity and position are within a certain constraint range.
[0003] At present, in the simulation and implementation of molecular dynamics, the implementation of constraint algorithms usually adopts the method of calculating particle-by-particle interaction and iteration. However, the correction of atomic position and velocity by constraint algorithms is a repeated and fine correction, which requires a considerable amount of calculation. In addition, due to the high-speed movement of particles, the implementation performance of constraint algorithms is required to be higher. The existing methods are inefficient and have low simulation performance. Summary of the invention
[0004] The present invention provides a particle action pair correction method, device, equipment and storage medium to solve the problem of low simulation performance caused by low correction efficiency of particle action pairs when simulating particle running trajectories in the prior art.
[0005] According to one aspect of the present invention, a method for correcting a particle action pair is provided, the method comprising:
[0006] Obtaining an action pair combination including a plurality of particle action pairs of molecular dynamics simulations;
[0007] According to the particle information of the particle action pairs, the relative distance of the particles of each group of particle action pairs is calculated in parallel;
[0008] Determine the switching flag of each group of particle action pairs according to the relative distance of the particles and the distance constraint condition;
[0009] The action pair combination is updated according to the switching flag bit to obtain a new action pair combination;
[0010] The particle action pairs in the new action pair combination are corrected by a particle constraint algorithm, the relative distances of the particles in the corrected particle action pairs are recalculated, and iteration is continued until an iteration termination condition is reached.
[0011] According to another aspect of the present invention, there is provided a device for correcting a particle action pair, the device comprising:
[0012] An acquisition module, used for acquiring an action pair combination including a plurality of particle action pairs;
[0013] A calculation module, used for calculating the relative distance of particles of each group of particle action pairs in parallel according to the particle information of the particle action pairs;
[0014] A determination module, used to determine the switching flag of each group of particle action pairs according to the relative distance of the particles and the distance constraint condition;
[0015] An updating module, used for updating the action pair combination according to the switching flag bit to obtain a new action pair combination;
[0016] The correction module is used to correct the particle action pairs in the new action pair combination by using a particle constraint algorithm, recalculate the relative distance of the particles of the corrected particle action pairs and continue to iterate until the iteration termination condition is reached.
[0017] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising: at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the particle action pair correction method described in any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for correcting particle action pairs described in any embodiment of the present invention when executed.
[0021] A method, device, equipment and storage medium for correcting particle action pairs according to an embodiment of the present invention, the method comprises: obtaining an action pair combination including a plurality of particle action pairs of molecular dynamics simulations; calculating the relative distance of particles of each group of particle action pairs in parallel according to the particle information of the particle action pairs; determining the switching flag of each group of particle action pairs according to the relative distance of particles and distance constraint conditions; updating the action pair combination according to the switching flag to obtain a new action pair combination; correcting the particle action pairs in the new action pair combination by a particle constraint algorithm, recalculating the relative distance of particles of the corrected particle action pairs and continuing to iterate until the iteration termination condition is reached. The method can improve the correction efficiency and further improve the performance of simulated particles by correcting the particle action pairs in parallel, and solves the problem of low simulation performance caused by low correction efficiency of particle action pairs when simulating particle running trajectories in the prior art.
[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 A schematic flow chart of a method for correcting a particle action pair provided in Embodiment 1 of the present invention;
[0025] Figure 2 A schematic diagram of the structure of a particle action pair correction device provided in Embodiment 2 of the present invention;
[0026] Figure 3 FIG. 4 is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only an embodiment of a part of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work should belong to the scope of protection of the present invention. It should be understood that the various steps recorded in the method implementation of the present invention can be performed in different orders and / or in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0028] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, any variations of the terms "including" and "having" are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0031] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.
[0032] Embodiment 1
[0033] Figure 1A flow chart of a method for correcting a particle action pair provided in Embodiment 1 of the present invention is applicable to the situation where particle action pairs are corrected when simulating particle motion trajectories in the simulation and implementation of molecular dynamics. The method can be executed by a correction device for particle action pairs, wherein the device can be implemented by software and / or hardware and is generally integrated on an electronic device. In this embodiment, the electronic device includes but is not limited to: computers and other devices.
[0034] like Figure 1 As shown, a particle action pair correction method provided by Embodiment 1 of the present invention includes the following steps:
[0035] S110, obtaining an action pair combination including a plurality of particle action pairs of molecular dynamics simulations.
[0036] Among them, molecular dynamics simulation can refer to a method of using computers to simulate the movement and evolution of molecular systems under certain conditions. The basic principle of molecular dynamics simulation is Newton's law of motion. By solving the molecular motion equations by numerical methods, the changes of the position, velocity, acceleration, etc. of the molecules over time, as well as the changes of the kinetic energy, potential energy, total energy, etc. of the molecules over time are obtained. A particle pair can refer to two particles that interact with each other during the simulation process. These particles can be atoms, molecules or other types of particles, and the interaction between the particles determines the dynamic behavior of the system. A pair combination can refer to a combination of multiple particle pairs.
[0037] In this embodiment, in molecular dynamics simulation, multiple particle action pairs can be obtained as action pair combinations, and the number of particle action pairs obtained can be set according to actual conditions. For example, if there are 16 particle action pairs that can be processed in parallel, 16 groups of particle action pairs can be selected.
[0038] S120. According to the particle information of the particle action pairs, the relative distance of the particles of each group of particle action pairs is calculated in parallel.
[0039] The particle information may be related information of particles in the particle action pair, and the relative distance of particles may be the distance between two particles.
[0040] In this embodiment, the relative distance between particles in each group of particle action pairs can be calculated in parallel according to the particle information of the particles in the particle action pairs.
[0041] In one embodiment, the method of calculating the relative distance of particles of each group of particle action pairs in parallel based on the particle information of the particle action pairs includes: obtaining the particle information of each group of particle action pairs; the particle information includes the position coordinates, velocity and mass of the particles; and calculating the relative distance of particles of each group of particle action pairs in parallel based on the position coordinates, velocity and mass of the particles in each group of particle action pairs.
[0042] The particle information may include the position coordinates, velocity and mass of the particle. The position coordinates may be the position of the particle, and the velocity may be the speed at which the particle moves.
[0043] In this embodiment, the distance between particles in the particle action pair can be calculated based on the position coordinates, velocity and mass of the particles, and the specific calculation method is not limited in this embodiment.
[0044] S130: Determine a switching flag of each group of particle action pairs according to the relative distance of the particles and the distance constraint condition.
[0045] The distance constraint condition may be a condition constraining a relative distance, and the distance constraint condition may be set according to actual conditions. The switching flag may be a flag used to indicate whether the particle action pair needs to be switched.
[0046] In this embodiment, it can be determined whether the relative distance between particles meets the distance constraint condition, and the switching flag of each group of particle action pairs is determined according to the determination result.
[0047] In one embodiment, determining the switching flag of each group of particle action pairs according to the relative distance of the particles and the distance constraint condition includes: for each group of particle action pairs, obtaining the sequence number of the particle action pair; when the relative distance of the particles of the particle action pair meets the distance constraint condition, based on the number of particle action pairs in the action pair combination, performing a modulo operation on the sequence number to obtain a modulo result, and using the sum of the modulo result and the number of particle action pairs in the action pair combination as the switching flag of the particle action pair; when the relative distance of the particles of the particle action pair does not meet the distance constraint condition, based on the number of particle action pairs in the action pair combination, performing a modulo operation on the sequence number to obtain a modulo result, and using the modulo result as the switching flag of the particle action pair.
[0048] The serial numbers of the particle action pairs may be numbered according to the order of the particle action pairs. The remainder operation represents the remainder obtained after a number is divided by another number. The remainder result is the remainder.
[0049] In this embodiment, for each group of particle action pairs, the sequence number of the particle action pair can be obtained to determine whether the relative distance of the particles meets the distance constraint condition; if so, the sequence number is modulo operation is performed by the number of particle action pairs in the action pair combination to obtain a modulo result, and the sum of the modulo result and the number of particle action pairs in the action pair combination is used as the switching flag of the particle action pair; otherwise, the modulo result is directly used as the switching flag of the particle action pair.
[0050] S140: Update the action pair combination according to the switching flag to obtain a new action pair combination.
[0051] In this embodiment, it is possible to determine whether the particle action pairs in the action pair combination need to be further replaced by switching the flag bit, and update the action pair combination to obtain a new action pair combination.
[0052] In one embodiment, the updating of the action pair combination according to the switching flag to obtain a new action pair combination includes: when it is determined according to the switching flag that all particle action pairs in the action pair combination do not need to continue to iterate, selecting new particle action pairs from uncorrected particle action pairs as new action pair combinations; when it is determined according to the switching flag that there are both particle action pairs that need to be iterated and those that do not need to be iterated in the action pair combination, interleaving the action pair combination with uncorrected particle action pairs based on the switching flag to obtain a new action pair combination; when it is determined according to the switching flag that all particle action pairs in the action pair combination need to continue to iterate, using the action pair combination as a new action pair combination.
[0053] In this embodiment, when the switch flag indicates that all the particle action pairs in the action pair combination do not need to be iterated further, it means that all the particle action pairs in this action pair combination meet the distance constraint condition and do not need to be corrected. If there are still particle action pairs that have not been corrected, a preset number of particle action pairs can be selected from the uncorrected particle action pairs as a new action pair combination. When the switch flag indicates that there are both particle action pairs that need to be iterated and those that do not need to be iterated in the action pair combination, it means that some particle action pairs still need to be corrected. At this time, a corresponding number of particle action pairs can be selected from the uncorrected particle action pairs in an interleaved manner to replace the particle action pairs that the switch flag indicates do not need to be iterated, and obtain a new action pair combination. When the switch flag indicates that all the particle action pairs in the action pair combination need to be iterated further, the original action pair combination can be used as a new action pair combination.
[0054] S150, correcting the particle action pairs in the new action pair combination by using a particle constraint algorithm, recalculating the relative distance of the particles of the corrected particle action pairs and continuing to iterate until an iteration termination condition is reached.
[0055] The particle constraint algorithm may be used to restrict the relative motion between particles to maintain a specific geometric relationship or constraint condition. The iteration termination condition may be a condition for terminating the iteration.
[0056] In this embodiment, the particle action pairs in the new action pair combination can be corrected by a particle constraint algorithm, and the relative distances of the particles of the corrected particle action pairs can be recalculated, and steps S130-S150 can be repeated until the iteration termination condition is reached.
[0057] In one embodiment, the particle action pairs in the new action pair combination are corrected by using a particle constraint algorithm, including: determining a position correction value and a speed correction value of each particle action pair in the new action pair combination by using a particle constraint algorithm; and correcting the position coordinates and speed of each particle action pair according to the position correction value and the speed correction value to obtain a corrected action pair combination.
[0058] The position correction value may be a correction value of the particle position coordinates, and the speed correction value may be a correction value of the particle speed.
[0059] In this embodiment, the position correction value and velocity correction value of each particle action pair in the new action pair combination can be calculated through the particle constraint algorithm, and the position coordinates and velocity of each particle action pair can be corrected according to the position correction value and velocity correction value to obtain the corrected action pair combination.
[0060] A method for correcting particle action pairs provided in a first embodiment of the present invention includes: obtaining an action pair combination including a plurality of particle action pairs of molecular dynamics simulations; calculating the relative distance of particles of each group of particle action pairs in parallel according to the particle information of the particle action pairs; determining the switching flag of each group of particle action pairs according to the relative distance of the particles and the distance constraint condition; updating the action pair combination according to the switching flag to obtain a new action pair combination; correcting the particle action pairs in the new action pair combination by a particle constraint algorithm, recalculating the relative distance of particles of the corrected particle action pairs and continuing to iterate until the iteration termination condition is reached. This method can improve the correction efficiency and further improve the performance of simulated particles by correcting the particle action pairs in parallel, and solves the problem of low simulation performance caused by low correction efficiency of particle action pairs when simulating particle running trajectories in the prior art.
[0061] Based on the above embodiment, a variant embodiment of the above embodiment is proposed. It should be noted that in order to make the description concise, only the differences from the above embodiment are described in the variant embodiment.
[0062] In one embodiment, the method of interleaving the action pair combination with the uncorrected particle action pairs based on the switching flag to obtain a new action pair combination includes: obtaining a preset number of uncorrected particle action pairs; interleaving the particle action pairs in the action pair combination that do not need to be further iterated into the corresponding particle action pairs in the uncorrected particle action pairs according to the switching flag; and using the interleaved action pair combination as a new action pair combination.
[0063] In this embodiment, a preset number of uncorrected particle action pairs can be obtained, and the preset number can be the same as the number of particle action pairs in the action pair combination. According to the switching flag, the particle action pairs in the action pair combination that do not need to continue to iterate are replaced with the corresponding particle action pairs in the uncorrected particle action pairs through interleaving instructions, and the interleaved action pair combination is used as the new action pair combination.
[0064] In one embodiment, the iteration termination condition includes: the relative distances of all particle action pairs in the action pair combination satisfy the distance constraint condition, and the number of uncorrected particle action pairs is less than a preset number; or, there are particle action pairs in the action pair combination whose relative distances do not satisfy the distance constraint condition, and the number of iterations of the particle action pairs reaches the maximum number of iterations.
[0065] The number of iterations may be the number of loop iterations of the particle action.
[0066] In this embodiment, the preset number may be the same as the number of particle action pairs in the action pair combination. When the number of uncorrected particle action pairs is less than the number, normal operation cannot be performed at this time. Therefore, the iteration termination condition may be that the relative distances of all particle action pairs in the action pair combination satisfy the distance constraint condition, and the number of uncorrected particle action pairs is less than the preset number. When the number of iterations of the particle action pairs reaches the maximum number of iterations, the simulation of molecular motion may be abnormal. Therefore, the iteration termination condition may include that there are particle action pairs in the action pair combination whose relative distances do not satisfy the distance constraint condition, and the number of iterations of the particle action pairs reaches the maximum number of iterations.
[0067] The embodiment of the present invention provides a specific implementation method based on the technical solutions of the above embodiments.
[0068] For molecular systems with large amounts of data, it is necessary not only to perform constraint algorithm calculations on each atomic action pair that is chemically bonded to each other, but also to perform multiple iterations on each atomic action pair in most cases. This embodiment takes particle action pairs as atomic action pairs as an example, processes N groups of atomic action pairs in parallel, and each group of atomic pairs performs particle constraint algorithm calculations in parallel. If some of the atomic action pairs meet the conditions, the processing results of this group are output, and the next group of atomic action pairs replaces the current group of atomic action pairs for iterative calculations.
[0069] Assuming that there are n groups of atomic pairs that need to be calculated, the atomic pairs can be numbered first, and all the parameters required for calculating the n groups of atomic pairs (atomic position coordinates, velocity, mass, etc.) can be stored in memory in order. The atomic groups are numbered 0, 1...n.
[0070] Table 1 Order of n groups of atomic action pairs in memory
[0071] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 … … … … … … … … … … … … … … n
[0072] As shown in Table 1, each information parameter of the atomic action pair can be stored in the memory in the order of numbers.
[0073] Taking 16 groups of parallel operations as an example, the iteration process is as follows:
[0074] Step 1: Read the atomic information of groups 0 to 15, and calculate the relative distances of atoms of groups 0 to 15 atomic action pairs in parallel.
[0075] Step 2: Determine the result based on the distance constraint.
[0076] 1. Establish 0 to 15 groups of atomic action pairs to distinguish the atomic action pairs that meet the distance constraint. For the atomic action pairs that meet the distance constraint, if the atomic action pair number is x, then its switch flag is recorded as mod(x,16)+16. For the atomic action pairs that do not meet the distance constraint, if the atomic action pair number is y, then its switch flag is recorded as mod(y,16). If the number of atomic action pairs to be processed is less than 16, the missing atomic action pairs are regarded as groups that meet the distance constraint.
[0077] Assuming that the atomic action pairs of groups 0 to 15 have the atomic information of groups 0, 3 and 4 satisfying the distance constraint in this iteration, the switching flags of the current atomic action pairs of groups 0 to 15 are shown in Table 2:
[0078] Table 2 Switching flags of atomic action pairs
[0079] 16 1 2 19 20 5 6 7 8 9 10 11 12 13 14 15
[0080] As shown in Table 2, the switching flag bits of group 0, group 3 and group 4 are not less than 16.
[0081] At this time, the position information of the storage parameters of the atomic action pair currently undergoing constraint calculation can be recorded to facilitate subsequent updating of the position and velocity information of the atomic action pair.
[0082] Step 3: Check the current switch flag. If all 16 flags are not less than 16, it is considered that there are no atomic action pairs to be processed, and the loop is exited to end the iteration, that is, the correction of all atomic positions and velocities is ended. As described in step 2, if the current 16 groups of atomic information all meet the distance constraint conditions, then the current flag is as shown in Table 3:
[0083] Table 3 Switching flags when both atomic action pairs meet the conditions
[0084] 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
[0085] If there is a flag bit less than 16 among the 16 flag bits, it is considered that there are still atoms that need to be corrected, and step 4 is performed.
[0086] Step 4: During the iteration process, record the number of iterations of the atomic action pairs. Count the 16 groups of atomic action pairs in parallel to record the number of iterations of each group of atomic action pairs. If there is an atomic action pair whose iteration number is greater than the maximum number of iterations set by the system and still does not meet the distance constraint condition, it is considered that the system simulation of molecular motion is abnormal, and the constraint calculation is terminated directly with an error. If the number of iterations of the atomic action pair does not exceed the maximum number of iterations, proceed to step 5 and iterate.
[0087] Step 5: Read the atomic information of groups 16 to 31, and combine it with the atomic information of groups 0 to 15 read previously to form groups 0 to 31 of atomic information, and interleave according to the switching flag of the atomic action pair, using the interleaving instruction, and interleave in the order of the switching flag of the atomic action pair, and store the interleaved atomic information data in the register. For example, if the switching flag of the 0th group of atomic action pairs is 16, the switching flag of the 3rd group of atomic action pairs is 19, and the switching flag of the 4th group of atomic action pairs is 20, then the 0th group of atomic action pairs is replaced by the 16th group of atomic action pairs, the 3rd group of atomic action pairs is replaced by the 19th group of atomic action pairs, and the 4th group of atomic action pairs is replaced by the 20th group of atomic action pairs.
[0088] The particle constraint algorithm is used to calculate the interleaved atomic information to obtain the position and velocity correction values of the 16 groups of atoms.
[0089] Step 6: Obtain the storage location information of the current atomic action pair, and discretely update the corrected position and velocity of the atomic action pair back to the storage address of the corresponding atomic action pair.
[0090] Step 7: Repeat step 1 to calculate the relative distance of the atoms of the modified atomic action pair, determine whether the distance constraint condition is met, and determine the switching flag. At this time, when interleaving, because the atomic information of groups 16 to 31 already exists in the information of the atomic action pair, the 16 groups of atomic action pairs read at this time are shown in Table 4:
[0091] Table 4 16 groups of atomic action pairs read
[0092] 32 17 18 35 36 21 22 23 24 25 26 27 28 29 30 31
[0093] Repeat steps 1 to 6 until the iteration of atomic position and velocity correction ends in the following two cases.
[0094] 1. The atomic information of the current 16 groups all meet the distance constraint conditions, and there is no switch flag less than 16 among the 16 switch flags. It is considered that all atomic groups have completed the correction of speed and position normally.
[0095] 2. Among the current 16 groups of atomic information, there are atomic action pairs that do not satisfy the distance constraint conditions, among the 16 switch flags, there are switch flags that are less than 16, and there are atomic action pairs whose iteration times have reached the maximum number of iterations.
[0096] The technical solution of this embodiment can realize iterative calculation of multiple groups of atomic action pairs in molecular dynamics simulation with large computational load, flexibly realize the switching of atomic action pairs, and can process N groups of particle action pairs in parallel, which greatly improves the performance without losing accuracy. Compared with calculating one particle action pair at a time and iterating iteratively, it greatly saves the calculation time, which plays a vital role in the simulation process of rapidly moving molecules.
[0097] Embodiment 2
[0098] Figure 2 A schematic diagram of the structure of a particle action pair correction device provided in Example 2 of the present invention, wherein the device can be used to correct particle action pairs when simulating particle motion trajectories in the simulation and implementation of molecular dynamics, wherein the device can be implemented by software and / or hardware and is generally integrated on an electronic device.
[0099] like Figure 2 As shown, the device comprises:
[0100] An acquisition module 210 is used to acquire an action pair combination including a plurality of particle action pairs;
[0101] A calculation module 220, configured to calculate in parallel the relative distance of particles of each group of particle action pairs according to the particle information of the particle action pairs;
[0102] A determination module 230, configured to determine a switching flag of each group of particle action pairs according to the relative distance of the particles and the distance constraint condition;
[0103] An updating module 240, configured to update the action pair combination according to the switching flag bit to obtain a new action pair combination;
[0104] The correction module 250 is used to correct the particle action pairs in the new action pair combination by using a particle constraint algorithm, recalculate the relative distance of the particles of the corrected particle action pairs and continue to iterate until the iteration termination condition is reached.
[0105] This embodiment provides a device for correcting particle action pairs, including: an acquisition module for obtaining an action pair combination including multiple particle action pairs; a calculation module for calculating the relative distance of particles of each group of particle action pairs in parallel according to the particle information of the particle action pairs; a determination module for determining the switching flag of each group of particle action pairs according to the relative distance of the particles and the distance constraint condition; an update module for updating the action pair combination according to the switching flag to obtain a new action pair combination; a correction module for correcting the particle action pairs in the new action pair combination through a particle constraint algorithm, recalculating the relative distance of particles of the corrected particle action pairs and continuing to iterate until the iteration termination condition is reached. By correcting the particle action pairs in parallel, the correction efficiency can be improved, and the performance of the simulated particles can be further improved, which solves the problem that the correction efficiency of the particle action pairs is low and the simulation performance is low when simulating the particle running trajectory in the prior art.
[0106] Furthermore, the calculation module 220 is specifically configured to:
[0107] Obtaining particle information of each group of particle action pairs; the particle information includes the position coordinates, velocity and mass of the particles;
[0108] According to the position coordinates, velocity and mass of the particles in each particle action pair, the relative distance of the particles in each particle action pair is calculated in parallel.
[0109] Furthermore, the determination module 230 is specifically configured to:
[0110] For each group of particle action pairs, obtaining the sequence number of the particle action pair;
[0111] When the relative distance between particles of the particle action pair satisfies the distance constraint condition, a modulo operation is performed on the sequence number based on the number of particle action pairs in the action pair combination to obtain a modulo result, and the sum of the modulo result and the number of particle action pairs in the action pair combination is used as a switching flag of the particle action pair;
[0112] When the relative distance between particles of the particle action pair does not satisfy the distance constraint condition, a modulo operation is performed on the sequence number based on the number of particle action pairs in the action pair combination to obtain a modulo result, and the modulo result is used as a switching flag of the particle action pair.
[0113] Furthermore, the update module 240 is specifically configured to:
[0114] When it is determined according to the switching flag that all the particle action pairs in the action pair combination do not need to continue iteration, a new particle action pair is selected from the particle action pairs that have not been corrected as a new action pair combination;
[0115] When it is determined according to the switching flag that there are both particle action pairs that need iteration and those that do not need iteration in the action pair combination, interweaving the action pair combination with the uncorrected particle action pairs based on the switching flag to obtain a new action pair combination;
[0116] When it is determined according to the switching flag that all particle action pairs in the action pair combination need to continue to iterate, the action pair combination is used as a new action pair combination.
[0117] Further, interleaving the action pair combination with the uncorrected particle action pair based on the switching flag to obtain a new action pair combination includes:
[0118] Get a preset number of uncorrected particle action pairs;
[0119] According to the switching flag, the particle action pairs in the action pair combination that do not need to be further iterated are interleaved into corresponding particle action pairs in the uncorrected particle action pairs;
[0120] The interleaved action pair combination is used as a new action pair combination.
[0121] Furthermore, the correction module 250 is specifically used for:
[0122] Determining the position correction value and the speed correction value of each particle action pair in the new action pair combination by a particle constraint algorithm;
[0123] The position coordinates and speed of each particle action pair are corrected according to the position correction value and the speed correction value to obtain a corrected action pair combination.
[0124] Furthermore, the iteration termination condition includes:
[0125] The relative distances of particles in all the particle action pairs in the action pair combination satisfy the distance constraint condition, and the number of uncorrected particle action pairs is less than a preset number;
[0126] Alternatively, there are particle action pairs in the action pair combination whose relative distances do not satisfy the distance constraint condition, and the number of iterations of the particle action pairs reaches the maximum number of iterations.
[0127] The above-mentioned particle action pair correction device can execute the particle action pair correction method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0128] Embodiment 3
[0129] Figure 3 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0130] like Figure 3 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0131] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0132] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a correction method for particle action pairs.
[0133] In some embodiments, the correction method for particle action pairs can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the correction method for particle action pairs described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the correction method for particle action pairs in any other appropriate manner (for example, by means of firmware).
[0134] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0135] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0136] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0137] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0138] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0139] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0140] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0141] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for correcting particle action pairs, characterized in that: The method comprises: Obtaining an action pair combination including a plurality of particle action pairs of molecular dynamics simulations; According to the particle information of the particle action pairs, the relative distance of the particles of each group of particle action pairs is calculated in parallel; Determine the switching flag of each group of particle action pairs according to the relative distance of the particles and the distance constraint condition; The action pair combination is updated according to the switching flag bit to obtain a new action pair combination; The particle action pairs in the new action pair combination are corrected by a particle constraint algorithm, the relative distances of the particles in the corrected particle action pairs are recalculated, and iteration is continued until an iteration termination condition is reached.
2. The method according to claim 1, characterized in that The step of calculating the relative distance of particles of each group of particle action pairs in parallel according to the particle information of the particle action pairs comprises: Obtaining particle information of each group of particle action pairs; the particle information includes the position coordinates, velocity and mass of the particles; According to the position coordinates, velocity and mass of the particles in each particle action pair, the relative distance of the particles in each particle action pair is calculated in parallel.
3. The method according to claim 1, characterized in that The step of determining the switching flag of each group of particle action pairs according to the relative distance of the particles and the distance constraint condition comprises: For each group of particle action pairs, obtaining the sequence number of the particle action pair; When the relative distance between particles of the particle action pair satisfies the distance constraint condition, a modulo operation is performed on the sequence number based on the number of particle action pairs in the action pair combination to obtain a modulo result, and the sum of the modulo result and the number of particle action pairs in the action pair combination is used as a switching flag of the particle action pair; When the relative distance between particles of the particle action pair does not satisfy the distance constraint condition, a modulo operation is performed on the sequence number based on the number of particle action pairs in the action pair combination to obtain a modulo result, and the modulo result is used as a switching flag of the particle action pair.
4. The method according to claim 1, characterized in that The updating of the action pair combination according to the switching flag bit to obtain a new action pair combination includes: When it is determined according to the switching flag that all the particle action pairs in the action pair combination do not need to continue iteration, a new particle action pair is selected from the particle action pairs that have not been corrected as a new action pair combination; When it is determined according to the switching flag that there are both particle action pairs that need iteration and those that do not need iteration in the action pair combination, interweaving the action pair combination with the uncorrected particle action pairs based on the switching flag to obtain a new action pair combination; When it is determined according to the switching flag that all particle action pairs in the action pair combination need to continue to iterate, the action pair combination is used as a new action pair combination.
5. The method according to claim 4, characterized in that The step of interleaving the action pair combination with the uncorrected particle action pair based on the switching flag to obtain a new action pair combination includes: Get a preset number of uncorrected particle action pairs; According to the switching flag, the particle action pairs in the action pair combination that do not need to be further iterated are interleaved into corresponding particle action pairs in the uncorrected particle action pairs; The interleaved action pair combination is used as a new action pair combination.
6. The method according to claim 1, characterized in that The modifying of the particle action pairs in the new action pair combination by using a particle constraint algorithm includes: Determining the position correction value and the speed correction value of each particle action pair in the new action pair combination by a particle constraint algorithm; The position coordinates and speed of each particle action pair are corrected according to the position correction value and the speed correction value to obtain a corrected action pair combination.
7. The method according to claim 1, characterized in that The iteration termination conditions include: The relative distances of particles in all the particle action pairs in the action pair combination satisfy the distance constraint condition, and the number of uncorrected particle action pairs is less than a preset number; Alternatively, there are particle action pairs in the action pair combination whose relative distances do not satisfy the distance constraint condition, and the number of iterations of the particle action pairs reaches the maximum number of iterations.
8. A correction device for particle action pairs, characterized in that: The device comprises: An acquisition module, used for acquiring an action pair combination including a plurality of particle action pairs; A calculation module, used for calculating the relative distance of particles of each group of particle action pairs in parallel according to the particle information of the particle action pairs; A determination module, used to determine the switching flag of each group of particle action pairs according to the relative distance of the particles and the distance constraint condition; An updating module, used for updating the action pair combination according to the switching flag bit to obtain a new action pair combination; The correction module is used to correct the particle action pairs in the new action pair combination by using a particle constraint algorithm, recalculate the relative distance of the particles of the corrected particle action pairs and continue to iterate until the iteration termination condition is reached.
9. An electronic device, characterized in that: The device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the particle action pair correction method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for correcting particle action pairs according to any one of claims 1 to 7 when executed.