## Introduction

Two-dimensional (2-D) materials are attracting a lot of attention as building blocks of ultra-scaled electronic components1. Among the most prominent materials are graphene,2 transition metal dichalcogenides (TMDs)3, and hexagonal boron nitride (h-BN)4, which are typically metallic, semiconducting, and insulating, respectively. h-BN is widely used as gate insulator of 2-D-based transistors or as encapsulating layer5,6. The popularity of 2-D materials has also reached the field of two-terminal resistive switching (RS) devices. This technology has established itself as a potential replacement for silicon-based memories, i.e., as storage units7. Such memristive systems are also natural candidates to be used in neuromorphic circuits owing to their unique, synapse-like current-voltage characteristics8,9.

RS devices are generally capacitor-like metal/insulator/metal (MIM) structures with either a volatile or nonvolatile switching of their active insulating region. The former is often called threshold switching (TS). The excellent insulating properties of h-BN make it a natural contender as switching layer of RS devices10,11,12,13,14. Especially, the coexistence of both nonvolatile (memory-type) and volatile (threshold-type) RS in metal/h-BN/metal stacks opens up exciting perspectives in neuromorphic computing applications where long- and short-term learning capabilities are highly desirable11,15.

The h-BN-based RS cells reported so far can be divided into two categories. The first one employs at least one electrochemically active electrode, e.g., Ag or Ti, and the switching mechanism is attributed to the migration of metal ions into and out of h-BN12,16. Hence, these devices behave as electrochemical metallization cells (ECM). In the second one RS relies on two electrochemically inert electrodes such as Pt/h-BN/Pt13 or graphene/h-BN/graphene14. It should be noted that the second category has not yet been well studied: threshold-type RS was observed in ref. 13, while a limited number of switching cycles was reported in ref. 14.

The physical switching mechanism of RS devices with inert electrodes has not yet been clearly identified. It has been speculated that it could be of ECM-type as well, where C atoms, for example, are oxidized and diffuse into the h-BN slab14, but there is currently no experimental evidence that supports such processes. We therefore highlight in this work an alternative mechanism that is intrinsic to h-BN. It operates independently of the electrode material and can explain the experimentally observed memory characteristics, in particular those of ref. 14.

The proposed intrinsic resistive switching mechanism is causally linked to the presence of multi-vacancies in h-BN. These defects result from the clustering of several mono-vacancies that start interacting with each other when the distance between them becomes short enough. In particular, through large lattice distortions, multi-vacancies can create interlayer bridges (or bonds) that electrically connect them with the neighboring h-BN monolayers17. As a consequence, the electronic properties of the switching medium get locally modified around the defect position.

In general, the most stable defect configurations depend on their charge, while electric fields can trigger transitions between different defect configurations. Hence, local charges and electric fields control the atomic positions and thereby the local electronic structure of RS devices. In other words, the multi-vacancies and interlayer bridges identified in h-BN potentially act as active switching elements. By intentionally exploiting this effect through defect engineering, the development of novel memristors based on extremely scaled material stacks can be envisioned. First, the suggested mechanism only requires two layers of h-BN embedded between two graphene electrodes. Second, because these multi-vacancy defects are very localized, small cross-sections of few square nanometers might be sufficient for data storage.

In this study we use hybrid density functional theory (DFT) with the PBE0-TC-LRC functional18 to characterize a prototypical intrinsic multi-vacancy defect present in h-BN known as trivacancy. We compute the effect of charges and electric fields on the defect configuration and on the formation of volatile and nonvolatile interlayer bridges. Both bulk h-BN and graphene/h-BN/graphene heterostructures are considered. Next, DFT is combined with the Non-equilibrium Green’s function (NEGF) formalism19 to compute the electrical characteristics of the graphene/h-BN/graphene heterostructure and to estimate the high-to-low resistance ratio that is achievable when the defect is reconfigured under an applied electric field.

The “Results” section is split into four separate parts. First, the defect structure is introduced. Secondly, electronic structure calculations of multi-vacancy states in bulk h-BN are presented. The obtained defects are characterized and a possible switching mechanism is proposed. Next, selected defect configurations are studied when placed into a graphene/h-BN/graphene heterostructure. Lastly, quantum transport simulations of graphene/h-BN/graphene memory cells are reported.

