2025 Volume 38 Issue 4
Article Contents

Yinxuan Song, Yingqi Tian, Yifan Cheng, Haibo Ma. Recent Implementations in Kylin 1.3: Improved Computational Efficiency of ab initio DMRG and a Spin-adapted Version of EC-MRCI†[J]. Chinese Journal of Chemical Physics, 2025, 38(4): 447-456. doi: 10.1063/1674-0068/cjcp2506083
Citation: Yinxuan Song, Yingqi Tian, Yifan Cheng, Haibo Ma. Recent Implementations in Kylin 1.3: Improved Computational Efficiency of ab initio DMRG and a Spin-adapted Version of EC-MRCI†[J]. Chinese Journal of Chemical Physics, 2025, 38(4): 447-456. doi: 10.1063/1674-0068/cjcp2506083

Recent Implementations in Kylin 1.3: Improved Computational Efficiency of ab initio DMRG and a Spin-adapted Version of EC-MRCI†

通讯作者: 陈斌, bchen63@163.com
  • 1. 

    沈阳化工大学材料科学与工程学院 沈阳 110142

  1. 本站搜索
  2. 百度学术搜索
  3. 万方数据库搜索
  4. CNKI搜索

Figures(9)  /  Tables(1)

Article Metrics

Article views(275) PDF downloads(0) Cited by(0)

Access History

Recent Implementations in Kylin 1.3: Improved Computational Efficiency of ab initio DMRG and a Spin-adapted Version of EC-MRCI†

