2026 Volume 39 Issue 2
Article Contents

Xuewei Xiong, Xingyuan Lu, Yueyang Zhang, Zijing Wu, Fuming Ying, Wei Wu, Peifeng Su. PyMEDA: A Unified Python Framework for Multiscale Energy Decomposition Analysis†[J]. Chinese Journal of Chemical Physics, 2026, 39(2): 171-181. doi: 10.1063/1674-0068/cjcp2510168
Citation: Xuewei Xiong, Xingyuan Lu, Yueyang Zhang, Zijing Wu, Fuming Ying, Wei Wu, Peifeng Su. PyMEDA: A Unified Python Framework for Multiscale Energy Decomposition Analysis†[J]. Chinese Journal of Chemical Physics, 2026, 39(2): 171-181. doi: 10.1063/1674-0068/cjcp2510168

PyMEDA: A Unified Python Framework for Multiscale Energy Decomposition Analysis†

  • Corresponding author: E-mail: supi@xmu.edu.cn
  • Received Date: 31/10/2025
    Available Online: 27/04/2026
通讯作者: 陈斌, bchen63@163.com
  • 1. 

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

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

Figures(5)  /  Tables(2)

Article Metrics

Article views(176) PDF downloads(2) Cited by(0)

Access History

PyMEDA: A Unified Python Framework for Multiscale Energy Decomposition Analysis†