## Results

### Atomic defect structure

Figure 1a illustrates the schematic of the memory cell considered in this study. The top and bottom electrodes are each composed of a single graphene layer. The bottom one is grounded, while a bias is applied to the top one. The switching layer in between consists of two to four layers of h-BN. At least two of them are connected to each other by an interlayer bridge. The example of a typical I-V curve resulting from a bridged structure is given in Fig. 1b for a three-layer h-BN stack. This device exhibits a high-to-low current ratio larger than two orders of magnitude and a SET voltage VSET of 5 V. To obtain this plot, the electrical current corresponding to the high and low resistance branches was calculated in the ballistic limit of transport, whereas abrupt transitions were assumed at the external voltages triggering the relevant atomic reconfigurations, VSET and VRESET. More details on the quantum transport calculations are provided in the Methods section.

Trivacancies where two B and one N atoms are missing in one h-BN monolayer (Fig. 1c) can trigger an interlayer bridge through which the electrical current flows in the low resistance state of the memristive device. As such defects are representative of what happens in charged multi-vacancies subject to an electric field in h-BN, they were chosen as prototypical defect configurations in this work: undercoordinated atoms at the edge of multi-vacancies bond with atoms from neighboring layers17. We found that trivacancies can adopt two stable bridged configurations in addition to a planar one without interlayer connection. In the first one, two undercoordinated N atoms each form a bond with the B atom directly above them in the neighboring h-BN monolayer, which we term the “2N configuration”. Alternatively, the undercoordinated B atom can bond with a neighboring N atom. This structure is called the “1B configuration”, while the planar configuration is termed “0P”. A side view of the three trivacancy configurations is displayed in Fig. 1d–f.

We identified three more distinct configurations. One is similar to the 2N configuration, but with only one N bridge (1N). We could not determine any condition under which it becomes the most energetically favorable one. The second one involves the two undercoordinated N atoms that are not marked in Fig. 1c. They can also form 1N-like configurations, but the resulting geometry is even higher in energy than 1N. Finally, the combination of 1B and 2N, where three interlayer bridges are formed, can also exist. In this case the B atom connects with the upper neighboring layer and the two N atoms with the lower one, or vice versa. In our simulations this configuration is only stable under electric fields equal to 8 V/nm (80 MV/cm) or larger. As these three configurations are either metastable or require extreme conditions to emerge they will not be further considered in the remainder of this paper.

### Characterization of the trivacancy in bulk h-BN

The lattice parameters computed for bulk h-BN are 6.6 Å for the out-of-plane direction and 2.49 Å for the in-plane one. Consequently, the B-N bond length is equal to 1.44 Å. These values agree well with the experimental lattice parameters of 6.603 Å and 2.506 Å at 10 K as well as with previous computational studies17,20. The length of the interlayer B-N bonds that are formed in the 1B and 2N configurations are 1.64 Å and 1.60 Å, respectively. The electronic band gap of defect-free h-BN is calculated to be 5.74 eV, again in good agreement with what was reported in the literature17,21,22. The offset between the Fermi energy in graphene and the valence band maximum (VBM) of h-BN is found to be 2.0–2.3 eV, depending on the stacking order and thickness of the h-BN slab. Most electrode materials have work functions between 4 eV and 6 eV and are thus expected to exhibit VBM offsets in the range of 2 eV to 4 eV23.

In the neutral charge state, the formation energies EForm (see Eq. (1) in the Methods section) of the 0P and 1B configuration are almost identical, namely 12.79 eV and 12.84 eV, the 1B being only 45 meV above the planar one (Fig. 2a). In the +1q charge state (i.e., one electron removed) EForm of the 1B configuration decreases and ends up 260 meV below the 0P one, while at −1q, EForm of the 0P is 360 meV below the 1B one. The 2N configuration is only stable at −3q where it is strongly favored as compared to the 0P and 1B ones.

