Atomic system simulation method, apparatus, device, and storage medium

By sequentially and in parallel selecting the atomic positions of the chain cell in Monte Carlo simulation, generating random integer arrays and masks, the problem of Monte Carlo simulation on vectorized computational units is solved, realizing the technical effectiveness of vectorization and expanding the application scope of Monte Carlo simulation.

CN120748522BActive Publication Date: 2025-11-18PENG CHENG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511219612.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-28
Publication Date
2025-11-18
Estimated Expiration
2045-08-28

AI Technical Summary

Technical Problem

Monte Carlo simulation is not suitable for operation on vectorized operation units in single-instruction multiple-data computation models, which limits its application scope.

Method used

By sequentially and in parallel selecting atomic positions in the chain cell during the simulation loop, a random integer array and mask are generated to ensure the orderliness of the atomic positions. The atomic exchange condition judgment is transformed into a batch filtering of vector masks, thereby realizing vectorized operation.

Benefits of technology

By adapting Monte Carlo simulation to vectorized computation units, its application scope is expanded, enabling parallel processing of batches of atoms and improving computational efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120748522B_ABST
    Figure CN120748522B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an atomic system simulation method, device, equipment and storage medium, and relate to the technical field of atomic system simulation. A simulation cycle is performed based on the number of chain cells, a target position is selected and a preset number of nearest neighbor positions are obtained during the cycle, a random integer array is generated according to the continuous atomic positions on the target position, a first cycle is performed based on the preset number, a random mask corresponding to the random integer array is generated in the first cycle, the exchange position of each target position is determined according to the random mask, and an attempted exchange configuration is obtained after the first cycle ends. A selection cycle is performed based on the preset number, an exchange mask is generated in the selection cycle, and the exchange configuration is updated according to the exchange mask, the attempted exchange configuration and an initial configuration. The exchange configuration is taken as the initial configuration in the next simulation cycle until the simulation cycle ends. The scattered exchange operation is converted into continuous vector operation through the mask process, so that the Monte Carlo simulation is suitable for the vector operation framework.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of atomic system simulation technology, and in particular to atomic system simulation methods, apparatus, devices and storage media. Background Technology

[0002] The physical properties of bulk materials are determined by their multi-scale structure, which originates from the arrangement of the atoms that make up the material. Microscopic techniques can experimentally determine the types and locations of atoms; however, these experiments involve time-consuming and labor-intensive processes such as sample synthesis, specimen preparation, measurement, and three-dimensional reconstruction. Atomic-level computational simulations can rapidly generate compositional distribution maps, more quickly establish the relationship between structure and properties, and accelerate the materials design cycle.

[0003] Monte Carlo simulations are used in related technologies to study atomic-scale behavior in materials. Specifically, they explore the thermodynamic properties of a system, such as energy, entropy, and free energy, through random sampling, and can predict the structural and dynamic behavior of materials under different temperature and pressure conditions. However, Monte Carlo simulations are a type of computation that relies on random access to memory, making them unsuitable for computation on the vectorized operational units of single-instruction multiple-data (SMD) computational models, thus limiting their application scope. Summary of the Invention

[0004] The main objective of this application is to propose methods, apparatus, devices, and storage media for simulating atomic systems, enabling Monte Carlo atom movement simulation based on vectorized operations, and expanding the applicability of Monte Carlo simulation in the field of atomic structure analysis.

[0005] To achieve the above objectives, a first aspect of this application proposes an atomic system simulation method, comprising:

[0006] Obtain the chain cell corresponding to the initial configuration and the number of atoms contained in each chain cell;

[0007] Based on the number of atoms, a simulation cycle is performed. In each simulation cycle, the atomic position corresponding to each chain cell is selected as the target position in sequence, and a preset number of nearest neighbor positions are obtained for each target position.

[0008] Obtain the continuous atomic positions of all the target positions, and generate a random integer array based on the continuous atomic positions. Perform an initial loop based on the preset number. In each initial loop, generate a random mask corresponding to the random integer array, and determine the swap position of each target position from the nearest neighbor position based on the random mask. After the initial loop ends, obtain the attempted swap configuration.

[0009] generating, in each selection cycle, an exchange mask corresponding to the random integer array, and generating an exchange configuration according to the exchange mask, the attempted exchange configuration and the initial configuration, taking the exchange configuration as the initial configuration in the next selection cycle, until a final exchange configuration is obtained;

[0010] taking the exchange configuration as the initial configuration in the next simulation cycle, until the simulation cycle ends.

[0011] In some embodiments, the generating a random integer array according to the continuous atomic positions comprises:

[0012] randomly selecting a plurality of random numbers from integers in a preset number constraint range, different integers corresponding to one of the nearest neighbor positions;

[0013] generating the random integer array consistent with the number of continuous atomic positions according to the random numbers.

[0014] In some embodiments, the generating, in each selection cycle, an exchange mask corresponding to the random integer array comprises:

[0015] obtaining a current cycle number, if the random number in the random integer array is consistent with the current cycle number, setting the random number in the corresponding position to one, otherwise to zero, and generating the corresponding random mask.

[0016] In some embodiments, the determining an exchange position of each target position from the nearest neighbor positions according to the random mask comprises:

[0017] generating a position mask according to the target position, calculating an AND operation of the random mask and the position mask to obtain an exchange identifier array;

[0018] determining the chain cell corresponding to the target position according to a "one" identifier in the exchange identifier array, matching the current cycle number in the integer, and determining the exchange position from the nearest neighbor positions according to the matching result.

[0019] In some embodiments, the generating, in each selection cycle, an exchange mask corresponding to the random integer array comprises:

[0020] calculating an exchange probability of each position in the random integer array after the atoms of the target position and the exchange position are exchanged, and determining an identifier according to the exchange probability, if the exchange probability indicates that exchange is needed, the identifier is one, otherwise it is zero;

[0021] generating an identifier mask consistent with the random integer array according to the identifier, generating a position mask according to the target position, and calculating an AND operation of the identifier mask and the position mask to obtain the exchange mask.

[0022] In some embodiments, the generating the exchange configuration according to the exchange mask, the attempt exchange configuration and the initial configuration comprises:

[0023] performing an AND operation according to the exchange mask and the random mask to obtain an element value of the target position in an operation result, and replacing the chain cell at the corresponding position in the initial configuration with the chain cell in the attempt exchange configuration if the element value is one.

[0024] In some embodiments, the obtaining the preset number of nearest neighbor positions corresponding to each target position further comprises:

[0025] If the target position is located in a boundary range of the chain cell, obtaining a next position range corresponding to each boundary of the chain cell according to cycle information, splicing the next position range outside 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.

[0026] To achieve the above object, a second aspect of the embodiment of the present application proposes an atomic system simulation device, comprising:

[0027] An initial parameter obtaining module is configured to obtain chain cells corresponding to an initial configuration and the number of atoms contained in each chain cell.

[0028] A target position selecting module is configured to perform simulation cycles based on the number of atoms, and in each simulation cycle, sequentially select an atomic position corresponding to each chain cell as a target position, and obtain a preset number of nearest neighbor positions corresponding to each target position.

[0029] A primary cycle module is configured to obtain continuous atomic positions on all target positions, and generate a random integer array according to 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 an exchange position of each target position from the nearest neighbor positions according to the random mask, and obtain an attempt exchange configuration after the primary cycle ends.

[0030] A selection cycle module is configured to perform a selection cycle based on the preset number, generate an exchange mask corresponding to the random integer array in each selection cycle, and generate an exchange configuration according to the exchange mask, the attempt exchange configuration and the initial configuration, and in the next selection cycle, the exchange configuration is used as the initial configuration until a final exchange configuration is obtained.

[0031] Iteration termination module: for the next simulation cycle, the exchange configuration is used as the initial configuration until the end of the simulation cycle.

[0032] To achieve the above object, a third aspect of embodiments of the present application provides an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor executes the computer program to implement the method of the first aspect.

[0033] To achieve the above object, a fourth aspect of embodiments of the present application provides a storage medium, which is a storage medium, the storage medium stores a computer program, and the computer program is executed by a processor to implement the method of the first aspect.

[0034] The atomic system simulation method, device, equipment and storage medium provided by the embodiments of the present application obtain the chain cell corresponding to the initial configuration and the number of atoms contained in each chain cell, perform simulation cycles based on the number of atoms, in each simulation cycle, sequentially select the atomic position corresponding to each chain cell as a target position, obtain a preset number of nearest neighbor positions corresponding to each target position, obtain continuous atomic positions on all target positions, and generate a random integer array according to the continuous atomic positions, perform a primary cycle based on the preset number, in each primary cycle, generate a random mask corresponding to the random integer array, and determine the exchange position of each target position from the nearest neighbor positions according to the random mask, after the primary cycle ends, obtain a trial exchange configuration, perform a selection cycle based on the preset number, in each selection cycle, generate an exchange mask corresponding to the random integer array, and generate an exchange configuration according to the exchange mask, the trial exchange configuration and the initial configuration, in the next selection cycle, take the exchange configuration as the initial configuration until the final exchange configuration is obtained, and in the next simulation cycle, take the exchange configuration as the initial configuration until the simulation cycle ends. Since Monte Carlo simulation relies on random access of memory, random access can cause a large number of conditional judgments and discrete data reading, greatly reducing the operation efficiency, therefore, in the simulation cycle, the embodiments of the present application sequentially and in parallel select the atomic position in the chain cell as the target position, ensuring the order of the atomic position and avoiding unordered random access. Secondly, the random integer array is generated and the random mask and the exchange mask are constructed based on the preset number, the exchange position is determined from the nearest neighbor position through the mask technology, and the conditional judgment of atomic exchange is converted into batch screening of the vector mask, wherein the random integer array provides a predictable random source, and the dispersed exchange operation is converted into continuous vector operation through the mask process, ensuring continuous access of data memory, so that the Monte Carlo simulation atomic movement originally relying on random memory access and conditional judgment can adapt to the characteristics of the vector operation unit, realize parallel processing of batch atoms, solve the hard requirement of the vector operation unit for data continuity, transplant the Monte Carlo simulation into the vector operation framework, and expand the application range. BRIEF DESCRIPTION OF DRAWINGS

[0035] Figure 1 is a flowchart of the atomic system simulation method provided by the embodiments of the present application.

[0036] Figure 2 is a schematic diagram of the initial configuration provided by the embodiments of the present application.

[0037] Figure 3 is another schematic diagram of the initial configuration provided by the embodiments of the present application.

[0038] Figure 4 is a flowchart of generating a random integer array according to continuous atomic positions provided by the embodiments of the present application.

[0039] Figure 5 is a flowchart provided by an embodiment of the present application for determining the exchange position of each target position from the nearest neighbor position according to the random mask.

[0040] Figure 6 is a schematic diagram of an attempt exchange configuration provided by an embodiment of the present application.

[0041] Figure 7 is a flowchart provided by an embodiment of the present application for generating an exchange mask corresponding to an array of random integers in each selection cycle.

[0042] Figure 8 is a schematic diagram of an exchange configuration provided by an embodiment of the present application.

[0043] Figure 9 is a schematic diagram of a boundary provided by an embodiment of the present application.

[0044] Figure 10 is a structural block diagram of an atomic system simulation device provided by another embodiment of the present application.

[0045] Figure 11 is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.

[0047] It should be noted that although the functional modules are divided in the device schematic diagram, and the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from the module division in the device or the order in the flowchart.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0049] The physical properties of bulk materials are determined by their multiscale structure, which originates from the atomic arrangement of the constituent materials. The identity and location of atoms can be determined experimentally by microscopic techniques. For example, atom probe tomography (APT) directly provides three-dimensional compositional information on a single-atom scale, characterizing nanoscale defects such as short-range order, nanoscale precipitates, and grain boundaries. However, the experimental approach involves processes such as sample synthesis, specimen preparation, measurement, and three-dimensional reconstruction, which are time-consuming and labor-intensive. In contrast, using atomistic calculations simulations can quickly generate composition maps, thereby more rapidly establishing the relationship between structure and properties and accelerating the materials design cycle.

[0050] However, using atomistic simulations to predict the composition distribution of APT samples (typically containing tens to hundreds of millions of atoms) faces a huge computational challenge. First, since APT samples are needle-shaped samples extracted from bulk materials, the simulation must start from a significantly larger supercell (possibly up to a billion atoms) to accurately represent the bulk environment before modeling the needle-shaped geometry. Although molecular dynamics (MD) simulations using machine-learned potential functions can reach such atomic scales, they are inherently limited to the nanosecond time scale and thus are not suitable for predicting the formation of complex composition nanoscale structures observed in APT.

