密度泛函理论软件ABACUS进展及其与深度学习算法的融合及应用
Progress of the ABACUS Software for Density Functional Theory and Its Integration and Applications with Deep Learning Algorithms
通讯作者: 陈默涵,mohanchen@pku.edu.cn,主要从事计算物理研究
收稿日期: 2024-05-29 修回日期: 2024-07-28
基金资助: |
|
Corresponding authors: CHEN Mohan, Tel:
Received: 2024-05-29 Revised: 2024-07-28
Fund supported: |
|
作者简介 About authors
陈默涵,男,1985年出生,博士
基于量子力学基本原理的密度泛函理论(DFT)可以有效预测材料性质,如今它在物理、化学、材料、生物等领域的研究工作中已得到广泛应用。随着对材料领域的深入研究,进一步提升DFT的精度和效率已成为迫切需求,但精度和效率往往不可兼得。近年来,在AI for Science理念的引领下,基于深度学习的电子结构计算方法迅速发展,有望解决电子结构计算中精度和效率不能两全的困境。然而,只有稳定可靠的DFT软件平台才能保证深入研究和持续推动AI辅助电子结构计算方法的广泛应用,这既充满挑战又蕴含机遇。在此背景下,本文主要从物理模型、深度学习算法和软件开发3方面介绍国产开源DFT软件ABACUS (atomic-orbital based ab-initio computation at UStc,中文名原子算筹)从开发2.2版本(2022年4月发布)到发布3.7版本(2024年7月发布)期间的进展及其与深度学习算法的融合和应用。
关键词:
Density functional theory (DFT), grounded in the fundamental principles of quantum mechanics, effectively predicts material properties and is now widely used across various research disciplines such as physics, chemistry, materials science, and biology. As research in materials science advances, there is an urgent need to further enhance the accuracy and efficiency of DFT. However, improving accuracy and efficiency is often challenging because these goals can be mutually exclusive. Recently, guided by the concept of AI for science, deep learning-based electronic structure calculation methods have rapidly emerged, offering potential solutions to resolve this accuracy-efficiency dilemma. Nonetheless, developing a stable and reliable DFT software platform remains a substantial challenge in exploring and expanding the use of AI-assisted methods on a broader scale. This paper introduces the open-source DFT package ABACUS (atomic-orbital based ab-initio computation at UStc), focusing on its physical models, deep learning algorithms, and software development aspects. The present discussion emphasizes the progress of the open-source package, highlighting its integration with deep learning algorithms and its evolution from version 2.2 (released in April 2022) to version 3.7 (released in July 2024).
Keywords:
本文引用格式
陈默涵.
CHEN Mohan.
近年来,在AI for Science (AI4S)理念的引领下,科学领域迎来了许多与人工智能相关的前沿进展。例如,基于深度势能的分子动力学 (deep potential for molecular dynamics,DeePMD)方法[1,2]能在量子力学精度模拟上亿原子,如今已成为原子尺度模拟的重要工具。在基于机器学习的势函数方法里,需要通过密度泛函理论(density functional theory,DFT)[3,4]软件等第一性原理计算软件算出体系的总能量、原子受力和晶胞所受应力等物理性质,然后把原子构型和对应的这些物理性质作为机器学习模型的“标签”,从而训练出具有第一性原理精度的深度神经网络势函数。
材料计算领域里的第一性原理是指基于量子力学的计算方法。第一性原理计算方法原则上不需要依赖经验参数,只根据原子的基本信息(例如元素种类和原子位置等)就能预测材料的稳定晶格结构、能带结构、电子态密度、力学性质和光学性质等关键物理量。过去几十年计算机的快速发展使得发展出来的DFT软件较好地平衡了精度和效率,并已广泛应用于物理、化学、材料、生物等诸多领域,研究体系包含从分子到成百上千个原子组成的复杂体系。另一方面,随着对新材料需求的日益增多,材料设计也逐渐深入到微尺度。近年来DFT软件也开始在工业界被使用,随着对材料领域的深入研究,提高DFT软件的精度和效率迫在眉睫,而人工智能的出现有望助推这一目标的实现。
近年来,基于机器学习的DFT方法处于快速发展阶段[5]。例如,Chen等[6]提出了deep Kohn-Sham (DeePKS)方法,基于局域基组构造电子结构的描述子,通过在电子体系的Hamiltonian量里添加基于深度学习的泛函修正项,学习低精度泛函和高精度泛函所预测的性质之差,从而较好地平衡效率和精度。2021年DeepMind公司的研究人员基于PySCF软件发布了基于深度学习的神经网络模型——DM21泛函[7],该泛函的精度在一些给定测试体系上高于杂化泛函(hybrid functional)甚至接近双杂化泛函。Li等[8~10]提出基于深度学习和局域基组的Hamiltonian矩阵构建(deep-learing DFT Hamiltonian,DeepH)方法以及基于深度学习的密度泛函微扰理论(density functional perturbation theory,DFPT),提高了二维材料等体系的电子结构计算效率。来自美国Sandia国家实验室和来自德国Helmholtz-Zentrum Dresden-Rossendorf研究机构的科研人员发起了materials learning algorithms (MALA)项目,该研究旨在通过深度学习的方法加速DFT计算,目前已应用于Kohn-Sham密度泛函理论(Kohn-Sham DFT,KSDFT)[11]和无轨道密度泛函理论(orbital-free DFT,OFDFT)[12]。Gong等[13]提出通过基于机器学习的对比学习方法可有效地对交换关联泛函进行物理限制,从而提高交换关联泛函精度。
ABACUS (atomic-orbital based ab-initio computation at UStc)是一款主要由C++语言编写的国产开源DFT软件,中文名为原子算筹。ABACUS支持平面波(plane wave)和数值原子轨道(numerical atomic orbitals) 2种基矢量下的Kohn-Sham方程求解,支持周期性边界条件和Brillouin区多k点采样算法,也支持晶格结构的对称性分析功能。程序采用模守恒赝势[21] (平面波基组还支持超软赝势),支持局域密度近似(local density approximation,LDA)[22]、广义梯度近似(generalized gradient approximation,GGA)[23]、Meta-GGA[24]、杂化泛函[25,26]等交换关联泛函,也支持外加电场、自旋轨道耦合、+U算法、van der Waals力修正、溶剂模型(solvation model)和极化修正(dipole correction)等功能。此外,开发团队基于平面波基组实现了无轨道密度泛函理论(orbital-free DFT)和随机波函数密度泛函理论(stochastic DFT)功能。基于数值原子轨道基组实现了含时演化的密度泛函理论。目前ABACUS的功能已较为齐全,可适用于从小体系到上千原子体系的电子结构优化、原子结构弛豫、分子动力学模拟等计算,支持DeePMD[2]、DP-GEN[27]、DeePKS[6]、DeepH[8]等多种机器学习辅助的电子结构算法并提供了相关接口,也提供了与ASE[28]、Phonopy[29]、Wannier90[30]、ShengBTE[31]、Hefei-NAMD[32]、PEXSI[33]、USPEX[34]、LibRI[35,36]、PYATB[37]等其他电子结构软件的接口。
ABACUS软件早期由中国科学技术大学何力新教授课题组主导开发,中国科学院物理研究所的任新国研究员也参与了软件的研发。ABACUS前期发展历经了10年左右并于2016年发布1.0版,2019年发布2.0版,2020年12月发布2.1版。2021年1月,ABACUS开发团队与鄂维南院士发起的DeepModeling社区展开深度合作。2022年4月,在2.1版的基础上经历了GitHub开源社区里3200多次修改记录后,2.2版ABACUS研发成功。截至2024年7月份发布3.7版为止,开发团队在过去3年时间内以每3个月为周期发布了10个大版本(v2.2~v2.3、v3.0~v3.7),并且以每2周为周期更新了40多个小版本。目前参与的开发者主要来自北京科学智能研究院、中国科学技术大学、中国科学院物理研究所、北京大学、合肥综合性国家中心人工智能研究院、北京深势科技有限公司等单位。下面将从物理建模、深度学习算法和软件开发3个角度对ABACUS进行更详细介绍。
1 物理模型
1.1 平面波赝势法
式中,左边Hamiltonian量里的四项分别代表电子的动能算符、Hartree势、交换关联(exchange-correlation,简称xc)势和外(external,简称ext)势, r 代表空间坐标,n( r )代表电子密度,εi 代表能级,ψi ( r )代表Kohn-Sham单体波函数。在KSDFT的理论框架里需要对交换关联泛函项进行近似处理,而第一性原理的计算精度往往取决于对交换关联泛函近似的好坏程度。除了早期发展的LDA泛函,目前较为常用的交换关联泛函是GGA泛函,例如Perdew-Burke-Ernzerhof (PBE)泛函[23]。此外,Meta-GGA泛函(例如strongly constrained and appropriately-normed (SCAN)泛函[24])近年来也获得了较为广泛的应用[38,39]。杂化泛函在一些体系性质的预测上可获得更好结果,例如半导体的能隙修正[35,36],但其计算量相比于GGA泛函也会有数量级的增加。
平面波基组加上赝势[40]是KSDFT方法中被较为广泛使用的方法。平面波基组是一组正交基,天然适合描述具有周期性边界条件的体系。采用平面波基组进行材料计算时,只需设置电子动能截断值就可定义计算所需的平面波基组,“动能”低于能量截断值的平面波会被选中,而更高频的平面波则被忽略。选取的能量截断值越高,则平面波基组越完备且精度越高,但同时计算量也会增加,因此用户在进行DFT计算前需对能量截断值做收敛性测试。此外,具有周期性边界条件的体系可定义相应的第一Brillouin区,该区域内的点称为k点。对于大体系,第一Brillouin区较小,可采用坐标为(0, 0, 0)的k点(即Gamma点)进行计算。然而,对于小体系需用更多k点。由于每个k点的Kohn-Sham方程需单独求解,因此DFT的计算量也会随k点增加而上升,在进行DFT计算前也需对k点进行收敛性测试。
模守恒赝势(norm-conserving pseudopotentials)[21]是一种广泛应用于描述电子-离子相互作用的近似方法,其目的是在保证计算精度的同时降低计算成本。模守恒赝势通过求解单原子Kohn-Sham方程,获得给定交换关联泛函近似下的原子核与价电子相互作用的近似表达,有效减少了求解Kohn-Sham方程所需电子数,尤其是对高Z (Z为原子序数)元素而言,可极大减少由于考虑全部电子而导致的较大计算量。此外,如果赝势里包含了非局域赝势,则需用到单电子Kohn-Sham波函数。模守恒赝势的构造方式有多种,不同赝势所描述的价电子数量可能不同。一般而言,包含价电子数少的赝势会使DFT计算效率更高,但降低了精度。反之,如果包含的价电子数较多,虽然保证了计算的精度但也降低了计算效率。因此,用户在选择使用赝势的时候需对精度和效率做一定的权衡。与projector augmented-wave (PAW)方法[41]相比,模守恒赝势所采用的能量截断值更高,因此PAW在计算效率方面有优势,但基于PAW的电子结构算法的实现过程相比于模守恒赝势更加复杂。目前,ABACUS软件支持多种格式的模守恒赝势,例如SG15模守恒赝势和Dojo模守恒赝势等,以及支持平面波基组下的超软赝势[42]。
求解Kohn-Sham方程可获得体系的基态电子密度和基态能量,而求解过程需用到自洽迭代(self-consistent)方法。在KSDFT的每一步自洽迭代中,需对所有Brillouin区内的k点进行Kohn-Sham方程求解。对于每个k点,先用电子密度构建Hamiltonian矩阵,再求解Hamiltonian矩阵从而得到该k点的单电子本征值和本征波函数,然后通过对电子占据的本征波函数进行计算从而得到新的电子密度。只有当新电子密度和输入电子密度的误差小于用户给定阈值时,迭代才收敛。若电子密度还未收敛,则需采用电子密度混合算法算出下一步迭代的电子密度。电子自洽迭代过程是否易收敛还取决于不同的材料体系。例如,半导体和绝缘体有带隙,非占据态波函数不易混入电子密度中影响电子密度收敛,而金属体系Fermi面附近的电子态较多,在计算电子密度时容易同时混入占据和非占据态的波函数贡献,引发迭代的不稳定,最终导致自洽计算难收敛。此外,带有真空或表面的材料体系也会因为电子密度在不同空间的分布不均引发收敛性问题。因此,可通过设置合适的电子密度混合参数和展宽(smearing)的方法参数来促进电子密度收敛。
在平面波基组的Kohn-Sham方程求解过程中,最耗时的步骤往往来自于矩阵对角化,其计算复杂度一般为O(N3),其中N是体系原子数或电子数。受限于平面波基组下矩阵对角化的计算时间复杂度,该方法在多数场景下只适合用于处理不超过数百原子的体系。此外,平面波基组包含的基矢量数量较多,实际计算中由于内存限制难以存下整个Hamiltonian矩阵,通常使用迭代法来计算本征值和本征向量。近年来,图形处理器(GPU)硬件在科学计算中被广泛使用,ABACUS团队在GPU和曙光深度计算处理器(DCU)硬件上实现了基于平面波基组的自洽迭代算法,获得了良好的加速效果,该方法已在实际材料计算中(如DPA-2大原子模型中[43])被大量使用。
1.2 数值原子轨道
除了采用平面波作为基矢量,KSDFT方法还可采用数值原子轨道作为基矢量。数值原子轨道
式中,
构造精度高、可系统提升数量、可移植性好的原子轨道基组颇具挑战。Junquera等[45]提出在一维量子力学方程中加入约束场,从而求解出具有严格截断的数值原子轨道。Ozaki[19]在OpenMX软件中采用变分法优化局域轨道形状。Blum等[20]提出在全电子DFT软件FHI-aims中,可在一个大的局域轨道基组池中挑选最优的局域轨道,从而构建不同精度的基组。Chen等[46,47]提出利用溢出函数(spillage function)构造可以系统提高轨道数量的数值原子轨道,其中每个数值原子轨道的径向部分由一组球Bessel函数展开。通过对半导体、氧化物、金属、团簇等一系列体系的测试,Li等[48]验证了利用溢出函数的方法产生数值原子轨道基组在求解Kohn-Sham方程时相比平面波基组效率更高,同时保持了良好的精度。Zheng等[49]在ABACUS中实现了基于数值原子轨道基组的高精度应力计算,测试表明相比于平面波基组,数值原子轨道基组在计算收敛应力方面更具优势。Lin等[50]提出了一种拟合数值原子轨道基组的新方案,该方案加入了对参考波函数一阶导数的拟合,进一步提升了数值原子基组的精度和效率。值得注意的是,ABACUS中的数值原子轨道需和对应的赝势一起使用,目前ABACUS官网为用户提供了赝势库和对应的数值原子轨道库文件。
2022年,Liu等[51]采用ABACUS计算了大尺寸的半导体表面催化反应,将前人提出的电荷外推法应用范围从之前的金属电极表面反应拓展到半导体电极表面反应,该工作需处理最大1620个原子和11214个电子的大体系。传统基于平面波的第一性原理计算软件(例如VASP或Quantum Espresso)难以进行上千原子的大体系计算。由于ABACUS利用数值原子轨道的局域性从而构造Hamiltonian矩阵,再加上message passing interface (MPI)和OpenMP的并行化处理,因此ABACUS有能力进行千原子以上的高效计算。该工作基于SG15模守恒赝势和PBE泛函,并且采用了兼具效率和精度的double zeta plus polarization (DZP)数值原子轨道基组,作者采用共轭梯度算法进行原子结构弛豫,还使用了针对Gamma点的加速算法。通过上述参数的设置,对于1620个原子的体系(加真空),采用120个E5-2690v3的中央处理器(CPU)进程进行并行计算,单步电子迭代的时间在80 s左右。此外,ABACUS的数值原子轨道方法也在其他材料体系里被广泛使用,例如无序超均匀态的二维材料(1800个原子)[52]和准一维材料碳纳米管[53]、二维铁电材料[54]、二维石墨烯纳米带[55]、薄膜材料[56]、钙钛矿材料[57]、反铁磁拓扑绝缘体[58]、液态金属[59,60]、电池材料[61]、DNA[62]、金属界面[63]、团簇[64]、矿石中的同位素扩散[65]等。
1.3 随机波函数密度泛函理论
传统KSDFT方法往往采用对角化体系Hamiltonian量的方法来得到电子能级和波函数,使得KSDFT的求解时间正比于体系原子数或占据电子数的3次方。因此,使用传统KSDFT方法模拟大尺寸原子体系(例如数百到上千个原子)或者高温体系(占据电子数随着温度上升而增加)十分困难。基于有限温度的KSDFT方法在过去十几年间成为了研究极端高温(几个电子伏以上)和高压下的重要工具,例如可以用传统KSDFT方法研究稠密等离子体、温稠密物质的状态方程、X射线Thomson散射、光学性质和输运性质等。然而,这些计算方法在模拟极端高温时会遇到巨大挑战。一方面,随着温度升高,更多电子被电离,在赝势方法中需要更多的价电子来描述电子与离子的作用,这会极大提升求解Kohn-Sham方程需要的能量截断值和计算量;另一方面,随着温度升高,需要计算的Kohn-Sham电子波函数随着体系温度增加,这也会导致计算时间的显著增加。
2013年,Baer等[66]提出了有限温度下的随机密度泛函理论(stochastic DFT,SDFT),利用Chebysev展开以及随机轨道求迹的方法得到基态电子密度,从而省去对角化矩阵的步骤,极大地提升了效率。此后,该方法被用于结合有限温度的DFT方法,成功模拟了温稠密物质的性质并在极端高温下展现出了相较于传统有限温度KSDFT方法在效率上的绝对优势。2020年,来自美国Los Alamos国家实验室的White和Collins[67]提出了混合随机密度泛函理论(mixed stochastic-deterministic DFT,MDFT)方法,该方法在低能级采用KS轨道描述而在高能级使用随机轨道展开,因此可大大降低SDFT的随机误差。以上工作为较大尺度模拟和极端高温条件下传统KSDFT方法低效的难题提供了新的解决方法。
1.4 分子动力学
分子动力学方法是一种模拟原子体系随时间运动的方法,被广泛地用于研究与原子运动路径相关的一些基本过程,如相变、扩散、化学反应等。经典分子动力学方法通过构建描述原子间相互作用的势函数,从而获得每个原子的受力(受力等于能量对原子位置的导数),再通过积分运动方程来获得每个原子下一时刻的位置,从而获得粒子随时间演化的位置和速度。当系统处在一定的密度、温度和压强等物理条件限制下,可以结合统计物理的方法计算物质的性质。具体来说,采取某个系综后,对粒子位置和速度采样,随后统计出体系的热力学宏观性质。从头算分子动力学(ab initio molecular dynamics,AIMD),也称为第一性原理分子动力学(first-principles molecular dynamics,FPMD)方法,该方法采用第一性原理方法(例如DFT)计算体系的势能面,因此计算量相比于经典分子动力学方法要大很多。ABACUS的分子动力学功能支持FPMD方法,也支持基于Lennard-Jones (LJ)对势的经典分子动力学模拟。此外,ABACUS还支持基于深度势能的分子动力学(deep potential molecular dynamics,DPMD)方法。
2 深度学习
2.1 基于深度学习的密度泛函
开发团队在ABACUS 3.0版本里推出了基于周期性边界条件的DeePKS方法[71],该算法将体系的总能量EDeePKS表示为:
式中,
图1
图1
实现于原子算筹(ABACUS)中的DeePKS方法可学习到高阶泛函的精度。此外,该方法还具有较高计算效率
Fig.1
DeePKS algorithm has been implemented within the self-consistent loop in ABACUS[71] (The Hamiltonian value for the DeePKS and the base methods are depicted as HDeePKS and Hbase, respectively. In addition, the difference of the above two Hamiltonians is labeled as Hδ . The electronic wave function and eigenvalue for the
ABACUS里实现的DeePKS方法旨在结合低精度DFT泛函与神经网络修正项,通过较低的计算成本,模拟高精度第一性原理方法的计算结果。DeePKS利用神经网络修正项去学习基准泛函求解Kohn-Sham方程得到的结果(低精度、低成本)与目标第一性原理方法(高精度、高成本)的结果之差。具体来说,这些结果包含计算得出的能量与原子受力和晶格应力之差,从而提升泛函精度。DeePKS中的神经网络修正项
2.2 基于深度学习的大原子模型
式中,Ri 代表原子i的坐标,该神经网络的输入端是一组根据每个原子
式中包含了第一性原理和深度势能所预测的体系能量Δϵ、原子受力ΔFi 和Virial张量Δ
2023年,Wu等[76]采用ABACUS为适用于钙钛矿氧化物的通用力场UniPero产生训练数据。研究团队构建了一个较为精炼的训练数据集(接近20000个构型),涉及14种金属元素、26种不同类型钙钛矿氧化物的200多种组分。得益于DPA-1强大的可表示性和可迁移性,UniPero模型能较好地拟合训练数据集中的体系能量和原子受力,这些数据由ABACUS软件求解Kohn-Sham方程获得。进一步测试表明,UniPero不仅能实现对由多种元素组成的钙钛矿氧化物及其任意组分固溶体的分子动力学模拟,还能够准确预测多种铁电氧化物在升温过程中的相变顺序,包括复杂的三元弛豫铁电固溶体。此外,研究团队已公布用于钙钛矿氧化物的训练数据集、力场模型以及相应的力场性能自动测试流程,为UniPero的进一步发展与完善提供支持。
2024年,Liu等[77]采用ABACUS生成训练数据,生成了IIB-VIA族半导体材料的大原子机器学习势函数模型DPA-Semi。如图2[77]所示,该模型共计包含19种半导体材料(Si、Ge、SiC、BAs、BN、AlN、AlP、AlAs、InP、InAs、InSb、GaN、GaP、GaAs、CdTe、InTe、CdSe、ZnS和CdS)。他们测试了不同半导体的晶格常数、体模量、剪切模量和Young's模量等性质,计算结果表明DPA-Semi模型的计算结果与DFT计算值一致。此外,他们利用DPA-Semi模型研究了各种半导体材料的声子谱、液体和非晶结构以及熔化温度,结果与实验和其他计算工作的结果一致,验证了DPA-Semi的精度和可靠性。将半导体体系拓展到金属体系也具有可行性,并且已经初步在DPA-2模型中实现[43]。
图2
图2
采用ABACUS训练的半导体势函数大模型DP-Semi,可用于模拟半导体的熔点等性质[77]
Fig.2
DPA, a large model based on deep neural networks, is used to train potential functions that can describe various semiconductor materials, where the first-principles training data all come from ABACUS calculations (a); DPA-Semi model generated through training also serves as an interatomic potential function, which can be used in various semiconductor simulations (b); and using the DPA-Semi model, the computed melting points of 19 semiconductors (Si, Ge, SiC, BAs, BN, AlN, AlP, AlAs, InP, InAs, InSb, GaN, GaP, GaAs, CdTe, InTe, CdSe, ZnS, CdS) obtained by the direct heating method (red dots) and the two-phase method (green dots) are relatively close to the experimental melting points (c)[77]
2.3 基于深度学习的电子动能密度泛函
无轨道密度泛函理论(OFDFT)[78,79]是除KSDFT之外的另一种DFT算法,其中“无轨道”意味着在DFT求解基态电子密度的过程中,不采用KSDFT中的单电子Kohn-Sham轨道,因此电子动能无法由Kohn-Sham轨道计算获得,而是需要构建一个描述电子动能的动能密度泛函(kinetic energy density functional,KEDF)来计算电子动能。实际的OFDFT计算中省去了KSDFT里需要的矩阵对角化步骤,可以直接采用截断Newton法、共轭梯度法等方法优化电荷密度,从而求解能量泛函的极小值。因此OFDFT的计算复杂度远小于KSDFT,其计算体系可达百万原子级别或更大[80]。
ABACUS实现了基于平面波基组的OFDFT算法。由于缺少单电子轨道,OFDFT无法利用单电子轨道计算赝势的非局域部分,因此一般采用局域赝势。目前ABACUS支持的局域赝势为bulk-derived local pseudopotentials (BLPS)[83]。如图3[84]所示,Sun等使用基于局域赝势和平面波基组,实现了一种基于机器学习且满足物理限制的非局域动能泛函(machine-learning-based physical-constrained non-local KEDF,MPN KEDF)。该动能泛函满足3个物理限制:标度率、Pauli能密度的非负性及自由电子气极限,作者对Li、Mg、Al金属以及59种合金进行了测试,获得了较好的结果,为基于机器学习的电子动能密度泛函构建提供了新的思路。
图3
图3
基于深度学习的电子动能密度泛函发展及其在合金中的应用[84]
Fig.3
Based on deep learning methods, an electronic kinetic energy density functional for machine learning is constructed, thus obtaining the electron kinetic energy and electron kinetic energy potential functions. This function introduces descriptors of free electron gas (FEG) and ensures that the electron kinetic energy satisfies physical conditions such as the free electron gas limit (a); new electronic kinetic energy functional machine-learning-based physical-constrained nonlocal (MPN), when applied to metallic systems such as Li, Mg, and Al, attained equilibrium volumes similar to those obtained with the Wang-Teter (WT) and Wang-Godvind-Carter (WGC) electronic kinetic energy functionals and demonstrated superior performance compared to other functionals like the TF
3 软件开发
3.1 密度泛函理论软件的特点
密度泛函理论软件的开发具有较大的复杂度。首先是软件的功能庞杂,输入参数多。以支持平面波基组和赝势的软件为例,若软件支持自旋非极化和自旋极化2种功能,其中每一种功能下支持LDA、GGA、Meta-GGA和hybrid functional 4种交换关联泛函,并且可以让用户选择使用模守恒赝势或超软赝势,则每次开发者对软件做出修改后,都需要让更新后的软件通过2 × 4 × 2 = 16个功能测试。
对于大多数功能全面的DFT软件,用户往往有较高自由度来选择不同的参数组合,例如用户可以选择是否在体系里增加电场、是否对强关联体系添加+U描述、是否选择对体系增加van der Waals力修正的描述。在电子自洽迭代过程中,用户可选择不同的Hamiltonian量对角化方法(例如共轭梯度法或Davidson方法),也可选择不同的电子密度混合方法(例如简单混合或者Broyden混合方法),还可选择不同的smearing方法(例如不加展宽或采用Fermi-Dirac展宽方法)。更进一步,当软件计算出收敛结果后需判断是否计算原子受力,是否计算晶胞所受应力。在保证前面16个测试都正确的基础上再覆盖以上参数的所有可能组合,则需16 × 28 = 4096个测试算例,这就加重了软件代码更新所需的测试代价。
若继续考虑Brillouin区的k点并行、平面波基组并行以及能带并行这3种不同的并行方案,则在每种并行方案下都需测试以上4096个算例,因此共需测试3 × 4096 = 12288个算例。进一步,若需要在CPU、GPU以及国产曙光硬件DCU上进行不同硬件下的测试,则需要3 × 12288 = 36864个算例。因此,面对参数增长带来的海量测试算例,如果每次代码更新后都需要把所有测试算例跑一遍来保证正确性,则时间成本和经济成本都难以承受。事实上,大多数DFT软件提供的参数比以上列举的更多,那么需要测试的算例个数将会达到天文数字。因此,如何维护多参数组合下的正确结果,往往关乎用户体验,同时开发者还要能够不断更新DFT软件,这对于任何DFT软件团队都是极大的考验。
此外,DFT软件的特点是基于DFT的新方法还在不断进步,新算法也不断涌现。例如前文提到的Stochastic DFT方法适合用来计算极端高温体系,但许多主流DFT软件里还未支持该算法。基于以上讨论,整个DFT软件领域还在不断推陈出新,因此有必要建立国产的DFT软件,为国内开发新算法的科研团队提供一个自主可控的国产软件平台。
3.2 开源软件理念
DFT软件的代码框架和算法都较为复杂,尤其对一个处在研发阶段的软件,其在不同材料计算场景应用时往往难以同时兼顾精度和效率,甚至在正确性和稳定性上会有缺陷。为了让不同用户满意,软件开发团队需要对用户提出的问题及时反馈,并需要持续投入人力对软件进行大量测试、代码修复乃至重构。虽然这样的开发模式有利于软件在短时间内的快速完善,但也对开发者提出了较高要求。一方面,开发者需兼具多学科知识,能够快速准确地定位出问题并且提出解决方案,才能应对用户提出的种种需求;另一方面,解决用户需求的科研模式往往给从事科学计算的科研工作者带来过重的软件工程负担,目前在国内培养这样的软件开发者仍是一个漫长的过程。
开源软件的意义不仅在于把源代码公布,也意味着用户可以获得免费使用的软件,因此有可能在短时间内获得更多用户的反馈。用户测试可以帮助开发者更快地发现软件中的缺陷,从而使得开发者有针对性地对软件进行修复,因此可以在短时间内提升软件的正确性和稳定性。其次,诸如Gitee或GitHub这样的开源社区里提供了丰富的开源软件开发工具,这些工具不仅可以帮助记录代码的修改历史,还可以使用自动测试等工具管理程序开发。此外,可以方便使用者对软件使用提出问题以及软件开发者迅速定位问题和分配任务。这样的软件开发模式极大降低了沟通成本,去中心化的发展模式使得所有软件的参与者可以更紧密地协作,从而快速推动软件发展。
2021年发布的《DeepModeling社区宣言》里曾提到:“机器学习与物理建模的结合正在改变着科学研究的范式。那些希望通过计算建模突破科学边界、解决困难问题的人们正在以前所未有的新方式集结起来。他们需要新的基础设施——新的协作平台,新的代码框架,新的数据处理手段,新的算力使用方式;他们需要新的文化——追求通力协作、惠及大众;追求知识与工具的自由交流与分享;追求尊重并欣赏相互的成就、和而不同”。ABACUS软件开发者在2021年与GitHub上的DeepModeling开源软件社区开始了紧密协作,同时在Gitee开源社区同步了代码。
过去3年,ABACUS软件在“好的代码是用出来的,而不是写出来的”开源理念的指引下快速迭代,其在功能、性能与可靠性上均取得了大幅度提升,开发者文档和各种教程有了较大完善,开发者与用户群体均稳步增长,同时也涌现出了许多优秀的开发者和深度用户。在ABACUS从2.2版本的开发到3.7版本的发布过程中(表1),汇聚了来自不同单位的优秀开发者,因此在一定程度上缓解了课题组模式的负担,其中来自北京科学智能研究院和北京深势科技有限公司的研发者在软件的开源过程中起到了重要的支撑和推动作用。随着开源模式的进一步探索和国内相应机制的逐步完善,DFT软件开发的难题有望获得一个更好的解决方案。
表1 从2022年4月到2024年7月ABACUS软件发布的版本号和主要内容
Table 1
Date of releasing ABACUS | Version | Content |
---|---|---|
2022.04.08 | v2.2 | Version 2.2 went through 3,200 commit modifications on GitHub from version 2.1, and the development team includes developers from various domestic research institutions |
2022.07.01 | v2.3 | Version 2.3 incorporates new plane wave generation and parallel modules, enhancing support for parallel computing with plane wave basis sets; the functionalities of the stochastic wave function density functional theory method have been released |
2022.10.01 | v3.0 | Version 3.0 has been released with the deep learning-based DeePKS functional approach based on periodic boundary conditions. Interfaces with the machine learning potential function method DeePMD-kit and the DP-GEN method have been released, as well as interfaces with the DeepH method for constructing Hamiltonians of electronic systems through machine learning |
2023.01.01 | v3.1 | Version 3.1 has been released with support for GPU and domestic DCU hardware in plane-wave basis set solutions for the Kohn-Sham equations, and introduces new features for the computation of solid-liquid interfaces |
2023.04.01 | v3.2 | Version 3.2 has been released with an interface for Hefei-NAMD software. The coverage of unit tests has increased to 60%, and the total coverage is now 76% |
2023.07.13 | v3.3 | Version 3.3 introduces an interface for calculating hybrid functionals with LibRI, and an interface with ShengBTE software for conducting material thermal conductivity calculations |
2023.10.07 | v3.4 | Version 3.4 primarily supports the DPA method, a machine learning potential function for universal large models, and has reconstructed core algorithms such as more efficient and reliable numerical atomic orbital two-center integrals |
2023.12.29 | v3.5 | Version 3.5 improved the algorithm for charge mixing and supported ultrasoft pseudopotentials for plane-wave basis sets, with targeted code development and optimization for three practical application scenarios: semiconductors, alloys, and batteries |
2024.04.01 | v3.6 | Version 3.6 has released a more stable and reliable DFT + U algorithm function and further optimized the program's computational performance on Sunway DCU hardware |
2024.07.01 | v3.7 | Version 3.7 has further supported the OpenLAM Large Atom Model project on a larger scale |
3.3 测试
程序测试是软件开发过程中的重要环节,通过对软件进行有效和系统的测试,可以降低项目风险,确保软件功能在各种参数组合和环境下的正确性,从而提高软件功能的稳定性。完善的测试可及时发现代码缺陷,对于越早发现和修复的缺陷,所需要付出的代价越小。ABACUS作为一个开源软件项目,涉及到许多不同背景的开发人员,每位开发人员负责开发代码的一部分功能。为了确保新开发的功能在持续更新的代码中保持正确性,开发者要编写相应功能的测试案例,这些案例能全面覆盖所编写的函数功能。此外,新写的测试需满足给定条件,例如测试需要独立且可被重复,测试失败后应提供错误信息,以及测试需能快速运行完毕等。手动编写和执行测试案例可能会非常繁琐和耗时,因此我们在ABACUS程序的开发流程中引入了Google Test测试框架进行单元测试的编写。开发者新添加的测试函数会被加入软件的自动测试流程,一旦有新提交的代码对该功能产生破坏,代码审核人员和代码开发者就可以更快速地得到反馈,从而尽可能避免错误或漏洞留下的隐患。此外,ABACUS开发团队建议所有开发者采用“测试驱动开发”的方法来开发程序新功能,即开发一个新功能前准备好完善的需求文档和测试案例,再写相关的新代码。
4 总结
密度泛函理论软件在人工智能时代又迎来了新一轮发展机遇,人工智能方法特别是深度学习方法有望提供同时兼顾精度和效率的电子结构计算新方案,大幅提升电子结构计算的预测能力。本文介绍的ABACUS是一款国内自主研发的开源DFT软件,从2021年开始开发2.2版本到2024年7月发布3.7版本,其开发者持续发展新的电子结构算法以及实现新功能,包括发展AI辅助的电子结构算法,适配国产超算,致力于打造出让用户满意的稳定和可靠软件,取得了阶段性的成果。
展望未来,ABACUS开发者团队将继续发展基于物理建模、人工智能和高性能计算的新一代电子结构软件计算平台。首先,不断丰富和完善软件现有的电子结构物理算法,实现以密度泛函理论为主的第一性原理计算新方法。其次,继续发展AI辅助的电子尺度新方法,不断拓展AI方法在电子结构领域的边界,推动AI方法实现更高精度、更高效率的电子结构计算。最后,构建新的软件算法框架,进一步设计容易适配各种国产超算平台的软件模块和组件,定义清晰的开发文档。希望随着ABACUS软件不断提升软件的可靠性和易用性,会有更多的用户愿意去使用国产第一性原理软件,并用于更多材料的实际应用场景。新用户和新开发者的不断加入可以壮大开源软件社区,切实提升国产第一性原理软件的实力,从而助力材料科学研究的发展。
参考文献
Deep potential molecular dynamics: A scalable model with the accuracy of quantum mechanics
[J].
DeePMD-kit: A deep learning package for many-body potential energy representation and molecular dynamics
[J].
Self-consistent equations including exchange and correlation effects
[J].
Roadmap on machine learning in electronic structure
[J].
DeePKS-kit: A package for developing machine learning-based chemically accurate energy and density functional models
[J].
Pushing the frontiers of density functionals by solving the fractional electron problem
[J].[Figure: see text].
Deep-learning density functional perturbation theory
[J].
Deep-learning density functional theory Hamiltonian for efficient ab initio electronic-structure calculation
[J].The marriage of density functional theory (DFT) and deep-learning methods has the potential to revolutionize modern computational materials science. Here we develop a deep neural network approach to represent the DFT Hamiltonian (DeepH) of crystalline materials, aiming to bypass the computationally demanding self-consistent field iterations of DFT and substantially improve the efficiency of ab initio electronic-structure calculations. A general framework is proposed to deal with the large dimensionality and gauge (or rotation) covariance of the DFT Hamiltonian matrix by virtue of locality, and this is realized by a message-passing neural network for deep learning. High accuracy, high efficiency and good transferability of the DeepH method are generally demonstrated for various kinds of material system and physical property. The method provides a solution to the accuracy-efficiency dilemma of DFT and opens opportunities to explore large-scale material systems, as evidenced by a promising application in the study of twisted van der Waals materials.© 2022. The Author(s), under exclusive licence to Springer Nature America, Inc.
General framework for E(3)-equivariant neural network representation of density functional theory Hamiltonian
[J].The combination of deep learning and ab initio calculation has shown great promise in revolutionizing future scientific research, but how to design neural network models incorporating a priori knowledge and symmetry requirements is a key challenging subject. Here we propose an E(3)-equivariant deep-learning framework to represent density functional theory (DFT) Hamiltonian as a function of material structure, which can naturally preserve the Euclidean symmetry even in the presence of spin-orbit coupling. Our DeepH-E3 method enables efficient electronic structure calculation at ab initio accuracy by learning from DFT data of small-sized structures, making the routine study of large-scale supercells (>10 atoms) feasible. The method can reach sub-meV prediction accuracy at high training efficiency, showing state-of-the-art performance in our experiments. The work is not only of general significance to deep-learning method development but also creates opportunities for materials research, such as building a Moiré-twisted material database.© 2023. The Author(s).
Accelerating finite-temperature Kohn-Sham density functional theory with deep neural networks
[J].
Accelerating equilibration in first-principles molecular dynamics with orbital-free density functional theory
[J].
Incorporation of density scaling constraint in density functional design via contrastive representation learning
[J].
Efficient iterative schemes for ab initio total-energy calculations using a plane-wave basis set
[J].
Efficiency of ab-initio total energy calculations for metals and semiconductors using a plane-wave basis set
[J].
Quantum espresso: A modular and open-source software project for quantum simulations of materials
[J].
CP2K: Atomistic simulations of condensed matter systems
[J].
The SIESTA method for ab initio order-N materials simulation
[J].
Variationally optimized atomic orbitals for large-scale electronic structures
[J].
Ab initio molecular simulations with numeric atom-centered orbitals
[J].
Norm-conserving pseudopotentials
[J].
Self-interaction correction to density-functional approximations for many-electron systems
[J].
Generalized gradient approximation made simple
[J].
Strongly constrained and appropriately normed semilocal density functional
[J].
Rationale for mixing exact exchange with density functional approximations
[J].
Hybrid functionals based on a screened Coulomb potential
[J].
DP-GEN: A concurrent learning platform for the generation of reliable deep learning based potential energy models
[J].
The atomic simulation environment—A Python library for working with atoms
[J].
Implementation strategies in phonopy and phono3py
[J].
Wannier90: A tool for obtaining maximally-localised Wannier functions
[J].
ShengBTE: A solver of the Boltzmann transport equation for phonons
[J].
Ab initio nonadiabatic molecular dynamics investigations on the excited carriers in condensed matter systems
[J].
Accelerating atomic orbital-based electronic structure calculation via pole expansion and selected inversion
[J].
USPEX—Evolutionary crystal structure prediction
[J].
Efficient hybrid density functional calculations for large periodic systems using numerical atomic orbitals
[J].
Accuracy of localized resolution of the identity in periodic hybrid functional calculations with numerical atomic orbitals
[J].We present an implementation of hybrid density functional approximations for periodic systems within a pseudopotential-based, numerical atomic orbital (NAO) framework. The two-electron Coulomb repulsion integrals (ERIs) are evaluated using the localized resolution-of-the-identity (LRI) approximation. The accuracy of the LRI approximation is benchmarked unambiguously against independent reference results obtained via a computational scheme whereby the ERIs are accurately evaluated by expanding the products of NAOs in terms of plane waves. An alternative strategy for constructing auxiliary basis sets is proposed, and its accuracy is assessed and compared to the previously used procedure. Finally, the reliability of our algorithm and implementation is benchmarked against other established implementations within different numerical frameworks in terms of the calculated band gap values of a set of semiconductors and insulators.
PYATB: An efficient python package for electronic structure calculations using ab initio tight-binding model
[J].
Ab initio theory and modeling of water
[J].Water is of the utmost importance for life and technology. However, a genuinely predictive ab initio model of water has eluded scientists. We demonstrate that a fully ab initio approach, relying on the strongly constrained and appropriately normed (SCAN) density functional, provides such a description of water. SCAN accurately describes the balance among covalent bonds, hydrogen bonds, and van der Waals interactions that dictates the structure and dynamics of liquid water. Notably, SCAN captures the density difference between water and ice I at ambient conditions, as well as many important structural, electronic, and dynamic properties of liquid water. These successful predictions of the versatile SCAN functional open the gates to study complex processes in aqueous phase chemistry and the interactions of water with other materials in an efficient, accurate, and predictive, ab initio manner.
Versatile van der Waals density functional based on a meta-generalized gradient approximation
[J].
Iterative minimization techniques for ab initio total-energy calculations: Molecular dynamics and conjugate gradients
[J].
Soft self-consistent pseudopotentials in a generalized eigenvalue formalism
[J].
DPA-2: Towards a universal large atomic model for molecular and material simulation
[DB/OL].
Ab initio electronic structure calculations based on numerical atomic orbitals: Basic fomalisms and recent progresses
[J].
Numerical atomic orbitals for linear-scaling calculations
[J].
Systematically improvable optimized atomic basis sets for ab initio calculations
[J].
Electronic structure interpolation via atomic orbitals
[J].
Large-scale ab initio simulations based on systematically improvable atomic basis
[J].
Accurate stress calculations based on numerical atomic orbital bases: Implementation and benchmarks
[J].
Strategy for constructing compact numerical atomic orbital basis sets by incorporating the gradients of reference wavefunctions
[J].
A caveat of the charge-extrapolation scheme for modeling electrochemical reactions on semiconductor surfaces: An issue induced by a discontinuous Fermi level change
[J].(Photo)electrochemical surface reactions in realistic experimental systems occur under a constant-potential condition, while the simulations of electrochemical reactions are mostly performed under a constant-charge condition. A charge-extrapolation scheme proposed by earlier theoretical studies converts constant-charge reaction energies to constant-potential reaction energies for electrochemical reactions on metal surfaces, which is based on a capacitor-model assumption to approximate the surface electrical double layer. However, the charge-extrapolation approach may be problematic when applied to models of photoelectrochemical reactions on semiconductor surfaces with a cross-bandgap Fermi level change along the reaction path. We perform density-functional-theory calculations to show that the error is induced by an abrupt change of the modeling system's potential making the capacitor model assumption invalid. We further propose an approach to avoid the cross-bandgap Fermi level change in the simulations of semiconductor surface reactions, with which the charge-extrapolation scheme still can be employed to compute the constant-potential reaction energies for the semiconductor photoelectrode cases.
Disordered hyperuniformity in two-dimensional amorphous silica
[J].
Disordered hyperuniform quasi-one-dimensional materials
[J].
Peculiar band geometry induced giant shift current in ferroelectric SnTe monolayer
[J].
Family behavior and Dirac bands in armchair nanoribbons with 4-8 defect lines
[J].
Tuning of Berry-curvature dipole in Ta-As slabs: An effective route to enhance the nonlinear Hall response
[J].
Efficient homojunction tin perovskite solar cells enabled by gradient germanium doping
[J].
Interplay between magnetic structures and surface states in MnBi2Te4 from first-principles studies
[J].
Retention and recycling of deuterium in liquid lithium-tin slab studied by first-principles molecular dynamics
[J].
First-principles molecular dynamics study of deuterium diffusion in liquid tin
[J].
Cooperative effect in a graphite intercalation compound: Enhanced mobility of AlCl4 in the graphite cathode of aluminum-ion batteries
[J].
A DFT study of energetic and structural properties of a full turn of A-form DNA under relaxed and stretching conditions
[J].
Copper-doped beryllium and beryllium oxide interface: A first-principles study
[J].
Structure evolution of chromium-doped boron clusters: Toward the formation of endohedral boron cages
[J].
Diffusion coefficients of Mg isotopes in MgSiO3 and Mg2SiO4 melts calculated by first-principles molecular dynamics simulations
[J].
Self-averaging stochastic Kohn-Sham density-functional theory
[J].
Fast and universal Kohn-Sham density functional theory algorithm for warm dense matter to hot dense plasma
[J].
Plane-wave-based stochastic-deterministic density functional theory for extended systems
[J].
Combining stochastic density functional theory with deep potential molecular dynamics to study warm dense matter
[J].
DeePKS: A comprehensive data-driven approach toward chemically accurate density functional theory
[J].We propose a general machine learning-based framework for building an accurate and widely applicable energy functional within the framework of generalized Kohn-Sham density functional theory. To this end, we develop a way of training self-consistent models that are capable of taking large datasets from different systems and different kinds of labels. We demonstrate that the functional that results from this training procedure gives chemically accurate predictions on energy, force, dipole, and electron density for a large class of molecules. It can be continuously improved when more and more data are available.
DeePKS + ABACUS as a bridge between expensive quantum mechanical models and machine learning potentials
[J].
DeePKS model for halide perovskites with the accuracy of a hybrid functional
[J].
Intramolecular and water mediated tautomerism of solvated glycine
[J].
Active learning of uniformly accurate interatomic potentials for materials simulation
[J].
Pretraining of attention-based deep learning potential model for molecular simulation
[J].
Universal interatomic potential for perovskite oxides
[J].
Machine-learning-based interatomic potentials for group IIB to VIA semiconductors: Toward a universal model
[J].
Orbital-free kinetic-energy functionals for the nearly free electron gas
[J].
Kinetic-energy functional of the electron density
[J].
Petascale orbital-free density functional theory enabled by small-box algorithms
[J].Orbital-free density functional theory (OFDFT) is a quantum-mechanics-based method that utilizes electron density as its sole variable. The main computational cost in OFDFT is the ubiquitous use of the fast Fourier transform (FFT), which is mainly adopted to evaluate the kinetic energy density functional (KEDF) and electron-electron Coulomb interaction terms. We design and implement a small-box FFT (SBFFT) algorithm to overcome the parallelization limitations of conventional FFT algorithms. We also propose real-space truncation of the nonlocal Wang-Teter KEDF kernel. The scalability of the SBFFT is demonstrated by efficiently simulating one full optimization step (electron density, energies, forces, and stresses) of 1,024,000 lithium (Li) atoms on up to 65,536 cores. We perform other tests using Li as a test material, including calculations of physical properties of different phases of bulk Li, geometry optimizations of nanocrystalline Li, and molecular dynamics simulations of liquid Li. All of the tests yield excellent agreement with the original OFDFT results, suggesting that the OFDFT-SBFFT algorithm opens the door to efficient first-principles simulations of materials containing millions of atoms.
Orbital-free kinetic-energy density functionals with a density-dependent kernel
[J].
Nonlocal orbital-free kinetic energy density functional for semiconductors
[J].
Transferable local pseudopotentials for magnesium, aluminum and silicon
[J].One obstacle in orbital-free density functional theory (OF-DFT) is the lack of accurate and transferable local pseudopotentials (LPSs). In this work, we build high quality LPSs by inverting Kohn-Sham (KS) equations on bulk valence electron densities to obtain an atom-centered local pseudopotential. With this approach, we build LPSs for Mg, Al, and Si, and then test them in KS DFT calculations of static bulk properties for several Mg, Al, and Si bulk structures as well as beta''-Al3Mg. Our Mg, Al, and Si LPSs produce correct ground state properties and phase orderings. These LPSs are then tested in KS-DFT calculations of surface energies for several low-index Mg and Al surfaces, point defect properties in hexagonal-close-packed (hcp) Mg, face-centered cubic (fcc) Al, and diamond Si, and stacking fault energies in fcc Al. All of these LPS results agree quantitatively with the results from nonlocal pseudopotentials with errors less than or equal to 40 meV per atom. Finally, we perform OF-DFT calculations for various Mg and Al structures, employing the Wang-Govind-Carter (WGC) nonlocal kinetic energy density functional (KEDF). The OF-DFT results generally agree well with the corresponding KS-DFT results. With our new Mg and Al LPSs and the WGC KEDF, OF-DFT now provides a practical method for accurate, large-scale first principles simulations of main group metals and their alloys.
Machine learning based nonlocal kinetic energy density functional for simple metals and alloys
[J].
/
〈 |
|
〉 |