The thermodynamic charge transfer levels (CTL) of the 0P configuration between the +1q and the neutral charge states (+10) is at 0.96 eV, the (0 −1) one at 1.89 eV, and the (−1  −2) one at 4.28 eV. For the 1B configuration the corresponding CTLs are located at 1.27 eV, 2.19 eV, and 3.91 eV. Up to 1.23 eV the 1B configuration is the most stable one. Between 1.23 eV and 4.26 eV the planar one is preferred. Between 4.26 eV and 4.58 eV the −2q charge state of the 1B configuration is again more favorable. Above 4.58 eV the 2N configuration in the −3q charge state is the lowest in energy.

In the neutral charge state the 0P and 1B configurations are separated by an energy barrier, kinetically preventing transitions between these two energetically similar states. The energy barrier between 0P and 1B is shown in Fig. 2b in the neutral charge state. The forward barrier height from 0P to 1B, which corresponds to the SET operation, is 0.34 eV, while the reverse barrier height (RESET) is equal to 0.29 eV. The shape of the barrier can be modulated by an electric field perpendicular to the h-BN layers. A field pointing in the direction of the displacement of the B atom (positive field strength) lowers the formation energy of 1B with respect to the one of 0P. A reverse field (negative field strength) reduces the formation energy of 0P. In both cases the electric field modulates the barrier heights by 0.1 eV for each 1 V/nm unit, as can be seen in Fig. 2c. Through linear extrapolation we find that an electric field of 3.3 V/nm (−2.9 V/nm) suppresses the 0P-to-1B (1B-to-0P) barrier such that a spontaneous transition from one configuration to the other is triggered. Once the field is removed, the barrier reappears and prevents the defect from recovering its original configuration. Thus, by controlling the electric field, the atomic configuration of the defect can be changed in a nonvolatile manner.

This operation scheme of h-BN-based memory cells also works in the ±1q charge states, which are shown in Fig. 2d. The −1q case where the trivacancy captured an electron is especially relevant because it is the one that is stable when two graphene electrodes are placed around the h-BN dielectric. The SET transition from 0P to 1B then occurs if an energy barrier of 0.46 eV is overcome. For the RESET process the barrier does not exceed 0.15 eV. Assuming a three-layer h-BN structure surrounded by graphene contacts and an electric field modulation efficiency equivalent to the one reported in Fig. 2c (0.1 eV per 1 V/nm unit), a voltage of 4.6 V (−1.5 V) must be applied to set (reset) this device. This is the situation that is depicted in Fig. 1b.

Experimental demonstrations of RS in h-BN with inert electrodes show switching voltages in the range of few volts13,14, in line with our predictions for RS due to reconfigurations of intrinsic (vacancy) defects (4.6 V and −1.5 V). The corresponding electric field is rarely reported and its strength difficult to estimate because of the filamentary nature of the resistive process. For that reason, the effective thickness of the switching layer is typically smaller than the physical one. To a first order approximation, the field strength required for RS due to defect reconfiguration agrees with the experimental switching voltages.

Note that with the barrier heights of Fig. 2b–d 0P-to-1B and 1B-to-0P transitions are expected to happen spontaneously at room temperature. For a rough estimate of the associated relaxation times classical transition state theory can be used. The attempt frequency is typically on the order of the phonon frequency. Assuming 10 THz for this parameter, relaxation times in the nano- to micro-second range are obtained for the high-to-low resistance transition and in the pico- to nano-second range for the opposite process, depending on the charge state of the trivacancy defect. For non-volatility with relaxation times in the order of years, the barrier height should be at least 1 eV. Larger and more complex defect configurations than the 1B and 2N ones could potentially lead to such high energy barriers between two stable states. However, higher energy barriers implicitly come with increased switching voltages. On the other hand, charged configurations exhibit a higher effective dipole moment as compared to neutral ones, which could increase the barrier lowering effect through the applied electric field. Hence, a combination of larger barriers and charged defects could enable truly nonvolatile switching in h-BN.