Abstract: Accurate evaluation of electron correlations is essential for the reliable quantitative description of electronic structures in strongly correlated systems, including bond-dissociating molecules, polyradicals, large conjugated molecules, and transition metal complexes. To provide a user-friendly tool for studying such challenging systems, our team developed Kylin 1.0 [J. Comput. Chem. 44, 1316 (2023)], an $ ab $ $ initio $ quantum chemistry program designed for efficient density matrix renormalization group (DMRG) and post-DMRG methods, enabling high-accuracy calculations with large active spaces. We have now further advanced the software with the release of Kylin 1.3, featuring optimized DMRG algorithms and an improved tensor contraction scheme in the diagonalization step. Benchmark calculations on the Mn4CaO5 cluster demonstrate a remarkable speed-up of up to 16 fater than Kylin 1.0. Moreover, a more user-friendly and efficient algorithm [J. Chem. Theory Comput. 17, 3414 (2021)] for sampling configurations from DMRG wavefunction is implemented as well. Additionally, we have also implemented a spin-adapted version of the externally contracted multi-reference configuration interaction (EC-MRCI) method [J. Phys. Chem. A 128, 958 (2024)], further enhancing the program’s efficiency and accuracy for electron correlation calculations.

    • The accurate evaluation of electron correlations is essential for describing electronic structures in strongly correlated systems, including bond-dissociating molecules, polyradicals, conjugated macromolecules, and transition metal complexes. In such systems, the existence of multiple dominant (near-degenerate) configurations in wavefunction necessitates accounting for static correlation. Complete active space configuration interaction (CASCI) and complete active space self-consistent field (CASSCF) methods could appropriately describe the static correlation. However, their applicability is limited by the exponential growth of the configuration space. Currently the largest active space that could be exactly solved is (26e, 23o) for C3H8/STO-3G on supercomputers via high-performance distributed computations [1]. Consequently, various near-exact Full CI (FCI) alternatives have been proposed in recent decades, including selected CI (sCI) [2-6], quantum Monte Carlo (QMC) [7-9], density matrix renormalization group (DMRG) [10-16] and others [17, 18]. Among them, DMRG notably circumvents the “dimensionality curse” by compressing information through iterative renormalization of truncated many-electron bases, enabling calculations for systems with a few tens of or even more than 100 orbitals [19, 20].

      In 2023, our team developed an $ ab $ $ initio $ quantum chemistry software package, Kylin 1.0 (website: https://kylin-qc.com) [19], which is designed for user-friendly and efficient DMRG methods based on matrix product state (MPS) and matrix product operator (MPO) framework. The pre-DMRG modules such as integral calculation and Hartree-Fock self-consistent field (HF-SCF) are implemented, thus the DMRG calculations could be performed without relying on other quantum chemistry programs. Meanwhile, a standalone version DMRG is also provided in Kylin, which requires users to offer molecular orbital (MO) integrals file. Furthermore, to capture the dynamic correlation outside the active space, post-DMRG methods are also implemented in Kylin. The implemented methods in Kylin are shown in FIG. 1.

      Recently, we released Kylin 1.3 version with significant enhancements:

      ● DMRG: The codes are optimized and an improved tensor contraction order in effective Hamiltonian diagonalization is implemented, leading to a remarkable reduction for calculation time. It should be noted that only OpenMP parallelism is implemented, over symmetry sectors, operators and sub-Hamiltonians, identical to Kylin 1.0.

      ● Algorithm for configuration sampling: The sweep algorithm for sampling configurations [21] from MPS is implemented. The algorithm only requires the configuration coefficient as an input parameter, improving the user-friendliness and efficiency for CI wavefunction reconstruction from MPS.

      ● Externally contracted multireference CI (EC-MRCI): A spin-adapted version is implemented, using configuration state function (CSF) as basis functions. The new version is based on the algorithm [22] with the hybrid of the tree structure [23] and the graphical unitary group approach (GUGA) [24-28]. The tree structure is convenient for configuration space management, while GUGA is efficient for matrix element calculations. Consequently, the spin symmetry is preserved and the computation efficiency is improved.

      These advancements collectively enhance Kylin’s efficiency and accuracy for electron correlation calculations across diverse chemical systems.

    II.   IMPROVEMENTS IN KYLIN 1.3
    • In DMRG, the $ n $-orbital multiconfiguration wavefunction could be written as MPS form,

      where $ |{\sigma_1 \cdots \sigma_n}\rangle $ is the occupation-number representation of the configuration, and $ M_{a_{i-1},a_i}^{\sigma_i} $ represents an element of the local rank-3 tensor $ {\bf{M}}[i] $ (graphical representation shown in FIG. 2), which has two link bonds $ a_{i-1} $, $ a_i $ with dimensions $ {m}_{i-1} $, $ m_i $, respectively and one physical bond $ \sigma_i $ with dimension $ d $ (the number of possible occupations of orbital $ i $). Similarly, one can decompose the global operator $ \hat{O} $ to the MPO tensors,

      where ${W}^{\sigma'_i,\sigma_i}_{b_{i-1},b_i}$ represents an element of the local rank-4 tensor $ {\bf{W}}[i] $ (graphical representation shown in FIG. 2), which has two link bonds $ b_{i-1} $, $ b_i $ and two physical bonds $ {\sigma}_i $, ${\sigma}'_i$.

      The ground state energy $ \epsilon $ can be minimized by introducing the Lagrange multiplier as follows:

      and solving the equation

      site-by-site from one end of the chain of sites to the other.

      Solving Eq.(4) is equivalent to diagonalizing an effective Hamiltonian matrix at site $ i $. Here we use two-site algorithm as an example. FIG. 2 shows the graphical representation of effective Hamiltonian $ {\bf{H}}[i] $, where the bonds $a'_{i-1}$, $\sigma'_i$, $\sigma'_{i+1}$ and $a'_{i+1}$ could be reshaped as matrix row, while $ a_{i-1} $, $ \sigma_i $, $\sigma_{i+1}$, and $ a_{i+1} $ could be reshaped as a matrix column. Due to the large dimension of $ {\bf{H}}[i] $ ($\approx m^2d^2 \times m^2d^2$, $ m $ is the maximum MPS bond dimension), the sigma vector in direct CI context (i.e., $ {\bf{H}}[i]{\boldsymbol{\Psi}}[i] $ shown in FIG. 2) is constructed explicitly instead of constructing $ {\bf{H}}[i] $ during diagonalization.

      The tensor $ {\bf{H}}[i]{\boldsymbol{\Psi}}[i] $ could be obtained by tensor contraction as

      where the contracted bonds are $ a_{i-1} $, $ a_{i+1} $, $ b_{i-1} $, $ b_{i+1} $, $ \sigma_i $, and $ \sigma_{i+1} $. The graphical representation of tensors $ {\bf{L}}[i-1] $, $ {\boldsymbol{\Psi}}[i] $, $ {\bf{V}}[i] $ and $ {\bf{R}}[i + 2] $ are shown in FIG. 3. In Kylin 1.0, Eq.(5) is used to construct $ {\bf{H}}[i]{\boldsymbol{\Psi}}[i] $, where the $ {\bf{L}}[i-1] $ tensor is first contracted with the MPS tensor $ {\boldsymbol{\Psi}}[i] $, as shown in FIG. 4 (MPS first).

      Recently, we found that using another contraction order could reduce the computation time remarkably compared with the MPS first order (see numerical results in Sec. III A). The new contraction order is called MPO first order, as shown in FIG. 4. The $ {\bf{L}}[i-1] $ and $ {\bf{R}}[i + 2] $ tensors are first contracted with the MPO tensors $ {\bf{W}}[i] $ and ${\bf{W}}[i + 1]$, respectively

      where the contracted bonds are $ b_{i-1} $ and $ b_{i+1} $ respectively, and the graphical representations of tensors $ {\bf{LO}}[i-1] $ and $ {\bf{OR}}[i + 2] $ are shown in FIG. 3. Then these two tensors are contracted with $ {\boldsymbol{\Psi}}[i] $ to generate $ {\bf{H}}[i]{\boldsymbol{\Psi}}[i] $

      in which the contracted bonds are $ a_{i-1} $, $ a_{i+1} $, $ b_{i} $, $ \sigma_i $ and $ \sigma_{i+1} $. Currently, both MPO first and MPS first orders are implemented in Kylin 1.3.

    • The coefficient of configuration $ |{\sigma_1 \cdots \sigma_n}\rangle $ (sometimes required for wavefunction analysis or multi-reference methods) could be extracted from MPS according to the equation

      However, traversing the large configuration space to get all configuration coefficients is unaffordable. To get a set of important configurations (i.e. with large absolute coefficients) from MPS wavefunction, the entanglement-driven genetic algorithm (EDGA) [29] was implemented in Kylin 1.0, in which the large configuration space is explored by virtue of a genetic algorithm accelerated by orbital entanglement information.

      Recently, the sweep algorithm for sampling configurations with a threshold [21] has been implemented in Kylin 1.3. It is preferable for the algorithm to commence with the MPS in its left canonical form. During the contraction between reference wavefunction and a particular configuration (Eq.(9)), one can judge whether the coefficient goes beyond the threshold at any given site (e.g., at site $ p $) by the set of partial coefficients $ \{C_{\sigma_1 \cdots \sigma_p}^{a_p}\} $, which could be obtained from

      Considering the left-normalized condition of left-canonical MPS, the coefficient of configuration $ |{\sigma_1 \cdots \sigma_n}\rangle $ could be written as

      following the Cauchy−Schwarz inequality. Therefore, if $\displaystyle\sqrt{\sum_{a_p} \left(C_{\sigma_1 \cdots \sigma_p}^{a_p}\right)^2}$ is smaller than the threshold, then this partial coefficient is dropped, as are all configurations involving the local basis string $ |{\sigma_1 \cdots \sigma_p}\rangle $. Consequently, all configurations with an absolute coefficient larger than the threshold could be obtained.

      It should be noted that if the MPS is spin-adapted, the corresponding CSFs are obtained by the sweep algorithm. Otherwise, the corresponding Slater determinants are obtained.

      The sweep algorithm shows more efficiency and stability than EDGA, as shown in Ref.[30]. Additionally, unlike EDGA, which requires an initial configuration guess, orbital entanglement information, and some other input parameters, the sweep algorithm is more user-friendly because it only requires the configuration coefficient threshold as input parameter. Since the sampled configurations could be used as reference for EC-MRCI, the sweep algorithm also makes DMRG2sCI-EC-MRCI calculation more convenient to perform.

    • Capturing dynamic correlation beyond large active spaces remains a quintessential challenge for robust quantitative results. MRCI method is one of the widely used tools to recover both static and dynamic correlations. However, it still faces the ``dimensionality curse". Various contraction approximations have been developed to break through this bottleneck. As one of the contraction approximations, the external contraction (EC) groups the configurations with the same internal parts, while the contraction coefficients are generated by perturbation theory.

      The EC-MRCI (with single and double excitations) wavefunction can be written as

      where $ |{\phi_{R}}\rangle $ is the reference configuration, while $ |{\psi_S}\rangle $ and $ |{\psi_D}\rangle $ are the single (S) and double (D) contracted states corresponding to the $(N - 1)$- and $(N - 2)$-electron internal parts respectively (in this work these internal parts $ |{\phi_S^{}}\rangle $ and $ |{\phi_D^{}}\rangle $ are called kernels):

      Here, $ |{\phi_S^{a}}\rangle $ is the single-excited CSF composed of the kernel $ |{\phi_S^{}}\rangle $ and the occupied external orbital $ a $, while the meaning of notation $ |{\phi_D^{ab}}\rangle $ is similar. $|{\psi_0}\rangle=\displaystyle\sum_R c_R|{\phi_{R}}\rangle$ is the reference wave function and $ E_0 $ indicates the corresponding reference energy. As shown in Eqs. (12)–(14), a kernel corresponds to an EC state. Meanwhile, the number of kernels is only dependent on the reference configurations. Thus, the dimension of Hamiltonian matrix is independent of external orbitals but dependent on reference configurations, which makes EC suitable for large basis set.

      To overcome the bottleneck of dependency on the increasing number of reference configurations, in 2018 our group developed an EC-MRCI method (DMRG2sCI-EC-MRCI) [31], which uses a small but important set of Slater determinants (DETs) as sCI reference, reconstructed from DMRG wavefunction (could be done by virtue of EDGA or the sweep algorithm mentioned in Sec. II A2). This indicates that DMRG2sCI-EC-MRCI could be applied to large active space and basis set.

      However, it is not spin-adapted due to the use of DETs as many-electron basis. For example, assuming that there are two DETs $ |{\rm{ud}}\rangle $ and $ |{\rm{du}}\rangle $ in the reference space, the singlet state wavefunction requires that the linear combination $\dfrac{1}{\sqrt{2}} \left( |{\rm{ud}}\rangle - |{\rm{du}}\rangle \right)$ is satisfied. Nevertheless, for a sCI reference wavefunction, if $ |{\rm{ud}}\rangle $ is selected and $ |{\rm{du}}\rangle $ is discarded, the spin symmetry is broken.

      To solve this problem, one could use CSFs, which are the eigenfunction of total-spin operator ($ S^2 $). Moreover, the number of CSFs is smaller than that of DETs under the same conditions. The numbers of CSFs ($ N_{\rm{CSF}} $) and DETs ($N_{\rm{DET}}$) are given by the formulae [32, 33]

      for an $ n $-orbital and $ N $-electron system with total-spin $ S $ and its z-component $ S_z(= S) $.

      Consequently, the ratio of $ N_{\rm{CSF}} $ to $ N_{\rm{DET}} $ is given by

      which illustrates that the variational space dimension can be significantly reduced when DETs are replaced by CSFs. Note that the equality only holds when $ 2S = N $ or $ 2S + N = 2n $.

      Recently we have developed a new algorithm by using CSFs instead of DETs to improve the computational accuracy and efficiency of DMRG2sCI-EC-MRCI (or sCI-EC-MRCI) [22]. To overcome the inherent limitations of Shavitt graph [24] (which is an efficient way for FCI CSF space management in GUGA), the new algorithm uses a tree structure [23] to manage selected CSFs. As shown in FIG. 5 for (4e, 4o) and $ S = 1 $, the CSF tree is organized based on the step vector representation. The root node represents the vacuum state. The numbers in the rest nodes show the corresponding step values. A walk from the root node to a leaf node represents a CSF. For example, the orange line in FIG. 5 represents the CSF $ |{1130}\rangle $.

      The calculation of EC-MRCI matrix elements could still utilize the formulae derived from GUGA. The key problem is to calculate the coupling coefficients $ \langle{\phi'}|\hat{E}_{{{pq}}}|{\phi}\rangle $ and $ \langle{\phi'}|\hat{e}_{{{pq,rs}}}^{}|{\phi}\rangle $, which could be factorized into the product of segment values, as

      where the segment sequence $ \{Q_k\} $ forms a loop in Shavitt graph. Actually, the segment sequence $ \{Q_k\} $ is also a sequence of step vector pairs $ (d_k', d_k) $. According to this connection, we could still use Eqs. (18, 19) to calculate the coupling coefficients in tree representation. The difference tree between two CSFs could be used to help to realize. FIG. 6(B) shows the different trees corresponding to $ \langle{3101}|\hat{E}_{{23}}|{3011}\rangle $. For each $ (d_r', d_r) $ pair in the difference tree, the corresponding loop segment could be found in Shavitt graph as shown in FIG. 6(A).

      More details about this spin-adapted (DMRG2sCI-/sCI-)EC-MRCI method could be found in our previous work [22], and currently this method is implemented in Kylin 1.3.

    III.   NUMERICAL EXAMPLES
    • To test the performance improvements of DMRG, the Mn4CaO5 cluster, at which the water splitting takes place in photosystem II [34], is taken as an example here. The geometry (shown in FIG. 7(A)) is taken from the XRD model in Ref.[35]. The active space (44e, 35o) is constructed first by iCAS (imposed automatic selection and localization of active orbitals) [36] selecting the 3$ d $ of Mn and 2$ p $ of O in Mn4CaO5, then localized by Boys method [37, 38], using Beijing Density Functional (BDF) package [39]. Scalar relativistic effects are taken into account with the “exact two-component" (X2C) Hamiltonian [40, 41]. The singlet ground state is calculated with ANO-RCC-MB basis set and $ C_1 $ point group symmetry. All DMRG calculations are performed on the machine with two Intel Xeon Gold 6548N 32-core CPUs, 2 TB memory and OpenMP parallelization.

      The DMRG energies are identical for both MPO first order and MPS first order. As shown in FIG. 7(B), for DMRG with $m = 1000$, a speed-up about 6 could be achieved from MPS first order to MPO first order in Kylin 1.3. Moreover, with other optimizations in DMRG codes, a total speed-up about 16 could be achieved from Kylin 1.0 to Kylin 1.3. Additionally, we further perform DMRG calculations with different $ m $ to test the computational limit of Kylin 1.3 with MPO first order. As shown in FIG. 7(C), the energy could be converged within 0.5 mEh when $ m $ is increased from 1000 to 7000. Furthermore, the DMRG calculation in Kylin 1.3 could be performed with at maximum $ m = 7000 $ using about 40 h for Mn4CaO5 cluster with CAS (44e, 35o).

    • To test the speed-up of EC-MRCI(CSF) in Kylin 1.3 compared with EC-MRCI(DET) in Kylin 1.0, we take homonuclear diatomics (bond length 1.5 Å) B2, C2, N2, O2 and F2 as examples, with active spaces (10e, 10o), (12e, 10o), (14e, 10o), (16e, 10o) and (18e, 10o) respectively constructed by 1$ s $, 2$ s $ and 2$ p $ orbitals. The ground states are calculated with cc-pVQZ basis set and $ C_1 $ point group symmetry on an AMD EPYC 9654 96-Core CPU with OpenMP parallelization.

      The calculation time and corresponding speed-up are shown in FIG. 8. The total calculation time of both EC-MRCI(CSF) and EC-MRCI(DET) for O2 and F2 is no more than 1 min because of the small active space (no more than 1200 configurations). For B2, the ratio of reference DETs and CSFs ($ N_{\rm{DET}} / N_{\rm{CSF}} $) is about 1.5, thus the speed-up of EC-MRCI(CSF) is only about 4. Meanwhile, for C2 and N2, $ N_{\rm{DET}} / N_{\rm{CSF}} $ is about 3, thus the speed-up about 14–15 could be achieved. In summary, the spin-adapted version EC-MRCI in Kylin 1.3 could remarkably reduce the calculation time compared with the EC-MRCI(DET) in Kylin 1.0, enhancing the program's efficiency.

    • To test the accuracy of EC-MRCI, we take radicals in QUEST#4X dataset [42] as examples to calculate the vertical excitation energies with the same basis set (aug-cc-pVTZ) and point group symmetry ($C_{\rm{s}}$ for HCO, HOC, H2PO, H2PS and C2H3 while $C_{\rm{2v}}$ for other radicals). The iCIPT2 (iterative CI with selection and second-order perturbation theory [5]), an approximation approach to FCI, is used as a benchmark here. The iCIPT2 excitation energies are taken from Ref.[42]. Meanwhile, the same state-averaged (SA) CASSCF orbitals in Ref.[42] are also used here to perform EC-MRCI calculations (with FCIDUMP files generated by BDF package). Since excitations from doubly-occupied orbitals to other orbitals (i.e. active and external) are not implemented in EC-MRCI module currently, for some radicals the active space is expanded to contain doubly-occupied orbitals, thus the correlation of those electrons could be considered, making EC-MRCI energy more accurate. The active spaces of all radicals for EC-MRCI are listed in Table S1 (Supplementary materials, SM). The same core orbitals (listed in Table S1 (SM)) in Ref.[42] are also frozen for EC-MRCI calculations. The size-consistency correction is included with renormalized Davidson correction [43].

      It should be noted that the active spaces (17e, 16o), (23e, 16o), and (23e, 16o) for allyl (C3H5), F2BO, and F2BS are not small, thus DMRG2sCI-EC-MRCI, instead of EC-MRCI calculations, are performed for these three radicals with $ m = 1000 $ and a $ 10^{-4} $ sampling threshold (the completeness $\displaystyle\sum_R c_R{^2}$ of reference configurations in DMRG wavefunction could be larger than 0.9999 for each state). In each irrep. (irreducible representation), the union of all the states sampled configurations is selected as the reference, thus the description of excited states could be more appropriate.

      Here we define the deviation of EC-MRCI from iCIPT2 as

      the absolute deviation (AD) as

      and the relative deviation (RD) as

      Table I shows the EC-MRCI deviations from iCIPT2 for the vertical excitation energies of 24 radicals in QUEST#4X, including 110 doublet and 39 quartet states. The mean deviation, mean AD, and mean RD for EC-MRCI are 0.04 eV, 0.06 eV, and 1.14% respectively. The histograms of ADs and RDs are shown in FIG. 9. For most cases, EC-MRCI could obtain vertical excitation energies close to iCIPT2 (with AD smaller than 0.15 eV and RD smaller than 3%).

      It should be noted that there are several states with large deviations (such as 0.30 eV for $ 2\ {}^2A_2 $ state of Nitromethyl). The EC approximation may be inappropriate to describe these excited states, due to the use of perturbation theory to evaluate the contraction coefficients for excited configurations. The coefficient relaxation of those configurations is constrained. Thus the excitation energies are overestimated. Adding the number of states to calculate in each irrep. may lower the excitation energies because the variational space is expanded and the relaxation of configuration coefficients could be more sufficient.

    IV.   CONCLUSION
    • This work summarizes the key advancements in Kylin 1.3 for electron correlation calculations. The optimized DMRG codes, particularly the implementation of MPO first tensor contraction order during the diagonalization step, improve the computational efficiency remarkably, reaching up to 16 times faster than Kylin 1.0 for DMRG calculations on Mn4CaO5 cluster. Meanwhile, the DMRG calculation with up to $m = 7000$ for Mn4CaO5 cluster is supported currently. Moreover, the sweep algorithm sampling configurations with a threshold has also been implemented. Compared with the EDGA method in Kylin 1.0, the sweep algorithm only requires one single parameter (the configuration coefficient threshold), simplifying CI wavefunction reconstruction from MPS, thereby improving efficiency and user-friendliness for workflows like DMRG2sCI-EC-MRCI. Furthermore, the spin-adapted version (DMRG2sCI-/sCI-)EC-MRCI has been implemented as well. Besides preserving the spin symmetry, the spin-adapted version also reduces the variational space by using CSFs instead of DETs as basis functions, resulting in an 15 fold speed-up for N2 EC-MRCI calculations relative to Kylin 1.0. Vertical excitation energy calculations for 24 radicals in QUEST#4X dataset show that EC-MRCI could obtain results close to iCIPT2 in most cases. Collectively, these advancements substantially enhance Kylin’s capability for efficient and accurate electron correlation calculations across diverse chemical systems.

      Supplementary materials: Active spaces and frozen orbitals of 24 radicals in QUEST#4X dataset for EC-MRCI calculations.

    Figure (9)  Table (1) Reference (43)

Catalog

    /

    DownLoad:  Full-Size Img  PowerPoint
    Return
    Return