A template-free molecular retrosynthesis method based on three-dimensional conformational enhancement

By fusing 1D and 3D information through the Retro3D model, the accuracy and feasibility issues of existing methods in handling complex molecules are solved, enabling more efficient reactant prediction and generation, and applicable to a variety of chemical reaction databases.

CN120015140BActive Publication Date: 2025-12-16EAST CHINA NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510154551.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-12
Publication Date
2025-12-16
Estimated Expiration
2045-02-12

AI Technical Summary

Technical Problem

Existing retrosynthetic methods for molecules have low accuracy and feasibility in predicting results when dealing with molecules with complex three-dimensional structures and multiple reaction centers, and they fail to effectively integrate 1D SMILES representation with 3D spatial location information.

Method used

The Retro3D model based on the Transformer architecture is adopted. The 1D and 3D embeddings are aligned through the Atom-align Fusion module. Combined with the Distance-weighted Attention mechanism, the 3D distance matrix and cross-attention mechanism are used to generate reactant SMILES sequences, which enhances the model's understanding of molecular spatial structure and prediction accuracy.

Benefits of technology

It improves the accuracy of reactant prediction and the rationality of the generated results, especially when dealing with molecules with complex three-dimensional structures and multiple reaction centers. It also enhances the scalability and computational efficiency of the model and is applicable to chemical reaction databases of different sizes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120015140B_ABST
    Figure CN120015140B_ABST
Patent Text Reader

Abstract

The application discloses a template-free molecular retrosynthesis method based on three-dimensional conformation enhancement, aiming to improve the accuracy and generalization ability of retrosynthesis prediction. The application fuses 1D SMILES sequence and 3D conformation information, solving the challenge of 1D-3D representation alignment and effective use of spatial information. The method adopts an Atom-align Fusion module to maintain the alignment of atom labels and 3D representation, and introduces a Distance-weighted Attention mechanism to optimize attention allocation through molecular spatial structure. In addition, combined with SMILES alignment, data enhancement (random atom arrangement, root atom alignment) and attention guided loss, the prediction ability of the model is further improved. The application does not need to rely on a template library or a molecular editing tool, and achieves significant Top-k accuracy improvement on the USPTO-50k dataset, surpassing existing template-free methods and reaching an advanced level, especially in the retrosynthesis prediction of complex molecular structures.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of molecular retrosynthesis, the field of model generation. Specifically, it relates to a template-free molecular retrosynthesis method based on three-dimensional conformation enhancement, which proposes a molecular retrosynthesis generation model Retro3D based on 3D information fusion. The model can effectively combine 1D SMILES representation and 3D spatial position information of molecular structure to generate reactant SMILES sequence. BACKGROUND

[0002] Currently, the field of molecular retrosynthesis is gradually becoming an important research direction of chemical informatics and drug discovery. With the continuous development of artificial intelligence and machine learning technology, especially under the promotion of deep learning models, data-driven molecular design methods have made significant progress. The task of molecular retrosynthesis aims to predict reactants according to a given target product, which is one of the key technologies in the fields of drug design, material science, etc.

[0003] Currently, existing molecular retrosynthesis methods can be broadly divided into template-based methods and template-free methods. Template-based methods rely on existing reaction template libraries and predict reactants by comparing and matching reaction centers, while template-free methods focus more on learning the rules of molecular reactions from big data without relying on traditional chemical knowledge bases. However, these methods often ignore the spatial structure information of molecules, resulting in low accuracy and feasibility of prediction results when dealing with molecules with complex stereostructure and multiple reaction centers.

[0004] In recent years, more and more research has begun to try to introduce molecular 3D structure information into the retrosynthesis prediction task to overcome the limitations of traditional methods in dealing with complex molecules. However, how to effectively fuse 1D SMILES representation and 3D spatial position information and utilize it in the model is still a challenge. Therefore, molecular retrosynthesis generation models that combine 1D and 3D information have become one of the current research hotspots. SUMMARY

[0005] The technical problem to be solved by the present application is to provide a template-free molecular retrosynthesis method based on three-dimensional conformation enhancement. The method is based on a molecular retrosynthesis generation model with 3D information fusion, which can improve the accuracy of reactant prediction and the rationality of the generated results, especially when dealing with complex stereostructure and multiple reaction center molecules, it has better performance.

[0006] The specific technical solution to achieve the purpose of the present application is:

[0007] A template-free molecular retrosynthesis method based on three-dimensional conformation enhancement, the method comprising the following steps:

[0008] Step A, Retro3D model construction; obtain molecular SMILES representation and 3D coordinate data, and design a Retro3D model based on the Transformer architecture, which simultaneously processes 1D SMILES sequence information and 3D conformation information;

[0009] Step B, generating 1D embedding representation of SMILES sequence; word vector encoding is performed on the molecular SMILES sequence, and each SMILES symbol is converted into a 1D embedding representation, representing each atom and its connection relationship;

[0010] Step C, extracting 3D conformation information and generating 3D position embedding; spatial position information of each atom is extracted from the 3D conformation of the molecule, and neighborhood information of each atom is generated through message passing by the ComENet method to form a 3D position embedding;

[0011] Step D, Atom-align Fusion module aligns 1D and 3D embedding; align the 1D SMILES embedding with the 3D position embedding to generate a fusion embedding F 3D , ensuring that the SMILES character is aligned with its corresponding 3D spatial position;

[0012] Step E, calculate and construct 3D distance matrix; generate a preliminary 3D distance matrix by calculating the Euclidean distance between each pair of atoms; use the Gaussian kernel function to convert the three-dimensional distance into a high-dimensional representation to enhance the model's understanding of spatial relationships;

[0013] Step F, apply Distance-weighted Attention mechanism; introduce 3D distance weight in self-attention mechanism, and reassign attention weight according to the spatial relationship between atoms, so that the model can focus on the atom pairs in the chemical reaction region;

[0014] Step G: SMILES alignment enhances the correspondence between products and reactants; use the atom mapping relationship between reactants and products to construct a SMILES alignment mapping, and guide the correspondence between atoms in the model training through cross-attention mechanism;

[0015] Step H: data augmentation and model training; perform data augmentation by randomly rearranging the order of atoms and aligning the root atoms of products and reactants to improve the generalization ability of the model; in the training process, optimize the loss function and adjust the model parameters;

[0016] Step I: inference and reactant generation; in the inference stage, use beam search strategy to select Top-k results from the generated candidate reactants, and output the optimal reactant SMILES sequence.

[0017] Further, the step A specifically comprises:

[0018] S11, obtain the SMILES representation of a molecule to encode the structural information of the molecule, including:

[0019] Use the SMILES representation of the 1D structure of the molecule, and the SMILES string represents the structure of the molecule through atomic symbols, chemical bonds and ring structure symbols;

[0020] Use 3D coordinate data to represent the spatial position information of each atom in the molecule to capture the stereostructure of the molecule;