The charging of the trivacancy defect to higher values could also have a beneficial impact on the energy barrier height and its modulation efficiency by an external electric field. Up to the −2q charge state the planar configuration is favored, while at −3q the 2N configuration becomes lower in energy. Charging the 0P configuration to −3q initiates the transition to 2N. The reverse holds for the 2N configuration. Discharging 2N to −2q induces a transition to 0P. For either charge state there is no barrier between the 0P and 2N configurations. Due to the lack of an energy barrier, this transition spontaneously takes place upon charging or discharging, which amounts to volatile threshold switching.

It should be emphasized that the 0P, 1B, and 2N configurations all feature defect energies within the band gap, but their positions with respect to the VBM differ, as illustrated in Fig. 3a–c. Diagrams showing all defect levels within the band gap are available in the Supplementary Figs. 12. The defect states of the 0P configuration are localized on the edge of the trivacancy (Fig. 3d). The 1B and 2N configurations, on the other hand, show much more delocalized defect states that extend across the bridged h-BN layers (Fig. 3e, f). Hence, the reconfiguration of the atomic structure is accompanied by a modification of the electronic structure of the material. Note that these individual defects can be reached by electrons coming from the electrodes through direct quantum mechanical tunneling, as will be demonstrated later with ballistic NEGF. In structures containing multiple such multi-vacancies, defects could possibly act as hopping centers and enhance the out-of-plane electron transport. Capturing such processes would require going beyond the ballistic limit of transport and including electron-phonon interactions.

Besides triggering (non)volatile RS, multi-vacancies could also fundamentally impact the initial forming step of h-BN-based memories due to their tendency to aggregate. We found that vacancies in the same plane tend to strongly bind to each other. The binding energy EBind is calculated according to Eq. (2) of the Methods section. For the neutral 0P trivacancy configuration EBind is equal to 10.7 eV with respect to the individual mono-vacancies. This finding agrees well with previous studies and is expected to hold for growing vacancy clusters as well17. We also examined the interaction between the neutral trivacancy and an additional neutral boron mono-vacancy (VB) in an adjacent layer. If a VB is located close to the trivacancy in the 0P configuration, both defects are virtually non-interacting. If the two vacancies are directly above each other, the binding energy reaches a maximum of only 0.04 eV, as shown in Fig. 4a. In contrast, the binding between 1B and a VB defect is quite strong if the VB is located in the plane to which 1B is bonded. When the VB is situated directly above the trivacancy EBind is 2.7 eV. Similarly, a 1B + 2N defect configuration, which would not even be stable with a pristine neighboring layer, shows a binding energy of 1.0 eV with a neighboring VB. Due to the strong binding the VB is effectively anchored above the trivacancy. Such a configuration could be considered a single defect that permanently connects two adjacent layers. Because the binding between vacancies within the same layer is even stronger than across layers17, the VB could potentially act as a seed for a vacancy cluster in its own layer. The aggregation of vacancies and the formation of interlayer bonds across adjacent h-BN layers are illustrated in Fig. 4b, c for 3- and 4-layer slabs.

Experimental realization of resistance switching in h-BN insulators typically requires a forming step prior to normal operation13,14. This forming process could be explained by such a layer-by-layer soft breakdown via the stacking and clustering of vacancies across layers, as illustrated in Fig. 4c. Reconfigurations of the atomic structure at the tip of the defect cluster might then be responsible for the resistance switching. Such a stacking and clustering of defects that propagate from one layer to the next one could also explain the experimentally observed layer-by-layer dielectric breakdown of h-BN24.

The investigation of the binding of (multi-)vacancy defects across layers hints at the many configurations that are possible. Extending such a study beyond the neutral charge state would likely lead to further viable configurations. The interaction between vacancies in different layers strongly impact the relative formation energies between planar and bonded configurations. Furthermore, the barrier heights might be affected as well. Potentially, certain configurations of clustered multi-vacancies could enable resistance switching as described above, but with larger barrier heights than reported here. This would allow for nonvolatile reconfigurations with longer relaxation times. Furthermore, the presence of defects in neighboring layers would break the perfect symmetry between 1B and 1B’, where in 1B’ the B atom is bonded to the opposite layer as compared to 1B.