[0051] In related art, Monte Carlo simulations are used to study atomic-scale behavior in materials, specifically by randomly sampling to explore the thermodynamic properties of a system, such as energy, entropy, free energy, etc., to predict the structural and dynamic behavior of materials under different temperature and pressure conditions. However, Monte Carlo simulation is a memory random access type of calculation, which is not suitable for operation on a vectorized operation unit of a single instruction multiple data stream computing model, resulting in limited application scope.

[0052] Since Monte Carlo simulation relies on constructing a Markov chain, in which each state (i.e. atomic configuration) only depends on the previous state. Through a series of state transitions (or called "moves", "atomic exchanges"), the system gradually reaches thermal equilibrium. Therefore, Monte Carlo simulation is essentially sequential, and it is necessary to develop efficient parallel algorithms. Monte Carlo simulation is a memory random access type of computation, and the scalable Monte Carlo method introduces chain cell algorithm and local interaction zone concept for parallel computing. In related technologies, CPU and GPU can be used for parallel computing simulation of scalable Monte Carlo, because CPU uses the SIMT single instruction multiple thread mechanism to read data, and can assemble discontinuous scalar data. Some other chips, such as the Ascend chip NPU, support vector operations, and the vector computing unit is the SIMD single instruction multiple data mechanism, and the data read and write must be continuous in memory or continuous in fragments. Since this type of chip does not support reading non-continuous data, the scalable Monte Carlo simulation method is not applicable to this type of chip.

[0053] Based on this, the embodiment of the application provides an atomic system simulation method, device, equipment and storage medium, in which the atomic positions in the chain cell are selected as target positions in sequence in a simulation cycle, the order of the atomic positions is ensured, and unordered random access is avoided. Secondly, a random integer array is generated, and a random mask and an exchange mask are constructed based on a preset number, the exchange position is determined from the nearest neighbor position through the mask technology, and the condition judgment of atomic exchange is converted into batch screening of the vector mask, wherein the random integer array provides a predictable random source, and the dispersed exchange operation is converted into continuous vector operation through the mask process, the data memory continuous access is ensured, the Monte Carlo simulation atomic movement originally relying on random memory access and condition judgment can adapt to the characteristics of the vector operation unit, batch atomic parallel processing is realized, the hard requirement of the vector operation unit for data continuity is solved, the Monte Carlo simulation is transplanted into the vector operation framework, and the application range is expanded.

[0054] The embodiment of the application provides an atomic system simulation method, device, equipment and storage medium, and the following embodiments are used for illustration. First, the atomic system simulation method in the embodiment of the application is described.

[0055] The atomic system simulation method provided in the embodiments of the present application relates to the technical field of atomic system simulation. The atomic system simulation method provided in the embodiments of the present application can be applied to a terminal, can be applied to a server, and can also be a computer program running in the terminal or the server. For example, the computer program can be a native program or a software module in an operating system; can be a native application (APP), that is, a program that needs to be installed in an operating system to run, such as a client supporting atomic system simulation, that is, a program that can run only after being downloaded into a browser environment; and can also be an applet that can be embedded into any APP. In summary, the computer program can be an application program, a module or a plug-in in any form. The terminal communicates with the server through a network. The atomic system simulation method can be executed by the terminal or the server, or can be executed by the terminal and the server cooperatively.

[0056] In some embodiments, the terminal can be a smartphone, a tablet computer, a notebook computer, a desktop computer or a smart watch, etc. The server can be a standalone server, or can be a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms; or can be a service node in a blockchain system, the service nodes in the blockchain system form a peer-to-peer (P2P) network, and the P2P protocol is an application layer protocol running on a transmission control protocol (TCP) protocol. The terminal and the server can be connected through a communication connection mode such as Bluetooth, a universal serial bus (USB) or a network, and the embodiments are not limited here.

[0057] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: 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, and distributed computing environments including any of the above systems or devices. This 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, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0058] The atomic system simulation method in the embodiments of this application is described below.

[0059] Figure 1 This is an optional flowchart of the atomic system simulation method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps 110 to 150. It is also understood that this embodiment... Figure 1 The order of steps 110 to 150 is not specifically limited. The order of steps can be adjusted or some steps can be reduced or added according to actual needs.

[0060] Step 110: Obtain the cell corresponding to the initial configuration and the number of atoms contained in each cell.

[0061] In one embodiment, metal atoms are bonded by metallic bonds, i.e., the attraction between metal ions that have lost their outer electrons and free electrons. Metallic bonds are neither saturated nor directional, causing the atoms inside the metal to be closely packed, forming a highly symmetrical close-packed structure. This structure is a crystal structure, and common crystal structures include face-centered cubic (FCC), body-centered cubic (BCC), or hexagonal close-packed (HCP). A 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 three-dimensional space, containing 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.

[0062] Alloy materials are usually composed of multiple atomic types. For example, in the AlCoFeNiTi alloy, an array "lattice" is used in the computer memory to represent the arrangement order of atoms, with 1 representing Al, 2 representing Co, and so on. For crystal structures such as face-centered cubic (FCC) and body-centered cubic (BCC), the array for storing 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 x, y, and z dimensions of the alloy block, and np represents the number of atoms in each unit cell, which is related to the type of crystal structure. For example, in FCC, there are 4 atoms in each unit cell, and in BCC, there are 2 atoms in each unit cell.

[0063] One of the basic limitations of Monte Carlo simulation is the sequential nature of lattice site updates in the Markov chain, which affects the simulation speed, so the scalable Monte Carlo algorithm converts the serial Monte Carlo simulation calculation process into partial parallel computation through the cell algorithm. The cell is further divided into multiple chains, and the atomic movement is attempted in parallel within each chain, thereby improving the calculation efficiency.

[0064] In the chain algorithm, all cells are divided into chains, each containing atoms, and the size of the chain should be larger than the interaction range between atoms to ensure that atomic movement within a chain does not affect the energy calculation process of adjacent chains. A Monte Carlo scan refers to a Monte Carlo attempt to move for each atom. With the chain decomposition, a Monte Carlo scan process is divided into successive steps, each containing parallel attempts to move, so using the chain algorithm can increase the running speed of the original serial Monte Carlo algorithm by times.

[0065] For example, for an FCC atomic system containing atoms, with 300 atoms in the x, y, and z directions, each unit cell of FCC contains 4 atoms, and it is assumed that each chain has a single side length of 4 lattice constants, containing atoms. At this time, the entire atomic system is divided into chains, and a Monte Carlo scan is divided into successive steps, each containing parallel attempts to move.

