[{"data":1,"prerenderedAt":475},["ShallowReactive",2],{"content-query-9qEufELgBe":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"body":13,"_type":469,"_id":470,"_source":471,"_file":472,"_stem":473,"_extension":474},"/technology-blogs/zh/2919","zh",false,"","MindSpore AI科学计算系类 | Allegro提升昇思分子势能预测准确性，将上线MindSpore Chemistry","作者：于璠 来源：知乎","2023-12-21","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2023/12/22/ea82a0a0144f46cfad24f81fd4b406f1.png","technology-blogs",{"type":14,"children":15,"toc":461},"root",[16,24,43,51,56,61,69,74,79,84,89,94,101,106,111,118,123,128,133,140,145,155,171,176,183,188,198,203,210,215,224,229,236,241,246,253,258,263,268,273,278,283,290,295,300,307,312,317,324,329,334,343,348,353,358,368,373,378,388,393,401,406,411,416,421,431,441,451],{"type":17,"tag":18,"props":19,"children":21},"element","h1",{"id":20},"mindspore-ai科学计算系类-allegro提升昇思分子势能预测准确性将上线mindspore-chemistry",[22],{"type":23,"value":8},"text",{"type":17,"tag":25,"props":26,"children":27},"p",{},[28,30,36,38],{"type":23,"value":29},"**作者：**",{"type":17,"tag":31,"props":32,"children":33},"strong",{},[34],{"type":23,"value":35},"于璠",{"type":23,"value":37}," ",{"type":17,"tag":31,"props":39,"children":40},{},[41],{"type":23,"value":42},"来源：知乎",{"type":17,"tag":25,"props":44,"children":45},{},[46],{"type":17,"tag":31,"props":47,"children":48},{},[49],{"type":23,"value":50},"背景",{"type":17,"tag":25,"props":52,"children":53},{},[54],{"type":23,"value":55},"分子建模（Molecular modelling），或称分子模拟，指利用理论方法与计算技术，模拟出化学分子的外观或性质，是计算化学、材料科学和生物学的核心支柱[1]。",{"type":17,"tag":25,"props":57,"children":58},{},[59],{"type":23,"value":60},"分子建模的理想方式是量子化学方法（quantum chemistry），包括从头算（ab initio）、 密度泛函理论（density functional theory）等，这种方法考虑了原子内部的量子特性，准确度高，但是计算成本也极高，仅可用于较小的系统。较大尺度下的建模方法常用分子动力学（molecular dynamics）方式，其对势能和原子力的预测必须既准确又有效，这样才能准确地描述复杂系统在长时间尺度上的演化。经典的立场方法，只使用基于的原子坐标的简单函数预测分子势能，在准确性上有所不足。而用机器学习模型来预测原子势能（machine learning interatomic potentials，MLIPs），有望以较高的计算效率提供准确的预测。其中，一类基于信息传递的神经网络模型在准确性表现上尤为突出。",{"type":17,"tag":25,"props":62,"children":63},{},[64],{"type":17,"tag":65,"props":66,"children":68},"img",{"alt":7,"src":67},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/6ea979dcf98a49628b60b27d0aa2b961.png",[],{"type":17,"tag":25,"props":70,"children":71},{},[72],{"type":23,"value":73},"图1 神经网络模型预测分子势能",{"type":17,"tag":25,"props":75,"children":76},{},[77],{"type":23,"value":78},"消息传递是图神经网络里的概念，在图神经网络中，我们希望相邻节点或边交换信息并借此更新各自的embedding。消息传递包含三个步骤（如图2所示）[2]：",{"type":17,"tag":25,"props":80,"children":81},{},[82],{"type":23,"value":83},"1). 对图中的每个节点或边，收集所有相邻节点或边的embedding（或消息）。",{"type":17,"tag":25,"props":85,"children":86},{},[87],{"type":23,"value":88},"2). 通过聚合函数（如求和）聚合所有消息。",{"type":17,"tag":25,"props":90,"children":91},{},[92],{"type":23,"value":93},"3). 所有聚合的消息都通过一个更新函数更新目标节点或边（通常是一个神经网络）。",{"type":17,"tag":25,"props":95,"children":96},{},[97],{"type":17,"tag":65,"props":98,"children":100},{"alt":7,"src":99},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/687d40e48e6047c1a014eb693722a704.png",[],{"type":17,"tag":25,"props":102,"children":103},{},[104],{"type":23,"value":105},"图2 GNN中的消息传递",{"type":17,"tag":25,"props":107,"children":108},{},[109],{"type":23,"value":110},"经过多次消息传递后，初始图中的局域的性质可以影响到远处的节点，这样的现象又叫做图上的卷积操作。基于多次消息传递后所形成的新的图，可以实施预测任务[3]。",{"type":17,"tag":25,"props":112,"children":113},{},[114],{"type":17,"tag":65,"props":115,"children":117},{"alt":7,"src":116},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/6a8adc11d8af46f181e4919b75320f39.png",[],{"type":17,"tag":25,"props":119,"children":120},{},[121],{"type":23,"value":122},"图3 GNN的完整工作流程",{"type":17,"tag":25,"props":124,"children":125},{},[126],{"type":23,"value":127},"在分子势能预测领域，几何图神经网络（Geometric GNN），通过利用分子的几何信息（如距离、角度和二面角等），并且保持物理量在运算过程中的对称性（平移、旋转和反演），也得到了快速发展[4]。",{"type":17,"tag":25,"props":129,"children":130},{},[131],{"type":23,"value":132},"其中，等变网络获得了极大关注，以NequIP[5]为例，由于引入等变性，其对数据集规模的需求大大降低。",{"type":17,"tag":25,"props":134,"children":135},{},[136],{"type":17,"tag":65,"props":137,"children":139},{"alt":7,"src":138},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/373574bdda254e278f6cc3f9e1f48433.png",[],{"type":17,"tag":25,"props":141,"children":142},{},[143],{"type":23,"value":144},"图4 Geometric GNN的发展",{"type":17,"tag":25,"props":146,"children":147},{},[148,150],{"type":23,"value":149},"**1、**",{"type":17,"tag":31,"props":151,"children":152},{},[153],{"type":23,"value":154},"Allegro的网络结构",{"type":17,"tag":25,"props":156,"children":157},{},[158,160,169],{"type":23,"value":159},"Allegro[6]是一种等变神经网络。关于等变性的相关概念，如不可约表示、张量积等，可以参考我们之前发布的知乎文章：",{"type":17,"tag":161,"props":162,"children":166},"a",{"href":163,"rel":164},"http://mp.weixin.qq.com/s?__biz=MzkxMTM2MjMzNg==&mid=2247585665&idx=1&sn=084030e97a7ad59155aae97d13030f83&chksm=c11e9fcef66916d8a7062ac95a3033e09715de4dba69ded78fc2df423e5573ba3bb8c1a83645&scene=21#wechat_redirect",[165],"nofollow",[167],{"type":23,"value":168},"MindSpore AI科学计算系列：等变神经网络与e3nn数学库",{"type":23,"value":170},"。",{"type":17,"tag":25,"props":172,"children":173},{},[174],{"type":23,"value":175},"相比于传统的基于消息传递的方法，Allegro主要有两处不同：使用有序原子对标记隐层特征、使用标量与张量的双通道架构取代消息传递机制。其整体网络结构如图5所示。",{"type":17,"tag":25,"props":177,"children":178},{},[179],{"type":17,"tag":65,"props":180,"children":182},{"alt":7,"src":181},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/3b80478979e446ab8a3db9ea39abc140.png",[],{"type":17,"tag":25,"props":184,"children":185},{},[186],{"type":23,"value":187},"图5 Allegro网络结构",{"type":17,"tag":189,"props":190,"children":192},"h2",{"id":191},"_11-有序原子对标记隐层特征",[193],{"type":17,"tag":31,"props":194,"children":195},{},[196],{"type":23,"value":197},"1.1 有序原子对标记隐层特征",{"type":17,"tag":25,"props":199,"children":200},{},[201],{"type":23,"value":202},"Allegro中的隐层特征，是由有序原子对（有向边）(i,j)标记的，i表示中心原子。其信息更新也是由边与边的张量积完成。",{"type":17,"tag":25,"props":204,"children":205},{},[206],{"type":17,"tag":65,"props":207,"children":209},{"alt":7,"src":208},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/071e787ea61f406b99a77189361377be.png",[],{"type":17,"tag":25,"props":211,"children":212},{},[213],{"type":23,"value":214},"图6 Allegro中的有序原子对",{"type":17,"tag":189,"props":216,"children":218},{"id":217},"_12-使用标量与张量的双通道架构",[219],{"type":17,"tag":31,"props":220,"children":221},{},[222],{"type":23,"value":223},"1.2 使用标量与张量的双通道架构",{"type":17,"tag":25,"props":225,"children":226},{},[227],{"type":23,"value":228},"图5中，蓝色通道表示不变的隐层空间，x^{ij}代表了保持不变特性的隐层特征（标量部分，l=0），对该部分可以使用任意操作。红色通道表示等变的隐层空间，V^{ij}代表了保持等变特性的隐层特征（张量部分，l>0），对该部分特征的操作需要遵循等变性。初始的隐层标量特征x^{ij}由原子种类和原子间距离的径向基投影（radial basis）拼接而成。",{"type":17,"tag":25,"props":230,"children":231},{},[232],{"type":17,"tag":65,"props":233,"children":235},{"alt":7,"src":234},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/f6d62aa83f8f41d5aaeb33432f87b21a.png",[],{"type":17,"tag":25,"props":237,"children":238},{},[239],{"type":23,"value":240},"式1",{"type":17,"tag":25,"props":242,"children":243},{},[244],{"type":23,"value":245},"初始的隐层张量特征V^{ij}为中心原子到邻域原子的距离矢量的球谐投影（spherical harmonics）的线性映射",{"type":17,"tag":25,"props":247,"children":248},{},[249],{"type":17,"tag":65,"props":250,"children":252},{"alt":7,"src":251},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/3d58d3334623468a8970d1162ac9e375.png",[],{"type":17,"tag":25,"props":254,"children":255},{},[256],{"type":23,"value":257},"式2",{"type":17,"tag":25,"props":259,"children":260},{},[261],{"type":23,"value":262},"相比于标量运算，等变空间的张量运算需要消耗更大的算力。设计双通道的目的，即是希望用较小的计算代价来获得等变特征的信息。",{"type":17,"tag":25,"props":264,"children":265},{},[266],{"type":23,"value":267},"具体地，对于每一层（layer），其由4部分组成：",{"type":17,"tag":25,"props":269,"children":270},{},[271],{"type":23,"value":272},"1). 隐层标量特征通过MLP（Embedding MLP），嵌入中心原子的邻域环境信息，作为每一对边与边张量积的权重。",{"type":17,"tag":25,"props":274,"children":275},{},[276],{"type":23,"value":277},"2). 边与边做张量积运算，在中心原子维度加权求和。",{"type":17,"tag":25,"props":279,"children":280},{},[281],{"type":23,"value":282},"3). 取张量积运算结果（irreps）的标量通道输出的部分（l=0,p=1），拼接原隐层标量特征后，经过MLP（Latent MLP），更新x^{ij}。",{"type":17,"tag":25,"props":284,"children":285},{},[286],{"type":17,"tag":65,"props":287,"children":289},{"alt":7,"src":288},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/127b20ef7dcb43539ab75ff059e32325.png",[],{"type":17,"tag":25,"props":291,"children":292},{},[293],{"type":23,"value":294},"式3",{"type":17,"tag":25,"props":296,"children":297},{},[298],{"type":23,"value":299},"4). 对张量积运算结果做等变线性层操作，更新V^{ij}。",{"type":17,"tag":25,"props":301,"children":302},{},[303],{"type":17,"tag":65,"props":304,"children":306},{"alt":7,"src":305},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/64c655f27ea64329af8478d6f250fe17.png",[],{"type":17,"tag":25,"props":308,"children":309},{},[310],{"type":23,"value":311},"式4",{"type":17,"tag":25,"props":313,"children":314},{},[315],{"type":23,"value":316},"其中，借助张量积运算的双线性特性，使得对于每一个中心原子的每条有向边，只需要做一次张量积运算，如下式所示。",{"type":17,"tag":25,"props":318,"children":319},{},[320],{"type":17,"tag":65,"props":321,"children":323},{"alt":7,"src":322},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2024/01/03/0c237c53956f4501993f662a62641b7d.png",[],{"type":17,"tag":25,"props":325,"children":326},{},[327],{"type":23,"value":328},"式5",{"type":17,"tag":25,"props":330,"children":331},{},[332],{"type":23,"value":333},"在层与层之间的标量空间还引入了残差（residual），以便信息传播。",{"type":17,"tag":189,"props":335,"children":337},{"id":336},"_13-能量分解",[338],{"type":17,"tag":31,"props":339,"children":340},{},[341],{"type":23,"value":342},"1.3 能量分解",{"type":17,"tag":25,"props":344,"children":345},{},[346],{"type":23,"value":347},"一个系统的分子势能可以分解为系统中所有原子能量的总和：E_system=Σ(i)E_i。Allegro进一步将每个原子的能量分解为以该原子为中心与其邻域原子组成的边的能量：",{"type":17,"tag":25,"props":349,"children":350},{},[351],{"type":23,"value":352},"E_i=Σ(j∈neighbor(i))E_{ij}。",{"type":17,"tag":25,"props":354,"children":355},{},[356],{"type":23,"value":357},"因此，Allegro网络的输出即为E_{ij}，可用于计算系统总能量。",{"type":17,"tag":25,"props":359,"children":360},{},[361,363],{"type":23,"value":362},"**2、**",{"type":17,"tag":31,"props":364,"children":365},{},[366],{"type":23,"value":367},"结果",{"type":17,"tag":25,"props":369,"children":370},{},[371],{"type":23,"value":372},"1. 预测准确性方面，Allegro在revMD-17数据集上取得了和NequIP相近的准确性，在QM9数据集上取得了最佳的准确性。",{"type":17,"tag":25,"props":374,"children":375},{},[376],{"type":23,"value":377},"2. 由于Allegro的严格局部特性，作者还展示了其在并行计算下的性能优势。",{"type":17,"tag":25,"props":379,"children":380},{},[381,383],{"type":23,"value":382},"**3、**",{"type":17,"tag":31,"props":384,"children":385},{},[386],{"type":23,"value":387},"感想",{"type":17,"tag":25,"props":389,"children":390},{},[391],{"type":23,"value":392},"基于群表示理论的相关操作（不可约表示与张量积等），计算代价较高，提升计算性能是几何图神经网络的重要课题。传统的基于消息传递机制的几何图神经网络无法高效利用并行计算。Allegro不依赖于消息传递机制，保证了严格局部特性，从而能较好地利用并行计算。当前昇思MindSpore AI框架结合自身优势，基于已有能力开展Allegro相关工作，预计不久将上线MindSpore Chemistry。当分子系统规模较大时，能否高效利用并行计算尤为重要，这也是研究者们在设计模型之初应当首先考虑的问题之一。",{"type":17,"tag":189,"props":394,"children":396},{"id":395},"参考文献",[397],{"type":17,"tag":31,"props":398,"children":399},{},[400],{"type":23,"value":395},{"type":17,"tag":25,"props":402,"children":403},{},[404],{"type":23,"value":405},"[1]Keith T Butler, Daniel W Davies, Hugh Cartwright, Olexandr Isayev, and Aron Walsh. 2018. Machine learning for molecular and materials science. Nature 559, 7715 (2018), 547–555.",{"type":17,"tag":25,"props":407,"children":408},{},[409],{"type":23,"value":410},"[2]Tian Xie and Jeffrey C Grossman. 2018. Crystal graph convolutional neural networks for an accurate and interpretable prediction of material properties. Physical Review Letters 120, 14 (2018), 145301.",{"type":17,"tag":25,"props":412,"children":413},{},[414],{"type":23,"value":415},"[3]Keqiang Yan, Yi Liu, Yuchao Lin, and Shuiwang Ji. 2022. Periodic Graph Transformers for Crystal Material Property Prediction. In The 36th Annual Conference on Neural Information Processing Systems. 15066–15080.",{"type":17,"tag":25,"props":417,"children":418},{},[419],{"type":23,"value":420},"往期回顾",{"type":17,"tag":25,"props":422,"children":423},{},[424],{"type":17,"tag":161,"props":425,"children":428},{"href":426,"rel":427},"http://mp.weixin.qq.com/s?__biz=MzkxMTM2MjMzNg==&mid=2247612095&idx=1&sn=0ffc537fe0dce27be07c2e87ff587b58&chksm=c11e26f0f669afe60444d9415ef306948caa081f2f985424e920ff904922a2bda08042a3c240&scene=21#wechat_redirect",[165],[429],{"type":23,"value":430},"MindSpore AI科学计算系列 | 周期性图Transformer提升MindSpore模型对晶体性质的预测",{"type":17,"tag":25,"props":432,"children":433},{},[434],{"type":17,"tag":161,"props":435,"children":438},{"href":436,"rel":437},"http://mp.weixin.qq.com/s?__biz=MzkxMTM2MjMzNg==&mid=2247611648&idx=1&sn=e911c86334147c2a3166b88d33b4d953&chksm=c11e254ff669ac596ce34dac6cb14ef9e0ab951ef0ef5bba8a354510e158dbc63264b58b5149&scene=21#wechat_redirect",[165],[439],{"type":23,"value":440},"MindSpore AI科学计算系列 | 初探海洋大模型AI-GOMS，打开大模型在海洋方面的大门",{"type":17,"tag":25,"props":442,"children":443},{},[444],{"type":17,"tag":161,"props":445,"children":448},{"href":446,"rel":447},"http://mp.weixin.qq.com/s?__biz=MzkxMTM2MjMzNg==&mid=2247611392&idx=1&sn=389807811fd28aef1d4d28477386bf70&chksm=c11e244ff669ad59788563652e2ceb065fcbd47d5bf171be264da2f4c17615e743fa268c487e&scene=21#wechat_redirect",[165],[449],{"type":23,"value":450},"MindSpore AI科学计算系列 | “没有最快，只有更快”，快速傅里叶变换详解",{"type":17,"tag":25,"props":452,"children":453},{},[454],{"type":17,"tag":161,"props":455,"children":458},{"href":456,"rel":457},"http://mp.weixin.qq.com/s?__biz=MzkxMTM2MjMzNg==&mid=2247610343&idx=1&sn=439ab653c8b9a1c43522cb1ff4edb324&chksm=c11e3fa8f669b6beebd68b7298d7c3d48abd229a4fb0b7b6fd628539c5d1e81cbb08578ad1d4&scene=21#wechat_redirect",[165],[459],{"type":23,"value":460},"MindSpore AI科学计算系列 | 有效改善预报模糊问题，生成式模型在短临降水预报中大放异彩",{"title":7,"searchDepth":462,"depth":462,"links":463},4,[464,466,467,468],{"id":191,"depth":465,"text":197},2,{"id":217,"depth":465,"text":223},{"id":336,"depth":465,"text":342},{"id":395,"depth":465,"text":395},"markdown","content:technology-blogs:zh:2919.md","content","technology-blogs/zh/2919.md","technology-blogs/zh/2919","md",1776506124289]