### Characterization of the trivacancy in graphene/h-BN/graphene

So far we have investigated how external stimuli in the form of an electric field can influence the defect configuration in bulk h-BN and affect the electronic structure. Realistic devices possess however electrodes that should ideally be explicitly accounted for in the modeling effort. To go one step further and describe entire memristive devices, we next examine a graphene/h-BN/graphene heterostructure with the same trivacancy as before as exemplary multi-vacancy defect.

We consider h-BN insulators composed of two to four layers encapsulated by a graphene electrode on each side of the stack, as depicted in Fig. 5a, b. First, we compute the offset between the VBM of h-BN and the Fermi energy of graphene. Based on the Kohn-Sham orbitals we find that this quantity is 2.0 eV and 2.3 eV for the AB(B) and AB(N) stacking orders, respectively. When increasing the thickness of the h-BN from two to four layers, the band gap of h-BN decreases from 6.1 eV to 5.9 eV and from 6.2 eV to 5.9 eV for the AB(B) and AB(N) stacking orders, respectively. Even for four layers the band gap remains 0.15 eV larger than in bulk (5.74 eV).

Under the influence of graphene contacts the Fermi energy is pinned such that the −1q state of both the 0P and 1B configurations is stable. As the 2N configuration requires a much higher Fermi energy, it is not viable in our simulations. We thus restrict our analysis to the transition between the 0P and 1B configurations. In a more realistic structure involving defects or grain boundaries in the graphene electrodes, the 2N configuration might be stable due to the bonding of the N atoms to irregularities in the neighboring h-BN or graphene layer. Even with pristine graphene electrodes the 2N configuration could be activated through band bending. These situations have not been explored in this study.

The lowest energy stacking order of graphene and h-BN is AB(N) where the C atoms of the graphene are located above the N atom of the adjacent h-BN layer25. In the 1B configuration a B atom bonds with another atom situated either directly above or below it. Hence, to allow for a possible bonding of the defect with the graphene we adopt the AB(B) stacking where a C atom is positioned above each B atom. We expect this stacking to have a minimal impact on the relative formation energies because the increased energy of AB(B) systematically affects all structures in the same way.

The energy barrier and barrier height between the neutral 0P and 1B configurations in graphene/h-BN/graphene stacks are very similar to the bulk case, as shown in Fig. 5(c–e). The formation energy of 1B relative to 0P in two- and three-layer h-BN is slightly higher than in bulk, but it converges to the bulk value already at four layers. The position of the defect has little impact on the barrier height, i.e., regardless of whether the bond is formed with a surface or “bulk” layer, the energies are all within 0.02 eV of each other. The largest asymmetry between the SET and RESET barriers was found to be 0.08 eV.

In bulk h-BN the interlayer bond of the 1B configuration can form with either neighboring layer. In heterostructures the situation is different if the trivacancy defect is located in a surface layer directly adjacent to the graphene contact. The 1B interlayer bond can only form with the neighboring h-BN layer. At the same time the B atom of the trivacancy can, in principle, also form a bond with the C atom located directly above or below it, which we call the 1BC configuration. The 1B and 1BC cases with two h-BN layers are visualized in Fig. 5a, b. In this heterostructure the formation energy of the 1BC configuration is 2.94 eV (2.86 eV) higher than the corresponding 0P (1B) energies. With an applied electric field of 3 V/nm the 1BC configuration is stable, but without a field, there is no energy barrier protecting it from relaxing back to 0P. Hence, 1BC is a metastable configuration.

If a C vacancy is included in the graphene layer above the BN trivacancy the binding between the two defects is very strong. In this situation the formation energy of 1BC is 2.7 eV lower than in the 0P case. These findings suggest that a nonvolatile switching between h-BN and graphene is possible if a multi-vacancy defect in h-BN is fully aligned with a defect, grain boundary, or stacking fault in graphene.

In summary, the formation energies and transition barriers in graphene/h-BN are almost equal to their bulk equivalents. If the defect is located in a surface layer the 1B configuration can only form with the neighboring h-BN layer, but not with the graphene electrode because of the asymmetry between the 1B and 1BC configurations. The SET and RESET voltages for neutral trivacancies are estimated to be 3.4 V and −2.8 V for three layers of h-BN, respectively, if the barrier lowering caused by the electric field remains similar to what was obtained in bulk h-BN.