[0021] S12, extract the 3D conformation information of the molecule; extract the 3D conformation data of the molecule through the molecular simulation tool RDKit; the specific operation is: 1) use RDKit or other molecular modeling tools to generate the 3D conformation of the molecule; 2) extract the three-dimensional coordinates (x i , y i , z i ) of each atom to form a 3D coordinate matrix;

[0022] S13, design the architecture of the Retro3D model; which includes: encoder: responsible for receiving the SMILES sequence and 3D conformation information of the input end, and encoding them into hidden representation; decoder: according to the representation generated by the encoder, it carries out reverse reasoning to predict the SMILES sequence of the reactant;

[0023] S14, select the input representation for embedding processing; combine the extracted 3D conformation information with the SMILES sequence, and convert them into unified vector representation through embedding layer; including:

[0024] Tokenize the SMILES string, and then convert each SMILES symbol into corresponding vector representation using word embedding layer;

[0025] Standardize the extracted 3D coordinate data and convert it into embedding representation consistent with the length of the SMILES sequence;

[0026] Combine the SMILES embedding and 3D position embedding to form a joint representation;

[0027] S15, select model architecture hyperparameters; which includes:

[0028] Model layer number: select appropriate encoder and decoder layer number, set to 6 layers, ensure the expression ability of the model;

[0029] Number of attention heads: set the number of heads of multi-head attention layer to 8, enhance the attention ability of the model to different structure information;

[0030] Model dimension: Set the dimension of the input vector, set to 512 dimensions, ensure that the model can effectively process large-scale data;

[0031] S16, initialize parameters and build training process; including:

[0032] Initialize parameters: use pre-training method or random initialization to initialize model parameters;

[0033] Define loss function: use cross-entropy loss function to optimize the prediction accuracy in the training process;

[0034] Optimizer selection: select Adam optimizer, set learning rate and weight decay parameters;

[0035] S17, model training setting and data preprocessing; do the preparation work of model training, standardize, denoise and clean the SMILES data to ensure the quality of input data; divide the training set, validation set and test set according to the ratio of 8:1:1.

[0036] Further, the step B specifically includes:

[0037] S21, word segmentation of SMILES sequence; first, use word segmentation algorithm to disassemble SMILES sequence into atomic symbol, chemical bond symbol and ring structure symbol; for example, the molecule CCO will be disassembled into three symbols C, C and O;

[0038] S22, symbol mapping; for each symbol obtained by word segmentation, use the predefined symbol set to map each symbol to a unique index;

[0039] S23, build word embedding layer; use word embedding technology to build SMILES symbol embedding layer; learn the vector representation of each symbol by training a large amount of molecular data, so that similar chemical bonds or atoms have similar vector representation;

[0040] S24, generate initial symbol embedding vector; use word embedding layer to map each SMILES symbol to a fixed dimension vector space; the vector representation of the symbol is input into the model;

[0041] S25, add position information; use position encoding technology to convert the position information of the symbol into a vector, and add it to the embedding vector of the symbol; ensure that the model can understand the relative position of the symbol in the sequence.

[0042] Further, the step C specifically includes:

[0043] S31, generating 3D conformation using molecular simulation tools; first, using the molecular simulation tool RDKit to generate the 3D conformation of the molecule; this process includes optimizing the three-dimensional structure of the molecule to ensure that it complies with chemical rules;

[0044] S32, extracting the 3D coordinates of each atom; extracting the 3D coordinates of each atom; the position of each atom is represented as (x i , y i , z i ), where x i , y i , z i is the coordinate of the i-th atom in three-dimensional space;

[0045] S33, calculating the local spatial relationship between atoms; calculating the distance, angle and local spatial relationship between each pair of atoms;

[0046] S34, generating 3D position embedding of atoms; according to the 3D coordinates and local spatial relationship of each atom, a corresponding 3D position embedding vector is generated for each atom;

[0047] S35, standardizing 3D position information; standardizing the coordinates of each atom to zero mean and unit variance to ensure that the 3D position representation between molecules is trained on the same scale;

[0048] S36, generating 3D position embedding matrix; organizing the 3D position embedding vectors of atoms into a matrix to represent the spatial position information of all atoms in the molecule; the dimension of this matrix is N*D, where N is the number of atoms in the molecule, and D is the embedding dimension of each atom position;

[0049] S37, combining 3D position embedding with 1D SMILES embedding; through the Atom-align Fusion module, combining the 1D embedding representation of SMILES sequence and the embedding representation of 3D position, generating the final joint embedding; the model can process 1D SMILES sequence information and 3D spatial position information at the same time, thereby enhancing the understanding of molecular structure;

[0050] S38, optimizing 3D position embedding; during the model training process, through the feedback of the loss function, the representation of 3D position embedding is optimized, so that the embedding can better capture the spatial relationship between molecules.

[0051] Further, the step D specifically comprises:

[0052] S41, extracting 1D and 3D embedding representation; 1D embedding is a vector sequence representing SMILES symbol, while 3D embedding is the position vector of each atom in three-dimensional space;

[0053] S42, determine the alignment method of 1D and 3D embedding; align 1D embedding and 3D embedding to the same atomic index, so that the 1D embedding and 3D position embedding of each atom can correspond in the same space;

[0054] S43, fill the 3D position embedding to match the length of 1D embedding; fill the non-atomic position with zero vector, and fill the 3D position embedding to the dimension equal to the length of 1D sequence;

[0055] S44, calculate the weight coefficient of fusion embedding; define the weight coefficient and , respectively, for controlling the proportion of 1D sequence embedding and 3D position embedding in the final fusion embedding; the weight coefficient is dynamically adjusted during the training process to ensure that the model can properly process 1D and 3D information;

[0056] S45, weighted fusion of 1D and 3D embedding; according to the calculated weight coefficient and , weighted fusion of 1D SMILES embedding and 3D position embedding; the specific formula is: ; wherein, is the 3D position embedding, is the SMILES embedding the final fusion embedding; the fusion embedding combines the 1D molecular structure information and the 3D spatial structure information.

[0057] Further, the step E specifically comprises:

[0058] S51, extract the 3D coordinate information of the atom; extract the 3D coordinate of each atom from the 3D conformation of the molecule; ensure that the coordinate information of each atom is correct and complete;

[0059] S52, calculate the Euclidean distance between each pair of atoms; according to the 3D coordinate data extracted from step S51, calculate the Euclidean distance between each pair of atoms in the molecule ; formula: , the distance measure reflects the relative position relationship between two atoms in three-dimensional space;

[0060] S53, generate a preliminary 3D distance matrix; construct a symmetric 3D distance matrix by calculating the Euclidean distance , the size of the matrix is , where N is the number of atoms in the molecule, and each element in the matrix represents the distance between the corresponding two atoms;

[0061] S54, Normalize the distance matrix; To ensure consistent scale between different molecules, the 3D distance matrix needs to be normalized; Divide each element in the distance matrix by the mean to standardize the distance values, so that the values ​​of the distance matrix have a uniform scale;

