Atomic system simulation method, device and equipment and storage medium
By selecting the atomic positions of the chain cells in parallel and sequentially in the Monte Carlo simulation and generating random integer arrays and masks, the data continuity problem of the vectorized operation unit is solved, and the parallel processing of the Monte Carlo simulation on the vectorized operation unit is realized, which expands its application scope and improves the computational efficiency of atomic structure analysis.
Patent Information
- Application Number
- CN202511219612.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-28
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-08-28
AI Technical Summary
Monte Carlo simulation is not applicable to the vectorized operation unit of the single instruction multiple data flow computing model, which limits its application scope and makes it impossible to effectively perform atomic structure analysis.
By selecting the atomic positions in the chain cells in parallel and sequentially in the simulation loop, generating random integer arrays and masks, and converting the atomic exchange condition judgment into vector mask batch screening, continuous access to data memory is ensured to adapt to the characteristics of the vectorized operation unit.
The parallel processing of Monte Carlo simulation on vectorized computing units has been realized, which has expanded its application scope and improved the computational efficiency of atomic structure analysis.
Smart Images

Figure CN120748522A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of atomic system simulation, and in particular to methods, devices, equipment and storage media for atomic system simulation. Background Art
[0002] The physical properties of bulk materials are determined by their multiscale structures, which originate from the arrangement of the atoms that make up the material. Microscopic techniques can experimentally determine the types and positions of atoms, but these experiments involve time-consuming and laborious processes, including sample synthesis, specimen preparation, measurement, and 3D reconstruction. Atomic-level computational simulations can rapidly generate compositional distribution maps, more quickly establishing relationships between structure and properties, and accelerating the materials design cycle.
[0003] Related technologies use Monte Carlo simulations to study the atomic-scale behavior of materials. Specifically, random sampling is used to explore the system's thermodynamic properties, such as energy, entropy, and free energy. This allows predictions of the material's structure and dynamic behavior under varying temperature and pressure conditions. However, Monte Carlo simulations rely on random memory access and are not suitable for vectorized operations within the Single Instruction Multiple Data (SIMD) computing model, limiting their application. Summary of the Invention
[0004] The main purpose of the embodiments of the present application is to propose atomic system simulation methods, devices, equipment and storage media, to realize Monte Carlo atomic movement simulation based on vectorized operations, and to enhance the applicability of Monte Carlo simulation in the field of atomic structure analysis.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application provides an atomic system simulation method, comprising: Obtaining the chain cells corresponding to the initial configuration and the number of atoms contained in each chain cell; Performing a simulation cycle based on the number of atoms, and in each simulation cycle, sequentially selecting the atomic position corresponding to each of the chain cells as a target position, and obtaining a preset number of nearest neighbor positions corresponding to each of the target positions; Obtaining continuous atomic positions at all target positions, generating a random integer array based on the continuous atomic positions, performing an initial loop based on the preset number, generating a random mask corresponding to the random integer array in each initial loop, and determining an exchange position for each target position from the nearest positions based on the random mask, and obtaining an attempted exchange configuration after the initial loop ends; Performing a selection cycle based on the preset number, generating a swap mask corresponding to the random integer array in each selection cycle, and generating a swap configuration based on the swap mask, the attempted swap configuration, and the initial configuration, and using the swap configuration as the initial configuration in the next selection cycle until a final swap configuration is obtained; In the next simulation cycle, the exchange configuration is used as the initial configuration until the simulation cycle ends.
[0006] In some embodiments, generating a random integer array according to the continuous atomic positions includes: Randomly selecting a plurality of random numbers from integers within the preset quantity constraint range, wherein different integers correspond to one of the nearest neighboring positions respectively; The random integer array consistent with the number of the consecutive atomic positions is generated according to the random number.
[0007] In some embodiments, generating a random mask corresponding to the random integer array in each initial loop includes: The current loop number is obtained. If the random number in the random integer array is consistent with the current loop number, the random number at the corresponding position is changed to one, otherwise it is zero, and the corresponding random mask is generated.
[0008] In some embodiments, determining a swap position for each of the target positions from the nearest neighboring positions according to the random mask comprises: Generate a position mask according to the target position, calculate the AND operation of the random mask and the position mask, and obtain a swap identifier array; The chain cell corresponding to the target position is determined according to the "1" identifier in the exchange identifier array, the current cycle number is matched in the integer, and the exchange position is determined from the nearest position according to the matching result.
[0009] In some embodiments, generating a swap mask corresponding to the random integer array in each selection cycle includes: Calculating an exchange probability corresponding to each position in the random integer array after the atoms at the target position and the exchange position are exchanged, and determining an identifier based on the exchange probability, wherein if the exchange probability indicates that an exchange is required, the identifier is one, otherwise it is zero; An identifier mask consistent with the random integer array is generated according to the identifier, a position mask is generated according to the target position, and an AND operation of the identifier mask and the position mask is calculated to obtain the exchange mask.
[0010] In some embodiments, generating a swap configuration according to the swap mask, the attempted swap configuration, and the initial configuration includes: An AND operation is performed according to the exchange mask and the random mask to obtain the element value of the target position in the operation result. If the element value is one, the chain cell in the attempted exchange configuration is used to replace the chain cell at the corresponding position in the initial configuration.
[0011] In some embodiments, obtaining a preset number of nearest neighboring positions corresponding to each target position further includes: If the target position is located in the boundary range of the chain cell, the next position range corresponding to each boundary of the chain cell is obtained according to the cycle information, and the next position range is spliced to the outer circle of the boundary range to form an atomic virtual layer, and at least one of the nearest positions is located in the atomic virtual layer.
[0012] To achieve the above-mentioned objectives, a second aspect of an embodiment of the present application provides an atomic system simulation device, comprising: Initial parameter acquisition module: used to obtain the chain cells corresponding to the initial configuration and the number of atoms contained in each chain cell; A target position selection module is configured to perform simulation cycles based on the number of atoms, and in each simulation cycle, sequentially select the atomic position corresponding to each of the chain cells as the target position, and obtain a preset number of nearest neighbor positions corresponding to each of the target positions; A primary cycle module is configured to obtain the continuous atomic positions of all the target positions, generate a random integer array based on the continuous atomic positions, perform a primary cycle based on the preset number, generate a random mask corresponding to the random integer array in each primary cycle, and determine the exchange position of each target position from the nearest position based on the random mask, and obtain an attempted exchange configuration after the primary cycle is completed; A selection loop module is configured to perform a selection loop based on the preset number, generate a swap mask corresponding to the random integer array in each selection loop, and generate a swap configuration based on the swap mask, the attempted swap configuration, and the initial configuration, and use the swap configuration as the initial configuration in the next selection loop until a final swap configuration is obtained; Iteration termination module: used for taking the exchange configuration as the initial configuration in the next simulation cycle until the simulation cycle ends.
[0013] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the method described in the first aspect when executing the computer program.
[0014] To achieve the above-mentioned purpose, the fourth aspect of the embodiment of the present application proposes a storage medium, which is a storage medium. The storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0015] The atomic system simulation method, device, equipment and storage medium proposed in the embodiments of the present application obtain the chain cells corresponding to the initial configuration and the number of atoms contained in each chain cell, and perform a simulation loop based on the number of atoms. In each simulation loop, the atomic position corresponding to each chain cell is selected in sequence as the target position, and a preset number of nearest positions corresponding to each target position are obtained. The continuous atomic positions on all target positions are obtained, and a random integer array is generated based on the continuous atomic positions. The initial loop is performed based on the preset number. A random mask corresponding to the random integer array is generated in each initial loop, and the exchange position of each target position is determined from the nearest positions based on the random mask. After the initial loop ends, a trial exchange configuration is obtained, and a selection loop is performed based on the preset number. A swap mask corresponding to the random integer array is generated in each selection loop, and an exchange configuration is generated based on the swap mask, the trial exchange configuration and the initial configuration. The swap configuration is used as the initial configuration in the next selection loop until the final swap configuration is obtained. The swap configuration is used as the initial configuration in the next simulation loop until the simulation loop ends. Since Monte Carlo simulation relies on random access to memory, random access will lead to a large number of conditional judgments and discrete data reading, which greatly reduces the computing efficiency. Therefore, in the embodiment of the present application, the atomic positions in the chain cell are selected in sequence and parallel as the target positions in the simulation loop to ensure the orderliness of the atomic positions and avoid disordered random access. Secondly, a random integer array is generated and a random mask and a swap mask are constructed based on a preset number. The swap position is determined from the nearest position through masking technology, and the conditional judgment of the atomic swap is converted into a batch screening of a vector mask. Among them, the random integer array provides a predictable random source, and then the scattered swap operations are converted into continuous vector operations through the masking process to ensure continuous access to data memory. This allows the Monte Carlo simulation atomic movement that originally relied on random memory access and conditional judgment to adapt to the characteristics of the vectorized operation unit, realize parallel processing of batch atoms, solve the rigid requirements of the vectorized operation unit for data continuity, transplant the Monte Carlo simulation into the vectorized operation framework, and expand its application range. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a flow chart of the atomic system simulation method provided in an embodiment of the present application.
[0017] Figure 2 It is a schematic diagram of the initial configuration provided in the embodiment of the present application.
[0018] Figure 3This is another schematic diagram of the initial configuration provided in the embodiment of the present application.
[0019] Figure 4 This is a flowchart of generating a random integer array based on continuous atomic positions provided by an embodiment of the present application.
[0020] Figure 5 This is a flowchart of an embodiment of the present application for determining the exchange position of each target position from the nearest neighboring positions based on a random mask.
[0021] Figure 6 It is a schematic diagram of an attempted exchange configuration provided in an embodiment of the present application.
[0022] Figure 7 This is a flowchart of generating a swap mask corresponding to a random integer array in each selection cycle provided by an embodiment of the present application.
[0023] Figure 8 This is a schematic diagram of generating the exchange configuration provided in an embodiment of the present application.
[0024] Figure 9 A schematic diagram of the boundary provided in an embodiment of the present application.
[0025] Figure 10 This is a structural block diagram of an atomic system simulation device provided in another embodiment of the present application.
[0026] Figure 11 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0028] It should be noted that although the functional modules are divided in the device schematic and the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in a different order than the module division in the device or the order in the flowchart.
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0030] The physical properties of bulk materials are determined by their multi-scale structures, which originate from the arrangement of the atoms that make up the material. Microscopic techniques can be used to experimentally determine the types of atoms and their positions. For example, atom probe tomography (APT) directly provides three-dimensional composition information at the single-atom scale, characterizing nanoscale defects such as short-range order, nanoprecipitates, and grain boundaries. However, the experimental method includes sample synthesis, specimen preparation, measurement, and three-dimensional reconstruction, which is time-consuming and labor-intensive. In contrast, the use of atomic-level computational simulations can quickly generate compositional distribution maps, thereby more quickly establishing the relationship between structure and performance and accelerating the material design cycle.
[0031] However, using atomistic simulations to predict the compositional distribution of APT samples (typically containing tens to hundreds of millions of atoms) faces significant computational challenges. First, because APT samples are needle-shaped samples extracted from bulk materials, simulations must start with significantly larger supercells (possibly requiring up to a billion atoms) to accurately represent the bulk environment before modeling the needle-like geometry. While molecular dynamics (MD) simulations using machine-learned potential functions can achieve this atomic scale, they are inherently limited to nanosecond timescales and are therefore unsuitable for predicting the formation of the complex compositional nanostructures observed in APT.
[0032] Related technologies use Monte Carlo simulations to study the atomic-scale behavior of materials. Specifically, random sampling is used to explore the system's thermodynamic properties, such as energy, entropy, and free energy. This allows predictions of the material's structure and dynamic behavior under varying temperature and pressure conditions. However, Monte Carlo simulations rely on random memory access and are not suitable for vectorized operations within the Single Instruction Multiple Data (SIMD) computing model, limiting their application.
[0033] Because Monte Carlo simulations rely on constructing a Markov chain, in which each state (i.e., atomic configuration) depends only on the previous state, the system gradually reaches thermal equilibrium through a series of state transitions (also known as "moves" or "atom swaps"). Therefore, Monte Carlo simulations are inherently sequential, requiring the development of efficient parallel algorithms. Monte Carlo simulations are a type of computation that relies on random memory access. Scalable Monte Carlo methods introduce chain cell algorithms and the concept of local interaction regions for parallel computing. Related technologies can utilize CPUs and GPUs for parallel Scalable Monte Carlo simulations. This is because CPUs use the SIMT (Single Instruction Multiple Threads) mechanism to read data, allowing discontinuous scalar data to be assembled. However, some other chips, such as the Ascend chip NPU, support vectorized operations. The vector computing unit uses the SIMD (Single Instruction Multiple Data) mechanism, requiring data to be read and written in memory contiguously or fragment-contiguously. Since these chips do not support reading discontinuous data, Scalable Monte Carlo simulations are not suitable for these chips.
[0034] Based on this, the embodiment of the present application provides an atomic system simulation method, device, equipment and storage medium, which selects the atomic positions in the chain cell as the target positions in sequence and parallel in the simulation loop to ensure the orderliness of the atomic positions and avoid disordered random access. Secondly, a random integer array is generated and a random mask and a swap mask are constructed based on a preset number. The swap position is determined from the nearest position through masking technology, and the conditional judgment of the atomic exchange is converted into a batch screening of the vector mask, wherein the random integer array provides a predictable random source, and then the scattered swap operations are converted into continuous vector operations through the masking process to ensure continuous access to the data memory, so that the Monte Carlo simulation of atomic movement that originally relied on random memory access and conditional judgment can adapt to the characteristics of the vectorized operation unit, realize parallel processing of batch atoms, solve the rigid requirements of the vector operation unit for data continuity, transplant the Monte Carlo simulation into the vectorized operation framework, and expand its application range.
[0035] The embodiments of the present application provide an atomic system simulation method, apparatus, device and storage medium, which are specifically illustrated by the following embodiments. First, the atomic system simulation method in the embodiments of the present application is described.
[0036] The atomic system simulation method provided in the embodiment of the present application relates to the technical field of atomic system simulation. The atomic system simulation method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be a computer program running in a terminal or a server side. For example, a computer program can be a native program or software module in an operating system; it can be a local (Native) application (Application, APP), that is, a program that needs to be installed in the operating system to run, such as a client that supports atomic system simulation, that is, a program that can be run only by downloading it to a browser environment; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module or plug-in. Among them, the terminal communicates with the server through a network. The atomic system simulation method can be executed by the terminal or the server, or by the terminal and the server in collaboration.
[0037] In some embodiments, the terminal may be a smartphone, tablet computer, laptop computer, desktop computer, or smartwatch. The server may be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Alternatively, the server may be a service node in a blockchain system, where each service node in the blockchain system forms a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol that runs on top of the Transmission Control Protocol (TCP). The terminal and server may be connected via Bluetooth, a Universal Serial Bus (USB), or a network connection, but this embodiment does not impose any limitations thereto.
[0038] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0039] The atomic system simulation method in the embodiments of the present application is described below.
[0040] Figure 1 This is an optional flowchart of the atomic system simulation method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps 110 to 150. It is also understood that this embodiment is Figure 1 The order of steps 110 to 150 is not specifically limited, and the order of steps can be adjusted or some steps can be reduced or added according to actual needs.
[0041] Step 110: Obtain the chain cells corresponding to the initial configuration and the number of atoms contained in each chain cell.
[0042] In one embodiment, metal atoms are bonded by metallic bonds, i.e., the mutual attraction between metal ions that have lost their outer electrons and free electrons. The metallic bonds are non-saturated and non-directional, so that the atoms inside the metal are tightly arranged to form a densely packed structure with high symmetry. This structure is a crystal structure. Common crystal structures include face-centered cubic FCC, body-centered cubic BCC, or hexagonal close-packed HCP. The crystal structure contains at least one basic repeating unit cell, and the entire crystal can be constructed by translating the unit cell. Specifically, the unit cell is the smallest volume element in a three-dimensional space. It contains the position and arrangement information of all atoms, ions, or molecules that constitute the crystal structure, and the entire crystal structure can be generated by infinite repetition in three non-coplanar directions.
[0043] Alloy materials are usually composed of multiple types of atoms. Taking AlCoFeNiTi alloy as an example, an array "lattice" is used in computer memory to represent the arrangement order of atoms, with 1 representing Al, 2 representing Co, etc. For crystal structures such as face-centered cubic FCC and body-centered cubic BCC, the array that stores atoms is generally a four-dimensional array, such as lattice[np][nx][ny][nz], where nx, ny, and nz represent the number of atoms in the alloy cube in the x, y, and z dimensions respectively, and np represents the number of atoms in each unit cell. Its value is related to the crystal structure type. For example, the number of atoms in each unit cell in FCC is 4, and the number of atoms in each unit cell in BCC is 2.
[0044] A fundamental limitation of Monte Carlo simulations is the sequential nature of lattice site updates within a Markov chain. Each time a pair of atoms is moved, this slows down the simulation. Therefore, the Scalable Monte Carlo algorithm uses a chain cell algorithm to convert the serial Monte Carlo simulation process into a partially parallel one. This algorithm further divides the unit cell into multiple chain cells, and within each chain cell, atomic moves are attempted in parallel, thereby improving computational efficiency.
[0045] In the chain cell algorithm, all cells are divided into chain cells, each of which contains The size of the chain cell should be larger than the interaction range between atoms to ensure that the movement of atoms in one chain cell will not affect the energy calculation process of adjacent chain cells. A Monte Carlo scan refers to a Monte Carlo attempt to move each atom. After the chain cell decomposition, a Monte Carlo scan process is decomposed into sequential steps, each of which contains Parallel attempts to move, so the chain cell algorithm can increase the running speed of the original serial Monte Carlo algorithm times.
[0046] For example, for a The FCC atomic system has 300 atoms in the x, y, and z directions. Each unit cell of the FCC contains 4 atoms. Assuming that the length of each side of the chain cell is 4 lattice constants, it contains atoms. At this point, the entire atomic system is divided into chain cells, a Monte Carlo scan is decomposed into sequential steps, each of which contains Try moving in parallel.
[0047] Therefore, the initial crystal structure is referred to as the initial configuration in the present embodiment, and is described below using a two-dimensional square lattice as an example. Figure 2 , Figure 2It is a schematic diagram of the initial configuration provided in the embodiment of the present application. Figure 2 This is a two-dimensional schematic diagram of the BCC structure. In the figure, each atom (indicated by a black solid circle) is surrounded by a layer of nearest neighboring atoms (indicated by a dotted circle), and outside the nearest neighboring atoms there is a layer of potentially affected atoms (indicated by a thin solid circle).
[0048] In one embodiment, referring to Figure 3 , Figure 3 This is another schematic diagram of the initial configuration provided in the embodiment of the present application. Each square in the figure represents an atom, with a total of atoms, each atom is indexed by two and Indicates that, Represents the number of the chain cell, Represents the atom number within the chain cell. For example, 3,11 represents the 11th atom in the 3rd chain cell. After obtaining the initial configuration, the parallel Monte Carlo scan process begins.
[0049] Step 120: Perform simulation cycles based on the number of atoms. In each simulation cycle, select the atomic position corresponding to each chain cell as the target position in sequence, and obtain a preset number of nearest neighbor positions corresponding to each target position.
[0050] In one embodiment, for the sake of discussion, it is assumed that atoms only interact with their nearest neighbors, but the actual calculation may be farther away. Figure 3 For example, assuming that the length of each side of the chain cell is 5 lattice constants, that is, it contains atoms, so the entire initial configuration is divided into chain cells, correspondingly, a Monte Carlo scanning process will be decomposed into sequential steps, each of which contains Try moving in parallel.
[0051] In one embodiment, Figure 3 Each chain cell in In each successive step, each atom in the chain cell is traversed in turn in each step. In each step, 4 chain cells select 1 atomic position as the target position, for a total of 4 atomic positions. The atoms at these 4 atomic positions are all tried to move in parallel. In other words, one step traverses an atom in the chain cell, and the number of steps is the same as the number of atoms. Therefore, a step is set as a simulation cycle, and a Monte Carlo scan process needs to execute the same number of steps as the number of atoms. Second cycle.
[0052] In one embodiment, during each simulation cycle, the atomic positions corresponding to each chain cell are sequentially selected as target positions. This order can be set based on actual conditions, with the goal of not repeatedly traversing all atomic positions in the chain cell. It is understood that after the order is selected, each chain cell uses the same atomic position as the target position. For example, the first atomic position in the chain cell may be selected as the target position, the 13th atomic position in the chain cell may be selected as the target position, and so on.
[0053] The following embodiment takes one simulation cycle as an example to describe the specific execution process.
[0054] Reference Figure 3 , assuming that the current traversal is the 13th atomic position in the 4-cell chain, the target positions are (1,13), (2,13), (3,13), and (4,13) as shown in the figure. Since the movement of atoms in Monte Carlo only occurs at the nearest position, and after the initial configuration is determined, the nearest position of each atom's nearest neighbor is also known. For example Figure 3 In the 2D schematic of the BCC structure, each atom at a target position has four nearest neighbors (indicated by the dashed boxes). In 3D, each atom at an FCC position has 12 nearest neighbors, and each atom at a BCC position has 8 nearest neighbors. Therefore, a preset number of nearest neighbors can be obtained for each target position, depending on the actual situation.
[0055] Combine Figure 3 When exchanging, the atom at the target position will randomly select one of the nearest atoms to try to exchange. When two atoms try to exchange, it may affect the energy of other atoms, so Figure 3 The positions of the nearest neighboring positions are outlined with thin solid lines as the atomic positions whose energy may be affected. Here, the target position, the nearest neighboring positions, and the potentially affected atomic positions in each chain cell together constitute the local impact area.
[0056] In one embodiment, according to this exchange mechanism, it can be seen that in this case, the same Indexed but different The Monte Carlo updates of the indexed atoms are independent of each other. This obviously provides an opportunity for parallel processing. For example, consider the atomic position (1,13). During the Monte Carlo update process, the atomic position (1,13) can be swapped with any of its nearest neighbors (1,12), (1,14), (1,8) and (1,18). At the same time, for other atoms, such as atom ( ,13), can be compared with its nearest neighbor ( ,12),( ,14),( ,8) and ( ,18) any one of the exchanges.
[0057] It can be understood that if the above description is made using the initial configuration of a two-dimensional square lattice as an example, this process of selecting the same position of different chain cells as the target position, determining a known number of nearest positions of the target position, and then determining the positions of atoms that may be affected based on the nearest positions is also applicable to different situations such as three-dimensional FCC or BCC lattices.
[0058] Since Monte Carlo simulation is a type of calculation with random memory access, it is not suitable for operation on the vectorized operation unit of the single instruction multiple data flow calculation model. For example, during the atomic movement process, although the coordinates of the atoms at the target position are regular, the coordinates of the nearest atoms exchanged with them are random and irregular. When processed in the CPU or GPU, each atom at the target position randomly attempts to exchange with the nearest neighbor atom, and each CPU core or GPU thread executes the same exchange code and reads the atomic type data from different places in the memory. This operation is not difficult on the CPU or GPU. However, on a chip of the vectorized operation type, these nearest positions are randomly discontinuous in the memory and cannot be operated. The embodiment of the present application eliminates conditional judgment and random memory access based on atomic copies and vector mask processes, solves the difficulty that the data memory must be continuous when the vector operation unit performs calculations, and realizes Monte Carlo atomic movement based on vectorized operations.
[0059] The following describes this vector calculation process in detail.
[0060] Step 130: Obtain the continuous atomic positions at all target positions, and generate a random integer array based on the continuous atomic positions, perform an initial loop based on a preset number, generate a random mask corresponding to the random integer array in each initial loop, and determine the exchange position of each target position from the nearest position based on the random mask. After the initial loop is completed, an attempted exchange configuration is obtained.
[0061] In one embodiment, for a target position, the continuous atoms in the memory are obtained, and then a random integer array is generated based on the continuous atomic positions. The length of the random integer array is consistent with the length of the continuous atomic positions. In the two-dimensional diagram, the storage of each row is continuous, and in the three-dimensional diagram, it is continuous along the z-axis. The specific continuous method is not limited here, only the corresponding part of the continuous data needs to be read. Figure 2 For example, the row where the target position is located is read row by row, that is, the consecutive atoms including the atom at the target position in the 3rd and 8th rows are read. Since they are stored continuously by row, the number of consecutive atoms is 10, and the length of the obtained random integer data is 10.
[0062] In one embodiment, referring to Figure 4 , Figure 4 This is a flowchart of generating a random integer array based on continuous atomic positions provided by an embodiment of the present application, which specifically includes the following steps: Step 410: Randomly select a plurality of random numbers from integers within a preset quantity constraint range.
[0063] Step 420: Generate a random integer array consistent with the number of consecutive atomic positions according to the random number.
[0064] In one embodiment, a preset quantity constraint range [0, Ne-1] is generated according to the preset quantity Ne, and different integers in the preset quantity constraint range correspond to a nearest neighbor position. Figure 2 In the example, the preset number Ne = 4, so the preset number constraint range is [0, 3]. In this case, the integers 0, 1, 2, and 3 correspond to the four nearest neighbor positions on the left, right, top, and bottom, respectively. For example, 0 represents the nearest neighbor position on the left, 1 represents the nearest neighbor position on the right, 2 represents the nearest neighbor position on the top, and 3 represents the nearest neighbor position on the bottom. It should be understood that the correspondence here is only for illustration and does not constitute a limitation.
[0065] Next, the atom at each target position reads multiple floating-point numbers that are consistent with the number of elements in the random integer array according to the thread they are in. The floating-point numbers are between 0.0 and 1.0, and then the floating-point numbers are converted into integers within the preset number constraint range as the corresponding random numbers to obtain the corresponding random integer array.
[0066] by Figure 3 For example, to generate a random integer array for the third and eighth rows respectively, it can be:
[0067] Among them, the third and eighth columns correspond to the integers of the four target positions (1,13), (2,13), (3,13), and (4,13) respectively. The second and fourth columns are the nearest positions corresponding to the target position in the third column, and the seventh and ninth columns are the nearest positions corresponding to the target position in the eighth column.
[0068] Next, an initial loop is performed, where the number of iterations is a predetermined number. In one embodiment, the process of generating a random mask corresponding to the random integer array in each initial loop is as follows: obtaining the current loop number, and if the random number in the random integer array is consistent with the current loop number, changing the random number at the corresponding position to one, otherwise to zero, and generating the corresponding random mask.
[0069] For example, let's take the i-th initial loop, where i = 0 to Ne - 1. If the current loop count is i, and the random number in the random integer array matches the current loop count i, then the random number at the corresponding position is set to 1; otherwise, it is set to 0, generating the corresponding random mask.
[0070] by Figure 3 For example, Ne is 4, so 4 cycles need to be executed.
[0071] For example, when i=0, the random number in the random integer array is compared with i=0. If the random number is 0, the corresponding position is set to 1, otherwise it is 0. The resulting random mask is:
[0072] When i=1, the random number in the random integer array is compared with i=1. If the random number is 1, the corresponding position is set to 1, otherwise it is 0. The resulting random mask is:
[0073] When i=2, the random number in the random integer array is compared with i=2. If the random number is 2, the corresponding position is set to 1, otherwise it is 0. The resulting random mask is:
[0074] When i=3, the random number in the random integer array is compared with i=3. If the random number is 3, the corresponding position is set to 1, otherwise it is 0. The resulting random mask is:
[0075] In one embodiment, after having the corresponding random mask in the initial cycle, it is necessary to determine the exchange position according to the random mask. Figure 5 , Figure 5 This is a flowchart of determining the exchange position of each target position from the nearest neighbor position according to a random mask provided by an embodiment of the present application, which specifically includes the following steps: Step 510: Generate a position mask according to the target position, calculate the AND operation of the random mask and the position mask, and obtain a swap identifier array.
[0076] In one embodiment, since only atoms at the target position of the current step need to be exchanged, the target position needs to be identified during the vector calculation process, and a position mask can be generated based on the target position. Figure 3 , the target position is located in the third column of the row, so the position mask is expressed as:
[0077] In each initial cycle, the random mask and the position mask are subjected to an "&" operation to obtain the exchange identification data.
[0078] by Figure 3 For example, when i=0, the exchange identification data is:
[0079] When i=1, the exchange identification data is:
[0080] When i=2, the exchange identification data is:
[0081] When i=3, the exchange identification data is:
[0082] Step 520: Determine the chain cell corresponding to the target position according to the "1" identifier in the exchange identifier array, match the current loop number in the integer, and determine the exchange position from the nearest position according to the matching result.
[0083] In one embodiment, during each initial iteration, the swap identifier array determines which atoms at target positions need to be swapped, as well as the destination atoms for the swaps. Specifically, the "1" identifier in the swap identifier array determines the chain cell corresponding to the target position. The current iteration count is matched against an integer within a preset constraint. Based on the matching result, the swap position is determined from the nearest neighbor.
[0084] For example, refer to Figure 3 When i=0, "1" is located in the second row and third column, so the target position to be exchanged is in the lower left corner of the chain cell, and at this time i=0, the position corresponding to the integer 0 is the nearest neighbor position on the left, so the atom at the target position (3,13) of the lower left corner of the chain cell needs to try to exchange with the atom at the nearest neighbor position (3,12) on the left.
[0085] Similarly, when i=1, there is no "1", so no exchange is attempted at each target position. When i=2, "1" is located in the first row, eighth column, so the target position to be exchanged is in the upper right corner of the chain cell. At this time, i=2, the position corresponding to the integer 2 is the nearest neighbor position above. Therefore, the atom at the target position (2,13) of the upper right corner chain cell needs to be exchanged with the atom at the nearest neighbor position (2,8) above. When i=3, "1" is located in the first row, third column and the second row, eighth column, so the target positions to be exchanged are in the upper left and lower right corner chain cells. At this time, i=3, the position corresponding to the integer 3 is the nearest neighbor position below. Therefore, the atom at the target position (1,13) of the upper left corner chain cell needs to be exchanged with the atom at the nearest neighbor position (1,18) below. At the same time, the atom at the target position (4,13) of the lower right corner chain cell needs to be exchanged with the atom at the nearest neighbor position (4,18) below.
[0086] After executing a preset number of initial cycles, the initial configuration is transformed into the trial exchange configuration. Figure 6 , Figure 6 It is a schematic diagram of an attempted exchange configuration provided in an embodiment of the present application. Figure 6 In the process, after four initial cycles, the four target positions are exchanged according to the exchange identification array. At this time, the target position of the upper left corner chain cell is exchanged with the nearest neighbor position below, the target position of the upper right corner chain cell is exchanged with the nearest neighbor position above, the target position of the lower left corner chain cell is exchanged with the nearest neighbor position on the left, and the target position of the lower right corner chain cell is exchanged with the nearest neighbor position below.
[0087] Step 140: Perform selection loops based on a preset number, generate a swap mask corresponding to the random integer array in each selection loop, and generate a swap configuration based on the swap mask, the attempted swap configuration, and the initial configuration. In the next selection loop, use the swap configuration as the initial configuration until the final swap configuration is obtained.
[0088] In one embodiment, attempting a swap means first swapping, then calculating whether the energy difference before and after meets the swap conditions. If so, the swap is performed; otherwise, the swap is not performed. Therefore, it is necessary to determine whether to retain the swap result and proceed to the next selection cycle based on a preset number of cycles, which is also a preset number.
[0089] In one embodiment, referring to Figure 7 , Figure 7 This is a flowchart of generating a swap mask corresponding to a random integer array in each selection cycle provided by an embodiment of the present application, specifically including the following steps: Step 710: Calculate the exchange probability corresponding to each position in the random integer array after the atoms at the target position and the exchange position are exchanged, and determine an identifier based on the exchange probability. If the exchange probability indicates that an exchange is required, the identifier is one, otherwise it is zero.
[0090] In one embodiment, the exchange probability is calculated according to the Metropolis-Hastings algorithm to obtain the old energy corresponding to each element position in the random integer array before and after the exchange. and new energy The energy here can be the system Hamiltonian or other energy, where the system Hamiltonian includes the interaction potential energy between atoms (such as Lennard-Jones potential, Coulomb potential, etc.) and kinetic energy terms. Then calculate the energy difference between the two , the exchange probability P is determined according to the energy difference, which is expressed as:
[0091] in, , is the Boltzmann constant, It's the temperature.
[0092] In one embodiment, the identifier is determined according to the exchange probability. If the exchange probability indicates that an exchange is required, the identifier is 1, otherwise it is 0. In this case, if the exchange probability is 1, it indicates that an exchange is required, and the obtained identifier is 1.
[0093] Step 720: Generate an identifier mask consistent with the random integer array according to the identifier, generate a position mask according to the target position, calculate the AND operation of the identifier mask and the position mask, and obtain a swap mask.
[0094] In one embodiment, the identifiers corresponding to each element position are combined to obtain an identifier mask, in which element 1 indicates that an exchange is required, and element 0 indicates that an exchange is not required. Figure 3 For example, suppose that after the exchange probability calculation, the identifier mask obtained is:
[0095] Since only atoms at the target position need to be swapped, the identifier mask and the position mask need to be ANDed together to obtain the swap mask. In the above example, the swap mask is expressed as:
[0096] Among them, the atoms at the target position corresponding to element 1 in the exchange mask need to be exchanged, and the atoms at the target position corresponding to element 0 do not need to be exchanged.
[0097] Therefore, in each selection cycle, the process of generating an exchange configuration based on the exchange mask, the trial exchange configuration and the initial configuration specifically includes: performing an AND operation based on the exchange mask and the random mask, obtaining the element value of the target position in the operation result, and if the element value is 1, using the chain cell in the trial exchange configuration to replace the chain cell in the corresponding position in the initial configuration.
[0098] In one embodiment, Figure 3 For example, when i=0, the result of the AND operation based on the swap mask and the random mask is:
[0099] When i=1, the result of the AND operation based on the swap mask and the random mask is:
[0100] When i=2, the result of the AND operation based on the swap mask and the random mask is:
[0101] When i=3, the result of the AND operation based on the swap mask and the random mask is:
[0102] From this, we can see that in the selection cycles corresponding to i=0 and i=1, since the element values at the target positions are both 0, the chain cells at the corresponding positions in the initial configuration are retained. In the selection cycle corresponding to i=2, the element value at the target position of the upper right corner chain cell is 1, so the upper right corner chain cell in the attempted exchange configuration is used to replace the upper right corner chain cell in the initial configuration. In the selection cycle corresponding to i=3, the element value at the target position of the upper left corner chain cell is 1, so the upper left corner chain cell in the attempted exchange configuration is used to replace the upper left corner chain cell in the initial configuration.
[0103] In one embodiment, in the selection cycle after the first one, in the next selection cycle, the exchange configuration is used as the initial configuration for iteration, and after the selection cycle is completed, the final exchange configuration can be obtained. Figure 8 , Figure 8 This is a schematic diagram of generating the exchange configuration provided in an embodiment of the present application. Figure 8 The initial configuration, the attempted exchange configuration, and the corresponding operation results in the four selection cycles are illustrated in the figure. It can be seen that in the final exchange configuration, only the two chain cells in the upper left corner and the upper right corner need to perform the exchange operation. Among them, the target position of the chain cell in the upper left corner is exchanged with the nearest neighbor position below it, and the target position of the chain cell in the upper right corner is exchanged with the nearest neighbor position above it.
[0104] Step 150: In the next simulation cycle, the exchange configuration is used as the initial configuration until the simulation cycle ends.
[0105] In one embodiment, following the above process, one step of the Monte Carlo scan is completed. Next, the remaining atomic positions in the chain cell are traversed, each serving as a target position, and the above simulation cycle is repeated until the traversal is complete. In the next simulation cycle, the exchange configuration obtained in the previous simulation cycle is used as the initial configuration until the simulation cycle ends. This ensures that the exchange process is continuous.
[0106] In one embodiment, if the multiple nearest neighbor positions corresponding to the target position are incomplete, for example, when the first atomic position is selected as the target position, only two nearest neighbor positions corresponding to it in the chain cell can be selected, and then atomic virtual layer processing is required. The atomic virtual layer is used to process atomic exchanges on loop boundaries, where the loop boundaries can be defined as boundaries in the configuration. For chips such as CPUs and GPUs, there is no need to set an atomic virtual layer, because they can judge on the boundary whether the other atom exchanged with the atom at the target position is located on the opposite side of the block, and read data from the discontinuous opposite side. However, the vectorized operation unit in the embodiment of the present application cannot realize this conditional judgment, so the atomic virtual layer is introduced, and the update operation of the virtual layer is completed after each atomic exchange to ensure the continuity of the data used for the calculation.
[0107] In one embodiment, when obtaining a preset number of nearest neighbor positions corresponding to each target position, if the target position is located in the boundary range of the chain cell, the next position range corresponding to each boundary of the chain cell is obtained according to the cycle information, and the next position range is spliced on the outer circle of the boundary range to form an atomic virtual layer, and at least one of the nearest neighbor positions is located in the atomic virtual layer.
[0108] In one embodiment, referring to Figure 9 , Figure 9Schematic diagram of the boundary provided for the embodiment of the present application. Among them, the boundary is illustrated with a thick line, and it can be seen that each chain cell has at least one edge located on the boundary. At this time, if the target positions are (1,15), (2,15), (3,15), and (4,15), then the two target positions (2,15) and (4,15) are located on the boundary, and at least one of their corresponding nearest neighbor positions is discontinuous. At this time, taking into account the cyclic information of the configuration, the atom to the right of (2,15) should be (1,11), so the column where (1,11) is located is used as the next position range, and the next position range is spliced to the outer circle of the boundary corresponding to (2,15). Similarly, the outer circle of the column where (1,11) is located is spliced to the column corresponding to (2,15). According to the same splicing method, the outer circle of the boundary where (3,21) is located can also be spliced with the row where the corresponding next position range (1,1) is located, and the outer circle of the boundary where (1,1) is located can also be spliced with the row where the corresponding next position range (3,21) is located. Finally, the entire initial configuration is surrounded, and when each position in the chain cell is used as the target position, a complete and continuous preset number of nearest neighbor positions can be obtained.
[0109] In one embodiment, after each atom swap, the atoms on the boundary are copied to the opposite side, forming a surrounding virtual layer of atoms. In three-dimensional cases, this layer wraps around the atoms, ensuring data continuity during computation. All atoms read data uniformly and continuously, regardless of whether their nearest neighbors are on the opposite side, and perform subsequent vectorized operations.
[0110] In one embodiment, single-card performance was tested on an Ascend 910B. The energy model used for energy calculation was qSRO. The alloy used for simulation was FeCoNiAlTi, with 1 billion atoms. Throughput represents the number of atoms that can complete one Monte Carlo step per second. The test results are as follows:
[0111] Performance testing of the atomic system simulation method proposed in this embodiment on the Ascend 910B chip demonstrates that an average of one Monte Carlo step can be completed per second for 7.75 million atoms, enabling parallel computation of the Monte Carlo scan process on chips with vector computing units. The method is applicable to a variety of lattice types and chain cell sizes. The aforementioned lattice structure types and chain cell sizes are for illustrative purposes only and do not limit application scenarios.
[0112] The embodiment of the present application eliminates conditional judgment and random memory access based on atomic copy and vector mask process, solves the difficulty that data memory must be continuous when the vector operation unit performs calculations, and realizes Monte Carlo atomic movement based on vectorized operations.
[0113] The technical solution provided by the embodiment of the present application obtains the chain cells corresponding to the initial configuration and the number of atoms contained in each chain cell, performs a simulation loop based on the number of atoms, selects the atomic position corresponding to each chain cell in sequence as the target position in each simulation loop, obtains a preset number of nearest positions corresponding to each target position, obtains the continuous atomic positions on all target positions, and generates a random integer array based on the continuous atomic positions, performs an initial loop based on the preset number, generates a random mask corresponding to the random integer array in each initial loop, and determines the exchange position of each target position from the nearest positions based on the random mask, after the initial loop ends, obtains an attempted exchange configuration, performs a selection loop based on the preset number, generates an exchange mask corresponding to the random integer array in each selection loop, and generates an exchange configuration based on the exchange mask, the attempted exchange configuration and the initial configuration, uses the exchange configuration as the initial configuration in the next selection loop until the final exchange configuration is obtained, and uses the exchange configuration as the initial configuration in the next simulation loop until the simulation loop ends. Since Monte Carlo simulation relies on random access to memory, random access will lead to a large number of conditional judgments and discrete data reading, which greatly reduces the computing efficiency. Therefore, in the embodiment of the present application, the atomic positions in the chain cell are selected in sequence and parallel as the target positions in the simulation loop to ensure the orderliness of the atomic positions and avoid disordered random access. Secondly, a random integer array is generated and a random mask and a swap mask are constructed based on a preset number. The swap position is determined from the nearest position through masking technology, and the conditional judgment of the atomic swap is converted into a batch screening of a vector mask. Among them, the random integer array provides a predictable random source, and then the scattered swap operations are converted into continuous vector operations through the masking process to ensure continuous access to data memory. This allows the Monte Carlo simulation atomic movement that originally relied on random memory access and conditional judgment to adapt to the characteristics of the vectorized operation unit, realize parallel processing of batch atoms, solve the rigid requirements of the vectorized operation unit for data continuity, transplant the Monte Carlo simulation into the vectorized operation framework, and expand its application range.
[0114] The present application also provides an atomic system simulation device that can implement the above atomic system simulation method. Figure 10 , the device comprises: The initial parameter acquisition module 1010 is used to obtain the chain cells corresponding to the initial configuration and the number of atoms contained in each chain cell.
[0115] The target position selection module 1020 is used to perform simulation cycles based on the number of atoms. In each simulation cycle, the atomic position corresponding to each chain cell is sequentially selected as the target position, and a preset number of nearest neighbor positions corresponding to each target position are obtained.
[0116] Initial loop module 1030: used to obtain the continuous atomic positions at all target positions, generate a random integer array based on the continuous atomic positions, perform an initial loop based on a preset number, generate a random mask corresponding to the random integer array in each initial loop, and determine the exchange position of each target position from the nearest position based on the random mask. After the initial loop is completed, an attempted exchange configuration is obtained.
[0117] Selection loop module 1040: used to perform selection loops based on a preset number, generate a swap mask corresponding to the random integer array in each selection loop, and generate a swap configuration based on the swap mask, the attempted swap configuration and the initial configuration. In the next selection loop, the swap configuration is used as the initial configuration until the final swap configuration is obtained.
[0118] Iteration termination module 1050: used to use the exchange configuration as the initial configuration in the next simulation cycle until the simulation cycle ends.
[0119] The specific implementation of the atomic system simulation device of this embodiment is basically the same as the specific implementation of the above-mentioned atomic system simulation method, and will not be repeated here.
[0120] An embodiment of the present application further provides an electronic device, including: at least one memory; at least one processor; at least one program; The program is stored in the memory, and the processor executes the at least one program to implement the atomic system simulation method described above. The electronic device can be any smart terminal including a mobile phone, tablet computer, personal digital assistant (PDA), car computer, etc.
[0121] See also Figure 11 , Figure 11 The hardware structure of an electronic device according to another embodiment is shown. The electronic device includes: The processor 1101 may be implemented as a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is configured to execute relevant programs to implement the technical solutions provided in the embodiments of the present application. The memory 1102 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1102 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1102 and is called by the processor 1101 to execute the atomic system simulation method of the embodiments of this application. Input / output interface 1103, used to implement information input and output; Communication interface 1104, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.); Bus 1105 , which transmits information between various components of the device (e.g., processor 1101 , memory 1102 , input / output interface 1103 , and communication interface 1104 ); The processor 1101 , the memory 1102 , the input / output interface 1103 and the communication interface 1104 are connected to each other in communication within the device via a bus 1105 .
[0122] An embodiment of the present application also provides a storage medium, which is a storage medium that stores a computer program. When the computer program is executed by a processor, the above-mentioned atomic system simulation method is implemented.
[0123] The memory, as a non-transient storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0124] The atomic system simulation method, apparatus, device and storage medium proposed in the embodiments of the present application obtain the chain cells corresponding to the initial configuration and the number of atoms contained in each chain cell, and perform a simulation cycle based on the number of atoms. In each simulation cycle, the atomic position corresponding to each chain cell is selected in sequence as the target position, and a preset number of nearest positions corresponding to each target position are obtained. The continuous atomic positions on all target positions are obtained, and a random integer array is generated based on the continuous atomic positions. The initial cycle is performed based on the preset number. A random mask corresponding to the random integer array is generated in each initial cycle, and the exchange position of each target position is determined from the nearest positions based on the random mask. After the initial cycle, an attempted exchange configuration is obtained, and a selection cycle is performed based on the preset number. An exchange mask corresponding to the random integer array is generated in each selection cycle, and an exchange configuration is generated based on the exchange mask, the attempted exchange configuration and the initial configuration. In the next selection cycle, the exchange configuration is used as the initial configuration until the final exchange configuration is obtained. In the next simulation cycle, the exchange configuration is used as the initial configuration until the simulation cycle ends. Since Monte Carlo simulation relies on random access to memory, random access will lead to a large number of conditional judgments and discrete data reading, which greatly reduces the computing efficiency. Therefore, in the embodiment of the present application, the atomic positions in the chain cell are selected in sequence and parallel as the target positions in the simulation loop to ensure the orderliness of the atomic positions and avoid disordered random access. Secondly, a random integer array is generated and a random mask and a swap mask are constructed based on a preset number. The swap position is determined from the nearest position through masking technology, and the conditional judgment of the atomic swap is converted into a batch screening of a vector mask. Among them, the random integer array provides a predictable random source, and then the scattered swap operations are converted into continuous vector operations through the masking process to ensure continuous access to data memory. This allows the Monte Carlo simulation atomic movement that originally relied on random memory access and conditional judgment to adapt to the characteristics of the vectorized operation unit, realize parallel processing of batch atoms, solve the rigid requirements of the vectorized operation unit for data continuity, transplant the Monte Carlo simulation into the vectorized operation framework, and expand its application range.
[0125] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0126] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0127] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0128] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0129] The terms "first," "second," "third," "fourth," and the like (if any) in the specification of the present application and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in orders other than those illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or apparatus.
[0130] It should be understood that in this application, "at least one (item)" means one or more, and "more" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or plural.
[0131] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0132] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0133] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0134] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store programs.
[0135] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. A method for simulating an atomic system, characterized in that: include: Obtaining the chain cells corresponding to the initial configuration and the number of atoms contained in each chain cell; Performing a simulation cycle based on the number of atoms, and in each simulation cycle, sequentially selecting the atomic position corresponding to each of the chain cells as a target position, and obtaining a preset number of nearest neighbor positions corresponding to each of the target positions; Obtaining continuous atomic positions at all target positions, generating a random integer array based on the continuous atomic positions, performing an initial loop based on the preset number, generating a random mask corresponding to the random integer array in each initial loop, and determining an exchange position for each target position from the nearest positions based on the random mask, and obtaining an attempted exchange configuration after the initial loop ends; Performing a selection cycle based on the preset number, generating a swap mask corresponding to the random integer array in each selection cycle, and generating a swap configuration based on the swap mask, the attempted swap configuration, and the initial configuration, and using the swap configuration as the initial configuration in the next selection cycle until a final swap configuration is obtained; In the next simulation cycle, the exchange configuration is used as the initial configuration until the simulation cycle ends.
2. The atomic system simulation method according to claim 1, characterized in that: Generating a random integer array according to the continuous atomic positions includes: Randomly selecting a plurality of random numbers from integers within the preset quantity constraint range, wherein different integers correspond to one of the nearest neighboring positions respectively; The random integer array consistent with the number of the consecutive atomic positions is generated according to the random number.
3. The atomic system simulation method according to claim 2, characterized in that: Generating a random mask corresponding to the random integer array in each initial cycle includes: The current loop number is obtained. If the random number in the random integer array is consistent with the current loop number, the random number at the corresponding position is changed to one, otherwise it is zero, and the corresponding random mask is generated.
4. The atomic system simulation method according to claim 3, characterized in that: Determining the exchange position of each of the target positions from the nearest positions according to the random mask includes: Generate a position mask according to the target position, calculate the AND operation of the random mask and the position mask, and obtain a swap identifier array; The chain cell corresponding to the target position is determined according to the "-" identifier in the exchange identifier array, the current cycle number is matched in the integer, and the exchange position is determined from the nearest position according to the matching result.
5. The atomic system simulation method according to claim 1, characterized in that: Generating a swap mask corresponding to the random integer array in each selection cycle includes: Calculating an exchange probability corresponding to each position in the random integer array after the atoms at the target position and the exchange position are exchanged, and determining an identifier based on the exchange probability, wherein if the exchange probability indicates that an exchange is required, the identifier is one, otherwise it is zero; An identifier mask consistent with the random integer array is generated according to the identifier, a position mask is generated according to the target position, and an AND operation of the identifier mask and the position mask is calculated to obtain the exchange mask.
6. The atomic system simulation method according to claim 5, characterized in that: Generating a swap configuration according to the swap mask, the attempted swap configuration, and the initial configuration comprises: An AND operation is performed according to the exchange mask and the random mask to obtain the element value of the target position in the operation result. If the element value is one, the chain cell in the attempted exchange configuration is used to replace the chain cell at the corresponding position in the initial configuration.
7. The atomic system simulation method according to claim 1, characterized in that: The obtaining of a preset number of nearest neighboring positions corresponding to each target position further includes: If the target position is located in the boundary range of the chain cell, the next position range corresponding to each boundary of the chain cell is obtained according to the cycle information, and the next position range is spliced to the outer circle of the boundary range to form an atomic virtual layer, and at least one of the nearest positions is located in the atomic virtual layer.
8. An atomic system simulation device, characterized in that: include: Initial parameter acquisition module: used to obtain the chain cells corresponding to the initial configuration and the number of atoms contained in each chain cell; A target position selection module is configured to perform simulation cycles based on the number of atoms, and in each simulation cycle, sequentially select the atomic position corresponding to each of the chain cells as the target position, and obtain a preset number of nearest neighbor positions corresponding to each of the target positions; A primary cycle module is configured to obtain the continuous atomic positions of all the target positions, generate a random integer array based on the continuous atomic positions, perform a primary cycle based on the preset number, generate a random mask corresponding to the random integer array in each primary cycle, and determine the exchange position of each target position from the nearest position based on the random mask, and obtain an attempted exchange configuration after the primary cycle is completed; A selection loop module is configured to perform a selection loop based on the preset number, generate a swap mask corresponding to the random integer array in each selection loop, and generate a swap configuration based on the swap mask, the attempted swap configuration, and the initial configuration, and use the swap configuration as the initial configuration in the next selection loop until a final swap configuration is obtained; Iteration termination module: used for taking the exchange configuration as the initial configuration in the next simulation cycle until the simulation cycle ends.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the atomic system simulation method according to any one of claims 1 to 7 when executing the computer program.
10. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the atomic system simulation method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method for rapidly representing number and size distribution of nuclear material point defect clusters
CN114764536A
Preparation method and application of taste-masking capsule skin based on molecular simulation
CN117153275A
Model construction and parameter optimization method and device of magnetic system and storage medium
CN118737341A
Base editor predictive algorithm and method of use
WO2021158995A1