### Transport characteristics of graphene/h-BN/graphene stacks

As next step we analyze the electrical properties of h-BN slabs with and without the trivacancy defect using quantum transport calculations. The same configurations as before are considered as well as the 2N. The formation energy of the latter is larger than that of 0P and 1B for the Fermi energy induced by graphene, but under the special conditions previously mentioned it could still be viable. Therefore, it is worth studying how it affects the electrical current. The NEGF simulation domain of three h-BN layers encapsulated by graphene is presented in Fig. 6a. It has a cross-section of 3.4 nm2, which corresponds to a defect density of 2.9 × 1013 cm−2.

All electrons are injected laterally from the bottom graphene layer, along the zigzag-direction, and extracted from the top layer, on the opposite side of the simulation domain, as indicated by the black arrows in Fig. 6a. The quantum transport simulations were performed in the coherent limit, i.e., in the absence of inelastic scattering such as electron-phonon interactions. The chosen approach still accounts for trap-assisted tunneling, which is sufficient when only individual defects are present.

The 0P and 1B configurations in the neutral charge state only marginally impact the electronic transmission function around the Fermi energy of a three-layer h-BN slab. In contrast, the transmission for the neutral 2N configuration displays a large peak near the Fermi energy. The three transmission functions are displayed in Fig. 6b together with the one for pristine h-BN. In the −1q charge state also the 0P and 1B configurations induce peaks in the transmission, see Fig. 6c. From the 0P to the 1B and 2N configurations more peaks appear, reflecting the increasing distortion of the lattice.

The large peaks in the transmission functions directly translate into high conductance values. These were extracted from the current at 0.5 V using the Landauer-Büttiker formula26. The conductance values for the three aforementioned defect configurations in the −1q charge states (−3q for 2N) and for the defect-free crystal in three-layer h-BN are shown in Fig. 6d. There is little difference between the conductance of the ideal crystal and 0P because the first, narrow peak in the transmission is situated more than 0.5 eV away from the Fermi energy. In contrast, the conductance of the 1B and 2N configurations increases by a factor of 270 (110) and 1770 (730) with respect to the pristine layer (0P configuration), respectively.

The conductance values of the defect-free crystal and 1B configuration are reported in Fig. 6e as a function of the h-BN thickness, from two to four layers. The plotted curve exhibits a roughly exponential decay as the number of layers increases, for both structures, but the slope is much steeper in the pristine crystal. The exception is the 1B configuration in the two-layer h-BN whose conductance is the same as in the pristine case. The transmission peaks explain this behavior: they are situated 0.4 eV and 0.7 eV below the Fermi energy in three- and four-layer h-BN, but they are shifted by 0.75 eV in the two-layer h-BN. The ratio between both conductance values (with and without any defect) increases from 270 in three-layer h-BN to 790 in four-layer h-BN. These ratios match the lower end of the values reported experimentally which range from two to seven orders of magnitude13,14.

Generally, we suspect that the conductance value depends on the number of interlayer bonds that are present in the defect. In the case investigated here (trivacancy) only one (1B) or two (2N) interlayer bond(s) per defect can form. In reality, larger multi-vacancy sites certainly exist. They could lead to the formation of more interlayer bridges per defect and thus higher conductance ratios. Also, stacks of multiple defects could increase this parameter by facilitating the transfer of electrons from one electrode to the other.

