Equivalent Distance Geometry Error for Molecular Conformation Comparison

1 INTRODUCTION . Small organic molecules , conventionally a chemical or biomedical topic , are now being widely studied by artificial intelligence researchers . Based on prior natural science knowledge , machine learning models aid in multiple tasks on molecules including 3-D Quantitative Structure-Activity Relationship ( QSAR ) analysis , virtual screening for drug discovery , and protein-ligand binding analysis . Before any real industrial applications , molecular conformation generation draws particular concern . The task is also challenging as ( 1 ) conformation contains the 3-D geometry which can be translated or rotated , making it complicated to compare the generated one with ground-truth ; ( 2 ) the number of molecules found in nature presents combination explosive growth , so the procedure of generating conformations is supposed to be fast enough for applicability . In the past few years , different machine learning models have been proposed to handle the molecular conformation generation task . Generally , the molecules are featurized into token sequences ( e.g . SMILES ( Weininger , 1988 ) ) or 2-D molecular graphs 1 ( Gilmer et al. , 2017 ) to feed the neural networks , while the way to obtain conformations is optional : ( 1 ) Straight-forward methods directly generate the 3-D coordinates of atoms from the inputs ; ( 2 ) Step-wise methods first predict distances between atom pairs and then rebuild the conformations from the distances either via discrete algorithms ( e.g . EDG ( Havel , 1998 ) ) or bi-level ( Xu et al. , 2021 ) . As the expense of avoiding the troublesome comparison between conformations , step-wise methods usually adopt more complex architectures and endure relatively expensive time and space costs . Therefore , based on its innate advantage of high efficiency , Straight-forward methods require powerful assistance to perform equally great as step-wise ones . And a well-designed loss function can be helpful . In recent studies , the simplest way to compare the conformations is to represent the conformations with atom position matrices R ( G ) ∈ Rn×3 and calculate their Root-Mean-Squared Deviations ( RMSD ) . Since conformation is invariant to spatial permutations ( e.g . translation and rotation ) , a universal approach is to first find an optimal alignment . As an instance , Kabsch algorithm ( Kabsch , 1976 ) provides a differentiable method to align two given conformations . We referred to the socalculated RMSD as Kabsch-RMSD . However , using Kabsch-RMSD as the loss of neural networks 1The atoms and bonds inside the molecule form the vertexes and edges respectively . is neither efficient nor effective : it needs to calculate the rotation matrix for every single conformation , which stifles batch processing and increases time cost ; meanwhile , the rotation matrix is vulnerable to misplaced atoms and poorly-predicted regions ( Mariani et al. , 2013 ) , so the RMSD between aligned and reference conformation can not correctly reflect molecular similarity when input conformations are less likely . To further improve the applicability of loss function on molecular conformation comparing , Distance Geometry ( DG ) is proposed to encode a conformation into a vector of distances among the atoms , where the comparison is applied . The main idea of DG is to indirectly optimize bond lengths D , bond angles Φ and dihedral angles2 Ψ by optimizing the distances among 1-hop , 2-hop and more distant neighbors respectively in the molecular graph . However , when balancing time and effects , traditional distance geometry methods are faced with a dilemma : ( 1 ) If too many distant neighbors in the graph are considered , the loss calculation will be time-consuming . ( 2 ) If only close atompairs ( e.g . 3-hop at most ) are considered , the factors in the geometry will be treated unfairly . Based on the theoretical and experimental demonstration in Appendix B.1 , the gradient allocated on bond angles Φ and dihedral angles Ψ will become much smaller than that on bond lengths D when optimizing atom-pair distances , resulting in contorted angles and poor local geometry . Therefore , the equivalence in optimizing different factors should be stressed in the comparison . To push the boundary of efficient and effective loss function for molecular conformation generation , we propose Equivalent Distance Geometry Error ( EDGE ) . Firstly , EDGE exploits the essential factors inside the conformation geometry , including a series of bond lengths D , bond angles Φ and dihedral angles Ψ . Then the factors are jointly optimized with certain weights to guarantee that they are fairly treated . To avoid the high complexity of directly calculating the angles , we introduce Taylor Expansion to our method to approximate the angles with linear transformations of atom-pair distances within 3-hop . Extensive experiments prove that the improved version of EDGE performs as fast as optimizing 1/2/3-hop atom-pair distances and achieves better performance than existing popular loss functions on conformation comparison when applied to straight-forward backbones . To conclude , our main contributions are threefold : • We propose a novel loss function , EDGE , for straight-forward models on molecular conformation generation , which optimizes the essential factors in the conformation geometry equivalently , realizing high consistency of generation . • To avoid the high complexity and gradient explosion caused by direct calculation of angles , we introduce Taylor Expansion and Multiplier Truncation which achieves efficient model optimization with improved EDGE and guarantees its applicability . • We conduct comprehensive experiments on several recently proposed benchmarks , including QM9 ( Wu et al. , 2018 ) , GEOM-QM9 and GEOM-Drugs ( Axelrod & GómezBombarelli , 2020 ) . The outstanding performance on different metrics shows that EDGE is powerful on both definite conformation prediction and multiple conformation generation tasks , compared with existing loss functions . Besides , EDGE ’ s efficiency is guaranteed via theoretical analysis and empirical test . 2 PROPOSED METHOD . 2.1 PRELIMINARIES . Notations In the statements and equations below , we use italic letters for scalars and indices , bold lower-case letters for ( column ) vectors , bold upper-case letters for matrices , calligraphic letters for sets , and normal letters for annotations . Given a certain molecule , M = ( V , E , n , m , Xv , Xe ) is the corresponding molecular graph . Here , V is the set of all n atoms , E ⊂ V × V is the set of all m chemical bonds , Xv = ( xv1 , ... , x v n ) > ∈ Rn×dv is the matrix of atomic features , and Xe = ( xe1 , ... , x e m ) > ∈ Rm×de that of bond features . G is the geometry of its conformation and R ( G ) is the matrix of atom positions . d ( u , v ; M ) is the graph distance between atom u , v inM and d ( u , v ; G ) is their Euclidean distance in G. A conformation geometry G has three types of factors D ( G ) , Φ ( G ) , Ψ ( G ) , which refer to the set of bond length d , bond angle φ and dihedral angle ψ 2Dihedral angle is referred as torsion angle in some works . respectively . For operators , ⊕ is the operator of concatenations and ‖ · ‖ denotes the l2 norm of the input vector . Problem Definition We consider following straight-forward molecular conformation generation process : the models input a molecular graphM and output a molecular conformation R ( G ) . Our task is to find an efficient and effective loss function to calculate the differential discrepancy between generated and reference conformation G , Ĝ , which can be utilized to optimize the models backwardly . 2.2 EQUIVALENCE IN MOLECULAR GEOMETRY . When applied to straight-forward backbones on molecular conformation generation , existing DGbased loss functions such as Conn-k ( Yang et al. , 2021 ) can ’ t fairly distribute the gradient to different factors D ( G ) , Φ ( G ) and Ψ ( G ) in the conformation during optimization , resulting in contorted geometry . Simply calculating the average error between the generated D ( G ) , Φ ( G ) , Ψ ( G ) and the reference ones has the same deficiency , because the three types of factors are in different dimensions and equivalence can hardly be guaranteed while training the model . To fairly treat all the factors , it is necessary to jointly optimize them with certain weights which are determined by their corresponding degrees of freedom and value distributions in the dataset . Degree of Freedom Consider a 3-D molecular geometry G of a molecule with n atoms , it has fG = 3n−6 degree of freedom due to the existence of rotation and translation ( Simm & HernandezLobato , 2020 ) . It means that a geometry can be just recovered from a certain combination of bond lengths , bond angles and dihedral angles with a total number 3n−6 . Note that three types of factors occupy fD , fΦ , fΨ degrees of freedom out of fG respectively , and we have3 : fG = fD + fΦ + fΨ = 3n− 6 ( 1 ) To completely perceive the local structure of molecular geometries , the number of bond lengths , bond angles and dihedral angles sampled in the geometry ( i.e . f̂D , f̂Φ , f̂Ψ ) may exceed their exact degrees of freedom fD , fΦ , fΨ during optimization . So we need to balance them through a simple proportion ( e.g . fD/f̂D for bond lengths D ) . Value Distribution When jointly optimizing bond lengths D , bond angles Φ and torsion angles Ψ , which are in different dimensions , it can hardly achieve equivalence to manually give hyperparameters to balance the gradients . Therefore , we rescale D , Φ , Ψ with the reciprocals of their deviations σD , σΦ , σΨ respectively to uniformly approximate a Gaussian distribution with σ = 1 . 3The calculation of degrees of freedom for each kind of factors can be found in Appendix C.1 . 2.3 OUR METHOD : EQUIVALENT DISTANCE GEOMETRY ERROR . We propose Equivalent Distance Geometry Error ( EDGE ) as a loss function for straight-forward methods of molecular conformation generation . As illustrated in Fig.1 , EDGE calculates the discrepancy between generated conformation G and reference conformation Ĝ following4 : L ( G , Ĝ ) = λ2D ∑ d∈D ( G ) d̂∈D ( Ĝ ) ( d− d̂ ) 2 + λ2Φ ∑ φ∈Φ ( G ) φ̂∈Φ ( Ĝ ) ( φ− φ̂ ) 2 + λ2Ψ ∑ ψ∈Ψ ( G ) ψ̂∈Ψ ( Ĝ ) ( ψ − ψ̂ ) 2 where λD = fD f̂D 1 σD λΦ = fΦ f̂Φ 1 σΦ λΨ = fΨ f̂Ψ 1 σΨ ( 2 ) To be more efficient , we can encode a molecular conformation into a vector z : zD = [ λDd|d ∈ D ( G ) ] zΦ = [ λΦφ|φ ∈ Φ ( G ) ] zΨ = [ λΨψ|ψ ∈ Ψ ( G ) ] z = zD ⊕ zΦ ⊕ zΨ ( 3 ) Then Eq.2 can be represented as the discrepancy between two encodings of conformation , which achieves fast comparison among multiple conformations : L ( G , Ĝ ) = ‖z − ẑ‖2 ( 4 ) ( a ) Calculation of D For a conformation G , we first calculate the distance matrix D : Di , j = ‖R ( G ) i −R ( G ) j‖2 ( 5 ) where R ( G ) i ∈ R3 is the 3-D position of i-th atom in G. Then the value of sampled bond lengths D can be found in D. Calculation of Φ For a certain bond angle φ determined by three atoms in G , a , b are the lengths of its two sides and c is the length of the side opposite it , which is shown in Fig.2 ( a ) . As a , b , c can be found in D , the value of φ can be calculated through the cosine theorem as φ = arccos a2 + b2 − c2 2ab ( 6 ) Calculation of Ψ For a certain dihedral angle ψ determined by four sequentially-connected atoms in G , a , b , c are the lengths of the sides in the atom chain and d , e , f are 2/3-hop distances among the atoms , which is shown in Fig.2 ( b ) . Following Euler ’ s formula in the tetrahedron , we have5 : ψ = arcsin √ 4a2b2e2 − b2t22 − a2r22 − e2t21 + r2t1t2 4a2b2c2 − a2r21 ( 7 )

Summary: This paper proposes a new loss function for conformer generation tasks. These tasks essentially generated 3D point clouds from molecular graphs, and require a geometric similarity metric between generated samples and training data to drive the learning. The traditional metric of distance is RMSD based on aligned poses, but the authors suggest this is too time-consuming and instead propose a heuristic-weighted combination of bond distance between first other neighbors, and a Taylor-expansion of angles between second-order neighbors and dihedrals between 3rd order neighbors.   The metric is empirically found to perform well, based on both statistical metrics used in conformer generation tasks, by visual inspection of pathological cases, and because the timings are excellent