[0062] S55, apply the Gaussian function to transform the distance matrix; use the Gaussian function to transform the distance between each pair of atoms. Mapping to a high-dimensional space yields a new representation between each pair of atoms. ;formula: ,in, It is the first The mean of the Gaussian functions, It is the standard deviation. It is the distance between atoms i and j;

[0063] S56, generate a weighted 3D distance matrix; transform the Gaussian function to obtain... Information is integrated into a matrix to generate a weighted 3D distance matrix. Each element in the matrix This represents the weighted distance between atom pairs (i, j);

[0064] S57, perform nonlinear transformation of the matrix; map the weighted 3D distance matrix through a multilayer perceptron. This generates the final 3D distance matrix.

[0065] S58, Construct the final representation of the 3D distance matrix; transform the 3D distance matrix The input is fed into the model for training, and is used to adjust the model's self-attention weights.

[0066] Furthermore, step F specifically includes:

[0067] S61 combines spatial distance with the standard attention mechanism; when calculating the attention score between atoms, in addition to the original similarity calculation based on vector representation, it also... As an additional measure, the standard attention score is adjusted so that spatially closer atomic pairs can receive greater attention weight;

[0068] S62, construct the final attention score; combine the standard attention score and weighted spatial information to construct the final attention score. Calculation method: ,in, and These are the query vector and key vector for atoms i and j, respectively, where dim is the dimension of the vector. It is a hyperparameter used to adjust the degree of influence of 3D spatial weights on attention;

[0069] S63, normalize the attention scores using the Softmax function; apply the Softmax function to normalize the attention scores, ensuring that the sum of all attention weights is 1; through the Softmax function, the attention weight between each pair of atoms will be allocated according to their relative distance and vector similarity;

[0070] S64, calculate the weighted attention output; using the normalized attention weights , weight the values of each atom and sum them up to get the final attention output ; the calculation formula is: , where, is the value vector of atom j, N(i) is the set of atoms adjacent to atom i, is the attention weight of atom i to atom j; the final will be passed as input to the next layer of the model.

[0071] Further, the step G specifically includes:

[0072] S71, generate SMILES alignment graph by atom mapping; atom mapping refers to the pairing relationship of corresponding atoms in reactants and products; by analyzing the atom mapping relationship between products and reactants, generate SMILES alignment graph;

[0073] S72, design attention-guided loss function; this loss function compares the difference between the model's predicted attention distribution and the actual SMILES alignment graph, guiding the model to allocate attention to the correct atom correspondence relationship during training.

[0074] Further, the step H specifically includes:

[0075] S81, apply Root-align SMILES enhancement; select the root atom in the product and find the corresponding atom in the reactant; by aligning the root atom, generate a reactant sequence with high similarity;

[0076] S82, use early stopping strategy to prevent overfitting; monitor the loss value on the validation set during training, if the model's performance on the validation set does not improve further, stop training in advance; prevent the model from over-learning on the training set, leading to decreased generalization ability.

[0077] Further, the step I specifically includes:

[0078] S91, beam search initialization; in the beam search, define the beam size as 10, indicating that in each generation step, the model retains the top 10 candidate results; initially, the beam search starts from the first symbol of the product sequence to generate the reactant sequence, and at each step, the most likely next symbol is selected according to the prediction of the model until the complete reactant sequence is generated.

[0079] Compared with existing template methods and traditional generative models, the Retro3D of the present application achieves better performance in the inverse synthesis task, especially when dealing with molecules with complex stereostructure, it can generate more accurate and reasonable reactant prediction results.

[0080] The beneficial effects of the present application mainly manifest in the following four aspects: (1) improve the prediction accuracy of molecular inverse synthesis. By combining 1D SMILES sequence and 3D molecular conformation information, Retro3D can capture the spatial structure characteristics of molecules, optimize the recognition of reaction centers, and generate reaction products that conform to chemical rules. Experimental results show that compared with traditional template-free methods, the present application has achieved significant improvement in Top-k prediction accuracy, especially on molecules with stereochemical characteristics. (2) Enhance the scalability and adaptability of the model. Since the present application does not rely on fixed reaction templates, but learns reaction rules directly from data through deep learning methods, it can be applied to different sizes of data sets, such as USPTO-50K, and can be extended to other chemical reaction databases. This method is particularly suitable for new or rare reaction types, and has strong versatility and application potential. (3) Optimize the calculation efficiency and improve the reasoning speed. Adopting beam search to optimize the reactant generation process and reducing the generation search space through SMILES alignment module, the model can improve the calculation efficiency while ensuring the prediction accuracy. Experiments show that under the same computing resources, the present application can generate high-quality reactants at a faster reasoning speed, improving the practicality of the model on large-scale data sets. (4) Enhance the processing ability of complex molecules. Through the Distance-weighted Attention mechanism, the present application can use 3D molecular information to guide the model to focus on spatially related atom pairs, thereby generating more reasonable reactants on molecules with complex stereostructure (such as multiple chiral centers, heterocyclic systems, bridged ring structures, etc.), improving the chemical feasibility of prediction. BRIEF DESCRIPTION OF DRAWINGS

[0081] Figure 1 Flowchart of the present application;

[0082] Figure 2 Inverse synthesis framework diagram of a molecular inverse synthesis method provided by an embodiment of the present application;

[0083] Figure 3Flowchart for multi-head self-attention mechanism;

[0084] Figure 4 Flowchart for multi-head cross-attention mechanism. DETAILED DESCRIPTION

[0085] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.

[0086] Referring to Figure 1 The present application is a template-free molecular retrosynthesis method based on three-dimensional conformation enhancement, which comprises the following steps:

[0087] Step A: Constructing the Retro3D model framework. This step includes selecting appropriate molecular representation methods (such as SMILES) and 3D coordinate data, and designing a Retro3D model based on the Transformer architecture, which can process 1D SMILES sequences and 3D conformation information simultaneously. Through the encoder-decoder architecture, the input layer is constructed and the corresponding embedding representation is provided for the model.

[0088] Step B: Generating 1D embedding representation of SMILES sequence. By performing word vector encoding on the molecular SMILES sequence, each SMILES symbol is converted into a 1D embedding representation, ensuring that each atom and its connection relationship is effectively represented.

[0089] Step C, extracting 3D conformation information and generating 3D position embedding. In this step, the spatial position information of each atom is extracted from the 3D conformation of the molecule, and the neighborhood information of each atom is generated through the ComENet method for message passing, thereby forming the 3D position embedding.

[0090] Step D, Atom-align Fusion module aligns 1D and 3D embedding. In this step, the 1D SMILES embedding is aligned with the 3D position embedding to generate a fusion embedding $F_{\text{3D}}$, ensuring that the SMILES atoms are aligned with their corresponding 3D spatial positions for subsequent processing.

[0091] Step E, calculate and construct 3D distance matrix. By calculating the Euclidean distance between each pair of atoms, a preliminary 3D distance matrix is generated. Then use the Gaussian kernel function to convert these distances into high-dimensional representations to enhance the model's understanding of spatial relationships.