[0066] Therefore, the initial crystal structure is referred to as the initial configuration in the embodiments of the present application, and a two-dimensional square lattice is taken as an example for illustration. Referring to Figure 2 , Figure 2This is a schematic diagram of the initial configuration provided in the embodiments of this application. Figure 2 This is a two-dimensional schematic diagram of the BCC structure. Each atom (represented by a solid black circle) is surrounded by a layer of nearest neighbor atoms (represented by dashed circles), and outside the nearest neighbor atoms is a layer of potentially affected atoms (represented by thin solid circles).

[0067] In one embodiment, reference is made to Figure 3 , Figure 3 This is another schematic diagram of the initial configuration provided in the embodiments of this application. Each square in the diagram represents one atom, and there are a total of... There are 10 atoms, each with two indices. and It means that, among them, The cell number represents the chain cell. This represents the atom number within the chain cell. For example, 3,11 indicates the 11th atom in the 3rd chain cell. After obtaining the initial configuration, the parallel Monte Carlo scan process begins.

[0068] Step 120: Perform a simulation loop based on the number of atoms. In each simulation loop, 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.

[0069] In one embodiment, for ease of discussion, it is assumed that atoms only interact with their nearest neighbors; in actual calculations, the distances may be greater. Figure 3 For example, assuming the length of a single side of each chain cell is 5 lattice constants, that is, it includes... 10 atoms, therefore the entire initial configuration is divided into 10 atoms. Each cell, correspondingly, a Monte Carlo scan process will be broken down into [number] cells. A series of consecutive steps, each step containing A parallel attempt to move.

[0070] In one embodiment, Figure 3 Each cell in the chain In each of the four consecutive steps, each atom within a chain cell is traversed sequentially. In each step, one atom position from each of the four chain cells is selected as the target position, for a total of four atom positions. The atoms at these four positions are moved in parallel once. In other words, each step traverses one atom within a chain cell, and the number of iterations is equal to the number of atoms. Therefore, if one step is defined as one simulation loop, a single Monte Carlo scan requires the same number of iterations as the number of atoms. The loop continues.

[0071] In an embodiment, in each simulation cycle, the atomic position corresponding to each of the chain cells is selected as the target position in sequence, which can be set according to actual conditions, and the purpose is to traverse all atomic positions in the chain cell without repetition. It can be understood that after the selected sequence, each chain cell obtains the same atomic position as the target position. For example, the first atomic position in the chain cell is selected as the target position, the 13th atomic position in the chain cell is selected as the target position, and the like.

[0072] The following embodiment takes one simulation cycle as an example to describe the specific execution process.

[0073] Referring to Figure 3 , it is assumed that the 13th atomic position in the 4 chain cells is currently traversed, and the target positions are (1, 13), (2, 13), (3, 13), and (4, 13) shown in the diagram. Since the movement of atoms in Monte Carlo only occurs at the nearest neighbor position, and the initial configuration is determined, the nearest neighbor position corresponding to each atom pair is also known. For example Figure 3 , in the two-dimensional schematic diagram of the BCC structure in the figure, the atoms at the target positions all have 4 nearest neighbor atoms (positions shown by the dashed line in the figure). For the three-dimensional case, each atomic position of the FCC has 12 nearest neighbor positions, and each atomic position of the BCC has 8 nearest neighbor positions. Therefore, a predetermined number of nearest neighbor positions corresponding to each target position can be obtained, and the predetermined number is set according to actual conditions.

[0074] In combination Figure 3 , when exchanging, the atom at the target position will randomly select one of the nearest neighbor atoms to attempt to exchange. After the two atoms attempt to exchange, the energy of other atoms may be affected, so Figure 3 , in the figure, the positions of the nearest neighbor positions in one circle are boxed with solid lines as atomic positions whose energy may be affected. Here, the target position, the nearest neighbor position, and the atomic position whose energy may be affected in each chain cell together constitute a local influence area.

[0075] In an embodiment, according to this exchange mechanism, it can be seen that in this case, the Monte Carlo update of the atoms with the same index but different indexes is independent of each other. This obviously provides an opportunity for parallel processing. For example, considering the atomic position (1, 13), the atomic position (1, 13) can be exchanged with any one of its nearest neighbor positions (1, 12), (1, 14), (1, 8), and (1, 18) in the Monte Carlo update process, while for other atoms, such as the atomic position (1, 13), it can be exchanged with its nearest neighbor positions (1, 12), (1, 14), (1, 8), and (1, 18). ,13), (1, 14), (1, 8), and (1, 18). ,13), (1, 14), (1, 8), and (1, 18). ,13), (1, 14), (1, 8), and (1, 18). ,8) and ( Any one of the swaps in ,18).

[0076] It is understandable that, if the above explanation is based on the initial configuration of a two-dimensional square lattice, this process of selecting the same position of different chain cells as the target position, determining the known number of nearest neighbor positions of the target position, and then determining the positions of atoms that may be affected based on the nearest neighbor positions is also applicable to different situations such as three-dimensional FCC or BCC lattices.

[0077] Because Monte Carlo simulation is a type of computation involving random memory access, it is not suitable for operation on vectorized computation units in a single-instruction multiple-data (SMD) computation model. For example, during atomic movement, although the coordinates of the atom at the target position are regular, the coordinates of the nearest neighbor atom to be swapped are random. In CPUs and GPUs, each atom at the target position randomly attempts to swap with its nearest neighbor atom, and each CPU core or GPU thread executes the same swap code, reading atomic data from different locations in memory. This operation is straightforward on CPUs and GPUs. However, on chips with vectorized computation, these nearest neighbor positions are random and discontinuous in memory, making computation impossible. This application's embodiment eliminates conditional judgments and random memory access through atomic copying and vector masking processes, overcoming the difficulty that vector computation units must have contiguous data memory for computation, and thus achieving Monte Carlo atomic movement based on vectorized computation.

[0078] The following describes this vector calculation process in detail.

[0079] Step 130: Obtain the continuous atomic positions on all target positions, and generate a random integer array based on the continuous atomic positions. Perform an initial loop based on a preset number. In each initial loop, generate a random mask corresponding to the random integer array, and determine the swap position of each target position from the nearest position based on the random mask. After the initial loop ends, the attempted swap configuration is obtained.

[0080] In one embodiment, for a target location, its contiguous atoms in memory are retrieved, and then a random integer array is generated based on the positions of these contiguous atoms. The length of this random integer array is the same as the length of the contiguous atom positions. In the two-dimensional diagram, each row is stored continuously; in the three-dimensional diagram, it is continuous along the z-axis. The specific continuity method is not limited; only the requirement to read the corresponding contiguous data is specified. Figure 2 For example, the line containing the target position is read row by row, that is, the consecutive atoms in the 3rd and 8th lines, including the atom at the target position. Since it is stored consecutively by row, the number of consecutive atoms is 10, and the length of the resulting random integer data is 10.

