## 1. Introduction

Molecular dynamics (MD) simulations of diffusive systems, such as the diffusion of a solute (a solvated ion or molecule) through solvent, has been a challenging task for multiscale methods, especially for combined quantum-mechanics/molecular-mechanics (QM/MM) methods [

1,

2,

3,

4,

5,

6,

7,

8,

9,

10,

11,

12,

13,

14,

15,

16,

17,

18,

19,

20,

21,

22,

23,

24,

25,

26]. In conventional QM/MM methodology, atoms are designated as QM or MM at the beginning of a simulation and do not change these identities throughout a simulation. This causes difficulties when solvent molecules are exchanged between the solute’s solvation shells and the bulk solution, which may occur frequently. Adaptive QM/MM mitigates these problems by reclassifying the atoms as QM or MM on-the-fly based on their positions, assuring that the solute and its solvation shells are always described at the QM level of theory [

25,

27,

28,

29,

30,

31,

32,

33,

34,

35,

36,

37,

38,

39,

40,

41,

42,

43,

44,

45,

46,

47,

48,

49,

50,

51,

52]. As a result, the QM and MM partitions in adaptive QM/MM are dynamically updated as needed, in contrast to the static partitions in conventional QM/MM.

One adaptive QM/MM algorithm is the permuted adaptive partitioning (PAP) scheme [

29,

32], which uses distance-based criteria for the QM and MM partitioning (

Figure 1). In PAP, the QM zone, also called the active zone, consists of the solute and all molecules within a preset cutoff distance

${r}_{\mathrm{min}}$ from the solute. A group-based prescription is often adopted, where a whole molecule is treated as an entity, and the distance from the solute

$r$ is measured using the center of mass or a representative atom of the entire molecule. The description for whole molecules can also be applied to molecular fragments, such as functional groups [

32]. The MM zone, also known as the environmental zone, consists of molecules with

$r>{r}_{\mathrm{max}}$, where

${r}_{\mathrm{max}}$ is another preset cutoff distance. Between the QM and MM zones is the buffer zone (

${r}_{\mathrm{max}}\ge r\ge {r}_{\mathrm{min}}$), and the molecules in the buffer zone are often called the buffer groups. The energy of the system and the gradients of all (QM, buffer, and MM) atoms are smoothly interpolated when molecules or functional groups migrate into, across, or out of the buffer zone. This is accomplished by expressing the QM/MM potential as a weighted sum of many-body contributions that vary continuously and smoothly as the buffer groups change their positions. The PAP method conserves energy and momentum, and it has been found to yield superior numerical stabilities in MD simulations [

29,

32].

A challenge in PAP (and other distance-based adaptive QM/MM methods) concerns the gradients due to the smoothing functions employed in the interpolation procedure, which, if not negligible, may cause artefacts in the MD simulations [

30,

35,

42,

46]. These forces, which are sometimes called transition forces, are proportional to the difference between the QM and MM energies at the current geometry. More specifically, the energy difference is the energy released (or absorbed) when a buffer group is switched from MM to QM while holding the QM or MM classifications of the other groups as well as all atomic coordinates fixed [

42]. These transition forces are therefore associated with the difference in chemical potential between the QM and MM descriptions of the given buffer group. These transition forces drive the molecules moving towards the QM or MM zones, even in the absence of the interpolated gradients between the QM and MM potential derivatives, which are considered the “real” or “physical” forces.

In principle, the effects due to these transition forces can be eliminated or minimized by carefully aligning the QM and MM potentials [

29]. However, it is difficult to align multi-dimensional potentials, and a simple and general algorithm to for potential alignment has not yet been developed. An alternative solution is the modified PAP (mPAP) scheme, where external forces are applied to cancel out these artificial forcs [

35]. Mathematically, the transition forces are simply deleted. Conceptually, this means that the chemical potentials are equalized at every step for the system [

46]. It has been demonstrated that mPAP yields reasonably accurate structures and dynamics in MD simulations [

35,

40,

43]. The downside is that, because of the involvement of the external forces, the scheme no longer has a Hamiltonian formulation and therefore cannot be used for studies where Hamiltonian systems are required [

43].

Recently, Boreboom et al. [

42] proposed the Hamiltonian adaptive many-body correction (HAMBC) for sorted adaptive-partitioning (SAP) QM/MM simulations. Inspired by the works of the molecular-mechanics/course-grained (MM/CG) community, especially the Hamiltonian adaptive resolution scheme (H-AdResS) by Potestio et al. [

53] the HAMBC method includes per-molecule-based correction terms to the SAP QM/MM Hamiltonian. By design, the gradients of the correction terms should cancel out the

average transition forces due to the smoothing functions; the cancellation is not necessarily exact at any single time step. The HAMBC was demonstrated in test calculations of a “water-in-water” model using dual MM levels, where a selected water molecule as the solute and its solvation shell are treated by one MM force field model and the bulk solvent by another MM force field model [

42]. (Due to their high efficiencies, dual-MM test calculations have frequently been employed in testing adaptive QM/MM schemes, e.g., in the development of the original PAP scheme [

29].) It is encouraging to find that HAMBC was able to produce correct solvation structures for the selected solute water while conserving energy in SAP simulations [

42].