It is also important to realize that the conductance of pristine h-BN is directly proportional to the MIM device area A and represents a leakage source whose impact increases with A. At the same time, the conductance extracted in the presence of a single interlayer bridge is independent of A as long as this defect does not interact with its neighbors, i.e., it does not create any mini-band inside the h-BN band gap. Because of that, the conduction ratio is not an absolute value, but it either depends on the device area A or on its defect density d. In particular, the conductance values reported in Fig. 6d, e were obtained at a defect density d0 = 2.9 × 1013 cm−2 (1 defect per 3.4 nm2), which is rather in the upper range of what was determined experimentally for exfoliated and CVD-grown h-BN13,27,28. When considering a more realistic defect density of d = 1012 cm−2 in three-layer h-BN, the conductance ratio between the 1B or 2N configuration (low-resistance state) and the 0P one (high-resistance state) drops to 9.8 and 59 instead of 110 and 730 at d0 = 2.9 × 1013 cm−2, respectively. The calculated density-dependent conduction ratios are presented in Supplementary Note 1.

Overall, both effects (presence of larger defects than trivacancies and lower defect densities than assumed here) should be taken into account in device simulation to quantitatively agree with experimentally data. While highly relevant, such calculations go beyond the scope of this paper because of the heavy computational burden associated with them.

## Discussion

In this paper we examined the switching of h-BN-based memory cells through DFT and NEGF calculations. Charged multi-vacancy defects are expected to connect neighboring h-BN monolayers and give rise to sharp transitions from a high to a low resistance state under the application of an electric field. We first determined the formation energies and electronic properties of an exemplary multi-vacancy defect, trivacancy, that can form interlayer bridges. Three different atomic configurations, 0P, 1B, and 2N, were found to be stable within the energy window where typical electrodes would pin the Fermi energy. We established that in the neutral charge state the 0P and 1B configurations are separated by an energy barrier of ~0.3 eV. This barrier can be overcome by applying an electric field of about 3 V/nm, which gives rise to a switching of the h-BN insulator.

We showed that the interaction between the 1B configuration and an additional VB in a neighboring layer is strongly binding, effectively anchoring VB above the trivacancy. This VB could then act as a seed and capture further vacancies in its vicinity. The resulting seeded multi-vacancy could in turn bond to the next h-BN layer. Such a cascading effect could explain both the forming process or the layer-by-layer breakdown of h-BN insulators, which was observed experimentally.

We further assessed the formation energy of the 0P and 1B configurations in graphene/h-BN/graphene heterostructures, similar to memory cells. We found that these energies are similar to the bulk case and could potentially lead to a nonvolatile resistive switching mechanism. Lastly, we examined the transport characteristics of graphene/h-BN/graphene stacks. The 0P configuration only slightly affects the current characteristics of the heterostructures. The 1B and particularly the 2N configurations increase the current by factors up to 270 and 1770 in three-layer h-BN insulators, respectively. The results presented in this work involve a single defect, where one or two atoms relocate. This small change already results in high-to-low resistance ratios above 100 that could be further increased by stacking multiple defects. In combination with the nonvolatile switching of graphene/h-BN/graphene heterostructures we provided an explanation for the experimental observation of resistive switching in h-BN with inert electrodes.

Eliminating the dependence of the resistance switching on the electrode material is expected to simplify the fabrication process of memristors, as compared to traditional random access memory layouts. At the same time the modest structural changes of the h-BN layer during switching should allow for better endurance and lower cycle-to-cycle variability than in competing technologies. Most importantly, our study indicates that defect engineering might be key to design future memristors based on 2-D materials and their van der Waals heterostructures.

## Methods

### DFT simulation methods

All DFT simulations were performed with the Quickstep module of the CP2K package29. The PBE0-TC-LRC hybrid functional18 with 25% Hartree-Fock exchange was employed to approximate the exchange and correlation functional. A hybrid functional is required in order to achieve accurate band gap values and proper localization of the electron density in charged defects. To increase the computational efficiency of the hybrid functional simulations, we used the auxiliary density matrix method (ADMM)30. DFT is known to struggle at correctly accounting for van der Waals forces, which are crucial to describe the interlayer distance in h-BN. We applied the DFT-D3 dispersion correction to compensate for this deficiency31. A double-zeta valence basis set (DZVP) in conjunction with Goedecker-Teter-Hutter (GTH) pseudopotentials and a plane wave cutoff of 500 Ry were employed in all calculations32,33.