[0081] In an embodiment, referring to Figure 4 Figure 4 is a flowchart for generating a random integer array according to continuous atomic positions provided by the embodiment of the present application, and specifically includes the following steps:

[0082] Step 410: randomly selecting a plurality of random numbers from integers in a preset quantity constraint range.

[0083] Step 420: generating a random integer array consistent with the number of continuous atomic positions according to the random numbers.

[0084] In an embodiment, a preset quantity constraint range [0, Ne-1] is generated according to a preset quantity Ne, at this time, different integers in the preset quantity constraint range correspond to a nearest neighbor position respectively. For example Figure 2 In the embodiment, the preset quantity Ne=4, so the preset quantity constraint range is [0, 3], at this time, integers 0, 1, 2, and 3 correspond to the left, right, upper, and lower four nearest neighbor positions respectively. For example, 0 represents the left nearest neighbor position, 1 represents the right nearest neighbor position, 2 represents the upper nearest neighbor position, and 3 represents the lower nearest neighbor position. It can be understood that the correspondence relationship herein is only illustrative and does not represent a limitation.

[0085] Next, for each atomic position, a plurality of floating-point numbers consistent with the number of elements in the random integer array are read according to the thread in which the atomic position is located, the floating-point number is between 0.0 and 1.0, and the floating-point number is converted to an integer in the preset quantity constraint range as the corresponding random number, that is, the corresponding random integer array can be obtained.

[0086] For example, a random integer array is generated for the third row and the eighth row, which can be Figure 3

[0087]

[0088] Among them, the third column and the eighth column correspond to the integers of the four target positions (1, 13), (2, 13), (3, 13), and (4, 13) respectively, the second column and the fourth column are the nearest neighbor positions corresponding to the target positions of the third column, and the seventh column and the ninth column are the nearest neighbor positions corresponding to the target positions of the eighth column.

[0089] Next, an initial loop is performed, and the number of cycles of the initial loop is the preset quantity. In an embodiment, the process of generating a random mask corresponding to the random integer array in each initial loop is specifically: obtaining the current cycle number, if the random number in the random integer array is consistent with the current cycle number, the random number in the corresponding position is changed to one, otherwise, it is zero, and the corresponding random mask is generated.

[0090] ​​Taking the i-th initial loop as an example, 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 changed to 1; otherwise, it is changed to 0, and the corresponding random mask is generated.

[0091] by Figure 3 For example, Ne is 4, so the loop needs to be executed 4 times.

[0092] 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:

[0093]

[0094] 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 set to 0. The resulting random mask is:

[0095]

[0096] 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 set to 0. The resulting random mask is:

[0097]

[0098] 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 set to 0. The resulting random mask is:

[0099]

[0100] In one embodiment, after obtaining the random mask corresponding to the initial loop, the swap positions need to be determined based on the random mask. (Refer to...) Figure 5 , Figure 5 This is a flowchart illustrating the process of determining the swap positions of each target location from its nearest neighbor based on a random mask, as provided in this application embodiment. The flowchart specifically includes the following steps:

[0101] Step 510: Generate a location mask based on the target location, calculate the AND operation between the random mask and the location mask, and obtain the swapped identifier array.

[0102] In one embodiment, since only atoms at the target position in the current step need to be swapped, the target position needs to be identified during vector computation, and a position mask can be generated based on the target position. (See also...) Figure 3 Since the target positions are all located in the third column of the row, the position mask is represented as:

[0103]

[0104] In each initial loop, the random mask and the position mask are ANDed to obtain the swapped identifier data.

[0105] by Figure 3 For example, when i=0, the exchanged identifier data is as follows:

[0106]

[0107] When i=1, the exchanged identifier data is:

[0108]

[0109] When i=2, the exchanged identifier data is as follows:

[0110]

[0111] When i=3, the exchanged identifier data is as follows:

[0112]

[0113] Step 520: Determine the cell corresponding to the target position based on the "-" identifier in the swap identifier array, match the current loop count in the integer, and determine the swap position from the nearest neighbor position based on the matching result.

[0114] In one embodiment, in each initial loop, with the exchange identifier array, it is possible to determine which target positions' atoms need to be exchanged and the destination atoms for the exchange. Specifically: the chain cell corresponding to the target position is determined based on the "1" identifier in the exchange identifier array; the current loop number is matched against integers within a preset quantity constraint range; and the exchange position is determined from the nearest neighbor position based on the matching result.

[0115] For example, refer to Figure 3 When i=0, "1" is located in the second row and third column. Therefore, the target position to be swapped is located in the bottom left cell. At this time, i=0, and the position corresponding to the integer 0 is the nearest neighbor position on the left. Therefore, the atom at the target position (3,13) of the bottom left cell needs to be swapped with the atom at the nearest neighbor position (3,12) on the left.

[0116] Similarly, when i=1, there is no "1", so no swap is needed for any target position. When i=2, "1" is located in the first row and eighth column, so the target position to be swapped is in the top right cell. Since i=2, the integer 2 corresponds to the nearest neighbor above, so the atom at target position (2,13) ​​in the top right cell needs to be swapped with the atom at its nearest neighbor above (2,8). When i=3, "1" is located in the first row and third column, and the second row and eighth column, so the target positions to be swapped are in the top left and bottom right cells. Since i=3, the integer 3 corresponds to the nearest neighbor below, so the atom at target position (1,13) in the top left cell needs to be swapped with the atom at its nearest neighbor below (1,18), and the atom at target position (4,13) in the bottom right cell needs to be swapped with the atom at its nearest neighbor below (4,18).

[0117] After executing a preset number of initial loops, the initial configuration transforms into an attempt to swap configurations. (See reference...) Figure 6 , Figure 6 This is a schematic diagram of an attempt to exchange configurations provided in an embodiment of this application. Figure 6 In the process, after four initial loops, the four target positions are attempted to be swapped according to the swap identifier array. At this point, the target position of the top left cell is swapped with the nearest position below it, the target position of the top right cell is swapped with the nearest position above it, the target position of the bottom left cell is swapped with the nearest position to its left, and the target position of the bottom right cell is swapped with the nearest position below it.

[0118] Step 140: Perform a selection loop based on a preset number. In each selection loop, generate a swap mask corresponding to a random integer array. 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.

