Training method of neural network force field model, related device and medium
Patent Information
- Application Number
- CN202510310941.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2026-09-15
Smart Images

Figure CN122762015A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a training method, related apparatus and medium for a neural network force field model. Background Technology
[0002] Molecular dynamics (MD) simulation is a widely used technique in materials and biological systems. It is a theoretical method for simulating the motion of interacting particle systems. Currently, neural network force field models are often introduced into molecular dynamics simulations to describe the motion and interactions of atoms within molecules. These neural network force field models use artificial neural networks to characterize the potential energy of interatomic interactions within a molecular system. For example, in molecular dynamics simulations, neural network force field models can be used to predict molecular energy and the forces acting on individual atoms within a molecule.
[0003] The prediction accuracy of neural network force field models often depends heavily on their training method. Common techniques use the atomic positions of individual atoms in a molecule as training input and rely on the output of the final output layer of the neural network model to calculate the loss function, thus training the neural network force field model. This approach often overlooks other important latent features of the neural network model, limiting its training and resulting in low accuracy in predicting the forces acting on individual atoms in the molecule. Summary of the Invention
[0004] This disclosure provides a training method, related apparatus, and medium for a neural network force field model, which can improve the accuracy of the neural network force field model in predicting the forces acting on atoms in molecules.
[0005] According to one aspect of this disclosure, a method for training a neural network force field model is provided, the method comprising:
[0006] Obtain the original model, which includes an embedding layer and multiple interconnected interaction layers;
[0007] Obtain sample molecule information of sample molecules, wherein the sample molecule information includes sample atom information and atomic force tags of each of the multiple sample atoms in the sample molecule;
[0008] Based on the sample atom information of each of the multiple sample atoms, feature encoding is performed through the embedding layer to obtain the atom encoding vector of each of the multiple sample atoms;
[0009] The atomic encoding vectors of each of the multiple sample atoms are input into the multiple interconnected interaction layers, wherein each interaction layer outputs the sample molecule graph features corresponding to the interaction layer;
[0010] For each interaction layer, force prediction is performed based on the sample molecular graph features corresponding to the interaction layer to obtain the predicted atomic force of each sample atom in the interaction layer. Based on the predicted atomic force and the atomic force label of each sample atom, the loss function corresponding to the interaction layer is determined.
[0011] The original model is trained based on the loss function corresponding to each interaction layer to obtain the neural network force field model.
[0012] According to one aspect of this disclosure, a molecular treatment method is provided, the method comprising:
[0013] Obtain the atomic information of multiple atoms in the target molecule;
[0014] The atomic information of each of the plurality of atoms is input into a neural network force field model to predict the energy, thereby obtaining the predicted molecular energy of the molecule;
[0015] Based on the predicted molecular energy, the predicted force of each of the multiple sample atoms is determined, wherein the neural network force field model is trained according to the above-described neural network force field model training method.
[0016] According to one aspect of this disclosure, a training apparatus for a neural network force field model is provided, the apparatus comprising:
[0017] The first acquisition unit is used to acquire the original model, which includes an embedding layer and multiple interconnected interaction layers;
[0018] The second acquisition unit is used to acquire sample molecule information of the sample molecule, wherein the sample molecule information includes sample atom information and atomic force tags of each of the multiple sample atoms in the sample molecule;
[0019] The encoding unit is used to perform feature encoding through the embedding layer based on the sample atom information of each of the plurality of sample atoms to obtain the atom encoding vector of each of the plurality of sample atoms;
[0020] An input unit is used to input the atomic encoding vectors of the plurality of sample atoms into the plurality of concatenated interaction layers, wherein each interaction layer outputs the sample molecule graph features corresponding to the interaction layer;
[0021] The first prediction unit is used to perform force prediction based on the sample molecular graph features corresponding to each interaction layer for each interaction layer, to obtain the predicted atomic force of each sample atom in the interaction layer, and to determine the loss sub-function corresponding to the interaction layer based on the predicted atomic force and the atomic force label of each sample atom.
[0022] The training unit is used to train the original model based on the loss sub-functions corresponding to each interaction layer to obtain the neural network force field model.
[0023] Optionally, the first prediction unit includes:
[0024] The prediction module is used to predict the energy of the sample molecule based on the features of the sample molecule graph for each interaction layer.
[0025] An extraction module is used to extract the atomic position information of each of the plurality of sample atoms from the sample atom information;
[0026] The calculation module is used to perform derivative calculations based on the predicted molecular energy and the atomic position information to obtain the predicted atomic force of the sample atom.
[0027] Optionally, the prediction module is used for:
[0028] Extract the molecular backbone information and molecular fragment type of the sample molecules from the sample molecule information;
[0029] The molecular backbone information is encoded to obtain a molecular backbone encoding vector;
[0030] The molecular fragment types are encoded to obtain molecular type encoding vectors;
[0031] For each interaction layer, energy prediction is performed based on the sample molecular graph features, the molecular skeleton encoding vector, and the molecular type encoding vector to obtain the predicted molecular energy corresponding to the interaction layer.
[0032] Optionally, the prediction module is used for:
[0033] For each of the interaction layers, the atomic interaction features of each of the sample atoms are determined in the sample molecular graph features;
[0034] Global pooling is performed on the atomic interaction features of the multiple sample atoms to obtain molecular pooling features;
[0035] Energy prediction is performed based on the molecular pooling features to obtain the predicted molecular energy corresponding to the interaction layer.
[0036] Optionally, the prediction module is used for:
[0037] For each of the interaction layers, the sample molecular graph features are subjected to a first dimensionality reduction process to obtain the first dimensionality-reduced graph features;
[0038] The first dimensionality reduction graph features are activated based on a preset activation function to obtain activated graph features;
[0039] The activation graph features are subjected to a second dimensionality reduction process to obtain a second dimensionality-reduced graph feature;
[0040] Global pooling is performed on the second dimensionality reduction graph features to obtain molecular pooling features;
[0041] Energy prediction is performed based on the molecular pooling features to obtain the predicted molecular energy corresponding to the interaction layer.
[0042] Optionally, the prediction module is used for:
[0043] For each of the interaction layers, the sample molecular graph features are linearly transformed based on the first preset weight matrix and the first preset bias vector to obtain the first transformed graph features;
[0044] The first transformation map features are activated based on a preset activation function to obtain activated map features;
[0045] The activation map features are linearly transformed based on the second preset weight matrix and the second preset bias vector to obtain the second transformed map features.
[0046] Energy prediction is performed based on the features of the second transformation graph to obtain the predicted molecular energy corresponding to the interaction layer.
[0047] Optionally, the sample molecular map features corresponding to the output of each interaction layer are determined in the following way:
[0048] For each interaction layer, based on the atomic encoding vectors of the plurality of sample atoms, the input features of the plurality of sample atoms in the interaction layer are determined, wherein the input features include the atomic scalar features of the sample atom and the relative position features of the sample atom with other sample atoms;
[0049] In each interaction layer, for each of the plurality of sample atoms, cross-attention calculation is performed based on the atomic scalar features of the sample atom, the relative position features with each of the other sample atoms, and the atomic scalar features of each of the other sample atoms to obtain the attention weight of the sample atom to the other sample atoms;
[0050] Based on the atomic scalar features of each of the other sample atoms and the attention weights, feature weighting is performed to obtain the atomic interaction features of the sample atoms;
[0051] Based on the atomic interaction characteristics of each of the multiple sample atoms, the sample molecular graph characteristics corresponding to the interaction layer are determined.
[0052] Optionally, the sample molecular map features corresponding to the output of each interaction layer are determined in the following way:
[0053] For each interaction layer, based on the atomic encoding vectors of the plurality of sample atoms, the input features of the plurality of sample atoms in the interaction layer are determined, wherein the input features include the atomic scalar features, atomic vector features, and the relative position features between the sample atom and other sample atoms;
[0054] For each of the sample atoms, based on the relative position features, weights are generated using a preset function to obtain the interaction weights of other sample atoms on the sample atom;
[0055] Based on the atomic scalar features and interaction weights of each of the other sample atoms, the atomic interaction features of the sample atoms are obtained by weighting the features.
[0056] Based on the atomic interaction features and the relative position features, the atomic vector features are updated to obtain the updated vector features of the sample atoms;
[0057] The atomic interaction features and the updated vector features are fused to obtain the atomic fusion features of the sample atoms;
[0058] Based on the atomic fusion features of each of the multiple sample atoms, the sample molecular graph features corresponding to the interaction layer are determined.
[0059] Optionally, the sample molecular map features corresponding to the output of each interaction layer are determined in the following way:
[0060] For each interaction layer, based on the atomic encoding vectors of the plurality of sample atoms, the input features of the plurality of sample atoms in the interaction layer are determined, wherein the input features include the atomic scalar features of the sample atom and the relative position features of the sample atom with other sample atoms;
[0061] For each of the sample atoms, based on the relative position features, weights are generated using a preset function to obtain the interaction weights of other sample atoms on the sample atom;
[0062] Based on the atomic scalar features and interaction weights of each of the other sample atoms, the atomic interaction features of the sample atoms are obtained by weighting the features.
[0063] The atomic interaction features and atomic scalar features of the sample atoms are concatenated to obtain atomic concatenation features;
[0064] Based on the atomic splicing features of each of the multiple sample atoms, the sample molecular graph features corresponding to the interaction layer are determined.
[0065] Optionally, the sample atom information includes the atom type and three-dimensional coordinates of the sample atom;
[0066] The encoding unit is used for:
[0067] For each of the sample atoms, the atom type is encoded to obtain the type encoding vector of the sample atom;
[0068] Based on the atomic three-dimensional coordinates of the sample atom and the atomic three-dimensional coordinates of each other sample atom directly connected to the sample atom in the sample molecule, the atomic distance between the sample atom and each other sample atom is determined.
[0069] The atomic distance between the sample atom and each of the other sample atoms is encoded to obtain the distance encoding vector of the sample atom;
[0070] The type encoding vector and the distance encoding vector are combined into the atomic encoding vector.
[0071] Optionally, integrating the type encoding vector and the distance encoding vector into the atomic encoding vector includes:
[0072] Extract the orientation information of the sample atoms from the sample molecule information;
[0073] The directional information is encoded to obtain the directional encoding vector of the sample atom;
[0074] The type encoding vector, the direction encoding vector, and the distance encoding vector are integrated into the atomic encoding vector.
[0075] Optionally, the first prediction unit is used for:
[0076] For each of the sample atoms, calculate the Euclidean norm of the difference between the predicted atomic force and the atomic force label;
[0077] The bisector norm is obtained by squaring the Euclidean norm.
[0078] The mean norm is obtained by averaging the bisecting norms of each of the multiple sample atoms.
[0079] Based on the norm mean, the loss function corresponding to the interaction layer is determined.
[0080] Optionally, the training unit is used for:
[0081] For each of the interaction layers, determine the weight of the interaction layer in the current iteration training round;
[0082] The total loss function is obtained by weighting the loss sub-functions and weights of each of the multiple interaction layers.
[0083] Based on the total loss function, the original model is trained to obtain the neural network force field model.
[0084] Optionally, the sample molecule information may further include the molecular energy tag of the sample molecule;
[0085] The prediction unit is used for:
[0086] For each of the interaction layers, a first loss function is determined based on the predicted molecular energy and the molecular energy label;
[0087] Based on the predicted atomic force and the atomic force label, a second loss function is determined;
[0088] The loss function is determined based on the first loss function and the second loss function.
[0089] According to one aspect of this disclosure, a molecular processing apparatus is provided, the apparatus comprising:
[0090] The third acquisition unit is used to acquire the atomic information of each of the multiple atoms in the target molecule;
[0091] The second prediction unit is used to input the atomic information of each of the plurality of atoms into the neural network force field model to perform energy prediction and obtain the predicted molecular energy of the molecule.
[0092] A determining unit is used to determine the predicted force of each of the plurality of sample atoms based on the predicted molecular energy, wherein the neural network force field model is trained according to the above-described neural network force field model training method.
[0093] Optionally, the neural network force field model includes an embedding layer and multiple interconnected interaction layers;
[0094] The second prediction unit is used for:
[0095] Based on the atomic information of each of the multiple atoms, feature encoding is performed through the embedding layer to obtain the encoding vector of each of the multiple atoms;
[0096] The atomic encoding vectors of each of the multiple sample atoms are input into the multiple interconnected interaction layers, and the multiple interaction layers output their respective molecular graph features.
[0097] For each interaction layer, energy prediction is performed based on the molecular graph features corresponding to the interaction layer to obtain a preliminary predicted energy.
[0098] The predicted molecular energy is obtained by weighting the preliminary predicted energy of each interaction layer.
[0099] Optionally, the neural network force field model includes an embedding layer and multiple interconnected interaction layers;
[0100] The second prediction unit is used for:
[0101] Based on the atomic information of each of the multiple atoms, feature encoding is performed through the embedding layer to obtain the encoding vector of each of the multiple atoms;
[0102] The atomic encoding vectors of each of the multiple sample atoms are input into the multiple interconnected interaction layers, and the target molecular map features are output by the last interaction layer.
[0103] Energy prediction is performed based on the target molecular map features to obtain the predicted molecular energy.
[0104] According to one aspect of this disclosure, an electronic device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the training method or molecular processing method of the neural network force field model as described above.
[0105] According to one aspect of this disclosure, a computer-readable storage medium is provided, the storage medium storing a computer program that, when executed by a processor, implements the training method or molecular processing method for the neural network force field model as described above.
[0106] According to one aspect of this disclosure, a computer program product is provided, comprising a computer program that is read and executed by a processor of an electronic device, causing the electronic device to perform the training method for a neural network force field model or the molecular processing method as described above.
[0107] In this embodiment, the feature information of multiple interconnected interaction layers in the original model used to train the neural network force field model is utilized during model training. Specifically, firstly, an original model including an embedding layer and multiple interconnected interaction layers is obtained, along with sample atom information and atomic force labels for each sample atom in the sample molecule. Next, using the embedding layer, the sample atom information of each atom is encoded into an atom encoding vector, transforming the sample atom information of each sample atom into a continuous feature vector. Then, the atom encoding vectors of each sample atom are input into the multiple interconnected interaction layers, and feature generation is performed sequentially by each interaction layer. Each interaction layer outputs a corresponding sample molecule map feature, and the atomic force experienced by each sample atom is predicted using the sample molecules of each interaction layer. A loss function is constructed for the predicted atomic force and the actual atomic force label of each interaction layer. In this way, by utilizing the feature information output by each interaction layer and constructing a loss function for each interaction layer, the original model can be trained using the loss functions corresponding to each interaction layer, thereby obtaining the neural network force field model. This approach introduces a constraint mechanism on the output feature information of each interaction layer of the neural network force field model, so that the feature information output by each interaction layer (sample molecular map features) is used in the model training, making full use of the feature information of each interaction layer, rather than relying solely on the final output layer. This can improve the accuracy of the trained neural network force field model in predicting the forces acting on atoms in molecules.
[0108] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the disclosure. The objectives and other advantages of this disclosure may be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description
[0109] The accompanying drawings are provided to further understand the technical solutions of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the technical solutions of this disclosure and do not constitute a limitation on the technical solutions of this disclosure.
[0110] Figure 1 This is a system architecture diagram of a training method or molecular processing method for a neural network force field model according to embodiments of the present disclosure.
[0111] Figure 2 A schematic diagram of the implementation environment of a training method for a neural network force field model according to an embodiment of the present disclosure is shown;
[0112] Figure 3 This is a flowchart of a method for training a neural network force field model according to an embodiment of the present disclosure;
[0113] Figure 4A This is a schematic diagram of the model structure of a neural network force field model according to an embodiment of the present disclosure;
[0114] Figure 4B This is a schematic diagram of the training process of a neural network force field model according to an embodiment of the present disclosure;
[0115] Figure 5 This is a flowchart illustrating the determination of an atomic encoding vector according to an embodiment of this disclosure;
[0116] Figure 6 This is a flowchart illustrating the determination of sample molecular graph features corresponding to the interaction layer, as an embodiment of this disclosure.
[0117] Figure 7 This is a schematic diagram illustrating the process of determining the sample molecular graph features corresponding to the interaction layer in one embodiment of this disclosure;
[0118] Figure 8 This is a flowchart illustrating the determination of the predicted molecular energy corresponding to the interaction layer, according to one embodiment of this disclosure.
[0119] Figure 9 This is a schematic diagram illustrating the process of determining the predicted molecular energy corresponding to the interaction layer in one embodiment of this disclosure;
[0120] Figure 10 This is a flowchart illustrating the determination of sample molecular graph features corresponding to the interaction layer, according to another embodiment of this disclosure.
[0121] Figure 11 This is a schematic diagram illustrating the process of determining the sample molecular graph features corresponding to the interaction layer according to another embodiment of the present disclosure;
[0122] Figure 12 This is a flowchart of determining the predicted molecular energy corresponding to the interaction layer according to another embodiment of the present disclosure;
[0123] Figure 13 This is a schematic diagram illustrating the process of determining the predicted molecular energy corresponding to the interaction layer according to another embodiment of the present disclosure;
[0124] Figure 14 This is a flowchart illustrating the determination of sample molecular graph features corresponding to the interaction layer according to another embodiment of this disclosure;
[0125] Figure 15 This is a schematic diagram illustrating the process of determining the sample molecular graph features corresponding to the interaction layer according to another embodiment of the present disclosure;
[0126] Figure 16 This is a flowchart of determining the predicted molecular energy corresponding to the interaction layer according to another embodiment of the present disclosure;
[0127] Figure 17 This is a flowchart of determining a loss subfunction according to an embodiment of the present disclosure;
[0128] Figure 18 This is a flowchart of training the original model according to an embodiment of the present disclosure;
[0129] Figure 19 This is a flowchart of a molecular processing method according to an embodiment of the present disclosure;
[0130] Figure 20 This is a schematic diagram illustrating the training and application process of a neural network force field model according to an embodiment of the present disclosure;
[0131] Figure 21 This is a block diagram of a training apparatus for a neural network force field model according to an embodiment of the present disclosure;
[0132] Figure 22 This is a block diagram of a molecular processing apparatus according to an embodiment of the present disclosure;
[0133] Figure 23 This is a terminal structure diagram of a training method for a neural network force field model according to an embodiment of the present disclosure;
[0134] Figure 24 This is a server structure diagram of a training method for a neural network force field model according to an embodiment of the present disclosure. Detailed Implementation
[0135] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the scope of this disclosure.
[0136] The system architecture and scenarios in which this disclosure is applied are described below.
[0137] Figure 1 This is a system architecture diagram applied to the training method of the neural network force field model according to embodiments of the present disclosure. It includes an object terminal 140, an Internet 130, a gateway 120, a server 110, and a molecular database 150, etc.
[0138] The object terminal 140 can take various forms, including desktop computers, laptops, PDAs (personal digital assistants), tablets, mobile phones, in-vehicle terminals, home theater terminals, smart TVs, and dedicated terminals. Furthermore, it can be a single device or a collection of multiple devices. The object terminal 140 can communicate with the Internet 130 via wired or wireless means to exchange data. The object terminal 140 is used by the object to submit the strategy for training the neural network force field model to the server, and by the object to submit molecules for energy prediction and atomic force prediction to the server.
[0139] Server 110 refers to a computer system that can provide certain services to object terminal 140. Compared to ordinary object terminal 140, server 110 has higher requirements in terms of stability, security, and performance. Server 110 can be a high-performance computer in a network platform, a cluster of multiple high-performance computers, a portion of a high-performance computer (e.g., a virtual machine), a combination of portions of multiple high-performance computers (e.g., virtual machines), or a cloud server, etc. Server 110 contains various types of services, and the implementation of each service of server 110 is often associated with some intermediate databases or storage media. Server 110 is used to train a neural network force field model that can predict molecular energy and atomic forces from sample molecular data extracted from molecular database 150 according to the received strategy for training neural network force field model, and to predict the molecular energy and the forces on the atoms in the molecules based on the neural network force field model, and to feed back the energy prediction results and atomic force prediction results to the object. The molecular database 150 is used to store molecular information, molecular energy tags, and atomic force tags for each sample molecule. The molecular database 150 can be set up independently or integrated into the processing server 110 or other electronic devices.
[0140] Gateway 120, also known as an internetwork connector or protocol converter, is a computer system or device that acts as a translator, enabling network interconnection at the transport layer. It bridges the gap between two systems using different communication protocols, data formats, languages, or even completely different architectures. Gateways can also provide filtering and security functions. Messages sent from target terminal 140 to server 110 are forwarded to the corresponding server via gateway 120. Messages sent from server 110 to target terminal 140 are also forwarded to the corresponding target terminal 140 via gateway 120.
[0141] The embodiments disclosed herein can be applied in various scenarios, such as Figure 2 A schematic diagram of an implementation environment provided in one embodiment of this application is shown. This implementation environment may include a model training device 10 and a model usage device 20.
[0142] The model training device 10 can be an electronic device such as a mobile phone, desktop computer, tablet computer, laptop computer, vehicle terminal, server, intelligent robot, smart TV, multimedia playback device, or other electronic devices with strong computing power; this application does not limit this. The model training device 10 is used to train the neural network force field model 30.
[0143] In this embodiment, the neural network force field model 30 is a machine learning model. Optionally, the model training device 10 can train the neural network force field model 30 using machine learning to achieve better performance.
[0144] Optionally, the neural network force field model 30 includes: an embedding layer, multiple cascaded interaction layers, and a prediction network. Its training process is as follows (this is only a brief description; for a detailed training process, please refer to the embodiments below, which will not be elaborated here): The embedding layer encodes the sample atom information to obtain the atom encoding vector of the sample atom. Multiple cascaded interaction layers generate features, and each interaction layer outputs sample molecular map features. The prediction network uses the sample molecular map features output by each interaction layer to predict the predicted atomic force of the sample atom corresponding to each interaction layer. The predicted atomic force refers to the force on the sample atom determined by the prediction network based on the output sample molecular map features of each interaction layer. Based on the predicted atomic force and atomic force label of the sample atoms in each interaction layer, a sub-loss function corresponding to each interaction layer is determined. The parameters of the neural network force field model are adjusted according to multiple sub-loss functions to obtain the trained neural network force field model.
[0145] In some embodiments, the model-using device 20 may be an electronic device such as a mobile phone, desktop computer, tablet computer, laptop computer, in-vehicle terminal, server, intelligent robot, smart TV, multimedia playback device, or other electronic devices with strong computing power; this application does not limit this. The trained neural network force field model can perform the task of predicting molecular energy and the forces acting on atoms in molecules.
[0146] The model training device 10 and the model usage device 20 can be two separate devices or the same device.
[0147] The method provided in this application embodiment can be executed by a computer device, which refers to an electronic device with data computing, processing, and storage capabilities. When the electronic device is a server, the server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The computer device can be... Figure 1The model training device 10 can also be the model usage device 20.
[0148] The embodiments of this disclosure are described in general below.
[0149] According to one embodiment of this disclosure, a method for training a neural network force field model is provided.
[0150] The training method for this neural network force field model is generally applied in molecular dynamics simulation scenarios that require prediction of molecular energy and forces acting on atoms within molecules. This disclosure provides a model training scheme for the neural network force field model that uses the output features of each interaction layer to jointly calculate the loss, thereby improving the accuracy of the neural network force field model in predicting the forces acting on atoms within molecules.
[0151] like Figure 3 As shown, the training method for a neural network force field model according to an embodiment of this disclosure can be executed by an electronic device, which may be... Figure 1 The server or object terminal shown. A method for training a neural network force field model according to an embodiment of this disclosure may include:
[0152] Step 310: Obtain the original model;
[0153] Step 320: Obtain sample molecule information;
[0154] Step 330: Based on the sample atom information of each of the multiple sample atoms, feature encoding is performed through the embedding layer to obtain the atom encoding vector of each of the multiple sample atoms;
[0155] Step 340: Input the atomic encoding vectors of each of the multiple sample atoms into the concatenated interaction layers;
[0156] Step 350: For each interaction layer, force prediction is performed based on the sample molecular graph features corresponding to the interaction layer to obtain the predicted atomic force of each sample atom in the interaction layer, and the loss sub-function corresponding to the interaction layer is determined based on the predicted atomic force and atomic force label of each sample atom.
[0157] Step 360: Based on the loss sub-functions corresponding to each interaction layer, train the original model to obtain the neural network force field model.
[0158] Steps 310-360 are described in detail below.
[0159] In step 310, the original model is obtained.
[0160] The original model is an untrained neural network model. The original model consists of an embedding layer and multiple cascaded interaction layers.
[0161] The embedding layer is used to convert atomic information such as the atom type and position of each atom in the input molecule into a continuous feature vector.
[0162] The interaction layer is used to capture the complex interactions between atoms in the input molecule and update the feature vectors of each atom.
[0163] In a specific implementation of this embodiment, with authorization, an existing neural network model can be directly called from a preset model library as the original model; alternatively, a neural network model can be built using a model building tool according to different business needs, and the built neural network model can be used as the original model.
[0164] In step 320, sample molecule information of sample molecules is obtained.
[0165] Sample molecules refer to molecules whose actual molecular energy and the force conditions of the sample atoms they contain are known, and are used to train a neural network force field model. Sample molecules include, but are not limited to, material molecules and biomolecules.
[0166] Sample molecule information is used to indicate the molecular chemical properties, three-dimensional structure, and other information of sample molecules.
[0167] The sample molecule information includes the individual sample atom information and atomic force tags of each sample atom in the sample molecule.
[0168] Sample atoms refer to the individual atomic elements that make up the sample molecule.
[0169] Sample atom information is used to indicate the atom type, three-dimensional coordinates, and other information of the sample atoms in the sample molecule.
[0170] Atomic force labels are used to indicate the actual force experienced by the atoms in a sample.
[0171] In this specific implementation, with authorization, a pre-defined cheminformatics toolkit is invoked. Based on the invoked toolkit, information is extracted from sample molecules in the molecular database to obtain sample molecule information. The pre-defined cheminformatics toolkit can be RDKit, etc.
[0172] In step 330, based on the sample atom information of each of the multiple sample atoms, feature encoding is performed through the embedding layer to obtain the atom encoding vector of each of the multiple sample atoms.
[0173] Atom encoding vectors are used to indicate the representation of atomic information of sample atoms in the latent vector space.
[0174] In this specific implementation, the sample atom information of each of the multiple sample atoms is input into the embedding layer. The embedding layer maps the sample atom information of each of the multiple sample atoms from the data space to the latent vector space to obtain the atom encoding vector of each of the multiple sample atoms.
[0175] In step 340, the atomic encoding vectors of each of the multiple sample atoms are input into multiple concatenated interaction layers.
[0176] Each interaction layer outputs the molecular graph features of the sample corresponding to the interaction layer.
[0177] Sample molecular graph features are used to indicate the representation of the overall information of sample molecules (including molecular structure information, molecular property information, etc.) in the latent vector space.
[0178] To save space, the specific process of inputting the atomic encoding vectors of multiple sample atoms into multiple cascaded interaction layers and having each interaction layer output the sample molecular map features corresponding to the interaction layer will be described in detail below, and will not be repeated here.
[0179] In step 350, for each interaction layer, force prediction is performed based on the sample molecular graph features corresponding to the interaction layer to obtain the predicted atomic force of each sample atom in the interaction layer, and the loss sub-function corresponding to the interaction layer is determined based on the predicted atomic force and atomic force label of each sample atom.
[0180] Predicted atomic forces are used to indicate the forces acting on sample atoms in a sample molecule, predicted based on the sample molecule graph features output by the interaction layer, during a given training iteration.
[0181] The loss function is used to indicate the overall difference between the forces predicted to be experienced by multiple sample atoms in a sample molecule based on the sample molecule graph features output by the interaction layer during model training and the actual forces experienced.
[0182] To save space, the specific process of force prediction based on the sample molecular graph features corresponding to the interaction layer in this embodiment of the present disclosure, and the specific process of determining the loss sub-function corresponding to the interaction layer based on the predicted atomic force and atomic force label of each sample atom, will be described in detail below, and will not be repeated here.
[0183] In step 360, the original model is trained based on the loss function corresponding to each interaction layer to obtain the neural network force field model.
[0184] The neural network force field model of this disclosure is a neural network model used to predict molecular energy and atomic forces in molecules. The neural network force field model prediction often takes molecular information of molecules and atomic information of each atom in molecules as inputs, and takes molecular energy of molecules and forces on each atom in molecules as outputs.
[0185] To save space, the specific process of training the original model based on the loss sub-functions corresponding to each interaction layer to obtain the neural network force field model in this embodiment will be described in detail below, and will not be repeated here.
[0186] like Figure 4A The diagram shown is a schematic representation of the neural network force field model (the trained original model) according to an embodiment of this disclosure. Specifically, the neural network force field model includes an embedding layer, multiple cascaded interaction layers (taking three interaction layers as an example, but not limited to three layers), and a prediction network. After the sample molecule information (or the target molecule's molecular information) is input into the neural network force field model, the embedding layer, the multiple cascaded interaction layers, and the prediction network sequentially process the input molecular information, finally outputting the predicted molecular energy of the sample molecule (or the predicted molecular energy of the target molecule).
[0187] like Figure 4B The diagram illustrates a specific embodiment of the training neural network force field model of this disclosure. Specifically, after inputting the sample molecule information into the original model, the embedding layer converts the sample molecule information into a continuous feature vector. Next, the first interaction layer processes the feature vector of the input sample molecule information, outputting sample molecule graph feature 1; the second interaction layer processes sample molecule graph feature 1, outputting sample molecule graph feature 2; and the second interaction layer processes sample molecule graph feature 2, outputting sample molecule graph feature 3. Further, force prediction is performed based on sample molecule graph feature 1, sample molecule graph feature 2, and sample molecule graph feature 3, respectively, to obtain the predicted atomic force 1 of each sample atom in the sample molecule predicted by sample molecule graph feature 1, the predicted atomic force 2 of each sample atom in the sample molecule predicted by sample molecule graph feature 2, and the predicted atomic force 3 of each sample atom in the sample molecule predicted by sample molecule graph feature 2. Next, based on the difference between the predicted atomic force 1 and the force label of the sample atoms, the sub-loss function Loss1 is determined; based on the difference between the predicted atomic force 2 and the force label of the sample atoms, the sub-loss function Loss2 is determined; and based on the difference between the predicted atomic force 3 and the force label of the sample atoms, the sub-loss function Loss3 is determined. Further, based on the weighted sum of the sub-loss functions Loss1, Loss2, and Loss3, the total loss function Loss is determined, and the original model is trained based on the total loss function to obtain the neural network force field model.
[0188] Through steps 310-360 above, in this embodiment of the disclosure, the feature information of multiple interconnected interaction layers in the original model used to train the neural network force field model is considered during model training. Specifically, firstly, an original model including an embedding layer and multiple interconnected interaction layers is obtained, along with sample atom information and atomic force labels for each sample atom in the sample molecule. Next, using the embedding layer, the sample atom information of each atom is encoded into an atom encoding vector, transforming the sample atom information of each sample atom into a continuous feature vector. Then, the atom encoding vectors of each sample atom are input into the multiple interconnected interaction layers, and feature generation is performed sequentially by each interaction layer. Each interaction layer outputs a corresponding sample molecule map feature, and the atomic force experienced by each sample atom is predicted using the sample molecules of each interaction layer. A loss function is constructed for the predicted atomic force and the actual atomic force label of each interaction layer. In this way, by utilizing the feature information output by each interaction layer and constructing a loss function for each interaction layer, the original model can be trained together using the loss functions corresponding to each interaction layer, thereby obtaining the neural network force field model. This approach introduces a constraint mechanism on the output feature information of each interaction layer of the neural network force field model, so that the feature information output by each interaction layer (sample molecular map features) is used in the model training, making full use of the feature information of each interaction layer, rather than relying solely on the final output layer. This can improve the accuracy of the trained neural network force field model in predicting the forces acting on atoms in molecules.
[0189] The above is a general description of steps 310-360. Since steps 310 and 320 have been detailed in the above general description, the specific implementations of steps 330, 340, 350 and 360 will be described in detail below.
[0190] Step 330 will be described in detail below.
[0191] In step 330, based on the sample atom information of each of the multiple sample atoms, feature encoding is performed through the embedding layer to obtain the atom encoding vector of each of the multiple sample atoms.
[0192] In this embodiment of the disclosure, the sample atom information includes the atom type and three-dimensional coordinates of the sample atom.
[0193] Atom type is used to indicate the type of chemical element to which the sample atoms belong.
[0194] Atomic three-dimensional coordinates are used to indicate the specific position of sample atoms in three-dimensional space. These coordinates are typically represented using Cartesian coordinates. Atomic three-dimensional coordinates directly determine the spatial configuration of sample molecules and the interactions between them.
[0195] Please refer to Figure 5 In one embodiment, step 330 specifically includes, but is not limited to, the following steps 510-540:
[0196] Step 510: For each sample atom, encode the atom type to obtain the sample atom type encoding vector;
[0197] Step 520: Determine the atomic distance between the sample atom and each other sample atom based on the atomic three-dimensional coordinates of the sample atom and the atomic three-dimensional coordinates of each other sample atom directly connected to the sample atom in the sample molecule.
[0198] Step 530: Encode the atomic distance between the sample atom and each other sample atom to obtain the distance encoding vector of the sample atom;
[0199] Step 540: Integrate the type encoding vector and the distance encoding vector into an atomic encoding vector.
[0200] Steps 510-540 are described in detail below.
[0201] In step 510, the type encoding vector is used to indicate the vector representation of the atom type of the sample atom in the latent vector space.
[0202] In the specific implementation of this embodiment, for each sample atom, the atom type is subjected to unique heat processing to obtain the type encoding vector of the sample atom.
[0203] In step 520, atomic distance is used to indicate the relative positional relationship between two sample atoms in a sample molecule.
[0204] In this specific implementation, for each sample atom, other sample atoms directly connected to that sample atom in the sample molecule are identified. Then, for each other sample atom directly connected to that sample atom, based on the atomic three-dimensional coordinates of the sample atom and the atomic three-dimensional coordinates of the other sample atom directly connected to the sample atom, the Euclidean distance between the sample atom and the other sample atom is calculated, and the calculated Euclidean distance is determined as the atomic distance between the sample atom and that other sample atom.
[0205] In step 530, the distance encoding vector is used to indicate the vector representation of the atomic distance between the sample atom and each other sample atom in the latent vector space.
[0206] In the specific implementation of this embodiment, for the atomic distance between the sample atom and each other sample atom, a Gaussian kernel function is used to map the atomic distance to a high-dimensional space, thereby obtaining the distance encoding vector between the sample atom and each other sample atom.
[0207] In step 540, the type encoding vector and the distance encoding vector are combined into the same vector group to integrate them. Simultaneously, this vector group is used as the atomic encoding vector.
[0208] The advantage of this embodiment is that the atom type determines the chemical properties of the sample atoms, and the atomic distance determines the spatial position between the sample atoms. By integrating the type encoding vector and the distance encoding vector into the atom encoding vector, the type encoding vector can provide local chemical information of a single sample atom, and the distance encoding vector can provide global geometric information of the sample molecule. This allows the atom encoding vector to contain both local and global structural features, improving the comprehensiveness of the feature information of the atom encoding vector. Compared with using only the atom type or only the atomic distance, using the atom encoding vector can significantly improve the accuracy of the model's prediction of atomic forces in the sample molecule.
[0209] In one embodiment, step 540 may include, but is not limited to, the following steps:
[0210] Extracting the orientation information of sample atoms from sample molecular information;
[0211] The directional information is encoded to obtain the directional encoding vector of the sample atom;
[0212] The type encoding vector, direction encoding vector, and distance encoding vector are integrated into an atomic encoding vector.
[0213] The orientation information is used to indicate the relative orientation of a sample atom with other sample atoms. The orientation encoding vector is used to indicate the vector representation of the relative orientation of a sample atom and each other sample atom in the latent vector space.
[0214] Specifically, firstly, the three-dimensional coordinates of the sample atoms in the Cartesian coordinate system are converted into angular information in the spherical coordinate system, and this angular information is determined as the orientation information of the sample atoms. Next, the orientation information of the sample atoms is input into a spherical harmonic function to encode the orientation information, obtaining the orientation encoding vector of the sample atoms. Finally, the type encoding vector, distance encoding vector, and orientation encoding vector are combined into a single vector group, and this vector group is used as the atom encoding vector.
[0215] The advantage of this embodiment is that, when training the neural network force field model, in addition to considering the sample atom type and the relative distance between sample atoms, the relative direction between sample atoms is also taken into account. The atom encoding vector is generated by combining the type encoding vector, direction encoding vector, and distance encoding vector as the basis for the model to predict the force on the sample atom, which can improve the accuracy of the trained neural network force field model in predicting the force on the atom in the molecule.
[0216] Steps 340-350 are described in detail below.
[0217] In steps 340-350, the atomic encoding vectors of multiple sample atoms are input into multiple cascaded interaction layers, and each interaction layer outputs the sample molecular graph features corresponding to the interaction layer. For each interaction layer, force prediction is performed based on the sample molecular graph features corresponding to the interaction layer to obtain the predicted atomic force of each sample atom in the interaction layer. Based on the predicted atomic force and atomic force label of each sample atom, the loss function corresponding to the interaction layer is determined.
[0218] Since the interaction layer and prediction network of the neural network force field model in this embodiment can be diverse, steps 340-350 will be described in detail below in conjunction with several network structures of the interaction layer and prediction network of the neural network force field model.
[0219] When a neural network force field model includes an embedding layer, multiple cascaded interaction layers, and a prediction network, the network structure of a single interaction layer is as follows: Figure 7 The network structure shown is the predicted network structure. Figure 9 When referring to the network structure shown, please refer to... Figure 5 In one embodiment, step 340 specifically includes, but is not limited to, the following steps 610-650:
[0220] Step 610: For each interaction layer, based on the atomic encoding vectors of each of the multiple sample atoms, determine the input features of each of the multiple sample atoms in the interaction layer;
[0221] Step 620: For each sample atom, based on the relative position features, generate weights using a preset function to obtain the interaction weights of other sample atoms on the sample atom;
[0222] Step 630: Perform feature weighting based on the atomic scalar features and interaction weights of each other sample atom to obtain the atomic interaction features of the sample atom;
[0223] Step 640: Concatenate the atomic interaction features and atomic scalar features of the sample atoms to obtain the atomic concatenation features;
[0224] Step 650: Based on the atomic splicing features of each of the multiple sample atoms, determine the sample molecular graph features corresponding to the interaction layer.
[0225] Steps 610-650 are described in detail below.
[0226] In step 610, the input features include the atomic scalar features of the sample atoms and the relative position features between the sample atoms and other sample atoms.
[0227] Atomic scalar features are used to indicate the atomic element information of a sample atom. Relative position features are used to indicate the relative positional relationship between a sample atom and other sample atoms.
[0228] In this specific implementation, when the interaction layer is the first of multiple cascaded interaction layers, the atomic scalar features and relative position features in the input features are directly determined based on the atomic encoding vectors of the sample atoms. For example, the type encoding vector in the atomic encoding vector is used as the atomic scalar feature, and the distance encoding vector is used as the relative position feature. When the interaction layer is any of the other interaction layers in multiple cascaded interaction layers besides the first one, the input features are determined based on the sample molecular graph features output by the previous interaction layer. For example, the input features of the sample atoms in the current interaction layer are determined based on the atomic splicing features of the sample atoms in the sample molecular graph features output by the previous interaction layer.
[0229] In step 620, the interaction weights are used to indicate the degree of interdependence of a sample atom with respect to each other sample atom. The preset function is the Rbf function.
[0230] In the specific implementation of this embodiment, firstly, for each sample atom among multiple sample atoms, for each of the other sample atoms corresponding to that sample atom, a convolution kernel is generated based on the relative position features between the sample atom and the other sample atoms according to a preset function, resulting in an atomic convolution kernel. Then, linear and nonlinear transformations are performed on the atomic convolution kernel to obtain the interaction weights of the other sample atoms with respect to the sample atom. The relative position features can be the Euclidean norm between the three-dimensional coordinate vectors of the sample atom and the three-dimensional coordinate vectors of the other sample atoms.
[0231] In step 630, the atomic interaction feature is used to indicate the overall dependence of a sample atom on other sample atoms in terms of feature information.
[0232] In the specific implementation of this embodiment, for each sample atom among multiple sample atoms, for each other sample atom among multiple other sample atoms corresponding to that sample atom, the atomic scalar features and interaction weights of the other sample atom are multiplied to obtain the atomic weighted scalar features of the other sample atom, and the atomic weighted scalar features of the multiple other sample atoms corresponding to that sample atom are added together to obtain the atomic interaction features of the sample atom.
[0233] It should be noted that, in order to reduce the model's learning of noise or irrelevant information, the atomic interaction features of the sample atoms can also be obtained by weighting the features based solely on the atomic scalar features and interaction weights of other sample atoms that are directly connected to the sample atoms.
[0234] In step 640, the atomic splicing feature is used to indicate the atomic information of the sample atom itself and the dependency information of the sample atom on other sample atoms.
[0235] In the specific implementation of this embodiment, for each sample atom, the atomic interaction feature corresponding to the sample atom and the atomic scalar feature of the sample atom are added together to obtain the atomic splicing feature.
[0236] In step 650, based on the order of each sample atom in the sequence of the sample molecule and the atomic splicing features of each sample atom, the sample atoms are treated as nodes, and the nodes corresponding to directly connected sample atoms are connected by edges. The atomic splicing features are used as the node features of the nodes, forming the sample molecule graph features corresponding to the interaction layer. Here, the sample molecule graph features are a feature graph structure.
[0237] like Figure 7The diagram illustrates the process of generating sample molecular graph features using a single interaction layer. Specifically, each interaction layer comprises a neural network layer, a feature-weighted network layer, another neural network layer, a preset activation function, and another neural network layer connected sequentially. The feature-weighted network layer includes a positional interaction layer, a preset function, a fully connected layer, a preset activation function, a fully connected layer, and a preset activation function connected sequentially. Based on this, firstly, the atomic scalar features of each sample atom are input into the neural network layer, converting them into 64-dimensional feature vectors. Next, the 64-dimensional atomic scalar features and relative positional features of each sample atom are input into the feature-weighted network layer. In this layer, the relative positional features of the sample atom and other sample atoms are first input into the positional interaction layer. The positional interaction layer outputs the positional interaction information between the sample atom and other sample atoms. The preset function then generates atomic convolution kernels by performing convolution kernels on each positional interaction information. Finally, the atomic convolution kernels are subjected to linear and nonlinear transformations through a fully connected layer and the preset activation function Shifted Softplus to obtain the interaction weights between other sample atoms. Simultaneously, for each sample atom among multiple sample atoms, for each of the other sample atoms corresponding to that sample atom, the atomic scalar features and interaction weights of the other sample atom are multiplied to obtain the atomic weighted scalar features of that other sample atom. The atomic weighted scalar features of the other sample atoms corresponding to that sample atom are then summed, and the atomic interaction features of each sample atom are output by the feature weighted network layer. Further, in the interaction layer, the atomic interaction features of each sample atom output by the feature weighted network layer are sequentially subjected to linear and nonlinear transformations using a neural network layer, a preset activation function (Shifted softplus), and another neural network layer, to obtain the final atomic interaction features of each sample atom. Finally, for each sample atom, the final atomic interaction features and atomic scalar features are concatenated to obtain atomic concatenation features, and sample molecular graph features are generated based on the atomic concatenation features of multiple sample atoms.
[0238] The advantage of this embodiment is that the feature-weighted network layer in each interaction layer can dynamically generate atomic convolution kernels based on the atomic distances between sample atoms. These kernels, after linear and nonlinear transformations, serve as interaction weights, and the atomic interaction features between sample atoms and other sample atoms are determined based on these weights. This captures the complex distance dependencies between atoms, enabling the model to accurately simulate atomic interactions rather than simply capturing bonding relationships. Furthermore, the concept of truncation distance is introduced in the interaction layer, limiting the information transmission range between atoms. This ensures that each sample atom only exchanges information with its nearest neighbors, rather than communicating with all sample atoms in the entire molecule. This significantly reduces computational burden and minimizes noise or irrelevant information that the model might learn. Through designs such as connection filtering convolution, localized information transmission, residual connections, and nonlinear activation, the interaction layer in this approach efficiently captures the complex interactions between sample atoms, generating high-quality sample molecule graph features for energy and force prediction. This improves the accuracy of energy and atomic force predictions in the neural network force field model.
[0239] In this embodiment, the specific process of performing force prediction based on the sample molecular graph features corresponding to the interaction layer in step 350 to obtain the predicted atomic forces of each sample atom in the interaction layer may include, but is not limited to, the following steps:
[0240] For each interaction layer, energy prediction is performed based on the features of the sample molecular graph to obtain the predicted molecular energy of the sample molecule;
[0241] For each sample atom among multiple sample atoms, extract the atom position information of the sample atom from the sample atom information;
[0242] The predicted atomic force of the sample atom is obtained by calculating the derivative based on the predicted molecular energy and atomic position information.
[0243] Specifically, the predicted molecular energy indicates the energy state of the sample molecule predicted based on the characteristics of the sample molecular map. Atomic position information indicates the specific location of the sample atoms in three-dimensional space (Cartesian coordinates).
[0244] Specifically, for each interaction layer, energy prediction is performed based on the features of the sample molecule graph. The specific process for obtaining the predicted molecular energy of the sample molecule will be described in detail below. It will not be elaborated here. Further, for each sample atom among multiple sample atoms, the atomic position information of the sample atom can be extracted from the SMILES string or PDB file of the sample molecule using computational chemistry software (such as RDKit, OpenBabel). Finally, the partial derivative of the predicted molecular energy with respect to the atomic position of each sample atom is used to obtain the predicted value of the atomic force corresponding to the sample atom. This predicted value is used as the predicted atomic force of the sample atom. Here, the atomic force is the negative gradient of the molecular energy with respect to the atomic position, and the predicted atomic force of the sample atom can be expressed as follows:
[0245]
[0246] Where E refers to the molecular energy determined based on the characteristics of the sample molecular map. This refers to the force exerted on the atoms in the sample. This refers to the atomic position of the sample atoms.
[0247] The advantage of this embodiment is that, for each sample molecular graph feature output by the interaction layer, a predicted molecular energy of a sample molecule is predicted, and based on the predicted molecular energy and the atomic position of each sample atom, an atomic force is calculated for each sample atom. This ensures that each interaction layer corresponds to a predicted molecular energy and a set of predicted atomic forces, enabling effective utilization of the output features of each interaction layer. This improves the model's ability to learn complex intermolecular interactions during training, and to discover and learn more potential features, thereby improving the predictive performance of the trained neural network force field model.
[0248] Further, please refer to Figure 8 In this embodiment, the specific process of energy prediction based on sample molecular map features may include, but is not limited to, the following steps 810-850:
[0249] Step 810: For each interaction layer, perform a first dimensionality reduction on the sample molecular graph features to obtain the first dimensionality reduction graph features;
[0250] Step 820: Activate the first dimensionality reduction graph features based on a preset activation function to obtain activated graph features;
[0251] Step 830: Perform a second dimensionality reduction on the activation graph features to obtain the second dimensionality-reduced graph features;
[0252] Step 840: Perform global pooling on the second dimensionality reduction graph features to obtain molecular pooling features;
[0253] Step 850: Based on molecular pooling features, perform energy prediction to obtain the predicted molecular energy corresponding to the interaction layer.
[0254] Steps 810-850 are described in detail below.
[0255] In step 810, the first dimensionality-reduced graph feature is used to indicate the feature representation of the sample molecular graph feature corresponding to the interaction layer in the low-dimensional vector space. Specifically, the first dimensionality-reduced graph feature is a 32-dimensional feature, and the sample molecular graph feature is a 64-dimensional feature.
[0256] In the specific implementation of this embodiment, for each interaction layer, the sample molecular graph features are mapped to a low-dimensional vector space to achieve the first dimensionality reduction processing of the sample molecular graph features, reducing the 64-dimensional sample molecular graph features to 32-dimensional first dimensionality reduction graph features.
[0257] In step 820, the preset activation function refers to the Shifted softplus activation function. The activation map features are used to indicate the feature representation formed by the nonlinear transformation of the first dimensionality reduction map features through the preset activation function.
[0258] In this specific implementation, a preset activation function is used to perform a nonlinear transformation on the first dimensionality reduction graph features to obtain the activation graph features. Taking the Shifted softplus activation function as an example, for the dimensionality reduction features corresponding to each sample atom in the first dimensionality reduction graph features, the activation features corresponding to these dimensionality reduction features in the activation graph features can be expressed as follows:
[0259] ssp(x)=ln(0.5e x +0.5);
[0260] Where ssp(x) represents the activation feature corresponding to the dimensionality reduction feature of each sample atom in the activation map feature, and x represents the dimensionality reduction feature of each sample atom in the first dimensionality reduction map feature.
[0261] In step 830, the second dimensionality-reduced graph feature is used to indicate the feature representation of the sample molecular graph features corresponding to the interaction layer in the low-dimensional vector space. The second dimensionality-reduced graph feature is a one-dimensional feature.
[0262] In the specific implementation of this embodiment, the activation graph features are mapped to a low-dimensional vector space to achieve the second dimensionality reduction process of the activation graph features, reducing the 32-dimensional activation graph features to a 1-dimensional second dimensionality reduction graph feature.
[0263] In step 840, molecular pooling features are used to indicate the overall interaction features of sample molecules.
[0264] In the specific implementation of this embodiment, since the second dimension reduction graph feature is a collection of atomic interaction features of each sample atom, the one-dimensional atomic interaction features of each sample atom in the second dimension reduction graph feature are summed to obtain the molecular pooling feature.
[0265] In step 850, a multilayer perceptron can be used to process the molecular pooling features, and the multilayer perceptron outputs the energy prediction value of the sample molecule corresponding to the interaction layer, and the output energy prediction value is used as the predicted molecule energy corresponding to the interaction layer.
[0266] like Figure 9 The diagram illustrates the specific application of a neural network force field model for energy prediction. Specifically, the neural network force field model prediction network comprises a neural network layer, a preset activation function, another neural network layer, and a global pooling layer connected sequentially. First, the sample molecular graph features are input into the neural network layer, reducing the 64-dimensional sample molecular graph features to a 32-dimensional first-dimensionality graph feature. Next, the preset activation function is used to perform a nonlinear transformation on the first-dimensionality graph feature to obtain the activation graph feature. Further, the activation graph feature is input into the neural network layer, reducing the 32-dimensional activation graph feature to a 1-dimensional second-dimensionality graph feature. Since the second-dimensionality graph feature is a set of atomic interaction features of each sample atom, the 1-dimensional atomic interaction features of each sample atom in the second-dimensionality graph feature are input into the global pooling layer for feature summation, obtaining the molecular pooling feature. Finally, a multilayer perceptron is used to process the molecular pooling feature, and the multilayer perceptron outputs the predicted molecular energy corresponding to the interaction layer.
[0267] The advantage of this embodiment is that multiple dimensionality reductions of the sample graph features can effectively reduce the feature dimensions and computational complexity while retaining key feature information. Activating the first dimensionality-reduced graph features using an activation function enables the neural network force field model to capture complex feature relationships during training. Global pooling of the second dimensionality-reduced graph features integrates the feature vectors of all sample atoms into molecular-level feature vectors. This feature integration from local to global perspective better characterizes the properties of the entire molecule. Energy prediction based on molecular pooling features can more accurately reflect the energy state of the sample molecule. This approach, by progressively extracting and updating atomic features in the molecular graph, improves the model's ability to mine and learn feature information during training, thereby enhancing the accuracy of the neural network force field model's prediction of molecular energy.
[0268] When a neural network force field model includes an embedding layer, multiple cascaded interaction layers, and a prediction network, the network structure of a single interaction layer is as follows: Figure 11 The network structure shown is the predicted network structure. Figure 13 When referring to the network structure shown, please refer to... Figure 10In one embodiment, step 340 specifically includes, but is not limited to, the following steps 1010-1060:
[0269] Step 1010: For each interaction layer, based on the atomic encoding vectors of each of the multiple sample atoms, determine the input features of each of the multiple sample atoms in the interaction layer;
[0270] Step 1020: For each sample atom, based on the relative position features, generate weights using a preset function to obtain the interaction weights of other sample atoms on the sample atom;
[0271] Step 1030: Perform feature weighting based on the atomic scalar features and interaction weights of each other sample atom to obtain the atomic interaction features of the sample atom;
[0272] Step 1040: Based on atomic interaction features and relative position features, update the atomic vector features to obtain the updated vector features of the sample atoms;
[0273] Step 1050: Perform feature fusion on the atomic interaction features and the updated vector features to obtain the atomic fusion features of the sample atoms;
[0274] Step 1060: Based on the atomic fusion characteristics of multiple sample atoms, determine the sample molecular graph features corresponding to the interaction layer.
[0275] Steps 1010-1060 are described in detail below.
[0276] In step 1010, the input features include the atomic scalar features, atomic vector features, and relative position features between the sample atoms and other sample atoms.
[0277] Atomic vector features are used to indicate the directional characteristics of sample atoms.
[0278] In the specific implementation of this embodiment, the process of step 1010 is similar to that of step 610 described above. To save space, it will not be repeated here.
[0279] In step 1020, firstly, for each sample atom, and for each of the other sample atoms corresponding to that sample atom, the relative position features are input into a preset function (RBF function). The preset function outputs the convolution kernel weights, and then the convolution kernel weights are linearly transformed by a preset weight matrix and a preset bias vector to obtain the transformed convolution kernel weights. Finally, the transformed convolution kernel weights are truncated using a truncation function to obtain the interaction weights of each other sample atom with respect to the sample atom.
[0280] In step 1030, firstly, for each sample atom and for each of the other sample atoms corresponding to that sample atom, the atomic scalar features of each other sample atom are linearly transformed using a weight matrix and a bias vector. The transformed atomic scalar features are then applied to an activation function (e.g., the SiLU function) to obtain atomic activation features. Next, a linear transformation is performed on these atomic activation features using a weight matrix and a bias vector to increase their dimensionality, resulting in increased-dimensional features for each other sample atom. These increased-dimensional features are then multiplied by interaction weights to obtain weighted atomic features for each other sample atom. Finally, the weighted atomic features of the other sample atoms corresponding to each sample atom are summed to obtain the atomic interaction features.
[0281] In step 1040, the updated vector features are used to indicate the update results of the vector feature information of the sample atoms.
[0282] In the specific implementation of this embodiment, for each sample atom, for each other sample atom corresponding to the sample atom, the atomic interaction features of the sample atom, the relative position features with the other sample atom, and the atomic vector features of the other sample atom are fused to obtain the atomic vector update features of each other sample atom. The atomic vector update features of multiple other sample atoms corresponding to the sample atom are then added together to obtain the update vector features of the sample atom.
[0283] In step 1050, the atomic interaction features and update vector features of each sample atom are incorporated into the same vector group to achieve feature fusion of the atomic interaction features and update vector features, thereby obtaining the atomic fusion features of the sample atom.
[0284] The specific process of step 1060 is similar to that of step 650 above. To save space, it will not be described in detail again.
[0285] like Figure 11The diagram illustrates the process of generating sample molecular graph features in a single interaction layer. Specifically, the interaction layer includes a message passing module and a message update module. First, the vector features, scalar features, and relative position features of each sample atom are input into the message passing module. Next, in the message passing module, on the one hand, based on the relative position features of the sample atom and other sample atoms, the relative position features are encoded using radial basis functions, and the encoding results are linearly transformed and truncated to obtain the interaction weights between the sample atom and other sample atoms; on the other hand, the atomic scalar features of the other sample atoms corresponding to the sample atom are linearly transformed and activated to obtain the upgraded features corresponding to each other sample atom; then, the upgraded features and interaction weights corresponding to each other sample atom are multiplied to obtain the atomic interaction features of the sample atom. Further, based on the atomic vector features, weighted atomic features, and relative position features of each other sample atom with respect to the sample atom, the vector update vectors of other sample atoms relative to the sample atom (the aforementioned atomic vector update features) are determined, and then the vector update vectors of other sample atoms relative to the sample atom are vector-summed to obtain the updated vector features of the sample atom. Furthermore, the sum of the atomic interaction features and the first feature of the atomic scalar features of each sample atom, and the sum of the second feature of the updated vector features and the second feature of the atomic vector features, are input into the message update module. In the message update module, two different linear transformations are performed on the sum of the second features of multiple other sample atoms for each sample atom to obtain the first feature transformation result and the second feature transformation result. The second feature transformation result is concatenated with the sum of the first feature to obtain a concatenated vector. This concatenated vector is then subjected to a linear transformation (based on bias vectors and weight matrices) and activation processing (based on the SiLU function) to obtain a vector processing result. Further, the vector processing result is segmented into vector features and scalar features. The scalar features are determined as the final atomic interaction features of the sample atom, and the sum of the vector features and the first feature transformation result is determined as the final updated vector feature of the sample atom. The atomic interaction features and the updated vector features are then incorporated into the same vector group to obtain the atomic fusion features of the sample atom.
[0286] The advantage of this embodiment is that, in the interaction layer, the vector and scalar features of sample atoms are updated by simulating the interactions between sample atoms. The message passing module is used to calculate the interaction weights between each sample atom and other sample atoms, and to determine the interaction between each sample atom. The message update module is used to integrate the interactions between atoms into the feature information of the sample atoms. This allows the model to effectively simulate the complex interactions within molecules in the interaction layer, and improves the richness and accuracy of the feature information of the molecular graph features output by each interaction layer. As a result, the accuracy of the model in energy and force prediction based on molecular graph features is improved.
[0287] In this embodiment, the specific process of force prediction based on the sample molecular graph features corresponding to the interaction layer in step 350 to obtain the predicted atomic forces of each sample atom in the interaction layer is similar to that described above. However, the energy prediction method in this embodiment differs from the energy prediction method in the above embodiment.
[0288] Please refer to Figure 12 In this embodiment, the specific process of energy prediction based on sample molecular map features may include, but is not limited to, the following steps 1210-1240:
[0289] Step 1210: For each interaction layer, perform a linear transformation on the sample molecular graph features based on the first preset weight matrix and the first preset bias vector to obtain the first transformed graph features;
[0290] Step 1220: Activate the first transformation map features based on a preset activation function to obtain activated map features;
[0291] Step 1230: Perform a linear transformation on the activation map features based on the second preset weight matrix and the second preset bias vector to obtain the second transformed map features;
[0292] Step 1240: Perform energy prediction based on the features of the second transformation graph to obtain the predicted molecular energy corresponding to the interaction layer.
[0293] Steps 1210-1240 are described in detail below.
[0294] In step 1210, the first preset weight matrix is used to indicate the weight parameters of the atomic interaction features of each sample atom in the sample molecular graph features. The first preset bias vector is used to indicate the offset degree of the atomic interaction features of each sample atom. The first transformation graph feature is used to indicate the result of linear transformation of each atomic interaction feature in the sample molecular graph features.
[0295] In this specific implementation, for each interaction layer, a product operation is performed on the first preset weight matrix and the sample molecular graph features, so that each atomic interaction feature in the sample molecular graph features is multiplied with its corresponding weight parameter to obtain a product result; then, the product result is added to the first preset bias vector, so that the product result of each atomic interaction feature and its corresponding weight parameter is added with the same bias vector to obtain the first transformation graph features.
[0296] For each atomic interaction feature in the sample molecular graph features, the transformation graph feature corresponding to that atomic interaction feature in the first transformation graph features can be expressed as follows:
[0297] x i ′ =Wxi +b;
[0298] Where, x i ′ The transformation graph feature corresponding to the atomic interaction feature of the i-th sample atom in the first transformation graph feature is shown, x i Let represent the atomic interaction feature of the i-th sample atom in the molecular graph feature. Let b represent the first preset bias vector and W represent the first preset weight matrix.
[0299] In step 1220, the preset activation function refers to the SiLU activation function.
[0300] In this specific implementation, a preset activation function is used to perform a nonlinear transformation on the first transformation map features to obtain the activation map features. Taking the SiLU activation function as an example, for the transformation map features corresponding to each sample atom in the first transformation map features, the atomic activation features corresponding to that transformation map feature in the activation map features can be expressed as follows:
[0301]
[0302] Where SiLU(x) represents the atomic activation feature corresponding to the transformation map feature of each sample atom in the activation map feature, and x represents the transformation map feature corresponding to each sample atom in the first transformation map feature.
[0303] In step 1230, the second preset weight matrix is used to indicate the weight parameters of each atomic activation feature in the activation map feature. The second preset bias vector is used to indicate the offset degree of the atomic activation feature of each sample atom. The second transformation map feature is used to indicate the result of linear transformation of each atomic activation feature in the activation map feature.
[0304] In the specific implementation of this embodiment, the process of performing a linear transformation on the activation map features based on the second preset weight matrix and the second preset bias vector is similar to step 1210 above. To save space, it will not be described again.
[0305] In step 1240, firstly, the transformation features corresponding to each sample atom in the second transformation map feature are aggregated to obtain molecular aggregation features. Next, a multilayer perceptron is used to process the molecular aggregation features, and the multilayer perceptron outputs the predicted molecular energy corresponding to the interaction layer.
[0306] like Figure 13The diagram illustrates the specific application of a neural network force field model for energy prediction. Specifically, the neural network force field model prediction network comprises a neural network layer, a preset activation function, another neural network layer, and an aggregation layer connected sequentially. Based on this, firstly, the sample molecular graph features are input into the neural network layer. The first preset weight matrix and the first preset bias vector of the neural network layer are used to transform the sample molecular graph features, resulting in a first transformed graph feature. Next, the preset activation function is used to perform a nonlinear transformation on the first transformed graph features, resulting in an activation graph feature. Further, the activation graph feature is input into the neural network layer. The second preset weight matrix and the second preset bias vector of the neural network layer are used to transform the activation graph feature, resulting in a second transformed graph feature. Since the second transformed graph feature is a collection of atomic transformation features of each sample atom, the transformation features corresponding to each sample atom in the second transformed graph feature are input into the aggregation layer for feature aggregation, resulting in molecular aggregation features. Finally, a multilayer perceptron is used to process the molecular aggregation features, and the multilayer perceptron outputs the predicted molecular energy corresponding to the interaction layer.
[0307] The advantage of this embodiment is that by performing multi-level linear transformation and non-linear activation processing on the molecular graph features of the sample, the neural network force field model can gradually extract higher-level feature information during training and use the extracted feature information for energy prediction. This approach can not only improve the prediction accuracy of the neural network force field model for molecular energy, but also enhance the generalization ability and adaptability of the neural network force field model.
[0308] When a neural network force field model includes an embedding layer, multiple cascaded interaction layers, and a prediction network, the network structure of a single interaction layer is as follows: Figure 15 When referring to the network structure shown, please refer to... Figure 14 In another embodiment, step 340 specifically includes, but is not limited to, the following steps 1410-1440:
[0309] Step 1410: For each interaction layer, based on the atomic encoding vectors of each of the multiple sample atoms, determine the input features of each of the multiple sample atoms in the interaction layer;
[0310] Step 1420: In each interaction layer, for each sample atom among multiple sample atoms, perform cross-attention calculation based on the atomic scalar features of the sample atom, the relative position features with each other sample atom, and the atomic scalar features of each other sample atom to obtain the attention weight of the sample atom to other sample atoms.
[0311] Step 1430: Based on the atomic scalar features of each other sample atom and the attention weight, perform feature weighting to obtain the atomic interaction features of the sample atom;
[0312] Step 1440: Based on the atomic interaction characteristics of each of the multiple sample atoms, determine the sample molecular graph characteristics corresponding to the interaction layer.
[0313] Steps 1410-1440 are described in detail below.
[0314] In step 1410, the input features include the atomic scalar features of the sample atoms and the relative position features between the sample atoms and other sample atoms.
[0315] In the specific implementation of this embodiment, the process of step 1410 is similar to that of step 610 described above. To save space, it will not be described again.
[0316] In step 1420, attention weights are used to indicate the degree of attention a sample atom pays to other sample atoms.
[0317] In the specific implementation of this embodiment, in each interaction layer, for each sample atom among multiple sample atoms, firstly, the atomic scalar features of the sample atom are linearly projected to obtain a query vector; then, the relative position features with a single other sample atom and the atomic scalar features of that other sample atom are concatenated to obtain concatenated features, and linearly projected onto the concatenated features to obtain the key vector projected onto the key channel and the value vector projected onto the value channel. Next, attention is calculated based on the key vector, value vector, and query vector to obtain the attention weight of the sample atom for that other sample atom.
[0318] In step 1430, atomic interaction features are used to indicate key feature information of sample atoms.
[0319] In the specific implementation of this embodiment, for each sample atom among multiple sample atoms, the atomic scalar features of each other sample atom and the attention weight are multiplied together to obtain the weighted atomic features of each other sample atom, and the weighted atomic features of all other sample atoms corresponding to that sample atom are summed to obtain the atomic interaction features of the sample atom.
[0320] In step 1440, based on the order of each sample atom in the sequence of the sample molecule and the atomic interaction characteristics of each sample atom, the sample atoms are treated as nodes, and the nodes corresponding to directly connected sample atoms are connected by edges. The atomic interaction characteristics are used as the node features of the nodes, forming the sample molecule graph features corresponding to the interaction layer. Here, the sample molecule graph features are a feature graph structure.
[0321] like Figure 15The diagram illustrates the generation of sample molecular graph features using an interaction layer. Specifically, the interaction layer is constructed using a Graph Transformer structure. The interaction layer includes a linear layer, a scaled dot-product attention layer, a feature mixing layer, and a concatenation layer. First, for each sample atom, other sample atoms relative to that sample atom are identified. Next, the relative position features of each other sample atom and its atomic scalar features are concatenated to obtain the concatenated features. Further, the atomic scalar features of the sample atom are input into the linear layer for projection transformation to obtain the query vector Q; and the concatenated features of each other sample atom are input into the linear layer for projection transformation to obtain the bond vector K and value vector V corresponding to each other sample atom. Next, for a single other sample atom, the query vector Q, bond vector K, and value vector V are input into the scaled dot-product attention layer for cross-attention calculation. A dot product operation is performed on the query vector Q and the bond vector K, and a score is calculated for the dot product operation to obtain the attention score. Finally, the attention score is normalized into attention weights using the softmax function, where the attention weights are values between 0 and 1. Furthermore, the attention weights and atomic scalar features of other sample atoms are input into the feature mixing layer. The attention weights are multiplied by the atomic scalar features of other sample atoms to obtain the weighted atomic features of each other sample atom. The weighted atomic features of all other sample atoms corresponding to that sample atom are then summed to obtain the atomic interaction features of the sample atom. Finally, the atomic interaction features of multiple sample atoms are input into the splicing layer for feature generation to obtain the sample molecular graph features corresponding to the interaction layer.
[0322] The advantage of this embodiment is that, through the cross-attention mechanism, each interaction layer can learn the interrelationships and dependencies between sample atoms, thereby enhancing the feature representation of each sample atom. The cross-attention mechanism can capture long-distance dependencies between sample atoms, enabling the interaction layer to have a more comprehensive understanding of the contextual information of sample atoms; simultaneously, cross-attention computation can improve the processing performance of the interaction layer on graph-structured data. Furthermore, feature weighting of the atomic scalar features and attention weights for each other sample atom of each sample atom can highlight important features and suppress unimportant features, which helps the interaction layer more accurately capture the key information of each sample atom. Integrating the atomic interaction features of multiple sample atoms into sample molecular graph features can integrate the global information of the sample molecule while retaining the overall features and spatial information of each sample atom, thereby improving the feature comprehensiveness and accuracy of the sample molecular graph features.
[0323] In this embodiment, the specific process of force prediction based on the sample molecular graph features corresponding to the interaction layer in step 350 to obtain the predicted atomic forces of each sample atom in the interaction layer is similar to that described above. However, the energy prediction method in this embodiment differs from the energy prediction method in the above embodiment.
[0324] The specific process of energy prediction based on sample molecular map features in this embodiment may include, but is not limited to, the following steps:
[0325] For each interaction layer, the atomic interaction features of each sample atom are determined in the sample molecular graph features;
[0326] Global pooling is performed on the atomic interaction features of multiple sample atoms to obtain molecular pooling features;
[0327] Energy prediction is performed based on molecular pooling features to obtain the predicted molecular energy corresponding to the interaction layer.
[0328] Specifically, since the sample molecular graph features are represented as a feature graph structure, and sample atoms are the nodes of this structure, there is an edge between nodes directly connected to each sample atom. Atomic interaction features are often represented as node features. Based on this, firstly, for each interaction layer, the nodes corresponding to each sample atom are determined in the sample molecular graph features corresponding to that layer, and the node features are extracted as the atomic interaction features of the sample atoms. Further, the atomic interaction features of multiple sample atoms are summed to achieve global pooling of these features, resulting in molecular pooling features. Finally, energy prediction is performed based on the molecular pooling features to obtain the predicted molecular energy corresponding to the interaction layer. The specific process of energy prediction based on molecular pooling features is similar to step 850 above. For brevity, it will not be elaborated further.
[0329] The advantage of this embodiment is that, for each interaction layer, the atomic interaction features in the sample minute plot reflect the local interactions between sample atoms. Global pooling can integrate this series of local features into molecular-level global features, thus characterizing the properties of the sample molecules as a whole. Furthermore, energy prediction is performed on the molecular pooling features of each interaction layer, which can refine the estimation of molecular energy at different levels, capture subtle changes in molecular energy at each level, improve the feature learning ability of each interaction layer of the neural network force field model, and thus improve the energy prediction accuracy of the trained neural network force field model.
[0330] Please refer to Figure 16 In another embodiment, step 340 specifically includes, but is not limited to, the following steps 1610-1640:
[0331] Step 1610: Extract the molecular backbone information and molecular fragment type of the sample molecules from the sample molecule information;
[0332] Step 1620: Encode the molecular skeleton information to obtain the molecular skeleton encoding vector;
[0333] Step 1630: Encode the molecular fragment type to obtain the molecular type encoding vector;
[0334] Step 1640: For each interaction layer, perform energy prediction based on sample molecular graph features, molecular skeleton encoding vector, and molecular type encoding vector to obtain the predicted molecular energy corresponding to the interaction layer.
[0335] Steps 1610-1640 are described in detail below.
[0336] In step 1610, molecular backbone information is used to indicate the basic structural framework of the sample molecule. Molecular fragment type is used to indicate the specific type of local fragment regions in the sample molecule that have a particular function or structure.
[0337] In this specific implementation, firstly, the molecular backbone information of the sample molecules can be extracted from the sample molecular information using rule-based methods (such as Murcko backbone extraction) or deep learning-based methods (such as graph neural networks or variational autoencoders). Next, the molecular fragment types of the sample molecules can be extracted from the sample molecular information using rule-based segmentation methods (such as BRICS and MacFrag) or AI-based methods (such as DigFrag).
[0338] Taking the BRICS rule-based segmentation method as an example, the BRICS rule predefines the chemical bond breaking rules, and the sample molecules are split into multiple molecular fragments according to these chemical bond breaking rules.
[0339] In step 1620, the molecular skeleton encoding vector is used to indicate the vector representation of molecular skeleton information in the potential vector space.
[0340] In the specific implementation of this embodiment, a graph neural network can be used to encode the molecular skeleton information, converting the complex topological structure information of the sample molecule's molecular skeleton into a numerical vector representation to capture information such as the shape, size, and connection method of the molecular skeleton, thereby obtaining the molecular skeleton encoding vector.
[0341] In step 1630, the molecular type encoding vector is used to indicate the vector representation of the molecular fragment type in the potential vector space.
[0342] In this specific implementation, molecular fragment types can be uniquely encoded to convert this chemical information into a numerical vector representation, thereby capturing the chemical properties, functional group types, etc., of the molecular fragments and obtaining a molecular type encoding vector. Different molecular fragment types correspond to different molecular type encoding vectors.
[0343] In step 1640, firstly, for each interaction layer, the sample molecular graph features, molecular backbone encoding vector, and molecular type encoding vector are concatenated to obtain a molecular concatenation vector. Next, energy prediction is performed based on the molecular concatenation vector to obtain the predicted molecular energy corresponding to the interaction layer. The specific process of energy prediction based on the molecular concatenation vector is similar to the process of energy prediction based on sample molecular graph features described above. For the sake of brevity, it will not be elaborated further.
[0344] The advantage of this embodiment is that, since the sample molecular graph features can provide overall structural information of the sample molecule; the molecular skeleton encoding vector can provide basic shape information of the sample molecule; and the molecular type encoding vector can provide chemical property information of the sample molecule, in energy prediction, combining the sample molecular graph features, molecular skeleton encoding vector, and molecular type encoding vector can capture energy information of the sample molecule from multiple perspectives, thereby more comprehensively describing the energy characteristics of the sample molecule. Simultaneously, each interaction layer captures sample molecular graph features at different levels. For the energy prediction of each interaction layer, the results of energy prediction can be progressively refined and optimized, achieving finer energy prediction. This allows the model to better handle the interactions and chemical reactions within the sample molecule, thereby improving the accuracy of energy prediction and the accuracy of determining the forces acting on individual sample atoms based on the predicted energy.
[0345] The following describes the specific process of determining the loss subfunction corresponding to the interaction layer based on the predicted atomic force and atomic force label of each sample atom in step 350.
[0346] In one embodiment, the specific process of determining the loss sub-function corresponding to the interaction layer based on the predicted atomic force and atomic force label of each sample atom includes, but is not limited to, the following steps:
[0347] For each sample atom, calculate the Euclidean norm of the difference between the predicted atomic force and the atomic force label;
[0348] By squaring the Euclidean norm, we obtain the bisecting norm.
[0349] The mean norm is obtained by averaging the bipartite norms of multiple sample atoms.
[0350] Based on the norm mean, the loss function corresponding to the interaction layer is determined.
[0351] Specifically, for each sample atom, firstly, the difference between the predicted atomic force and the atomic force label is calculated to obtain the difference between the predicted atomic force and the atomic force label, and then the Euclidean norm of the difference between the predicted atomic force and the atomic force label is calculated. Next, the Euclidean norm is squared to obtain the bipartite norm. Further, the bipartite norms of multiple sample atoms in the sample molecule are averaged to obtain the norm mean, and the quotient of the norm mean divided by 3 is used as the loss function corresponding to the interaction layer.
[0352] The division by 3 is because the predicted atomic force and atomic force tag are a three-dimensional vector, and the error of the predicted atomic force and atomic force tag in three directions needs to be averaged when calculating the loss function.
[0353] The loss function corresponding to a single interaction layer can be expressed as follows:
[0354]
[0355] Among them, Loss MSE,force This is the loss function corresponding to the interaction layer. M is the total number of sample atoms in the sample molecule, and M is a positive integer. It is the predicted atomic force of the i-th sample atom of the sample molecule based on the sample molecule graph features output by the interaction layer. This is the atomic force label of the i-th sample atom in the sample molecule. Here, i is an integer greater than 0 and not greater than M. `pred` indicates that the predicted atomic force is a predicted parameter, and `true` indicates that the atomic force label is a true parameter. It is the Euclidean norm of the difference between the predicted atomic force and the atomic force label of the i-th sample atom.
[0356] The advantage of this embodiment is that by calculating the Euclidean norm of the difference between the predicted and actual atomic forces for each sample atom, the difference between the predicted and actual atomic forces for each sample atom can be directly quantified. Furthermore, squaring the Euclidean norm of the difference between the predicted and actual atomic forces further amplifies the impact of the prediction error, making the model more inclined to reduce larger prediction biases during training, rather than just focusing on small errors, thereby improving the model's predictive ability. In addition, the norm after squaring is a continuously differentiable function, making the entire sub-loss function smoother, which is beneficial for the convergence of the optimization algorithm and can improve the model training efficiency to a certain extent. Averaging the bipartite norms of multiple sample atoms balances the contribution of different sample atoms to the sub-loss function, preventing the model from being dominated by certain extreme values (such as particularly large errors in some sample atoms) during training, thereby improving the model's robustness.
[0357] In this embodiment of the disclosure, the sample molecule information also includes the molecular energy tag of the sample molecule.
[0358] Molecular energy labels are used to indicate the true state parameters of sample molecules in their energy state.
[0359] Please refer to Figure 17 In one embodiment, the specific process of determining the loss subfunction corresponding to the interaction layer based on the predicted atomic force and atomic force label of each sample atom includes, but is not limited to, the following steps 1710-1730:
[0360] Step 1710: For each interaction layer, determine the first loss function based on the predicted molecular energy and molecular energy label;
[0361] Step 1720: Based on the predicted atomic force and the atomic force label, determine the second loss function;
[0362] Step 1730: Determine the loss sub-function based on the first loss sub-function and the second loss sub-function.
[0363] Steps 1710-1730 are described in detail below.
[0364] In step 1710, the first loss function is used to indicate the degree of difference between the molecular energy predicted by the original model in a certain iterative training round and the actual molecular energy.
[0365] In the specific implementation of this embodiment, for each interaction layer, firstly, the predicted molecular energy and the molecular energy label are subtracted to obtain the energy difference value. Then, the energy difference value is squared to obtain the squared result, and the squared result is used as the first loss function corresponding to the interaction layer.
[0366] In step 1720, the second loss function is used to indicate the overall difference between the forces predicted by the original model for sample atoms in a sample molecule during a certain iterative training round and the forces actually experienced by the sample atoms.
[0367] In the specific implementation of this embodiment, the process of determining the second loss function based on the predicted atomic force and the atomic force label is basically the same as the steps described above, such as calculating the Euclidean norm of the difference between the predicted atomic force and the atomic force label for each sample atom, and averaging the squares of the Euclidean norms. To save space, these steps will not be repeated.
[0368] In step 1730, firstly, a first weight and a second weight are determined, wherein the first weight indicates the importance of the original model's accuracy in predicting molecular energy during model training; and the second weight indicates the importance of the original model's accuracy in predicting atomic forces during model training. Next, the product of the first weight and the first loss function is added to the product of the second weight and the second loss function to obtain the damage function corresponding to the interaction layer.
[0369] The advantages of this embodiment are that it combines molecular energy prediction and atomic force prediction, introducing multi-task learning of the neural network force field model, which reduces the risk of overfitting the training data caused by single-task learning. Simultaneously, since molecular energy and atomic force are physically closely related, the constraint of the energy-force relationship allows the neural network force field model to satisfy the physical relationship between energy and force during training, improving the model's learning and understanding of molecular structure and interactions, thereby increasing the prediction accuracy of the trained neural network force field model. Furthermore, by decomposing the sub-loss function of the interaction layer into a first loss sub-function and a second loss sub-function, the weights of different tasks can be flexibly adjusted during model training, enabling the trained neural network mechanics model to meet the prediction accuracy requirements of molecular energy and atomic forces in different application scenarios.
[0370] Step 360 will be described in detail below.
[0371] In step 360, the original model is trained based on the loss function corresponding to each interaction layer to obtain the neural network force field model.
[0372] Please refer to Figure 18 In one embodiment, step 360 specifically includes, but is not limited to, the following steps 1810-1830:
[0373] Step 1810: For each interaction layer, determine the weight of the interaction layer in the current iteration training round;
[0374] Step 1820: Perform a weighted calculation based on the loss sub-functions and weights of each of the multiple interaction layers to obtain the total loss function;
[0375] Step 1830: Based on the total loss function, train the original model to obtain the neural network force field model.
[0376] Steps 1810-1830 are described in detail below.
[0377] In step 1810, the weights are used to indicate the importance of the extraction processing capability of each interaction layer in predicting atomic forces.
[0378] In this specific implementation, during model training, the weights of each interaction layer can be dynamically adjusted at the beginning of each training iteration. Specifically, an adaptive weight adjustment strategy based on gradient variance can be used to determine the weights of the interaction layers in the current training iteration. First, the weights of each interaction layer are initialized to 1. Then, in each training iteration, the loss function value corresponding to the sub-loss function of each interaction layer and the gradient variance corresponding to the gradient value are recorded. Further, at the beginning of the current training iteration, the recorded gradient variances of each interaction layer in the previous training iteration are extracted, and the square root of the ratio between the gradient variance of each interaction layer and the sum of the gradient variances of all interaction layers is used as the weight adjustment factor for that interaction layer. Finally, the weights of the interaction layer in the previous training iteration are multiplied by the weight adjustment factor to obtain new weights, which are the weights of the interaction layer in the current training iteration.
[0379] In step 1820, the total loss function is used to measure the overall accuracy of the trained original model in predicting atomic forces.
[0380] In this specific implementation, firstly, for each interaction layer, the loss function and weights corresponding to that interaction layer are multiplied together to weight the loss function, resulting in a weighted loss function for that interaction layer. Next, the weighted loss functions of all interaction layers are summed to obtain the total loss function.
[0381] When the neural network force field model contains three interaction layers, the total loss function can be expressed as follows:
[0382] Loss=weight1×Loss1+weight2×Loss2+weight3×Loss3;
[0383] Here, Loss refers to the total loss function. Loss1 refers to the loss function corresponding to the first interaction layer, and weight1 refers to the weight corresponding to the first interaction layer; Loss2 refers to the loss function corresponding to the second interaction layer, and weight2 refers to the weight corresponding to the second interaction layer; Loss3 refers to the loss function corresponding to the third interaction layer, and weight3 refers to the weight corresponding to the third interaction layer.
[0384] In step 1830, the original model is trained based on the total loss function. The parameters of the original model are adjusted according to the total loss function, with the goal of minimizing the total loss function. The parameters of the original model are continuously adjusted, and iterative training is performed according to steps 310-360 above. The parameters of the original model that minimize the total loss function are taken as the final parameters, and the original model with the final parameters is taken as the trained neural network force field model.
[0385] The advantage of this embodiment is that, for each interaction layer, a weight is determined for it in each iteration of training, and the sub-loss functions corresponding to the interaction layers are weighted. Thus, the total loss function is determined based on the sum of multiple weighted loss sub-functions, and the total loss function is used to train the original model. This can improve the overall performance of the model in multi-task learning to a certain extent, thereby improving the accuracy of the trained neural network force field model in predicting the forces acting on atoms in molecules.
[0386] The following is a detailed description of a molecular processing method according to an embodiment of the present disclosure.
[0387] According to one embodiment of this disclosure, a molecular processing method is provided.
[0388] This molecular processing method is generally applied in molecular dynamics simulations where predictions of molecular energy and forces acting on atoms within a molecule are required. This disclosure provides a scheme for predicting molecular energy and forces based on a trained neural network force field model, which improves the accuracy of predictions of molecular energy and forces acting on atoms within a molecule.
[0389] like Figure 19 As shown, the molecular processing method according to an embodiment of this disclosure can be executed by an electronic device, which may be... Figure 1 The server or object terminal shown. A molecular processing method according to one embodiment of this disclosure may include:
[0390] Step 1910: Obtain the atomic information of each atom in the target molecule;
[0391] Step 1920: Input the atomic information of each atom into the neural network force field model to predict the energy and obtain the predicted molecular energy of the molecule;
[0392] Step 1930: Based on the predicted molecular energy, determine the predicted power of each of the multiple sample atoms.
[0393] Steps 1910-1930 are described in detail below.
[0394] In step 1910, the target molecule refers to the molecule whose molecular energy and the forces acting on its atoms need to be predicted. Atomic information is used to indicate the atomic type, three-dimensional coordinates, and other atomic property and structural information of each atom in the target molecule.
[0395] In a specific implementation of this embodiment, with authorization, a pre-defined cheminformatics toolkit is invoked, and atomic information of each atom is extracted from the molecular structure of the target molecule based on the invoked toolkit. The pre-defined cheminformatics toolkit can be RDKit, etc.
[0396] In step 1920, the predicted molecular energy is used to indicate the energy state parameters of the target molecule predicted by the trained neural network force field model based on the atomic information of each atom in the target molecule. The neural network force field model is trained using the training method of the neural network force field model described in the above embodiment. The neural network force field model includes an embedding layer and multiple interconnected interaction layers.
[0397] In a specific implementation of this embodiment, step 1920 includes, but is not limited to, the following steps:
[0398] Based on the atomic information of each atom, feature encoding is performed through an embedding layer to obtain the encoding vectors of each atom.
[0399] The atomic encoding vectors of multiple sample atoms are input into multiple concatenated interaction layers, and the multiple interaction layers output their respective molecular graph features.
[0400] For each interaction layer, energy prediction is performed based on the molecular graph features corresponding to the interaction layer to obtain a preliminary predicted energy.
[0401] The predicted molecular energies are obtained by weighting the preliminary predicted energies of each interaction layer.
[0402] The encoding vector indicates the representation of atomic information in the latent vector space. Molecular graph features indicate the representation of the overall information of the target molecule (including molecular structure and properties) in the latent vector space. The preliminary predicted energy indicates the molecular energy predicted based on the molecular graph features output from each interaction layer.
[0403] Specifically, based on the atomic information of multiple atoms, feature encoding is performed through an embedding layer to obtain the encoding vectors of each atom. The atomic encoding vectors of multiple sample atoms are then input into multiple concatenated interaction layers, which output their respective molecular graph features. For each interaction layer, energy prediction is performed based on the molecular graph features corresponding to that layer to obtain the preliminary predicted energy. The specific process is similar to the process in steps 330-340 and 350 above, where energy prediction is performed based on the sample molecular graph features for each interaction layer to obtain the predicted molecular energy of the sample molecule. For the sake of brevity, this will not be elaborated further.
[0404] Furthermore, after determining the preliminary predicted energy corresponding to each interaction layer, the weight parameters of each interaction layer in the trained neural network force field model are multiplied by the preliminary predicted energy to obtain the final predicted molecular energy. In this embodiment, after predicting the molecular energy based on the molecular graph features output by each interaction layer during model application, the multiple predicted molecular energies are weighted to obtain the final predicted molecular energy.
[0405] In another embodiment, step 1920 specifically includes, but is not limited to, the following steps:
[0406] Based on the atomic information of each atom, feature encoding is performed through an embedding layer to obtain the encoding vectors of each atom.
[0407] The atomic encoding vectors of multiple sample atoms are input into multiple cascaded interactive layers, and the target molecular map features are output by the last interactive layer.
[0408] Energy prediction is performed based on the features of the target molecular map to obtain the predicted molecular energy.
[0409] Specifically, the process of obtaining the encoding vectors of each atom through feature encoding via an embedding layer, based on the atomic information of each atom, is similar to step 330 above. The process of inputting the atomic encoding vectors of each sample atom into multiple concatenated interaction layers, with the last interaction layer outputting the target molecular graph features, is similar to step 340 above. The difference is that step 340 requires determining the molecular graph features output by each interaction layer, while step 1920 only requires determining the molecular graph features output by the last interaction layer. For the sake of brevity, this will not be elaborated further.
[0410] Furthermore, the specific process of energy prediction based on the target molecular graph features is similar to the specific process in step 350 above, where energy prediction is performed based on the sample molecular graph features for each interaction layer to obtain the predicted molecular energy of the sample molecule. To save space, it will not be elaborated further. In this embodiment, after predicting the molecular energy based on the molecular graph features output from the last interaction layer during model application, the predicted molecular energy is directly used as the final predicted molecular energy.
[0411] In step 1930, the process of determining the predicted force of each of the multiple sample atoms based on the predicted molecular energy is similar to the process described above, where atomic position information of each sample atom is extracted from the sample atom information. The specific process of calculating the derivative based on the predicted molecular energy and atomic position information to obtain the predicted atomic force of the sample atom is also similar. To save space, it will not be elaborated further.
[0412] The advantage of this embodiment is that, since the neural network force field model of this disclosure is based on learning from a large amount of molecular data and performing loss calculations based on the outputs of each interaction layer, this neural network force field model can capture more complex intermolecular interactions. Therefore, by inputting the atomic information of multiple atoms of the target molecule into the neural network force field model, performing energy prediction based on the molecular graph features output by the last interaction layer or the molecular graph features output by each interaction layer, and determining the force on each atom based on the finally determined predicted energy, the energy of the molecule and the force on each atom in the molecule can be predicted more accurately and quickly, improving the prediction efficiency and accuracy of molecular energy and atomic force, and meeting the needs of various application scenarios such as molecular simulation, material design, and drug design.
[0413] The following is a detailed description of the training and practical application of a neural network mechanics model according to an embodiment of this disclosure.
[0414] like Figure 20 The diagram illustrates a simplified process of training a neural network mechanics model and applying it to molecular dynamics simulations. Specifically, labeled training samples are used to train the neural network force field model. These labeled training samples refer to sample molecules and their information, with the labels including the atomic force labels of each atom within the sample molecule. The molecular energy label E of the sample molecules and the training method of the neural network force field model are similar to steps 310-360 above.
[0415] Furthermore, the trained neural network force field model is used for molecular prediction, enabling the prediction of the forces acting on individual atoms in the molecule and the molecular energy. Based on the predicted molecular energy and the forces acting on individual atoms, this is applied in molecular dynamics simulations. The specific process of using the neural network force field model to predict the forces acting on individual atoms in the molecule and the molecular energy is similar to steps 1910-1930 described above. For the sake of brevity, it will not be elaborated further.
[0416] The following describes the interaction layer of the neural network force field model in the embodiments of this disclosure. Figure 7 The presented neural network structure, and the prediction network is Figure 9 When presenting the neural network structure, the model training method of this disclosure embodiment and its predictive performance are compared and explained with those of model training methods in related technologies.
[0417] Specifically, in the embodiments of this disclosure and related technologies, the interaction layer of the neural network force field model is... Figure 11 The presented neural network structure, and the prediction network is Figure 13The presented neural network structure was comprehensively tested on the MD17 dataset. The MD17 dataset consists of MD trajectories of seven small organic molecules; the number of conformations in each molecule ranges from 133,700 to 993,237. The MD17 dataset includes molecular energy labels and atomic force labels calculated using the DFT method. The MD17 dataset is a commonly used benchmark dataset for evaluating the potential function of neural networks.
[0418] In this comparative verification, 1000 molecules from MD17 were selected for model training (950 molecules as the training set and 50 molecules as the validation set), while the remaining molecules were reserved as the test set to analyze in depth the predictive ability of the neural network force field model obtained by the training method based on the embodiments of this disclosure on different subsets.
[0419] Table 1 shows the specific performance of the neural network force field model in predicting molecular energy and force using the model training method of this disclosure embodiment and the model training method in related technologies:
[0420] Table 1 Comparison of mean absolute error of neural network force field models under different model training methods
[0421]
[0422] Table 1 shows a comparison of the mean absolute errors of the energy and force of seven small organic molecules on the MD17 dataset between the model training methods of the present disclosure embodiments and related technologies. Among the 14 sub-items in the seven different subsets, the prediction accuracy of 10 sub-items improved by 10%, the prediction accuracy of another 3 sub-items improved by 5%, and the prediction accuracy of all sub-items improved. This result fully demonstrates that the training method of the present disclosure embodiments has a significant advantage and contribution to model prediction performance compared to the training methods of related technologies.
[0423] The following describes the interaction layer of the neural network force field model in the embodiments of this disclosure. Figure 11 The presented neural network structure, and the prediction network is Figure 13 When presenting the neural network structure, the model training method of this disclosure embodiment and its predictive performance are compared and explained with those of model training methods in related technologies.
[0424] Specifically, in the embodiments of this disclosure and related technologies, the interaction layer of the neural network force field model is... Figure 11 The presented neural network structure, and the prediction network is Figure 13The presented neural network structure was comprehensively tested on the MD17 dataset. The MD17 dataset consists of MD trajectories of seven small organic molecules; the number of conformations in each molecule ranges from 133,700 to 993,237. The MD17 dataset includes molecular energy labels and atomic force labels calculated using the DFT method. The MD17 dataset is a commonly used benchmark dataset for evaluating the potential function of neural networks.
[0425] In this comparative verification, 1000 molecules from MD17 were selected for model training (950 molecules as the training set and 50 molecules as the validation set), while the remaining molecules were reserved as the test set to analyze in depth the predictive ability of the neural network force field model obtained by the training method based on the embodiments of this disclosure on different subsets.
[0426] Table 2 shows the specific performance of the neural network force field model in predicting molecular energy and force using the model training method of this disclosure embodiment and the model training method in related technologies:
[0427] Table 2 Comparison of mean absolute error of neural network force field models under different model training methods
[0428]
[0429] Table 2 shows a comparison of the mean absolute errors of the energy and force of seven small organic molecules on the MD17 dataset between the model training methods of the present disclosure embodiments and related technologies. Among the 14 items in seven different subsets, the prediction accuracy of four items improved by 10%, the prediction accuracy of five items improved by 5%, and the prediction accuracy of 13 items improved, ranging from 2.4% to 30.8%. Only one item, representing the data with the highest original accuracy, showed a decrease in prediction accuracy. This result fully demonstrates that the training method of the present disclosure embodiments has a significant effect on improving model prediction performance compared to the training methods of related technologies.
[0430] The apparatus and device according to embodiments of this disclosure will now be described.
[0431] It is understood that although the steps in the above flowcharts are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this embodiment, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the above flowcharts may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0432] It should be noted that in various specific embodiments of this application, when processing is required based on data related to the characteristics of the target object, such as target object attribute information or a set of attribute information, the permission or consent of the target object will be obtained first. Furthermore, the collection, use, and processing of this data will comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require obtaining target object attribute information, separate permission or consent from the target object will be obtained through pop-ups or redirection to a confirmation page. Only after obtaining the target object's separate permission or consent will the necessary target object-related data for the normal operation of the embodiments of this application be obtained.
[0433] Figure 21 A schematic diagram of the structure of a training device 2100 for a neural network force field model provided in this embodiment of the disclosure. The training device 2100 for the neural network force field model includes:
[0434] The first acquisition unit 2110 is used to acquire the original model, which includes an embedding layer and multiple interconnected interaction layers.
[0435] The second acquisition unit 2120 is used to acquire sample molecule information of the sample molecule, wherein the sample molecule information includes sample atom information and atomic force tags of each of the multiple sample atoms in the sample molecule.
[0436] The encoding unit 2130 is used to perform feature encoding through the embedding layer based on the sample atom information of each of the multiple sample atoms to obtain the atom encoding vector of each of the multiple sample atoms;
[0437] The input unit 2140 is used to input the atomic encoding vectors of multiple sample atoms into multiple concatenated interaction layers, wherein each interaction layer outputs the sample molecular graph features corresponding to the interaction layer.
[0438] The first prediction unit 2150 is used to perform force prediction based on the sample molecular graph features corresponding to each interaction layer for each interaction layer, to obtain the predicted atomic force of each sample atom in the interaction layer, and to determine the loss sub-function corresponding to the interaction layer based on the predicted atomic force and atomic force label of each sample atom.
[0439] Training unit 2160 is used to train the original model based on the loss sub-functions corresponding to each interaction layer to obtain the neural network force field model.
[0440] Optionally, the first prediction unit 2150 includes:
[0441] A prediction module (not shown) is used to predict the energy of the sample molecules based on the features of the sample molecular graph for each interaction layer.
[0442] An extraction module (not shown) is used to extract the atomic position information of each sample atom from the sample atom information for each sample atom among multiple sample atoms;
[0443] A calculation module (not shown) is used to perform derivative calculations based on the predicted molecular energy and atomic position information to obtain the predicted atomic force of the sample atom.
[0444] Optionally, the prediction module (not shown) is used for:
[0445] Extract the molecular backbone information and molecular fragment type of the sample molecules from the sample molecule information;
[0446] The molecular backbone information is encoded to obtain the molecular backbone encoding vector;
[0447] The molecular fragment types are encoded to obtain molecular type encoding vectors;
[0448] For each interaction layer, energy prediction is performed based on sample molecular graph features, molecular skeleton encoding vector, and molecular type encoding vector to obtain the predicted molecular energy corresponding to the interaction layer.
[0449] Optionally, the prediction module (not shown) is used for:
[0450] For each interaction layer, the atomic interaction features of each sample atom are determined in the sample molecular graph features;
[0451] Global pooling is performed on the atomic interaction features of multiple sample atoms to obtain molecular pooling features;
[0452] Energy prediction is performed based on molecular pooling features to obtain the predicted molecular energy corresponding to the interaction layer.
[0453] Optionally, the prediction module (not shown) is used for:
[0454] For each interaction layer, the sample molecular graph features are subjected to a first dimensionality reduction process to obtain the first dimensionality-reduced graph features;
[0455] The first dimensionless graph features are activated based on a preset activation function to obtain activated graph features.
[0456] The activation graph features are subjected to a second dimensionality reduction process to obtain the second dimensionality-reduced graph features.
[0457] Global pooling is performed on the second dimension-reduced graph features to obtain molecular pooling features;
[0458] Energy prediction is performed based on molecular pooling features to obtain the predicted molecular energy corresponding to the interaction layer.
[0459] Optionally, the prediction module (not shown) is used for:
[0460] For each interaction layer, the sample molecular graph features are linearly transformed based on the first preset weight matrix and the first preset bias vector to obtain the first transformed graph features;
[0461] The first transformation map features are activated based on a preset activation function to obtain the activated map features;
[0462] The activation map features are linearly transformed based on the second preset weight matrix and the second preset bias vector to obtain the second transformed map features.
[0463] Energy prediction is performed based on the features of the second transformation graph to obtain the predicted molecular energy corresponding to the interaction layer.
[0464] Optionally, the sample molecular map features corresponding to the output interaction layer of each interaction layer are determined in the following way:
[0465] For each interaction layer, based on the atomic encoding vectors of multiple sample atoms, the input features of each sample atom in the interaction layer are determined. The input features include the atomic scalar features of the sample atom and the relative position features between the sample atom and other sample atoms.
[0466] In each interaction layer, for each sample atom among multiple sample atoms, cross-attention is calculated based on the atomic scalar features of the sample atom, its relative position features with each other sample atom, and the atomic scalar features of each other sample atom to obtain the attention weight of the sample atom to other sample atoms.
[0467] Based on the atomic scalar features of each other sample atom and the attention weight, the atomic interaction features of the sample atom are obtained by weighting the features.
[0468] Based on the atomic interaction characteristics of multiple sample atoms, the molecular graph characteristics of the sample corresponding to the interaction layer are determined.
[0469] Optionally, the sample molecular map features corresponding to the output interaction layer of each interaction layer are determined in the following way:
[0470] For each interaction layer, based on the atomic encoding vectors of multiple sample atoms, the input features of each sample atom in the interaction layer are determined. The input features include the atomic scalar features, atomic vector features, and relative position features between the sample atom and other sample atoms.
[0471] For each sample atom, weights are generated based on relative position features using a preset function to obtain the interaction weights of other sample atoms on the sample atom;
[0472] The atomic interaction features of the sample atoms are obtained by weighting the features based on the atomic scalar features and interaction weights of each other sample atom.
[0473] Based on atomic interaction features and relative position features, the atomic vector features are updated to obtain the updated vector features of the sample atoms;
[0474] Feature fusion is performed on atomic interaction features and update vector features to obtain atomic fusion features of sample atoms;
[0475] Based on the atomic fusion characteristics of multiple sample atoms, the molecular graph features of the sample corresponding to the interaction layer are determined.
[0476] Optionally, the sample molecular map features corresponding to the output interaction layer of each interaction layer are determined in the following way:
[0477] For each interaction layer, based on the atomic encoding vectors of multiple sample atoms, the input features of each sample atom in the interaction layer are determined. The input features include the atomic scalar features of the sample atom and the relative position features between the sample atom and other sample atoms.
[0478] For each sample atom, weights are generated based on relative position features using a preset function to obtain the interaction weights of other sample atoms on the sample atom;
[0479] The atomic interaction features of the sample atoms are obtained by weighting the features based on the atomic scalar features and interaction weights of each other sample atom.
[0480] The atomic interaction features and atomic scalar features of the sample atoms are concatenated to obtain the atomic concatenation features;
[0481] Based on the atomic splicing characteristics of multiple sample atoms, the molecular graph features corresponding to the interaction layer are determined.
[0482] Optionally, the sample atom information includes the atom type and three-dimensional coordinates of the sample atom;
[0483] Encoding unit 2130 is used for:
[0484] For each sample atom, the atom type is encoded to obtain the sample atom type encoding vector;
[0485] The atomic distance between the sample atom and each other sample atom is determined based on the three-dimensional atomic coordinates of the sample atom and the three-dimensional atomic coordinates of each other sample atom that is directly connected to the sample atom in the sample molecule.
[0486] The atomic distance between a sample atom and each other sample atom is encoded to obtain the distance encoding vector of the sample atom;
[0487] The type encoding vector and the distance encoding vector are combined into an atomic encoding vector.
[0488] Optionally, the type encoding vector and the distance encoding vector are integrated into an atomic encoding vector, including:
[0489] Extracting the orientation information of sample atoms from sample molecular information;
[0490] The directional information is encoded to obtain the directional encoding vector of the sample atom;
[0491] The type encoding vector, direction encoding vector, and distance encoding vector are integrated into an atomic encoding vector.
[0492] Optionally, the first prediction unit 2150 is used for:
[0493] For each sample atom, calculate the Euclidean norm of the difference between the predicted atomic force and the atomic force label;
[0494] By squaring the Euclidean norm, we obtain the bisecting norm.
[0495] The mean norm is obtained by averaging the bipartite norms of multiple sample atoms.
[0496] Based on the norm mean, the loss function corresponding to the interaction layer is determined.
[0497] Optionally, training unit 2160 is used for:
[0498] For each interaction layer, determine the weight of the interaction layer in the current training iteration;
[0499] The total loss function is obtained by weighting the loss sub-functions and weights of each of the multiple interaction layers.
[0500] Based on the total loss function, the original model is trained to obtain a neural network force field model.
[0501] Optionally, the sample molecule information may also include the molecular energy label of the sample molecule;
[0502] The prediction unit is used for:
[0503] For each interaction layer, a first loss function is determined based on the predicted molecular energy and molecular energy label;
[0504] Based on the predicted atomic force and the atomic force label, the second loss function is determined;
[0505] The loss function is determined based on the first loss function and the second loss function.
[0506] Figure 22 This is a schematic diagram of the structure of a molecular processing device 2200 provided in an embodiment of the present disclosure. The molecular processing device 2200 includes:
[0507] The third acquisition unit 2210 is used to acquire the atomic information of each of the multiple atoms in the target molecule;
[0508] The second prediction unit 2220 is used to input the atomic information of multiple atoms into the neural network force field model to predict the energy and obtain the predicted molecular energy of the molecule.
[0509] The determination unit 2230 is used to determine the predicted force of each of the multiple sample atoms based on the predicted molecular energy, wherein the neural network force field model is trained according to the above-mentioned neural network force field model training method.
[0510] Optionally, the neural network force field model includes an embedding layer and multiple cascaded interaction layers;
[0511] The second prediction unit 2220 is used for:
[0512] Based on the atomic information of each atom, feature encoding is performed through an embedding layer to obtain the encoding vectors of each atom.
[0513] The atomic encoding vectors of multiple sample atoms are input into multiple concatenated interaction layers, and the multiple interaction layers output their respective molecular graph features.
[0514] For each interaction layer, energy prediction is performed based on the molecular graph features corresponding to the interaction layer to obtain a preliminary predicted energy.
[0515] The predicted molecular energies are obtained by weighting the preliminary predicted energies of each interaction layer.
[0516] Optionally, the neural network force field model includes an embedding layer and multiple cascaded interaction layers;
[0517] The second prediction unit 2220 is used for:
[0518] Based on the atomic information of each atom, feature encoding is performed through an embedding layer to obtain the encoding vectors of each atom.
[0519] The atomic encoding vectors of multiple sample atoms are input into multiple cascaded interactive layers, and the target molecular map features are output by the last interactive layer.
[0520] Energy prediction is performed based on the features of the target molecular map to obtain the predicted molecular energy.
[0521] Reference Figure 23 , Figure 23 To implement the structural block diagram of the terminal portion of the neural network force field model training method or molecular processing method of the embodiments of this disclosure, the terminal may be... Figure 1 The terminal shown includes: a radio frequency (RF) circuit 2310, a memory 2315, an input unit 2330, a display unit 2340, a sensor 2350, an audio circuit 2360, a wireless fidelity (WiFi) module 2370, a processor 2380, and a power supply 2390, among other components. Those skilled in the art will understand that... Figure 23 The terminal structure shown does not constitute a limitation on mobile phones or computers and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0522] The RF circuit 2310 can be used to receive and transmit signals during information transmission or calls. In particular, it receives downlink information from the base station and processes it with the processor 2380; in addition, it transmits uplink data to the base station.
[0523] The memory 2315 can be used to store software programs and modules. The processor 2380 executes various functional applications and data processing of the target terminal by running the software programs and modules stored in the memory 2315.
[0524] The input unit 2330 can be used to receive input numeric or character information, and to generate key signal inputs related to the settings and function control of the target terminal. Specifically, the input unit 2330 may include a touch panel 2831 and other input devices 2332.
[0525] Display unit 2340 can be used to display input or provided information, as well as various menus of the target terminal. Display unit 2340 may include display panel 2341.
[0526] Audio circuitry 2360, speaker 2361, and microphone 2362 provide an audio interface.
[0527] In this embodiment, the processor 2380 included in the terminal can execute the neural network force field model training method or molecular processing method of the previous embodiment.
[0528] Figure 24 This is a structural block diagram of a server portion for implementing the neural network force field model training method or molecular processing method according to embodiments of this disclosure. The server may be... Figure 1 The server shown is a complex example. Servers can vary significantly in configuration and performance, and may include one or more Central Processing Units (CPUs) 2422 (e.g., one or more processors) and memory 2432, and one or more storage media 2430 (e.g., one or more mass storage devices) for storing application programs 2442 or data 2444. The memory 2432 and storage media 2430 can be temporary or persistent storage. The program stored in the storage media 2430 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 2422 may be configured to communicate with the storage media 2430 and execute the series of instruction operations stored in the storage media 2430 on the server.
[0529] The server may also include one or more power supplies 2426, one or more wired or wireless network interfaces 2450, one or more input / output interfaces 2458, and / or one or more operating systems 2441, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0530] The central processing unit 2422 in the server can be used to execute the training method or molecular processing method of the neural network force field model of the present disclosure embodiments.
[0531] This disclosure also provides a computer-readable storage medium for storing a computer program for executing the training method or molecular processing method of the neural network force field model of the foregoing embodiments.
[0532] This disclosure also provides a computer program product comprising a computer program. An electronic device's processor reads and executes the computer program, causing the electronic device to perform the training method or molecular processing method for implementing the aforementioned neural network force field model.
[0533] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in this disclosure and the foregoing drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “including,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes 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 apparatuses.
[0534] It should be understood that in this disclosure, "at least one item" means one or more, and "more than one" 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 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 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.
[0535] It should be understood that in the description of the embodiments disclosed herein, "multiple" means two or more, "greater than", "less than", "exceeding" etc. are understood to exclude the number itself, and "above", "below", "within" etc. are understood to include the number itself.
[0536] In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units 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, indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0537] The units described 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.
[0538] Furthermore, the functional units in the various embodiments of this disclosure 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.
[0539] 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 disclosure, 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 several 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 disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0540] It should also be understood that the various implementation methods provided in this disclosure can be combined arbitrarily to achieve different technical effects.
[0541] The above is a detailed description of the embodiments of this disclosure. However, this disclosure is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this disclosure. All such equivalent modifications or substitutions are included within the scope defined by the claims of this disclosure.
Claims
1. A method for training a neural network force field model, characterized in that, The method includes: Obtain the original model, which includes an embedding layer and multiple interconnected interaction layers; Obtain sample molecule information of sample molecules, wherein the sample molecule information includes sample atom information and atomic force tags of each of the multiple sample atoms in the sample molecule; Based on the sample atom information of each of the multiple sample atoms, feature encoding is performed through the embedding layer to obtain the atom encoding vector of each of the multiple sample atoms; The atomic encoding vectors of each of the multiple sample atoms are input into the multiple interconnected interaction layers, wherein each interaction layer outputs the sample molecule graph features corresponding to the interaction layer; For each interaction layer, force prediction is performed based on the sample molecular graph features corresponding to the interaction layer to obtain the predicted atomic force of each sample atom in the interaction layer. Based on the predicted atomic force and the atomic force label of each sample atom, the loss function corresponding to the interaction layer is determined. The original model is trained based on the loss function corresponding to each interaction layer to obtain the neural network force field model.
2. The method of claim 1, wherein, The step of performing force prediction based on the sample molecular graph features corresponding to each interaction layer to obtain the predicted atomic forces of each sample atom in the interaction layer includes: For each interaction layer, energy prediction is performed based on the features of the sample molecule graph to obtain the predicted molecular energy of the sample molecule; For each of the plurality of sample atoms, the atomic position information of the sample atom is extracted from the sample atom information; The predicted atomic force of the sample atom is obtained by performing derivative calculations based on the predicted molecular energy and the atomic position information. 3.The method of Claim 1, wherein, The sample atom information includes the atom type and three-dimensional coordinates of the sample atom; The step of performing feature encoding through the embedding layer based on the sample atom information of each of the plurality of sample atoms to obtain the atom encoding vector of each of the plurality of sample atoms includes: For each of the sample atoms, the atom type is encoded to obtain the type encoding vector of the sample atom; Based on the atomic three-dimensional coordinates of the sample atom and the atomic three-dimensional coordinates of each other sample atom directly connected to the sample atom in the sample molecule, the atomic distance between the sample atom and each other sample atom is determined. The atomic distance between the sample atom and each of the other sample atoms is encoded to obtain the distance encoding vector of the sample atom; The type encoding vector and the distance encoding vector are combined into the atomic encoding vector.
4. The training method for the neural network force field model according to claim 3, characterized in that, The step of integrating the type encoding vector and the distance encoding vector into the atomic encoding vector includes: Extract the orientation information of the sample atoms from the sample molecule information; The directional information is encoded to obtain the directional encoding vector of the sample atom; The type encoding vector, the direction encoding vector, and the distance encoding vector are integrated into the atomic encoding vector.
5. The training method for the neural network force field model according to claim 1, characterized in that, The sample molecular map features output by each interaction layer are determined in the following way: For each interaction layer, based on the atomic encoding vectors of the plurality of sample atoms, the input features of the plurality of sample atoms in the interaction layer are determined, wherein the input features include the atomic scalar features of the sample atom and the relative position features of the sample atom with other sample atoms; For each of the sample atoms, based on the relative position features, weights are generated using a preset function to obtain the interaction weights of other sample atoms on the sample atom; Based on the atomic scalar features and interaction weights of each of the other sample atoms, the atomic interaction features of the sample atoms are obtained by weighting the features. The atomic interaction features and atomic scalar features of the sample atoms are concatenated to obtain atomic concatenation features; Based on the atomic splicing features of each of the multiple sample atoms, the sample molecular graph features corresponding to the interaction layer are determined.
6. The training method for the neural network force field model according to claim 1, characterized in that, The sample molecular map features output by each interaction layer are determined in the following way: For each interaction layer, based on the atomic encoding vectors of the plurality of sample atoms, the input features of the plurality of sample atoms in the interaction layer are determined, wherein the input features include the atomic scalar features, atomic vector features, and the relative position features between the sample atom and other sample atoms; For each of the sample atoms, based on the relative position features, weights are generated using a preset function to obtain the interaction weights of other sample atoms on the sample atom; Based on the atomic scalar features and interaction weights of each of the other sample atoms, the atomic interaction features of the sample atoms are obtained by weighting the features. Based on the atomic interaction features and the relative position features, the atomic vector features are updated to obtain the updated vector features of the sample atoms; The atomic interaction features and the updated vector features are fused to obtain the atomic fusion features of the sample atoms; Based on the atomic fusion features of each of the multiple sample atoms, the sample molecular graph features corresponding to the interaction layer are determined.
7. The training method for the neural network force field model according to claim 1, characterized in that, The step of determining the loss function corresponding to the interaction layer based on the predicted atomic force and the atomic force label of each sample atom includes: For each of the sample atoms, calculate the Euclidean norm of the difference between the predicted atomic force and the atomic force label; The bisector norm is obtained by squaring the Euclidean norm. The mean norm is obtained by averaging the bisecting norms of each of the multiple sample atoms. Based on the norm mean, the loss function corresponding to the interaction layer is determined.
8. The training method for the neural network force field model according to claim 1, characterized in that, The process of training the original model based on the loss function corresponding to each interaction layer to obtain the neural network force field model includes: For each of the interaction layers, determine the weight of the interaction layer in the current iteration training round; The total loss function is obtained by weighting the loss sub-functions and weights of each of the multiple interaction layers. Based on the total loss function, the original model is trained to obtain the neural network force field model.
9. The training method for the neural network force field model according to claim 2, characterized in that, The sample molecule information also includes the molecular energy tag of the sample molecule; The step of determining the loss function corresponding to the interaction layer based on the predicted atomic force and the atomic force label of each sample atom includes: For each of the interaction layers, a first loss function is determined based on the predicted molecular energy and the molecular energy label; Based on the predicted atomic force and the atomic force label, a second loss function is determined; The loss function is determined based on the first loss function and the second loss function.
10. The training method for the neural network force field model according to claim 2, characterized in that, The step of predicting the predicted molecular energy of the sample molecule based on the sample molecule graph features for each interaction layer includes: For each of the interaction layers, the sample molecular graph features are subjected to a first dimensionality reduction process to obtain the first dimensionality-reduced graph features; The first dimensionality reduction graph features are activated based on a preset activation function to obtain activated graph features; The activation graph features are subjected to a second dimensionality reduction process to obtain a second dimensionality-reduced graph feature; Global pooling is performed on the second dimensionality reduction graph features to obtain molecular pooling features; Energy prediction is performed based on the molecular pooling features to obtain the predicted molecular energy corresponding to the interaction layer.
11. The training method for the neural network force field model according to claim 2, characterized in that, The step of predicting the predicted molecular energy of the sample molecule based on the sample molecule graph features for each interaction layer includes: For each of the interaction layers, the sample molecular graph features are linearly transformed based on the first preset weight matrix and the first preset bias vector to obtain the first transformed graph features; The first transformation map features are activated based on a preset activation function to obtain activated map features; The activation map features are linearly transformed based on the second preset weight matrix and the second preset bias vector to obtain the second transformed map features. Energy prediction is performed based on the features of the second transformation graph to obtain the predicted molecular energy corresponding to the interaction layer.
12. The training method for the neural network force field model according to claim 2, characterized in that, The step of predicting the predicted molecular energy of the sample molecule based on the sample molecule graph features for each interaction layer includes: Extract the molecular backbone information and molecular fragment type of the sample molecules from the sample molecule information; The molecular backbone information is encoded to obtain a molecular backbone encoding vector; The molecular fragment types are encoded to obtain molecular type encoding vectors; For each interaction layer, energy prediction is performed based on the sample molecular graph features, the molecular skeleton encoding vector, and the molecular type encoding vector to obtain the predicted molecular energy corresponding to the interaction layer.
13. A molecular treatment method, characterized in that, The method includes: Obtain the atomic information of multiple atoms in the target molecule; The atomic information of each of the plurality of atoms is input into a neural network force field model to predict the energy, thereby obtaining the predicted molecular energy of the molecule; Based on the predicted molecular energy, the predicted force of each of the plurality of sample atoms is determined, wherein the neural network force field model is trained by the training method of the neural network force field model according to any one of claims 1 to 12.
14. A training device for a neural network force field model, characterized in that, The device includes: The first acquisition unit is used to acquire the original model, which includes an embedding layer and multiple interconnected interaction layers; The second acquisition unit is used to acquire sample molecule information of the sample molecule, wherein the sample molecule information includes sample atom information and atomic force tags of each of the multiple sample atoms in the sample molecule; The encoding unit is used to perform feature encoding through the embedding layer based on the sample atom information of each of the plurality of sample atoms to obtain the atom encoding vector of each of the plurality of sample atoms; An input unit is used to input the atomic encoding vectors of the plurality of sample atoms into the plurality of concatenated interaction layers, wherein each interaction layer outputs the sample molecule graph features corresponding to the interaction layer; The first prediction unit is used to perform force prediction based on the sample molecular graph features corresponding to each interaction layer for each interaction layer, to obtain the predicted atomic force of each sample atom in the interaction layer, and to determine the loss sub-function corresponding to the interaction layer based on the predicted atomic force and the atomic force label of each sample atom. The training unit is used to train the original model based on the loss sub-functions corresponding to each interaction layer to obtain the neural network force field model.
15. A molecular processing device, characterized in that, The device includes: The third acquisition unit is used to acquire the atomic information of each of the multiple atoms in the target molecule; The second prediction unit is used to input the atomic information of each of the plurality of atoms into the neural network force field model to perform energy prediction and obtain the predicted molecular energy of the molecule. A determining unit is used to determine the predicted force of each of the plurality of sample atoms based on the predicted molecular energy, wherein the neural network force field model is trained by the training method of the neural network force field model according to any one of claims 1 to 12.
16. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the training method for the neural network force field model according to any one of claims 1 to 12, or the molecular processing method according to claim 13.
17. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the training method for the neural network force field model according to any one of claims 1 to 12, or the molecular processing method according to claim 13.
18. A computer program product comprising a computer program that is read and executed by a processor of an electronic device, causing the electronic device to perform a training method for a neural network force field model according to any one of claims 1 to 12, or a molecular processing method according to claim 13.