[0092] Step F, apply Distance-weighted Attention mechanism. Introduce 3D distance weight in the self-attention mechanism, and reassign attention weights according to the spatial relationship between atoms. In this way, the model can focus on the atom pairs that have important influence on chemical reactions.

[0093] Step G: SMILES alignment module enhances the correspondence between products and reactants. By utilizing the atomic mapping relationship between reactants and products, a SMILES alignment map (SAM) is constructed, and the correct atomic correspondence is guided in model training through the cross-attention mechanism, thereby improving the accuracy of prediction.

[0094] Step H: Data augmentation and model training. Through methods such as randomly rearranging atomic order and aligning the root atoms of products and reactants, data augmentation is performed to improve the generalization ability of the model. In the training process, the loss function is optimized, and the model parameters are adjusted.

[0095] Step I: Inference and reactant generation. In the inference stage, the beam search strategy is used to select Top-k results from the generated candidate reactants, and finally output the optimal reactant SMILES sequence.

[0096] Step A, build the Retro3D model framework, the specific implementation steps are:

[0097] S11, select appropriate molecular representation method. In this step, appropriate molecular representation method is selected to encode the structural information of molecules, mainly including: using SMILES (Simplified Molecular Input Line Entry System) to represent the 1D structure of molecules, SMILES string represents the structure of molecules through atomic symbol, chemical bond and ring structure symbol; adopt 3D coordinate data, represent the spatial position information of each atom in the molecule, to capture the stereostructure of the molecule.

[0098] S12, extract the 3D conformation information of the molecule. This step extracts the 3D conformation data of the molecule through molecular simulation tools (such as RDKit). The specific operation is: 1) use RDKit or other molecular modeling tools to generate the 3D conformation of the molecule. 2) extract the position (such as coordinates x i , y i , z i ) of each atom, and construct a 3D coordinate matrix as the input of subsequent processing.

[0099] S13, design the architecture of Retro3D model. In this step, the core architecture of Retro3D model is designed. Retro3D is based on Transformer architecture, which includes: 1) Encoder (encoder): responsible for receiving input data (SMILES sequence and 3D conformation information), and encoding it into hidden representation. 2) Decoder (decoder): according to the representation generated by the encoder, it carries out reverse reasoning to predict the SMILES sequence of the reactant.

[0100] S14, select input representation and perform embedding processing. Combine the extracted 3D conformation information with the SMILES sequence, and convert them into a unified vector representation through an embedding layer. Specifically, it includes:

[0101] Tokenization of SMILES string, then convert each SMILES symbol to corresponding vector representation using word embedding layer.

[0102] Standardize the extracted 3D coordinate data and convert it into an embedding representation matching the length of the SMILES sequence.

[0103] Combine SMILES embedding and 3D position embedding to form a joint representation input into the Transformer model.

[0104] S15, select appropriate Transformer architecture hyperparameters. In this step, set the hyperparameters of the Transformer model to ensure it can handle complex structural information of molecules. Mainly includes:

[0105] Model layers: Select appropriate encoder and decoder layers, generally 6 to 12 layers, to ensure the model's expression ability.

[0106] Number of attention heads: Set the number of attention heads for each layer of the Transformer, usually 8 to 16 heads, to enhance the model's attention to different structural information.

[0107] Model dimension: Set appropriate dimensions for each input vector, such as 512 dimensions or higher, to ensure the model can effectively process large-scale data.

[0108] S16, initialize parameters and build training process. In this step, initialize the model parameters and build the training process:

[0109] Initialize parameters: Use pre-training methods or random initialization to initialize model parameters.

[0110] Define loss function: Select an appropriate loss function, such as Cross-Entropy Loss, for optimizing prediction accuracy during training.

[0111] Optimizer selection: Select an appropriate optimizer (such as Adam optimizer) and set learning rate, weight decay, and other hyperparameters.

[0112] S17, model training setup and data preprocessing. In this step, the training preparation work of the model is carried out, and the SMILES data is standardized, denoised and cleaned to ensure the quality of the input data. According to the proportion of the training set, the validation set and the test set (such as 70% training, 15% validation and 15% testing), the data is divided to ensure that the model can be effectively trained on different data sets.

[0113] Step B, generating 1D embedding representation of SMILES sequence, specifically including:

[0114] S21, tokenization of SMILES sequence. First, the SMILES representation of the molecule is obtained, and the tokenization algorithm is used to decompose the SMILES sequence into basic units (tokens) such as atomic symbols, bond symbols and ring structure symbols. For example, the molecule CCO will be decomposed into C, C and O.

[0115] S22, symbol mapping. For each symbol obtained by tokenization, use a predefined symbol set (such as the standard symbol set provided by RDKit or other tools) to map it to a unique index, ensuring that each symbol has a corresponding unique identifier.

[0116] S23, building word embedding layer. Use word embedding technology (such as Word2Vec, GloVe, etc.) to build the embedding layer of SMILES symbols. Through the training of a large amount of molecular data, the vector representation of each symbol is learned, so that similar chemical bonds or atoms have similar vector representations, ensuring that the molecular structure information can be effectively transmitted.

[0117] S24, generating initial symbol embedding vectors. Use the word embedding layer to map each SMILES symbol to a fixed-dimensional vector space. Usually, the dimension of these vectors is set to 512 dimensions or higher to ensure sufficient expression ability. The vector representation corresponding to each symbol will be the input of the symbol in the model.

[0118] S25, adding position information. In order to ensure that the order information in the SMILES sequence can be transmitted to the model, position information is added to the embedding vector of each symbol. Usually, the position encoding (Positional Encoding) technology is used to convert the position information of each symbol into a vector and add it to the embedding vector of the symbol. This ensures that the model can understand the relative position of the symbol in the SMILES sequence.

[0119] Step C, extracting 3D conformation information and generating 3D position embedding, specifically including:

[0120] S31, generate 3D conformation using molecular simulation tools. First, select a suitable molecular simulation tool (such as RDKit or Gaussian, etc.) to generate the 3D conformation of the molecule. By using these tools, based on the 2D structure information of the molecule, molecular dynamics simulation or energy minimization is performed to generate a stable 3D conformation. This process usually includes optimizing the three-dimensional structure of the molecule to ensure that it meets the chemical rules, such as the reasonableness of atomic distance and angle.

[0121] S32, extract the 3D coordinates of each atom. After obtaining the stable 3D conformation through the molecular simulation tool, extract the spatial position information (i.e. 3D coordinates) of each atom. The position of each atom can be represented as a three-tuple (x i , y i , z i ), where x i , y i , z i is the coordinate of the i-th atom in three-dimensional space.

[0122] S33, calculate the local spatial relationship between atoms. After extracting the 3D coordinates of each atom, calculate the distance, angle and other spatial relationships between each pair of atoms. These local spatial relationships are used to enhance the model's understanding of atomic neighborhood relationships and structures. For example, calculate the Euclidean distance between two atoms so that the spatial feature fusion later.