[0119] In one embodiment, attempting an exchange means first exchanging energy, then calculating whether the energy difference before and after the exchange meets the exchange conditions. If it does, the exchange is performed; otherwise, it is not. Therefore, it is necessary to determine whether to retain the exchange result and proceed to the next selection loop based on a preset number of iterations. The number of loop iterations is also a preset number.

[0120] In one embodiment, reference is made to Figure 7 , Figure 7 This is a flowchart of generating a swap mask corresponding to a random integer array in each selection loop, provided by an embodiment of this application. Specifically, it includes the following steps:

[0121] Step 710: Calculate the swap probability of each position in the random integer array after swapping the atoms at the target position and the swap position, and determine the identifier based on the swap probability. If the swap probability indicates that a swap is required, the identifier is one; otherwise, it is zero.

[0122] In one embodiment, the exchange probability is calculated using the Metropolis-Hastings algorithm, and the old energy corresponding to each element position in the random integer array before and after the exchange is obtained. and new energy The energy here can be the system Hamiltonian or other energies. The system Hamiltonian includes the interatomic interaction potential energy (such as the Lennard-Jones potential, Coulomb potential, etc.) and the kinetic energy term. Then, the energy difference between the two is calculated. The exchange probability P is determined based on the energy difference, and is expressed as:

[0123]

[0124] in, , It is Boltzmann's constant. It's temperature.

[0125] In one embodiment, an identifier is determined based on the exchange probability. If the exchange probability indicates that an exchange is needed, the identifier is 1; otherwise, it is 0. In this case, if the exchange probability is 1, it indicates that an exchange is needed, and the resulting identifier is 1.

[0126] Step 720: Generate an identifier mask that is consistent with the random integer array based on the identifier, generate a position mask based on the target position, calculate the AND operation of the identifier mask and the position mask to obtain the swap mask.

[0127] In one embodiment, the identifier mask is obtained by combining the identifiers corresponding to each element position. In the identifier mask, element 1 indicates a swap is needed, and element 0 indicates no swap is needed. Figure 3 For example, assuming that the identifier mask obtained after calculating the exchange probability is:

[0128]

[0129] Since only the atoms at the target position need to be swapped, the identifier mask and the position mask need to be ANDed to obtain the swap mask. In the example above, the swap mask is represented as:

[0130]

[0131] In this process, the atoms at the target position corresponding to element 1 in the swap mask need to be swapped, while the atoms at the target position corresponding to element 0 do not need to be swapped.

[0132] Therefore, in each selection loop, the process of generating a swap configuration based on the swap mask, the attempted swap configuration, and the initial configuration specifically includes: performing an AND operation based on the swap mask and the random mask, obtaining the element value at the target position in the operation result, and if the element value is 1, replacing the corresponding cell in the initial configuration with the cell in the attempted swap configuration.

[0133] In one embodiment, with Figure 3 For example, when i=0, the result of the AND operation based on the swapped mask and the random mask is:

[0134]

[0135] When i=1, the result of the AND operation based on the swapped mask and the random mask is:

[0136]

[0137] When i=2, the result of the AND operation based on the swapped mask and the random mask is:

[0138]

[0139] When i=3, the result of the AND operation based on the swapped mask and the random mask is:

[0140]

[0141] Therefore, in the selection loops corresponding to i=0 and i=1, since the element value at the target position is 0, the corresponding cell in the initial configuration is retained. In the selection loop corresponding to i=2, the element value at the target position of the top-right cell is 1, so the top-right cell in the initial configuration is replaced by the cell in the initial configuration by attempting to swap the top-right cell in the current configuration. In the selection loop corresponding to i=3, the element value at the target position of the top-left cell is 1, so the top-left cell in the initial configuration is replaced by the cell in the initial configuration by attempting to swap the top-left cell in the current configuration.

[0142] In one embodiment, in the selection loop following the first iteration, the swap configuration is used as the initial configuration for iteration in the next selection loop. After the selection loop is completed, the final swap configuration is obtained. (See also...) Figure 8 , Figure 8 This is a schematic diagram illustrating the generation of the exchange configuration provided in the embodiments of this application. Figure 8 The diagram illustrates the results of the operations in the initial configuration, the attempted swap configuration, and the four selection loops. It can be seen that in the final swap configuration, only the two chain cells in the upper left and upper right corners need to perform swap operations. Specifically, the target position of the upper left chain cell is swapped with its nearest position below it, and the target position of the upper right chain cell is swapped with its nearest position above it.

[0143] Step 150: In the next simulation cycle, use the swap configuration as the initial configuration until the simulation cycle ends.

[0144] In one embodiment, following the above process, one step of the Monte Carlo scan is completed. Next, the other atomic positions in the chain cell are traversed, each taken as a target position, and the simulation loop is executed until the traversal is complete. In the next simulation loop, the exchange configuration obtained in the previous simulation loop is used as the initial configuration until the simulation loop ends. This ensures that the exchange process is continuously changing.

[0145] In one embodiment, if the nearest neighbor positions corresponding to the target position are not all present—for example, when the first atomic position is selected as the target position, only two nearest neighbor positions can be selected in the chain cell—an atomic virtual layer is required. The atomic virtual layer handles atomic exchanges on cycle boundaries, which can be defined as boundaries in the configuration. For chips such as CPUs and GPUs, an atomic virtual layer is unnecessary because they can determine at the boundary whether the other atom exchanged with 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 this embodiment cannot perform this conditional judgment; therefore, an atomic virtual layer is introduced, and an update operation is performed after each atomic exchange to ensure the continuity of the data used for computation.

[0146] In one embodiment, when obtaining a preset number of nearest neighbor positions corresponding to each target position, if the target position is located within the boundary range of the chain cell, the next position range corresponding to each boundary of the chain cell is obtained according to the loop information, and the next position range is spliced ​​on the outer ring of the boundary range to form an atomic virtual layer, wherein at least one of the nearest neighbor positions is located in the atomic virtual layer.