Bulk h-BN was simulated in an orthorhombic 4 × 8 × 6 super cell containing 768 atoms and with periodic boundary conditions. Owing to the large size of the simulation domain all calculations were performed with sampling the Brillouin zone only at the Γ-point. The lattice parameter and geometry of the crystalline h-BN cell were fully optimized. For the defect investigations the bulk lattice parameters were fixed, but the atomic positions were relaxed so that the minimum energy configuration could be identified. Graphene has almost the same lattice constant as h-BN. To construct the graphene/h-BN heterostructures we used the same cross-section as in the bulk h-BN case and strained the graphene layer by 1.81% in order to match both lattices. These slab simulations were performed with a layer of 2 nm of vacuum along the out-of-plane direction to separate the heterostructure from its periodic images. The atomic coordinates of all defect configurations calculations are available in the Supplementary Information.

The transition energy barriers were computed using the climbing image nudged elastic band method (CI-NEB) with 10 images and a spring constant of 0.0234. The root-mean-square distance between the images is in the range of 0.35 Å to 0.4 Å. The energy barriers under the influence of an electric field were evaluated at the NEB-images obtained without an electric field. The latter was included through the Berry phase formulation for periodic electric fields within the framework of the modern theory of polarization35.

### Calculation of the formation and binding energies

The formation energies of the defect were determined based on the following equation

$${E}_{{{{\rm{Form}}}}}={E}_{{{{\rm{Def}}}}}^{q}-{E}_{{{{\rm{Crystal}}}}}^{0}+{n}_{i}{\mu }_{i}+q({E}_{{{{\rm{VBM}}}}}+{E}_{{{{\rm{F}}}}})+{E}_{{{{\rm{Corr}}}}}.$$
(1)

In Eq. (1)$${E}_{{{{\rm{Def}}}}}^{q}$$ is the energy of the cell containing a defect with charge q, $${E}_{{{{\rm{Crystal}}}}}^{0}$$ the energy of the pristine supercell cell in the neutral state, ni the number of vacancies of species i, μi the chemical potential of species i, and EF the Fermi energy with the maximum of the valence band, EVBM, as a reference. The term ECorr in Eq. (1) includes the image charge and potential alignment corrections according to S. Lany et al.36. The chemical potentials μB and μN were calculated for N-rich conditions following the argument of Huang et al.37. It should be noted that μB and μN only affect the absolute value of the formation energy of the trivacancy defect shown in Fig. 2a. The relative energies between different trivacancy configurations, the energy barrier heights, and the binding energies - and hence the conclusions drawn in this study—are independent of the choice of μB and μN.

The binding energy EBind is a measure of the strength of the attraction between two or more defects. We evaluated it according to

$${E}_{{{{\rm{Bind}}}}}=\mathop{\sum}\limits_{i}{E}_{i}-{E}_{{{{\rm{Int}}}}}$$
(2)

where EInt is the formation energy of the interacting defects and the Ei are the formation energies of the individual defects. Positive (negative) values indicate that the defects are attracted to (repulsed by) each other.

### Quantum transport simulation methods

The quantum transport simulations were performed with the Non-equilibrium Green’s function formalism (NEGF) as implemented in our in-house package38. The coupling between our quantum transport solver and CP2K is outlined in detail in ref. 39. The Hamiltonian and overlap matrices required by NEGF were exported from CP2K. These two quantities were constructed from a separate self-consistent field calculation using the short-ranged 3SP basis set40. The latter captures the electronic structure of h-BN and graphene around the band gap well and drastically reduces the computational burden with respect to DZVP. The quantum transport simulations were conducted in the low-bias approximation where the electrostatic potential is frozen and not updated self-consistently. The low-bias regime corresponds to the readout of a memory state. Large biases would trigger atomic reconfigurations. Fully self-consistent NEGF-DFT geometry optimizations could theoretically be performed, but they are computationally not feasible for the simulation domain considered in this study. Hence, for the calculation of the I–V curve we restricted ourselves to the evaluation of the conductance of the 0P and 1B configurations at 0.5 V. It was assumed that both structures are in the −1q charge state, the barrier lowering effect caused by the electric field was taken into account, and the ballistic limit of transport was considered, i.e., in the absence of momentum and energy relaxation.