[0123] S34, generate 3D position embedding of atoms. According to the 3D coordinates and local spatial relationships of each atom, generate a corresponding 3D position embedding vector for each atom. Usually, the position encoding technique is used to encode the position of the atom to generate a fixed-dimensional embedding representation (such as 512 dimensions or higher), which contains the spatial position information of the atom.

[0124] S35, normalize 3D position information. In order to avoid the influence of scale difference between different molecules on the learning of the model, the 3D position embedding of the atom is usually normalized. By standardizing the coordinates of each atom to zero mean and unit variance, it ensures that the 3D position representation of molecules is trained on the same scale, thereby improving the robustness of the model.

[0125] S36, generate 3D position embedding matrix. Organize the 3D position embedding vectors of each atom into a matrix, which is used to represent the spatial position information of all atoms in the molecule. The dimension of this matrix is usually N*D, where N is the number of atoms in the molecule and D is the embedding dimension of each atomic position (usually 512 or higher). This matrix will be passed as input to the subsequent steps of the Transformer model.

[0126] S37, combine 3D position embedding with 1D SMILES embedding. Through the Atom-align Fusion module, the 1D embedding representation of SMILES sequence and the embedding representation of 3D position are combined to generate the final joint embedding. In this way, the model can process both 1D SMILES sequence information and 3D spatial position information, thereby enhancing the understanding of molecular structure.

[0127] S38, optimize 3D position embedding. During the model training process, the representation of 3D position embedding is optimized through the feedback of the loss function, so that the embedding can better capture the spatial relationship between molecules, thereby improving the prediction accuracy. This step ensures that the 3D position embedding can effectively help the model generate synthetic routes and predict reactants during the prediction process.

[0128] Step D, the Atom-align Fusion module aligns 1D and 3D embeddings, which specifically includes:

[0129] S41, extract 1D and 3D embedding representations. First, obtain the 1D embedding representation from the SMILES sequence and the 3D position embedding representation from the 3D conformation of the molecule. Before this, the SMILES sequence has been converted into a vector representation through tokenization and word embedding techniques, while the 3D position embedding is a spatial position vector generated by extracting the 3D coordinates of each atom. At this time, the 1D embedding is a sequence of vectors representing SMILES symbols, while the 3D embedding is a position vector of each atom in three-dimensional space.

[0130] S42, determine the alignment method of 1D and 3D embeddings. Since 1D SMILES embedding and 3D position embedding represent different aspects of the molecule (1D represents the linear relationship of the molecular structure, and 3D represents the geometric relationship of the molecular spatial structure), it is necessary to ensure the alignment of these two embeddings in the model. The specific method is to align the 1D embedding and the 3D embedding to the same atomic index, so that the 1D embedding and the 3D position embedding of each atom can correspond in the same space.

[0131] S43, pad the 3D position embedding to match the length of the 1D embedding. Since the length of the SMILES sequence (i.e. the number of atomic symbols) may be different from the number of atoms in the 3D position, the 3D position embedding needs to be padded. The specific method is: if the length of the 3D position embedding is less than the length of the SMILES sequence, pad the 3D position embedding to the same dimension as the length of the SMILES sequence, usually using zero padding or special symbol padding for non-atomic positions.

[0132] S44, calculate the weight coefficient of the fusion embedding. In order to effectively fuse 1D and 3D embeddings, define the weight coefficient and , respectively, are used to control the contribution ratio of 1D SMILES embedding and 3D position embedding in the final fused embedding. The weight coefficients are dynamically adjusted during the training process to ensure that the model can properly handle 1D and 3D information.

[0133] S45, weighted fusion of 1D and 3D embedding. According to the calculated weight coefficients and , the 1D SMILES embedding and the 3D position embedding are weighted and fused. The specific formula is: . Wherein, is the 3D position embedding, is the SMILES embedding is the final fused embedding. The fusion embedding combines 1D molecular structure information and 3D spatial structure information, providing it to the subsequent model for processing.

[0134] Step E, calculate and construct 3D distance matrix, specifically including:

[0135] S51, extract the 3D coordinate information of the atoms. First, extract the 3D coordinates (x i , y i , z i ) of each atom from the 3D conformation of the molecule. These coordinate data can be obtained through molecular modeling tools such as RDKi. In this step, ensure that the coordinate information of each atom is correct and complete so that the spatial relationship between atoms can be calculated later.

[0136] S52, calculate the Euclidean distance between each pair of atoms. According to the 3D coordinate data extracted from step S51, calculate the Euclidean distance between each pair of atoms in the molecule. The formula is: , which measures the relative position relationship between two atoms in three-dimensional space, is the core calculation for constructing the 3D distance matrix.

[0137] S53, generate a preliminary 3D distance matrix. Through the calculated Euclidean distance , a symmetric 3D distance matrix is constructed, where N is the number of atoms in the molecule, and each element in the matrix represents the distance

[0138] S54, normalize the distance matrix. In order to ensure the scale consistency between different molecules, it is necessary to normalize the 3D distance matrix. By dividing each element in the distance matrix by the maximum distance or the mean value, the distance value is standardized, so that the value of the distance matrix has a uniform scale. This helps to improve the robustness of the model to spatial relationships and reduce inconsistencies caused by different molecule sizes.

[0139] S55, Apply Gaussian Function Transformation to Distance Matrix. To increase the expressive power of the matrix, a Gaussian Basis Function can be used to transform the distance matrix into a higher-dimensional representation. By applying a Gaussian function to the distance between each pair of atoms , a new representation of each pair of atoms is obtained , where is the mean of the th Gaussian basis function, is the standard deviation, and is the distance between atoms i and j.

[0140] S56, Generate Weighted 3D Distance Matrix. The information obtained by the Gaussian basis function transformation is integrated into the matrix to generate a weighted 3D distance matrix . Each element in this matrix represents the weighted distance between atom pair (i, j), which can reflect the complexity of the spatial relationship between atoms.

[0141] S57, Perform Nonlinear Transformation of Matrix. To enhance the model's ability to express spatial structure, a nonlinear transformation is used to further process the 3D distance matrix. Through a multi-layer perceptron (MLP) or other nonlinear layer, the weighted 3D distance matrix is mapped to generate the final 3D distance matrix. This transformation helps capture the nonlinear spatial relationship between atoms and enables the model to handle more complex spatial dependencies.

[0142] S58, Construct the Final Representation of 3D Distance Matrix. The 3D distance matrix after normalization, Gaussian transformation and nonlinear transformation is taken as the final 3D spatial relationship matrix, which is passed as input to the subsequent model for training. This matrix will be used to adjust the model's attention mechanism to ensure that the model can focus on important spatial relationships in the molecule.

[0143] Step F, Apply Distance-weighted Attention Mechanism, which includes:

[0144] S61, Combine Spatial Distance with Standard Attention Mechanism. To enable the model to balance between spatial structure and sequence information, the 3D distance-based attention weight needs to be combined with the traditional self-attention mechanism. Specifically, when calculating the attention score between atoms, in addition to the original similarity calculation based on vector representation (such as dot product calculation), the As an additional item, the standard attention score is adjusted so that atom pairs that are closer in space can obtain greater attention weights, thereby enhancing the model's perception of spatial relationships.

[0145] S62, constructing the final attention score. Combining the standard attention score and the weighted spatial information, the final attention score is constructed . The calculation method is as follows: , where, and are the query and key vectors of atom i and atom j respectively, d is the dimension of the vector, is a hyperparameter used to adjust the degree of influence of 3D spatial weight on attention.

[0146] S63, normalizing the attention score using the Softmax function. In order to obtain the final attention weight, the Softmax function is applied to for normalization processing, ensuring that the sum of all attention weights is 1. Through the Softmax function, the attention weight between each atom pair will be allocated according to their relative distance and vector similarity.

[0147] S64, calculating the weighted attention output. Using the normalized attention weight , the values of each atom are weighted and summed to obtain the final attention output . The calculation formula is as follows: , where, is the value vector of atom j, N(i) is the set of atoms adjacent to atom i, is the attention weight of atom i to atom j. The final will be passed as input to the next layer of the model.

[0148] Step G, the SMILES alignment module enhances the correspondence between the product and the reactant, specifically including:

[0149] S71, generating SMILES alignment map (SAM) through atom mapping. By analyzing the atom mapping relationship between the product and the reactant, a SMILES Alignment Map (SAM) is generated. Atom mapping refers to the pairing relationship of corresponding atoms in the reactant and the product. For example, in a certain reaction, an atom of the reactant may become an atom of the product. Through these mapping relationships, a SMILES alignment map is constructed, which contains the correspondence between atoms in the reactant and the product, helping the model understand the structural relationship between the two.

[0150] S72, Design Attention Guidance Loss Function. To enhance the model's learning of SMILES alignment, an attention guidance loss function is designed. This loss function compares the predicted attention distribution of the model with the actual SMILES alignment graph, encouraging the model to learn the correct atomic correspondence through attention during training. Specifically, the loss function measures the alignment error by calculating the cross-entropy loss, guiding the model to pay more attention to the structural mapping between the product and reactant when generating the reactant.

[0151] Step H, Data Augmentation and Model Training, specifically including:

[0152] S81, Apply Root-align SMILES Enhancement. Select a root atom in the product and ensure that a corresponding atom in the reactant is found as the root atom. By aligning the root atom, a reactant SMILES sequence with higher similarity is generated. This method can reduce the structural difference between the reactant and product, enhancing the stability of model learning and helping the model focus more on learning the key changes of the reaction.

[0153] S82, Use Early Stopping Strategy to Prevent Overfitting. To avoid overfitting of the model during training, the early stopping strategy is used. During training, monitor the loss value on the validation set. If the model's performance on the validation set does not improve further, stop training early. This helps prevent the model from overlearning on the training set, leading to decreased generalization ability.

[0154] Step I, SMILES Alignment Module Enhances the Correspondence between Product and Reactant, specifically including:

[0155] S91, Beam Search Initialization. To generate the optimal reactant SMILES sequence, the beam search algorithm is used. In beam search, a beam size is defined, for example, set to 10, indicating that in each generation step, the model retains the top 10 candidate results. Initially, beam search starts from the first symbol of the product SMILES sequence to generate the reactant sequence, and at each step, the most likely next symbol is selected according to the model's prediction until the complete reactant SMILES sequence is generated.

[0156] S92, an early stopping strategy is adopted to prevent overfitting. In order to avoid overfitting of the model during training, an early stopping strategy is used. During training, the loss value on the validation set is monitored, and if it is found that the performance of the model on the validation set does not further improve, the training is stopped in advance. This helps to prevent the model from over-learning on the training set, resulting in a decrease in generalization ability.

[0157] The method of the present application first extracts the SMILES representation of the target molecule through a molecular simulation tool (such as RDKit) and generates its corresponding 3D conformation. The generated 3D conformation includes the spatial coordinates of each atom, and then the embedding representation of the 1D SMILES sequence is aligned with the embedding representation of the 3D spatial position information through the Atom-alignFusion module. This module combines the 1D SMILES representation and the 3D position embedding to ensure that the linear information and spatial information of the molecular structure can be effectively fused in the self-attention stage (see Figure 3 ) when input to the model.

[0158] Next, the Distance-weighted Attention mechanism is used to perform attention calculation on the combination of 1D and 3D embeddings. By introducing a Gaussian weighting function, the attention weight is adjusted according to the 3D distance between atoms in the molecule, so that the model can pay more attention to atom pairs with similar spatial structures. This mechanism calculates the Euclidean distance between each pair of atoms and adjusts the model's attention allocation by combining these distance information, ensuring that the model can focus on the key spatial relationships in the molecule in the cross-attention stage (see Figure 4 ).

[0159] During the model training process, data augmentation strategies are used for optimization. First, the SMILES sequence is randomized (such as randomly rearranging the order of atoms) to generate augmented training data. This process can increase the diversity of training data, allowing the model to adapt to more diverse reactant predictions. Then, through the SMILES alignment module, the SMILES sequences of the product and reactant are aligned to generate a SMILES Alignment Map (SAM), and the model is guided to learn the atomic mapping relationship between the product and reactant by introducing an attention-guided loss.

[0160] In the inference stage, the beam search algorithm (beam search) is used to generate the reactant SMILES sequence. In beam search, the model starts from the SMILES sequence of the product and gradually generates the reactant sequence through the decoder. During the generation process, the model selects the optimal path according to the probability of each candidate symbol until the complete reactant SMILES sequence is generated. The generated reactant candidate sequence is verified to ensure that it meets the chemical rules and is effective.

[0161] Finally, through the above steps, the molecular retrosynthesis generation model combining 1D and 3D information can effectively predict the reactant SMILES sequence, especially when facing complex molecules, it can generate more accurate and reasonable reactant prediction results.

[0162] Example 1

[0163] Referring to Figure 2 , this embodiment constructs a molecular retrosynthesis generation model Retro3D based on 3D information fusion. The model can effectively combine the 1D SMILES representation of the molecular structure and the 3D spatial position information to generate the reactant SMILES sequence. Next, the model is applied to the molecular retrosynthesis task in the USPTO-50k dataset to verify its effect. The working process is described in detail below:

[0164] First, reaction data is extracted from the USPTO-50k dataset, which contains 50,016 atom-labeled reactions, of which 40,008 reactions are used as the training set, 5,001 reactions are used as the validation set, and 5,007 reactions are used as the test set. Each reaction in the dataset includes a product SMILES sequence and the corresponding reactant SMILES sequence.

[0165] Then, the molecular simulation tool (such as RDKit) is used to generate the corresponding 3D conformation for each reaction, and the 3D position embedding of each reactant and product molecule is extracted. These 3D position information and the 1D SMILES representation of the product and reactant are input into the Retro3D model, the 1D and 3D embedding are aligned through the Atom-align Fusion module, and the spatial relationship is introduced into the attention calculation through the Distance-weighted Attention mechanism.