Abstract: Energy decomposition analysis (EDA) has become a powerful approach for elucidating chemical bonding and non-covalent interactions, especially in complex and multiscale systems. Embedding strategies combining high-level quantum chemical methods with more approximate treatments of the environment provide a promising balance between accuracy and efficiency, yet existing embedding schemes of EDA approaches implementations are often fragmented and software-dependent. To address this challenge, we present PyMEDA, a unified, open-source interface framework for multiscale energy decomposition analysis. Through a modular design, PyMEDA standardizes interfaces to diverse quantum mechanical, molecular mechanics, and semi-empirical backends (initially XEDA, OpenMM, and xtb), enabling the unified implementation of workflows for both conventional and embedding-type EDA schemes, such as DM-EDA (QM/MM) and DM-EDA (EB). By providing extensibility, reproducibility, and automation, PyMEDA offers a flexible environment to advance multiscale interaction analysis and facilitates the future development of embedding-based EDA methods.

    • Energy decomposition analysis (EDA) is an important tool for elucidating chemical bonding and non-covalent interactions, via dividing interaction energy into physically meaningful components that reveal the nature of different types of interactions [1–12]. With the rapid advancement in materials, energy, and life sciences, the studies of intermolecular interactions have been expanded beyond simple, small-scale systems [13–16]. Nevertheless, the high computational cost of EDA methods, which depend on quantum chemical calculations, poses a significant challenge for their applications in large and intricate molecular assemblies.

      Multiscale embedding methods offer an optimal balance between computational efficiency and accuracy, enabling the application of high-level electronic structure theory to a chemically active region while treating the surrounding environment with lower-level approximations. This strategy has been implemented in well-established frameworks spanning different embedding paradigms, including mechanical/electrostatic embedding schemes such as QM/MM and ONIOM [17–20], as well as electronic embedding approaches such as density embedding theory and density matrix embedding theory [21–24]. The multiscale embedding methods have been integrated into EDA frameworks to overcome the limitations of conventional methods in large-scale systems. Until now, the QM/MM-based EDA schemes, for exmaple, Hirao et al. [25], Nogueira et al. [26], and Head-Gordon et al. [27], have been proposed.

      In 2014, our group introduced the generalized Kohn-Sham energy decomposition analysis (GKS-EDA) approach within the Kohn-Sham density functional theory (KS-DFT) framework for analyzing diverse chemical bonds and non-covalent interactions [11, 12]. To enable the study of interactions in protein environments, we subsequently developed GKS-EDA(QM/MM), a QM/MM-based variant [28, 29].

      In 2024, GKS-EDA was extended to a general formulation termed density-matrix-based EDA (DM-EDA), which uses the density matrix as its central variable, in contrast to conventional EDA approaches that depend on intermediate state wave functions [30, 31]. With the low-rank algorithm, DM-EDA shows extensibility and efficiency for large systems. Most recently, based on DM-EDA, we presented an ONIOM-type method, DM-EDA (EB) [32], which synergistically applies the DFT-in-xTB embedding scheme combining Kohn-Sham DFT with the semi-empirical GFNn-xTB approach [33, 34].

      Both our proposed GKS-EDA(QM/MM) and DM-EDA(EB) are implemented via dedicated interfaces that connect XEDA to their respective external packages. XEDA is a fast and versatile software for the quantitative analysis of intermolecular interactions [35]. Its original version was built on GAMESS [36], while the current release incorporates standalone low-rank integral and SCF modules [30].

      Although several embedding-based EDA schemes have been demonstrated, their implementations are typically tailored to specific software combinations and workflow requirements. The lack of a standardized framework for embedding-based EDA schemes hinders interoperability. It arises from heterogeneous software I/O interfaces and distinct methodological requirements. This limitation directly restricts extensibility and practical utility of embedding-based EDA schemes.

      Consequently, in this work, to bridge this gap, a unified interface framework for multiscale EDA calculations, called PyMEDA, is introduced. The motivations of this work are: (i) to formulate a unified computational framework that integrates our embedding EDA methodologies, DM-EDA (QM/MM) and DM-EDA(EB); (ii) to create a unified interface layer that standardizes communication with diverse computational backends (ab initio, force field, semi-empirical), ensuring completeness and interoperability; (iii) to design a modular architecture that facilitates the implementation of complex, multi-step EDA workflows, allowing for easy customization and automation.

    II.   OVERVIEW OF PyMEDA
    • In DM-EDA, the total interaction energy by single determinant methods can be decomposed as the following terms

      In the decomposition scheme, the electrostatic term $ \Delta {E}^{\rm{{ele}}} $ represents the quasi-classical Coulombic interaction between monomers with monomers’ orbitals. The exchange term $ \Delta {E}^{\rm{{ex}}} $ denotes the exchange contribution of exact exchange energy between the orbitals of one monomer and the orbitals of the others. The repulsion term $ \Delta {E}^{\rm{{rep}}} $ represents the energy penalty due to the orthonormalization of monomers’ orbitals. In practice, the sum of $ \Delta {E}^{\rm{{ex}}} $ and $ \Delta {E}^{\rm{{rep}}} $ is regarded as $ \Delta {E}^{\rm{{exrep}}} $, demonstrating the Pauli-repulsion term defined in other EDA methods. The polarization term $ \Delta {E}^{\rm{{pol}}} $ represents the energy contribution of the orbital relaxation from monomers to supermolecule. The correlation term $ \Delta {E}^{\rm{{corr}}} $ denotes the contribution of dynamic correlation to the total interaction energy. By KS-DFT, this term is determined by the exchange−correlation functional and KS orbitals simultaneously [11, 12, 29, 30].

      To compute the EDA terms in Eq.(1), the single point energy of each monomer can be expressed in the form of density matrix [30],

      In Eq.(2), $ {E}^{\rm{{nuc}}}_A $ is the nuclear repulsion energy of monomer A, $ {E}^{\rm{{corr}}}_A $ is the correlation energy of monomer A defined by the generalized Kohn−Sham scheme [11]. while terms in $ E^0[{\bf{P}}_A] $ are formulated as

      where $ {\bf{P}}_A $ is the density matrix of monomer A, $ {\bf{T}} $ is the kinetic integral matrix, $ {\bf{V}}_A $ is the nucleus-electron attraction integral matrix. Subscripts $ \mu $, $ \nu $, $ \lambda $ and $ \sigma $ represent atomic orbital basis, while the superscripts $ \alpha $ and $ \beta $ represent spins.

      In Eq.(1), the electrostatic term $ \Delta {E}^{\rm{{ele}}} $ and the exchange term $ \Delta {E}^{\rm{{ex}}} $ represent the electrostatic and exchange interaction among monomers. The two terms are expressed as

      where A and B are index of monomers, S denotes supermolecule, $ {E}^{\rm{{n-e}}}_A[{\bf{P}}_B] = \mathrm{tr}[{\bf{V}}_A {\bf{P}}_B] $. $ {E}^{\rm{{Coul}}}[{\bf{P}}_A, {\bf{P}}_B] $ and $ {E}^{\rm{{ex}}}[{\bf{P}}_A, {\bf{P}}_B] $ are defined as follows:

      The repulsion term $ \Delta {E}^{\rm{{rep}}} $ in Eq.(1) represents the repulsive effect caused by wavefunction orthonormalization. The polarization term $ \Delta {E}^{\rm{{pol}}} $ in Eq.(1) describes the interaction energy caused by orbital relaxation and electron cloud deformation. The two terms are defined by Pauli state of density matrix $ {{\bf{P}}}_{\rm{{Pauli}}} $, which is the idempotialized density matrix of the direct summation of monomers’ density matrices $ {\bf{P}}_0 $.

      where $ {\bf{C}}_0 $ can be obtained by matrix decomposition methods such as Cholesky decomposition, $ {\bf{S}} $ is the overlap matrix. Denoting the density matrix of the supermolecule as $ {\bf{P}}_S $, $ \Delta {E}^{\rm{{rep}}} $ and $ \Delta {E}^{\rm{{pol}}} $ can be expressed as follows:

      The correlation term in Eq.(1) describes electronic correlation. It is defined as

      When Kohn−Sham density functional theory is applied, $ {E}^{\rm{{corr}}} $ in Eq.(8) is defined as

      where $ E_C $ and $ E_X $ are the correlation part and exchange part of the density functional. $ \lambda $ is the propotion of exact HF exchange defined in hybrid DFT functionals. $ {E}^{\rm{{disp}}} $ is the dispersion correction, $ \gamma $ equals to 1 when Grimme dispersion correction is applied.

      Among the five terms in Eq.(1), the exchange term $ \Delta {E}^{\rm{{ex}}} $ and the repulsion term $ \Delta {E}^{\rm{{rep}}} $ are short-range interaction terms arising from monomers’ orbital overlaps, while the others belong to long-range effects. The strategy of embedding-type EDA is the separation into short-range (SR) and long-range (LR) regions to balance accuracy and efficiency. High-accuracy quantum mechanics methods like DFT are applied to the SR region to capture the critical interactions, while the LR region is modeled using faster, approximate methods like molecular mechanics or tight-binding theories, as shown in FIG. 1. The selection of SR and LR regions is system-dependent. Since a criterion has been discussed previously [32], the optimal partitioning ultimately depends on the specific system and properties of interest. With the strategy, the total interaction energy is decomposed into four parts as

      Our two embedding EDA approaches, DM-EDA(QM/MM) (the successor of GKS-EDA (QM/MM) in this work) and DM-EDA(EB), leverage DFT for short-range interactions, while employing a molecular force field and GFNn-xTB, respectively, for the long-range environment. The general form of energy components in terms of Eq.(10) can be expressed as

      Therefore, the energy terms are expressed by the formulas below,

      In both DM-EDA(QM/MM) and DM-EDA(EB), the decomposition formula of the SR−SR region is almost the same with Eq.(1), only replacing density matrices $ {\bf{P}} $ with $ {\bf{P}}^0 $, which represents the density matrices polarized by the LR regions.

      The electrostatic term is generally considered through electric field interaction. The general form of the electrostatic interaction term between two regions $ M $ and $ N $ is expressed as

      where $\rho_M$ and $ \rho_N $ are the electronic charge densities of region $ \mathrm{M} $ and $ \mathrm{N} $; $ I $ and $ J $ are indices of atoms; $ Z_I $ and $ Z_J $ are the nuclear charges of the corresponding atoms; $ {\rm R}_I $ is the coordinate of nuclear $ I $, while $ {\rm r}_M $ is the coordinate of an electron in M region.

      The electronic density $ \rho $ in the SR region is obtained from KS-DFT calculations. Conversely, the LR region is typically treated using an atom-centered multipole expansion to approximate its electronic density. When GFNn-xTB or unpolarized force fields are employed for the LR region, the electrostatic field is approximated using atomic charges, which correspond to the first-order Cartesian expansion term. The resulting SR–LR and LR–LR electrostatic interaction terms are given below.

      where $ q_J $ is the atomic charge of site $ J $ in LR region of B, $ {V}^{\rm{{PC}}}_B $ is the matrix representing the LR point charge-electron attraction, defined as:

      If a polarizable force field is applied on LR region, the charge density in Eq.(13) is expanded to the second order, i.e. dipole contribution to the electric field is considered. The electrostatic term is thus expressed as such:

      where $ {V}^{\rm{{MM}}}_B $ denotes the potential contributed by point charges and dipoles in LR region of B, defined as

      The correlation term in LR−SR and LR−LR interactions specifies dispersion interaction, and is considered through Grimme’s D3 correction [37, 38]:

      However, a fundamental challenge arises specifically with the polarization term. A naive summation of the polarization terms from the SR−SR, SR−LR, and LR−LR regions would be incorrect because it neglects the non-additive, many-body nature of polarization, leading to an inaccurate total interaction energy. Therefore, in our practical implementation, the total polarization energy is not computed as a sum of these regional contributions. Instead, the overall polarization energy is obtained globally by subtracting the sum of all other well-defined, additive energy components from the total interaction energy.

    • The primary challenge in implementing embedding-type methods lies in the seamless integration of computational backends at different theoretical levels, each with distinct data structures and input/output protocols. While existing solutions like OpenBabel [39] and ChemShell [40–42] (for multiscale simulation scripting) address aspects of this problem, they are not designed to support the specialized workflows of embedding-type EDA. The PyMEDA package is therefore designed from the ground up with a modular and interface-driven architecture specifically for this purpose.

      The overall architecture of PyMEDA is shown in FIG. 2, featuring the separation of two parallel layers: interface layer and module layer, which are explained as follows:

      (1) Interface layer: this layer handles all communication with specific computational software (e.g., XEDA, OpenMM, GFNn-xTB) through a unified API. Each interface is responsible for translating the module’s abstract task into software-specific inputs and converting the outputs back into a standardized internal data structure.

      (2) Module layer: this layer defines software-agnostic procedures for key tasks, such as single-point energy calculations, molecular dynamics, and the EDA workflow itself. Operations here are specified independently of any particular computational backend.

      PyMEDA adopts a primarily object-oriented design. Each interface and module is implemented by a certain class. In the interface layer, $ {{\mathrm{Theory}}}$ classes are implemented to provide a unified data structure and public APIs, through which users controls different software in a consistent manner.

      For our existing two embedding type of EDA methods, the central component is the $ {\mathrm{interface\_XEDA}}$ module, which provides a dedicated link to the XEDA software to run DFT-level calculation and EDA for SR regions. The $ {\mathrm{interface\_OpenMM}}$ is implemented to interface to the molecular force field software OpenMM [43]. Also, $ {\mathrm{interface\_xtb}}$ is implemented to interface to the GFNn-xTB software xtb [34]. The $ {\mathrm{interface\_OpenMM}}$ is adapted from the identically named module in the ASH platform [44]. The $ {\mathrm{interface\_xtb}}$ supports execution through both the native xTB Python API and conventional input file/command-line pathways.

      A representative implementation is the $ {\mathrm{XEDATheory}}$ class. The $ {\mathrm{XEDATheory}}$ class is initialized with all key parameters for a computation, including the basis set, pseudopotential, and exchange−correlation functional. The activation of energy decomposition analysis is controlled by the boolean $ {\mathrm{eda}}$ parameter. Furthermore, the $ {\mathrm{eda\_type}}$ parameter allows user to select from several EDA modes: ${“\mathrm{normal}”}$ for conventional DM-EDA, ${“\mathrm{atomic}”}$ for an atom-wise decomposition of energy components, and ${“\mathrm{real\_space}”}$ for visualizing the spatial distribution of interaction terms.

      In each $ {\mathrm{Theory}}$ class, a $ {\mathrm{run()}}$ method serves as a common entry point for initialing calculation by different software. The $ {\mathrm{run()}}$ method in $ {\mathrm{XEDATheory}}$ calls $ {\mathrm{prepare\_run()}}$ and $ {\mathrm{actual\_run()}}$. The $ {\mathrm{prepare\_run()}}$ method sets up the number of threads in XEDA, and constructs a mol object in XEDA that stores molecular coordinates, charges, and multiplicities. The $ {\mathrm{actual\_run()}}$ does SCF and EDA by given configurations. Such implementation realizes the separation of preprocessing and calculations.

      In module layer, benefiting from the unified interface, data fetching, job running, and multi-job combination can be implemented in a way independent of certain software. Basic geometry information, coordinates of atoms in molecule, is stored in a $ {\mathrm{Fragment}}$ class object implemented in $ {\mathrm{module\_coords}}$. In $ {\mathrm{module\_singlepoint}}$, a general method for single point energy $ {\mathrm{Singlepoint()}}$ is implemented, as well as a general method for both conventional DM-EDA and QM part of embedding type of EDA $ {\mathrm{Energy\_decomposition()}}$. Results of each job is stored in a uniform $ {\mathrm{Result}}$ class object designed by $ {\mathrm{module\_Result}}$. Furthermore, $ {\mathrm{module\_QMMM}}$ and $ {\mathrm{module\_QMMMEDA}}$ are realized to run QM/MM calculation and DM-EDA (QM/MM) jobs, as well as $ {\mathrm{module\_DFTxTB}}$ that realizes DFT/GFNn-xTB embedding scheme and $ {\mathrm{module\_DFTxTB\_EDA}}$ that realizes DM-EDA(EB).

      Single point jobs of embedding type of theories are motivated by $ {\mathrm{QMMMTheory}}$ class and $ {\mathrm{DFTxTBTheory}}$ class in $ {\mathrm{module\_QMMM}}$ and $ {\mathrm{module\_DFTxTB}}$, implemented both mechanical and electrostatic type of embedding. In the mechanical embedding scheme, interaction between SR region and LR region is omitted, while in electrostatic embedding scheme, LR region is considered to influence the iteration of SR region by electrostatic interaction. On the SR-LR boundary, linking H atoms are added automatically. Charge shifting method is applied to redistribute the charge of MM atoms near the boundary, thereby preventing unphysical over-polarization of QM electron density [45–47].

      For the two embedding EDA approaches, $ {\mathrm{QMMM\_EDA}}$ class in $ {\mathrm{module\_QMMMEDA}}$ and $ {\mathrm{DFTxTB\_EDA}}$ class in $ {\mathrm{module\_DFTxTB\_EDA}}$ are implemented respectively to realize DM-EDA(QM/MM) and DM-EDA(EB). The two classes build $ {\mathrm{QMMMTheory}}$ and $ {\mathrm{DFTxTBTheory}}$ to obtain the total energy (including SR part and LR part) for each monomer and the interacting supermolecule. The EDA result of SR part under LR electric field is also returned. By integrating the SR EDA terms and LR interaction energies, it gives the total interaction EDA terms.

    • PyMEDA supports single point energy calculations (pure QM and embedding-type), and DM-EDA calculations. All calculations are controlled by Python scripts. The detailed input scripts of such jobs are described in the supplementary material. For the calculations of DM-EDA(QM/MM) and DM-EDA(EB), the working procedure of a embedding-type single point calculation is listed below.

      1. Reading the atoms and judging the connectivity between atoms by residue structure provided by the $ {\mathrm{pdb}}$ file into a $ {\mathrm{Fragment}}$ object, or simply reading the atoms coordinates procided by the $ {\mathrm{xyz}}$ file into a $ {\mathrm{Fragment}}$ object;

      2. Selecting SR region according to user’s configuration, check if covalent SR−LR border exists;

      3. Dealing with all SR−LR borders and adding H link atoms if needed;

      4. Calling the LR software to do LR calculation of the whole system. SR−LR border are dealt in a specific way;

      5. Passing atoms’ coordinates of SR region to SR calculation software. Point charge electrostatic field of the LR atoms are also passed to SR calculation. Atomic charge near the border is distributed to other connected LR atoms by Charge Shift method, so as not to over-polarize SR electronic density near the border;

      6. Calling the SR software to do SR calculations under the electrostatic field, returning the SR energy and electrostatic interaction energy between SR and LR;

      7. Combining the SR energy and LR energy to obtain the final total energy, returning a $ {\mathrm{Result}}$ class object.

      QM/MM and DFT-in-xTB follow different procedures in LR calculation. For QM/MM calculation, charges of atoms in SR region are set to 0, and bonding interaction among these atoms are removed. Through this, LR energy can be obtained directly. In DFT-in-xTB, however, the LR energy is obtained by subtracting total xTB energy by SR xTB energy.

      The workflow for the multiscale EDA calculations is shown below.

      1. In the initialization method, key parameters are provided to define the calculation, including the file containing information about molecular structure ($ {\mathrm{pdb}}$ file required by $ {\mathrm{QMMM\_EDA}}$, and $ {\mathrm{xyz}}$ file required by $ {\mathrm{DFTxTB\_EDA}}$), indices of atoms in SR region, specific method for SR theory and LR theory, numbers of atoms in monomers, etc. In this part, the supermolecule is divided into monomers, and $ {\mathrm{Fragment}}$ class in $ {\mathrm{module\_coord}}$ is called to read information of different monomers.

      2. The $ {\mathrm{Fragment}} $ objects are then passed into a $ {\mathrm{QMMMTheory\_EDA}}$ object or a $ {\mathrm{DFTxTB\_Theory}}$ object. $ {\mathrm{QMMMTheory\_EDA}}$ class is inherited from $ {\mathrm{QMMMTheory}}$ in $ {\mathrm{module\_QMMM}}$, it overwrites the $ {\mathrm{elstat\_run}}$ method to interface to OpenMM software, calculating MM energy and dealing with QM-MM boundary.

      3. An $ {\mathrm{XEDA\_EB}}$ class object is created by atom coordinates of the QM region and MM background charge, which is inherited from $ {\mathrm{XEDATheory}}$ class in $ {\mathrm{interface\_XEDA}}$ and is specifically designed for multiscale EDA calculation by reading lists of background charge.

      4. EDA results of the SR region, including the electrostatic interaction between QM and MM regions, are calculated by $ {\mathrm{XEDA\_EB}}$ through XEDA software and passed back to $ {\mathrm{QMMM\_EDA}}$ or $ {\mathrm{DFTxTB\_EDA}}$.

      5. The energy terms arising purely from the LR−LR interactions (electrostatics and dispersion) are evaluated with the required parameters obtained from OpenMM and xTB. Note that PyMEDA itself does not perform quantum chemical calculations. It orchestrates the workflow and integrates results computed by the external backends (XEDA, OpenMM, xtb). The results from all regions are integrated, and the totally decomposed interaction energy according to Eq.(12) is returned in a $ {\mathrm{Result}}$ class object.

    III.   APPLICATIONS
    • Here, several illustrative applications of PyMEDA are presented. All calculations were carried out on Intel Xeon Gold 6226R Processor parallel on 16 CPU cores.

    • The peptide−peptide complex in FIG. 3 serves to validate the embedding EDA methodology, confirming its ability to accurately handle systems fragmented by cleaving covalent bonds.

      In the DM-EDA(QM/MM) and DM-EDA(EB) calculations, the carboxyl groups involved in hydrogen bonding and their β-methylenes are defined as the SR region, which is treated at the B3LYP-D3/def2-SVP level. The methods differ in their treatment of the LR region: the Amber14 force field is employed in DM-EDA(QM/MM), while the GFN1-xTB method is used in DM-EDA(EB). The results of DM-EDA, DM-EDA(QM/MM), and DM-EDA(EB) for the peptide-peptide interaction are summarized in Table I. Note that the calculation of DM-EDA is carried out at the level of B3LYP-D3/def2-SVP.

      In the peptide−peptide complex, there is a double hydrogen bond between the COOH groups. As can be seen in Table I, first, all the three EDA calculations show the character of the strong hydrogen bonding interaction. The electrostatic term is the largest among all the EDA terms, while the polarization term, ranging from −23.74 kcal/mol to −28.72 kcal/mol, plays a secondary role. Second, and more importantly, the results of the three EDA methods are quite similar, proving the reliability of the EDA methods implemented in the PyMEDA framework. In general, the electrostatic and polarization terms in the two embedding EDA schemes are in agreement with the corresponding terms in DM-EDA, while the exchange, repulsion, and correlation terms in the two embedding EDA approaches are smaller than those of DM-EDA. It is because for small complexes, the neglect of long-range effects by high level QM methods will lead to an inadequate description of short-range interaction terms.

      The comparative analysis reveals that DM-EDA(EB) yields results closer to the full QM(DM-EDA) benchmark than DM-EDA(QM/MM). This superior agreement is attributed to the semi-empirical GFNn-xTB method providing a more physically realistic description of long-range electronic interactions compared to a classical force field. The more negative polarization energy in DM-EDA(EB) suggests that the GFN1-xTB Hamiltonian induces a stronger response in the electron density of the SR region compared to the fixed-charge TIP3P force field. This may more accurately reflect the many-body polarization effects present in the bulk water environment, which are not fully captured by the simple force field, albeit potentially overcorrecting in this specific setup. Conversely, DM-EDA(QM/MM) is the most computationally efficient strategy, as evidenced by the timings in Table S1 (Supplementary materials, SM), demonstrating a clear accuracy−efficiency trade-off between the two embedding approaches. Therefore, by providing a unified computational environment, PyMEDA enables direct and consistent comparison of EDA results across different theoretical levels—from full-QM to a variety of embedding strategies—thereby clarifying the performance and applicability of each approach.

    • In this section, we present a case study analyzing the interaction between a single water molecule and its 1435 surrounding water molecules using DM-EDA(QM/MM) and DM-EDA(EB), as illustrated in FIG. 4 and FIG. 5. The SR region was treated at the B3LYP-D3/def2-SVP level. The SR region was systematically defined as comprising the central water molecule along with its 10, 40 and 60 nearest neighboring molecules. For the LR region, the TIP3P force field was employed in DM-EDA(QM/MM), while the GFN1-xTB method was used in DM-EDA(EB). The fragmentation schemes for the water cluster are shown in the first column of Table II. Atoms(A(SR)/B(SR)/LR) denotes the number of water molecules in SR of monomer A, SR of monomer B, and LR. Here the central molecule is monomer A while the surrounding molecules belong to monomer B.

      As shown in SM, the three examples vary only in the selection of SR and LR regions, thus in the job script, one only need to change the atom indices selected in the SR region. Batch-wise calculations can be carried out in a convenient way benefiting from the flexibility of PyMEDA framework. The results are listed in Table II.

      As can be seen from Table II, the interactions between the water clusters and the surrounding water shell are dominated by the electrostatic term. It is noted that different from the previous example, the correlation terms are larger than the polarization terms, showing the contribution of dynamic correlation to the cluster interactions.

      It is important to note that the total interaction energy increases with the size of the SR region and gradually converges. This convergence is primarily governed by the polarization term, which exhibits the most significant variation and largely accounts for the difference in total energy between DM-EDA(QM/MM) and DM-EDA(EB). In contrast, the other energy components (electrostatic, exchange, repulsion, and correlation) remain nearly constant (within 0.5 kcal/mol) regardless of the SR region size or the choice of the LR method (MM or xTB). This analysis highlights three key findings: first, both molecular force field and xTB give a relatively exact approximation to the electrostatic and dispersion intermolecular interaction. Thus, the total electrostatic interaction and correlation interaction terms in different calculation jobs do not differ too much with each other. Second, the exchange and repulsion terms are short-range interactions caused by QM effect, so the two terms converge quickly as the size of SR region increases in both DM-EDA(QM/MM) and DM-EDA(EB). Third, the polarization energy emerges from reshaping electron density and relaxing orbitals. The unpolarizable TIP3P force field captures no LR polarization interactions, while the iterative semi-empirical GFN1-xTB energy is polarized to some extend in LR region, and DFT calculation in SR region captures full QM-level polarization. Therefore, compared with DM-EDA(QM/MM), DM-EDA(EB) calculation contains more polarization contribution to the interaction energy, resulting in DM-EDA(EB) both total interaction energy and polarization term slightly larger than DM-EDA(QM/MM). When the SR region increases, more polarization is considered by DFT-level calculation, the total polarization term increases. The results show the privilege of the automatic workflow in testing batches. PyMEDA simplifies the multiscale computing procedure and enables systematic high-throughput testing cases.

    IV.   SUMMARY
    • In this work, we introduce PyMEDA, a unified and modular framework that fundamentally transforms the implementation and application of multiscale EDAs. PyMEDA directly addresses the critical bottleneck of interoperability in embedded EDA by establishing a standardized interface layer for diverse computational backends (XEDA, OpenMM, xTB) and a flexible module layer for orchestrating complex workflows. This architecture disentangles the methodological specification of EDA schemes from the software-specific details of their execution.

      Through the seamless integration of both the DM-EDA(QM/MM) and DM-EDA(EB) methodologies, we have demonstrated the capability of this framework to perform sophisticated interaction analyses across a spectrum of systems, from peptide−peptide interactions to extensive solute-solvent networks. The consistent physical trends observed across different embedding schemes validate the reliability of our implementation, while the comparative analysis highlights the framework’s unique capability to facilitate informed decisions regarding the accuracy−efficiency trade-off in multiscale simulations.

      The scriptable Python interface of PyMEDA makes it highly accessible for users to perform sophisticated embedding EDA calculations. It provides a robust foundation upon which new EDA methods, additional computational backends, and more advanced embedding protocols can be built. PyMEDA would be a useful tool for unraveling the nature of intermolecular interactions in large complex systems, thereby accelerating discoveries in fields ranging from drug design to materials science.

      Supplementary materials: Illustrative Python scripts of common workflow, time consumption and input files of jobs, illustrative input files in Section II.C, and the coordinates for the test examples.

    Figure (5)  Table (2) Reference (47)

Catalog

    /

    DownLoad:  Full-Size Img  PowerPoint
    Return
    Return