[0147] In one embodiment, reference is made to Figure 9 , Figure 9This is a schematic diagram of the boundary provided in the embodiments of this application. The boundary is indicated by a thick line, showing that each cell has at least one edge located on the boundary. If the target positions are (1,15), (2,15), (3,15), and (4,15), then the target positions (2,15) and (4,15) are located on the boundary, and at least one of their nearest neighbor positions is discontinuous. Considering the cyclic information of the configuration, the atom to the right of (2,15) should be (1,11). Therefore, the column containing (1,11) is taken as the next position range, and this next position range is concatenated to the outer ring of the boundary corresponding to (2,15). Similarly, the column corresponding to (2,15) is concatenated to the outer ring of the column containing (1,11). Following the same concatenation method, the outer ring of the boundary containing (3,21) can also be concatenated to the row containing the corresponding next position range (1,1), and the outer ring of the boundary containing (1,1) can also be concatenated to the row containing the corresponding next position range (3,21). Ultimately, the entire initial configuration is encircled, and when each position within the chain cell is used as the target position, a complete and continuous number of nearest neighbor positions can be obtained.

[0148] In one embodiment, after each atomic exchange, the atoms on the boundary that form a loop are copied to the opposite side, forming a ring of virtual atoms, which in three dimensions is an outer wrapping, to achieve data continuity during computation. All atoms do not need to consider whether their nearest neighbor is on the opposite side; instead, data is read continuously and subsequent vectorized operations are performed uniformly.

[0149] In one embodiment, single-card performance was tested on an Ascend 910B. The energy model used for calculating energy was qSRO, the alloy used for simulation was FeCoNiAlTi with 1 billion atoms, and Throughput represents the number of atoms per second that can complete one Monte Carlo step. The test results are as follows:

[0150]

[0151] As can be seen, the performance test of the atomic system simulation method proposed in this application on the Ascend 910B chip shows that it can complete one Monte Carlo step for an average of 7.75 million atoms per second, enabling the Monte Carlo scanning process to be parallelized on chips with vector computing units. It is applicable to various lattice types or various cell sizes. The types of lattice structures and cell sizes mentioned above are for illustrative purposes only and do not represent a limitation on the application scenarios.

[0152] The embodiments of this application eliminate conditional judgments and random memory access based on atomic copying and vector masking processes, solving the difficulty that data memory must be contiguous when vector operation units perform calculations, and realize Monte Carlo atomic movement based on vectorized operations.

[0153] The technical solution provided in this application involves obtaining the cell corresponding to the initial configuration and the number of atoms contained in each cell, performing a simulation loop based on the number of atoms, selecting the atomic position corresponding to each cell as the target position in each simulation loop, obtaining a preset number of nearest neighbor positions corresponding to each target position, obtaining continuous atomic positions on 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 the swap position of each target position from the nearest neighbor positions based on the random mask, obtaining a trial swap configuration after the initial loop, performing a selection loop based on the preset number, generating a swap mask corresponding to the random integer array in each selection loop, and generating a swap configuration based on the swap mask, the trial swap configuration, and the initial configuration, using the swap configuration as the initial configuration in the next selection loop, until the final swap configuration is obtained, using the swap configuration as the initial configuration in the next simulation loop, until the simulation loop ends. Since Monte Carlo simulation relies on random memory access, which leads to numerous conditional judgments and discrete data reads, significantly reducing computational efficiency, this embodiment selects the atomic positions in the chain cell as target positions sequentially and in parallel during the simulation loop. This ensures the orderliness of atomic positions and avoids disordered random access. Secondly, a random integer array is generated, and random masks and exchange masks are constructed based on a preset number. The exchange position is determined from the nearest neighbor position using masking technology, transforming the conditional judgments of atomic exchanges into batch filtering using vector masks. The random integer array provides a predictable random source, and the masking process transforms the scattered exchange operations into continuous vector operations, ensuring continuous access to data memory. This allows the atomic movement in Monte Carlo simulation, which originally relied on random memory access and conditional judgments, to adapt to the characteristics of vectorized computation units, enabling parallel processing of batch atoms. This solves the hard requirement of data continuity for vector computation units, porting Monte Carlo simulation to a vectorized computation framework and expanding its application scope.

[0154] This application also provides an atomic system simulation apparatus that can implement the above-described atomic system simulation method, referring to... Figure 10 The device includes:

[0155] Initial parameter acquisition module 1010: used to obtain the chain cell corresponding to the initial configuration and the number of atoms contained in each chain cell.

[0156] Target position selection module 1020: used for simulation loop based on the number of atoms. In each simulation loop, the atomic position corresponding to each chain cell is selected as the target position in sequence, and the preset number of nearest neighbor positions corresponding to each target position are obtained.

[0157] Initial loop module 1030: used to obtain the continuous atomic positions on 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 swap position of each target position from the nearest position based on the random mask. After the initial loop ends, the attempted swap configuration is obtained.

[0158] Selection loop module 1040: Used to perform selection loops based on a preset number. In each selection loop, a swap mask corresponding to a random integer array is generated. The swap configuration is generated 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.

[0159] Iteration Termination Module 1050: Used to use the exchange configuration as the initial configuration in the next simulation cycle until the simulation cycle ends.

[0160] The specific implementation of the atomic system simulation device in this embodiment is basically the same as the specific implementation of the atomic system simulation method described above, and will not be repeated here.

[0161] This application also provides an electronic device, including:

[0162] At least one memory;

[0163] At least one processor;

[0164] At least one program;

[0165] The program is stored in a memory, and the processor executes the at least one program to implement the atomic system simulation method described above in this application. The electronic device can be any smart terminal, including mobile phones, tablets, personal digital assistants (PDAs), in-vehicle computers, etc.

[0166] Please see Figure 11 , Figure 11 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:

[0167] The processor 1101 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0168] The memory 1102 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1102 can store the operating system and other applications. 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 and executed by the processor 1101 using the atomic system simulation method of the embodiments of this application.

[0169] Input / output interface 1103 is used to implement information input and output;

[0170] The communication interface 1104 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0171] Bus 1105 transmits information between various components of the device (e.g., processor 1101, memory 1102, input / output interface 1103, and communication interface 1104);

[0172] The processor 1101, memory 1102, input / output interface 1103 and communication interface 1104 are connected to each other within the device via bus 1105.

[0173] This application embodiment also provides a storage medium that stores a computer program, which, when executed by a processor, implements the above-described atomic system simulation method.