[0166] In order to enhance the training data, random SMILES enhancement and root-align SMILES enhancement strategies are used for data enhancement of the original SMILES data. By randomizing the SMILES sequence and generating different reactant samples through root atom alignment, the diversity of the dataset is increased, and the generalization ability of the model is improved.

[0167] Next, the dataset is divided into training, validation, and test sets in the ratio of 8:1:1. By training the Retro3D model on the training set, adjusting the model parameters on the validation set, and evaluating the performance of the model on the test set. In the experiment, the Retro3D model is compared with existing template methods, semi-template methods, and other non-template methods, including RetroSim, GLN, Retroformer, etc., to evaluate its Top-k accuracy in generating reactant SMILES sequences.

[0168] Table 1

[0169] The experimental results of Table 1 show that, regardless of the presence or absence of reaction types, Retro3D outperforms existing non-template methods in terms of accuracy and effectiveness in generating reactant SMILES sequences, and also performs quite well in comparison with template and semi-template methods. This indicates that Retro3D can effectively combine 1D and 3D information and achieve good prediction results in complex molecule retrosynthesis tasks.

Claims

1. A template-free molecular retrosynthesis method based on three-dimensional conformational enhancement, characterized in that, The method comprises the following steps: Step A, constructing a Retro3D model; obtaining molecular SMILES representation and 3D coordinate data, and designing a Retro3D model based on a Transformer architecture, while processing 1D SMILES sequence information and 3D conformation information; Step B, generating 1D embedding representation of SMILES sequence; word vector coding is performed on the molecular SMILES sequence, and each SMILES symbol is converted into 1D embedding representation to represent each atom and its connection relationship; Step C, extracting 3D conformation information and generating 3D position embedding; the spatial position information of each atom is extracted from the 3D conformation of the molecule, message passing is performed through the ComENet method to generate the neighborhood information of each atom, and 3D position embedding is formed; Step D, Atom-align Fusion module aligns 1D and 3D embeddings; aligns 1D SMILES embeddings with 3D positional embeddings to generate fused embeddings F 3D , ensuring that SMILES characters are aligned with their corresponding 3D spatial positions; Step E, calculating and constructing a 3D distance matrix; a preliminary 3D distance matrix is generated by calculating the Euclidean distance between each pair of atoms; a Gaussian kernel function is used to convert the three-dimensional distance into a high-dimensional representation to enhance the understanding of the model to the spatial relationship; Step F, applying a Distance-weighted Attention mechanism; a 3D distance weight is introduced in the self-attention mechanism, and the attention weight is redistributed according to the spatial relationship between atoms, so that the model can focus on the atom pairs in the chemical reaction region; Step G: SMILES alignment enhances the correspondence between products and reactants; the atom mapping relationship between the reactant and the product is used to construct a SMILES alignment mapping, and the cross-attention mechanism is used to guide the correspondence between atoms in the model training; Step H: data enhancement and model training; the generalization ability of the model is improved by randomly rearranging the atom order and aligning the root atoms of the product and the reactant; in the training process, the loss function is optimized, and the model parameters are adjusted; Step I: reasoning and reactant generation; in the reasoning stage, a beam search strategy is used to select Top-k results from the generated candidate reactants, and the optimal reactant SMILES sequence is output.

2. The method of template-free molecular retrosynthesis of claim 1, wherein, The step A specifically comprises: S11, obtaining a molecular SMILES representation to encode the structure information of the molecule, comprising: Using SMILES to represent the 1D structure of the molecule, the SMILES string represents the structure of the molecule through atom symbols, chemical bonds and ring structure symbols; Using 3D coordinate data to represent the spatial position information of each atom in the molecule to capture the stereostructure of the molecule; S12, extracting 3D conformation information of the molecule; the 3D conformation data of the molecule is extracted through a molecular simulation tool RDKit; the specific operation is: 1) generating the 3D conformation of the molecule using RDKit or other molecular modeling tools; 2) extracting the three-dimensional coordinates (x i , y i , z i ) of each atom to form a 3D coordinate matrix; S13, designing the architecture of the Retro3D model; which includes: an encoder responsible for receiving the SMILES sequence and 3D conformation information at the input end and encoding them into hidden representations; a decoder that performs reverse reasoning according to the representation generated by the encoder to predict the SMILES sequence of the reactant; S14, selecting input representation for embedding processing; combine the extracted 3D conformation information with the SMILES sequence, and convert them into unified vector representation through the embedding layer; including: Tokenizing the SMILES string, and then converting each SMILES symbol into a corresponding vector representation using a word embedding layer; The extracted 3D coordinate data is standardized and converted into an embedding representation consistent with the length of the SMILES sequence; Combine SMILES embedding and 3D position embedding to form a joint representation; S15, select model architecture hyperparameters; including: Model layer number: select the number of encoder and decoder layers, set to 6 layers, ensure the expression ability of the model; Number of attention heads: the number of heads of the multi-head attention layer, set to 8 heads, enhance the attention ability of the model to different structure information; Model dimension: the dimension of the input vector, set to 512 dimensions, ensure that the model can effectively process large-scale data; S16, initialize parameters and build training process; including: Initialize parameters: initialize model parameters using pre-training method or random initialization; Define loss function: use cross-entropy loss function to optimize the prediction accuracy in the training process; Optimizer selection: select Adam optimizer, set learning rate and weight decay parameters; S17, model training setting and data preprocessing; prepare the model for training, standardize, denoise and clean the SMILES data to ensure the quality of the input data; divide the training set, validation set and test set according to the ratio of 8:1:

1.

3. The method of template-free molecular retrosynthesis of claim 1, wherein, The step B specifically includes: S21, word segmentation of SMILES sequence; first, use word segmentation algorithm to decompose SMILES sequence into atomic symbol, chemical bond symbol and ring structure symbol; S22, symbol mapping; for each symbol obtained by word segmentation, use the pre-defined symbol set to map each symbol to a unique index; S23, build word embedding layer; use word embedding technology to build SMILES symbol embedding layer; learn the vector representation of each symbol by training a large amount of molecular data, so that similar chemical bonds or atoms have similar vector representation; S24, generate initial symbol embedding vector; use word embedding layer to map each SMILES symbol to a fixed-dimensional vector space; the vector representation of the symbol is input into the model; S25, add position information; use position encoding technology to convert the position information of the symbol into a vector, and add it to the embedding vector of the symbol; ensure that the model can understand the relative position of the symbol in the sequence.