In this paper, we report the tailoring of the HAMBC treatment to the much more sophisticated PAP method. In the HAMBC by Boreboom et al. [

42] the per-molecule correction term is a function of the fractional “QM character” for a solvent molecule, which is the sum of the weights of the contributing partitions that describe this solvent molecule at the QM level. Because in general there is no analytical function for the correction term, the correction must be calculated through thermodynamic integration over the selected variable. In PAP, it is more convenient to use the value of the smoothing function than the QM character for the given buffer group. We have previously shown that this QM character is equivalent to the value of the smoothing function for a given buffer group in a fully expanded PAP potential [

46]. However, the many-body expansion of the PAP potential is often truncated to reduce computational costs, and in a truncated PAP potential, the value of the smoothing function no longer equals the QM character. In this work, we demonstrate that the correction can be taken as a function of the value of the smoothing function even when the PAP potential is truncated.

## 4. Discussion

It is interesting to note that the correction

$\langle \mathsf{\Delta}E\left({P}_{i}\right)\rangle $ is approximately a linear function of

${P}_{i}$ in the present work. To understand the origin of this approximate linearity, let us consider a given

i-th buffer group. When the description of this buffer groups is switched between the two employed MM force fields, SPC/Fw and TIP3P/Fs, there will be changes in the non-bonded (van der Waals and electrostatic) interactions through which this buffer group interacts with active-zone groups, environmental-zone groups, and the other buffer groups. Also changing are the intramolecular bonded (O-H bond and H-O-H angle) interactions within this buffer group. The decomposition of

$\langle \mathsf{\Delta}{E}_{i}\left({P}_{i}\right)\rangle $ is depicted in

Figure 7a according to

where

i denotes the

i-th buffer group.

The bonded energy terms are the dominant contributors to

$\mathsf{\Delta}{E}_{i}$. This is not surprising because of the similarity in the nonbonded interaction parameters (

Table 1). Both the O-H bond and H-O-H angle energies are sizeable, but the O-H bond energy is overall more significant. The difference in the O-H bond energies between the two descriptions are

where

x is the instantaneous O-H bond length, and

${k}_{1}$ and

${k}_{2}$ are the force constants parameters and

${x}_{01}$ and

${x}_{02}$ the equilibrium geometric parameters of the two water models, respectively. If

${k}_{1}={k}_{2}=k$, as it is for the two water models employed here, one has

This means that the energy difference will vary linearly with respect to the instantaneous bond length.

Figure 7b suggests smooth structural changes of the water molecule in the buffer zone between the TIP3P/Fs model at

${P}_{i}=0$ and the SPC/Fw model at

${P}_{i}=1$ and confirms that the average instantaneous O-H bond length in the simulations is indeed approximately linear with respect to

${P}_{i}$. The situation is similar in the H-O-H angle energy (

Figure 7c), where

${k}_{1}\approx {k}_{2}=k$, and the linearity also roughly holds. As a result,

$\langle \mathsf{\Delta}E\left({P}_{i}\right)\rangle $ is approximately linear with respect to

${P}_{i}$.

Of course, the above analysis can only be conducted when the interactions are pairwise, which is true here for the dual-MM simulations. However, because pairwise interactions are usually predominant (e.g., accounting for ~80% of total interaction energies in water [

60]), the approximate linearity may still hold when models with higher-order many-body potentials are employed, albeit to a less extent, unless the two employed potentials differ significantly from each other. In reality, the potentials should agree with each other reasonably well in the buffer region, otherwise it is likely that at least one potential is very inaccurate and should not be used at all.

We note that while the forces by the correction term cancel the average transition forces, the cancellation is not exact at every step. Inexact transient cancellations lead to “residue” forces, whose effects on the simulation may or may not lead to erroneous solvation structures, which probably varies from case to case. While further investigations will be needed to explore this in the future, it is conceivable that narrow, symmetric distributions of the residue forces can help to minimize their effects, which is the case in this work. Therefore, it is prudent to match the potentials as closely as possible in the buffer zone. At this point, we note that Jiang et al. [

61] are developing MM water models specifically designed for adaptive QM/MM simulations.

Overall, the results presented here demonstrate that the HPAP can both yield accurate solvation structures and conserve energy in

NVE simulations. The progress thus fills a gap in the PAP algorithms. The successful applications of the HAMBC treatment to both SAP by Boreboom et al. [

42] and PAP in this work suggest that other distance-based adaptive QM/MM schemes may also benefit from this treatment. We expect that the new HPAP algorithm will be useful to many applications where simulations of Hamiltonian systems are required. Future studies are especially encouraged to investigate the cases where multiple types of buffer groups (e.g., water and ions) are present and to explore the treatments for inhomogeneous systems (e.g., ion channels).