[0174] Memory, as a non-transitory storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0175] The atomic system simulation method, apparatus, device, and storage medium proposed in this application obtain the cell corresponding to the initial configuration and the number of atoms contained in each cell. Simulation loops are performed based on the number of atoms. In each simulation loop, the atomic position corresponding to each cell is selected sequentially as the target position. A preset number of nearest neighbor positions are obtained for each target position. Continuous atomic positions on all target positions are obtained, and a random integer array is generated based on the continuous atomic positions. An initial loop is performed based on the preset number of nearest neighbor positions. A random mask corresponding to the random integer array is generated in each initial loop, and the swap position for each target position is determined from the nearest neighbor positions based on the random mask. After the initial loop, a trial swap configuration is obtained. A selection loop is performed based on the preset number of nearest neighbor positions. A swap mask corresponding to the random integer array is generated in each selection loop, and a swap configuration is generated based on the swap mask, the trial 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. In the next simulation loop, the swap configuration is used as the initial configuration until the simulation loop ends. Since Monte Carlo simulation relies on random memory access, which leads to numerous conditional judgments and discrete data reads, significantly reducing computational efficiency, this embodiment selects the atomic positions in the chain cell as target positions sequentially and in parallel during the simulation loop. This ensures the orderliness of atomic positions and avoids disordered random access. Secondly, a random integer array is generated, and random masks and exchange masks are constructed based on a preset number. The exchange position is determined from the nearest neighbor position using masking technology, transforming the conditional judgments of atomic exchanges into batch filtering using vector masks. The random integer array provides a predictable random source, and the masking process transforms the scattered exchange operations into continuous vector operations, ensuring continuous access to data memory. This allows the atomic movement in Monte Carlo simulation, which originally relied on random memory access and conditional judgments, to adapt to the characteristics of vectorized computation units, enabling parallel processing of batch atoms. This solves the hard requirement of data continuity for vector computation units, porting Monte Carlo simulation to a vectorized computation framework and expanding its application scope.

[0176] The embodiments described in this application are for the purpose of more clearly illustrating 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. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0177] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0178] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0179] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0180] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises 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 processes, methods, products, or apparatus.

[0181] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0182] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0183] The units described above as separate components may or may not be physically separate. 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 the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0184] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0185] If the integrated unit is implemented as 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 this application, in essence, 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. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0186] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A method for simulating atomic systems, characterized in that, include: Obtain the chain cell corresponding to the initial configuration and the number of atoms contained in each chain cell; Based on the number of atoms, a simulation cycle is performed. In each simulation cycle, the atomic position corresponding to each chain cell is selected as the target position in sequence, and a preset number of nearest neighbor positions are obtained for each target position. Obtain the continuous atomic positions of all the target positions, and generate a random integer array based on the continuous atomic positions. Perform an initial loop based on the preset number. In each initial loop, generate a random mask corresponding to the random integer array, and determine the swap position of each target position from the nearest neighbor position based on the random mask. After the initial loop ends, obtain the attempted swap configuration. Based on the preset number, a selection loop is performed. In each selection loop, a swap mask corresponding to the random integer array is generated. A swap configuration is generated 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. In the next simulation cycle, the exchange configuration is used as the initial configuration until the simulation cycle ends; The step of determining the swap position of each target position from the nearest neighbor positions based on the random mask includes: generating a position mask based on the target position; calculating the AND operation between the random mask and the position mask to obtain a swap identifier array; determining the cell corresponding to the target position based on the "-" identifier in the swap identifier array; matching the current loop number in integers; and determining the swap position from the nearest neighbor positions based on the matching result. The step of generating a swap configuration based on the swap mask, the attempted swap configuration, and the initial configuration includes: performing an AND operation on the swap mask and the random mask to obtain the element value at the target position in the operation result; if the element value is one, replacing the corresponding cell in the initial configuration with the cell in the attempted swap configuration.

2. The atomic system simulation method according to claim 1, characterized in that, The step of generating a random integer array based on the consecutive atomic positions includes: Multiple random numbers are randomly selected from the integers within the preset quantity constraint range, and different integers correspond to a nearest neighbor position; The random integer array is generated based on the random number, which is consistent with the number of consecutive atomic positions.

3. The atomic system simulation method according to claim 2, characterized in that, The step of generating the random mask corresponding to the random integer array in each initial loop includes: Get the current loop count. If the random number in the random integer array is the same as the current loop count, change the random number at the corresponding position to one; otherwise, change it to zero, and generate the corresponding random mask.

4. The atomic system simulation method according to claim 1, characterized in that, The step of generating the swap mask corresponding to the random integer array in each selection loop includes: Calculate the swap probability corresponding to each position in the random integer array after swapping the atoms at the target position and the swap position, and determine an identifier based on the swap probability. If the swap probability indicates that a swap is required, the identifier is one; otherwise, it is zero. An identifier mask consistent with the random integer array is generated based on the identifier, a location mask is generated based on the target location, and the AND operation of the identifier mask and the location mask is calculated to obtain the swap mask.

5. The atomic system simulation method according to claim 1, characterized in that, The step of obtaining a preset number of nearest neighbor positions corresponding to each target position also includes: If the target position is located within 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, wherein at least one of the nearest neighbor positions is located in the atomic virtual layer.

6. An atomic system simulation device, characterized in that, include: Initial parameter acquisition module: used to acquire the cell corresponding to the initial configuration and the number of atoms contained in each cell; Target position selection module: used to perform simulation loops based on the number of atoms. In each simulation loop, the atomic position corresponding to each chain cell is selected as the target position in sequence, and a preset number of nearest neighbor positions are obtained for each target position. Initial loop module: used to obtain the continuous atomic positions of all the target positions, generate a random integer array based on the continuous atomic positions, perform an initial loop based on the preset number, generate a random mask corresponding to the random integer array in each initial loop, and determine the swap position of each target position from the nearest position based on the random mask. After the initial loop is completed, the attempted swap configuration is obtained. Selection loop module: used to perform 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. In the next selection loop, the swap configuration is used as the initial configuration until the final swap configuration is obtained. Iteration termination module: used to use the exchange configuration as the initial configuration in the next simulation cycle until the simulation cycle ends; The step of determining the swap position of each target position from the nearest neighbor positions based on the random mask includes: generating a position mask based on the target position; calculating the AND operation between the random mask and the position mask to obtain a swap identifier array; determining the cell corresponding to the target position based on the "-" identifier in the swap identifier array; matching the current loop number in integers; and determining the swap position from the nearest neighbor positions based on the matching result. The step of generating a swap configuration based on the swap mask, the attempted swap configuration, and the initial configuration includes: performing an AND operation on the swap mask and the random mask to obtain the element value at the target position in the operation result; if the element value is one, replacing the corresponding cell in the initial configuration with the cell in the attempted swap configuration.

7. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the atomic system simulation method according to any one of claims 1 to 5.

8. A storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the atomic system simulation method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Preparation method and application of taste-masking capsule skin based on molecular simulation

    CN117153275A

  • Base editor predictive algorithm and method of use

    WO2021158995A1