4. The method of template-free molecular retrosynthesis of claim 1, wherein, The step C specifically includes: S31, generate 3D conformation using molecular simulation tool; first, use molecular simulation tool RDKit to generate 3D conformation of molecule; this process includes optimizing the three-dimensional structure of the molecule to ensure that it meets the chemical rules; S32, extract 3D coordinates of each atom; extract 3D coordinates of each atom; the position of each atom is represented as (x i , y i , z i ), where x i , y i , z i are the coordinates of the i-th atom in three-dimensional space; i i i i i i S33, calculate the local spatial relationship between atoms; calculate the distance, angle and local spatial relationship between each pair of atoms; S34, generate 3D position embedding of atoms; generate a corresponding 3D position embedding vector for each atom according to its 3D coordinates and local spatial relationship; S35, standardize 3D position information; standardize the coordinates of each atom to zero mean and unit variance, ensure that the 3D position representation between molecules is trained on the same scale; S36, generating a 3D position embedding matrix; organizing the 3D position embedding vectors of atoms into a matrix to represent the spatial position information of all atoms in the molecule; the dimension of this matrix is N*D, where N is the number of atoms in the molecule and D is the embedding dimension of each atomic position; S37, combining 3D position embedding with 1D SMILES embedding; through the Atom-align Fusion module, combining the 1D embedding representation of the SMILES sequence and the embedding representation of the 3D position to generate the final joint embedding; the model can process both 1D SMILES sequence information and 3D spatial position information, thereby enhancing the understanding of the molecular structure; S38, optimizing 3D position embedding; during the model training process, the representation of 3D position embedding is optimized through the feedback of the loss function, so that the embedding can better capture the spatial relationship between molecules.

5. The method of template-free molecular retrosynthesis of claim 1, wherein, The step D specifically comprises: S41, extracting 1D and 3D embedding representations; the 1D embedding is a vector sequence representing the SMILES symbol, and the 3D embedding is the position vector of each atom in three-dimensional space; S42, determining the alignment method of 1D and 3D embedding; aligning 1D embedding and 3D embedding to the same atomic index, so that the 1D embedding and 3D position embedding of each atom can correspond in the same space; S43, padding 3D position embedding to match the length of 1D embedding; using zero vectors to fill non-atomic positions, and padding 3D position embedding to a dimension equal to the length of 1D sequence; S44, calculating the weight coefficient of the fused embedding; defining the weight coefficient and respectively for controlling the proportion of 1D sequence embedding and 3D position embedding in the final fused embedding; the weight coefficient is dynamically adjusted during the training process to ensure that the model can process 1D and 3D information; S45, weighted fusion of 1D and 3D embedding; according to the calculated weight coefficient and , weighted fusion of 1D SMILES embedding and 3D position embedding; the specific formula is: ; wherein, is the 3D position embedding, is the SMILES embedding the final fusion embedding; the fusion embedding combines the 1D molecular structure information and the 3D spatial structure information.

6. The method of template-free molecular retrosynthesis of claim 1, wherein, The step E specifically comprises: S51, extracting 3D coordinate information of atoms; extracting the 3D coordinates of each atom from the 3D conformation of the molecule; ensuring that the coordinate information of each atom is correct and complete; S52, calculating the Euclidean distance between each pair of atoms; calculating the Euclidean distance between each pair of atoms in the molecule according to the 3D coordinate data extracted from step S51 ; formula: This distance measure reflects the relative positional relationship between two atoms in three-dimensional space; S53, generating a preliminary 3D distance matrix; by calculating the Euclidean distance , constructing a symmetric 3D distance matrix, the size of the matrix is , where N is the number of atoms in the molecule, each element in the matrix represents the distance between the corresponding two atoms; S54, normalizing the distance matrix; dividing each element in the distance matrix by the mean value to standardize the distance value, so that the values in the distance matrix have a uniform scale; S55, applying a Gaussian function to the distance matrix; mapping the distance between each pair of atoms to a high-dimensional space by a Gaussian function to get a new representation between each pair of atoms ; formula: where, is the mean of the th Gaussian basis function, is the standard deviation, is the distance between atoms i and j;​ S56, generating a weighted 3D distance matrix; converting the Gaussian basis functions into information into a matrix, generating a weighted 3D distance matrix ; each element of the matrix represents the weighted distance between atom pair (i, j); S57, performing a non-linear transformation of the matrix; mapping the weighted 3D distance matrix through a multi-layer perceptron , generating a final 3D distance matrix; S58, constructing a final representation of the 3D distance matrix; transforming the 3D distance matrix into the model for training to adjust the self-attention weights of the model.

7. The method of template-free molecular retrosynthesis of claim 1, wherein, The step F specifically comprises: S61, combine the spatial distance with the standard attention mechanism; when calculating the attention score between atoms, in addition to the original similarity calculation based on vector representation, the As an additional item, adjust the standard attention score so that atoms that are closer in space can obtain greater attention weight; S62, constructing the final attention score; combining the standard attention score and the weighted spatial information to construct the final attention score ; calculation method: wherein, and are the query vector and the bond vector of atom i and atom j respectively, and dim is the dimension of the vector, is a hyperparameter for adjusting the degree of influence of the 3D spatial weight on the attention; S63, normalizing the attention scores using a Softmax function; applying a Softmax function to perform normalization to ensure that the sum of all attention weights is 1; through the Softmax function, the attention weight between each pair of atoms will be assigned according to their relative distance and vector similarity; S64, compute weighted attention output; use normalized attention weights , and sum the values for each atom to get the final attention output ; the formula is: , where, is the value vector for atom j, N(i) is the set of atoms adjacent to atom i, is the attention weight of atom i for atom j; the final is passed as input to the next layer of the model.

8. The method of template-free molecular retrosynthesis of claim 1, wherein, The step G specifically comprises: S71, generating SMILES alignment graph through atomic mapping; atomic mapping refers to the pairing relationship of corresponding atoms in reactants and products; by analyzing the atomic mapping relationship between products and reactants, a SMILES alignment graph is generated; S72, designing an attention-guided loss function; this loss function compares the difference between the predicted attention distribution of the model and the actual SMILES alignment graph, guiding the model to allocate attention to the correct atomic correspondence relationship during the training process.

9. The method of template-free molecular retrosynthesis of claim 1, wherein, The step H specifically comprises: S81, applying Root-align SMILES enhancement; selecting the root atom in the product and finding the corresponding atom in the reactant; through the alignment of the root atom, a reactant sequence with high similarity is generated; S82, using early stopping strategy to prevent overfitting; during the training process, monitor the loss value on the validation set, if it is found that the performance of the model on the validation set does not further improve, stop training in advance; prevent the model from over-learning on the training set, leading to a decline in generalization ability.

10. The method of template-free molecular retrosynthesis of claim 1, wherein, The step I specifically comprises: S91, beam search initialization; in the beam search, define the beam size as 10, indicating that in each generation step, the model keeps the top 10 candidate results; initially, the beam search starts from the first symbol of the product sequence to generate the reactant sequence, and at each step, the next symbol is selected according to the prediction of the model until the complete reactant sequence is generated.

Citation Information

Patent Citations

  • Deep learning-based inverse synthesis prediction method and device, medium and equipment

    CN114220496A

  • Molecular multi-step inverse synthesis prediction method and device based on template-free

    CN117292763A