Introduction

In the era of artificial intelligence, traditional von Neumann-based computer architecture suffers severe challenges in executing machine learning tasks due to low processing speed and high energy consumption1. In contrast, the human brain like in-memory computing architecture2 can process large amounts of information in parallel via its neural network consisting of a very large number of neurons and synapses. Thus, neuromorphic computing built by constructing artificial neural networks is considered the most effective solution to overcome von Neumann’s bottleneck3,4. In the human brain, synaptic plasticity5 plays a major role in information transmission. Synaptic plasticity is the activity-dependent modification in the connection strength between neurons and it can be precisely adjusted by the external pulses. Memristor is the most promising candidate to mimic the biological synapses in the artificial neural network6,7. Like the synaptic weight update, a memristor can reversibly switch between a high resistance state (HRS) and a low resistance state (LRS) with the application of an external electric field. The theoretical concept of memristor was first proposed by Leon O. Chua in 19718, and it was first practically implemented by Strukov et al. at HP Labs in 20089. Memristors have gained profound interest due to their metal-insulator-metal (MIM) based two-terminal simple structures, fast read-write speed, high density, good scalability, low cost, and compatibility with complementary metal oxide semiconductor (CMOS) process6,7,10. Although bulk materials, including metal oxides11,12,13,14 and perovskites15, have been initially used in memristive devices, 2D materials are gaining enormous attention due to their atomic thickness and unique electrical and mechanical characteristics16,17,18. To design MIM configurations, 2D materials can be vertically or laterally stacked between two electrodes19. As the vertical MIM devices occupy a much lesser footprint, they possess several advantages like lower switching voltage, fast switching speed, and high-density integration20,21. In recent years, several experiments have been performed to fabricate vertical MIM devices using 2D materials for data storage22,23,24, neuromorphic computing16,17,25, data encryption26 and radio frequency switches27,28.

Despite such fascinating advancements, the fundamental mechanism of resistive switching (RS) in these 2D material-based MIM devices has remained elusive, which may impede the optimization of such disruptive technology. Most of these devices are built on electrochemically active metal electrodes, and the switching mechanisms are attributed to the metal ion migration from the electrode19,29,30. In monolayer (ML) MoS2 and h-BN-based devices, it was proposed that metal ions get adsorbed in the point defects of the 2D layer for switching to LRS20,21,31. In the case of multilayer devices, it is suggested that the application of external bias leads to the dissolution of metal ions from the active electrode into the 2D material and the formation of a metallic bridge between the two electrodes24,29,32, which is similar to the bulk amorphous oxide-based memristor33. However, how the metal ions migrate through the multilayer stack of 2D materials remains poorly understood, since the amorphous oxide materials provide enough interstitial spaces for metal ion propagation, whereas 2D materials are crystalline in nature. Only defects can provide leaky paths for metal ion migration in 2D materials; however, we have a limited understanding of the type of defects responsible for such filament formation. At the same time, the RESET mechanism in these devices is not well understood. Some works suggested reversing the voltage leads to back diffusion of metal ions, disrupting the filament34. However, the coexistence of bipolar and unipolar RS in the same device implies the presence of a non-directional effect besides voltage-induced drifting35. Observation of such remarkable resistive switching in devices having chemically passive electrodes (graphene) indicates that intrinsic changes inside the 2D material are also responsible for memristive property36. Demonstration of phase change in MoTe2-based devices with active electrodes37 has also fueled the speculation that the chemical properties of electrodes might have a limited role in RS.

In this work, we study MoS2 and h-BN-based memristors, which are most commonly used in experiments, to find the origin of nonvolatile RS. In contrast to previous computational reports38,39,40, here we adopt reactive molecular dynamics (MD) simulation with a charge equilibrium method to obtain atomistic descriptions of all potential mechanisms governing the RS. More precisely, the present work focuses on the filament formation and disruption process in multilayer h-BN and MoS2 having defects and grain boundaries. While existing reactive force fields are used to simulate the Ni/h-BN/Ni device, parameter sets for Au-Mo reactive interactions are developed to simulate the Au/MoS2/Au device. Our study reveals both the intrinsic (creation of interlayer B-N bond and S atom popping) and extrinsic (adsorption and migration of metal atoms from the electrodes) mechanism of RS, which helps to explain the contradictory experimental observations. We show that the coexistence of volatile and nonvolatile RS in some experimental devices arises from the atomic configurations at grain boundaries. We also suggest that Joule heating-assisted filament disruption may lead to bipolar and unipolar switching in the same device, whereas the presence of multi-resistance states stems from the partial dissolution of filament during RESET. Our atomic understanding could be valuable for 2D material optimization in the development of high-performance nonvolatile resistive memory.

Results

Electric field-induced intrinsic changes in multilayer h-BN

To evaluate the intrinsic changes in h-BN responsible for RS, we have carried out reactive MD simulations on bilayer h-BN films comprising different types of defects (see Methods for details). It is worth noting that reactive MD were earlier used to gain insight to RS mechanisms in bulk oxide-based memristor33,41, and monolayer atomistors42,43. Since we are only interested in the local changes in h-BN independent of electrodes, no explicit electrodes are used in this simulation to reduce the computational cost. However, to provide the necessary mechanical support to h-BN layers, two Lennard-Jones (LJ) walls fitted to emulate the Ni–h-BN interactions are placed on top and bottom of h-BN (See “Methods”). As B and N monovacancies are reported to be the most abundant and stable defects in h-BN21,44,45, we have created a B and N vacancy separately in two devices, as shown in Fig. 1a, c, respectively. At equilibrium, the ReaxFF predicted ionic charges of B and N about +0.48e and −0.48e, respectively. Formation of a B vacancy leads to undercoordination of surrounding three N atoms, and their ionic charges become about −0.35e. If a B vacancy is created in the upper BN layer (Fig. 1a) and electric field is applied towards the upward direction, the undercoordinated N atoms experience forces to move towards the lower h-BN layer. Due to the electron deficiency, after a critical field, each of the three undercoordinated N atoms starts gaining electrons from the B atoms directly below them in the lower BN layer and eventually create bonds with them. As a result, three vertical conductive bridges are formed between the two BN layers (Fig. 1b), leading to a significant rise in conductance. The interlayer bridge involving an undercoordinated N atom is termed as “N-B bridge”. Due to the electron transfer, the charge in vacancy surrounding N atoms becomes about −0.41e. The average distance between B and N atoms in the interlayer bond is about 1.68 Å. The bond remains stable even if the electric field is withdrawn, indicating the nonvolatile nature of switching. ReaxFF bond order analysis shows the interlayer N-B bond (bond order 0.445) is weaker than the other two intralayer N-B bonds (bond orders 1.286, 0.997). When an electric field is applied in reverse direction, the B and N atoms in the interlayer bonding experience force in opposite directions and try to move away from each other. At a critical reverse field, the interlayer B-N bond breaks, resulting in the device reset (Fig. 1b).

Fig. 1: Intrinsic RS in multilayer h-BN.
figure 1

a top-view of h-BN bilayer film consisting of a B vacancy (red dashed circle) in the top layer, b upper panel shows the applied electric field pulses with simulation time, lower panel shows the snapshots of side views of h-BN layers during different time steps. The red arrows denote the direction of the applied field. c top-view of h-BN bilayer film consisting of a N vacancy (red dashed circle) in the top layer, d upper panel shows the applied electric field pulses with simulation time, lower panel shows the snapshots of side views of h-BN layers during different time steps. B and N atoms are denoted by green and silver balls respectively. The yellow rectangles represent the virtual walls placed across the h-BN layers during the MD simulations.

In this work, we have applied an electric field pulse of 15 V/Å with 0.5 ns width to SET the device. The field appears to be quite high compared to the experimental value. The main reason behind this is that ReaxFF significantly underestimated the charges of B and N atoms. Bader analysis shows charges in B and N atoms are +2.16 and −2.16 e, respectively, about 4.5 times higher than ReaxFF charges. Applying an electric field leads to exerting forces on each atom according to their charges. Therefore, reducing atomic charges requires a higher field to create interlayer bonding. Also, the addition of LJ walls generates a force on the atoms in the vertical direction, the same as the direction of the electric field, resulting in a variation of the threshold field value. We have found that the threshold field value reduces to 8 V/Å if the walls are eliminated (Supplementary Fig. 1). However, the wall is required to give mechanical support to the h-BN layers; otherwise, the film will suffer from distortion while doing MD simulations. Large field values also accelerate the occurrence of rare events in a much shorter time scale. Since, in simulation, the critical value of force required to create interlayer bonding is a combined effect of the electric field, atomic charge, interaction with walls, and interatomic forces calculated using different potential functions, it is indeed challenging to corroborate the simulation field values with experimental findings.

Next, we performed similar simulations on an N vacancy inhabited structure (Fig. 1c). However, in B and N vacancy inhabited structures, the polarities of the SET and RESET fields are different due to the opposite charges of B and N atoms. When an N vacancy is created in the upper h-BN layer, an electric field should be applied downward to move the undercoordinated B atoms toward the N atoms in the lower h-BN layer (Fig. 1d). The interlayer bond formed between an undercoordinated B atom, and a neighboring N atom is termed as “B-N bridge”. Our simulations reveal that the threshold value of the electric field required to create a B-N bridge is higher compared to the N-B bridge. The ReaxFF-based nudged elastic band (NEB) simulations (Supplementary Fig. 2) can explain this, where we find that the forward barrier height to create one B-N bridge is higher than the N-B bridge.

Ducry et al.38 earlier observed such interlayer bridges using static density functional theory (DFT) based calculations. However, they showed the possibility of vertical BN bond formation only in multi-vacancies like B2N. To corroborate their findings, we have created another bilayer h-BN device with one B2N vacancy in the upper h-BN layer (Supplementary Fig. 3a). Creating one B2N vacancy leads to the generation of undercoordinated four N atoms and one B atom. When an electric field pulse of 15 V/Å is applied upward, two of the four undercoordinated N atoms (N1, N2 in Supplementary Fig. 3a) create bonds with B atoms in the neighboring h-BN layer (Supplementary Fig. 3b). The other two N atoms (N3, N4) are not involved in the interlayer bond formation, the same as reported in ref. 38 From ReaxFF, we found that the partial atomic charges of the N1 and N2 are about −0.33e while that of the N3 and N4 are about −0.39e. This is because N3 and N4 are in proximity to the undercoordinated B atom (B1), and hence, electron transfer occurs between them. The higher electron deficiency in N1 and N2 makes them more prone to form bonds with interlayer B atoms.

A reverse field is required to create an interlayer BN bond involving the undercoordinated B atom. However, we have found when the same amount of electric pulse is applied in the reverse direction (-15V/Å), the “B-N bridge” is not formed (Supplementary Fig. 3c). We have increased the field to −20V/Å, but no interlayer bond is formed. The atomic charge of the undercoordinated B atom is found to be about +0.40e, which is closer to its equilibrium charge (+0.48e) compared to the undercoordinated N atoms. Therefore, the possibility of bond formation with the B atom is less. Also, from NEB calculations, we have found the resulting structure with a “B-N bridge” (Supplementary Fig. 3e) is energetically less stable, and the forward barrier height is significantly higher compared to that with an “N-B bridge” (Supplementary Fig. 3d). The static DFT simulations predict both “B-N bridge” and “N-B bridge” can form simultaneously during the SET process38. However, the MD simulations show that the “N-B bridge” formation is more probable at room temperature. The difference stems from the fact that static DFT simulation is not involved in the system’s explicit temporal evolution. External voltage may change ground state setups, hence static simulations cannot always predict appropriate results. Our study thus reveals that not only multi vacancies, but mono vacancies are also responsible for interlayer bond formation.

Metal atoms migration from electrode in multilayer hBN

In electrochemically active electrode-based devices, metal ion migration through the h-BN layers has been identified to be responsible for RS. In a recent experiment46 Ag filament formation through h-BN is shown through the HAADF-STEM image. It was reported that defects play a major role in metal ion migration. However, it is not clear what defect configurations are exactly responsible and how the metal ions migrate through them. To understand this, we perform reactive MD simulations on three layered h-BN sandwiched between two Ni electrodes with different types of scattered vacancies, as shown in Supplementary Fig. 4a.

In the preceding section, we applied an external electric field in the out-of-plane direction of h-BN to study the interlayer bond formation. Such an electric field adds force to the atoms according to their charge. However, using such a direct field to simulate metal ion migration is ineffective since the charges in metal atoms are very low, and hence, the force due to the electric field is too weak to desorb metal ions from the electrode. In reality, the applied voltage leads to the charging of metal atoms in the electrodes. Therefore, a self-consistent description of the change in partial atomic charges in metal atoms due to the external voltage is essential for simulating metal ion migration. The external voltage between two Ni electrodes has been generated by the electrochemical dynamics with implicit degrees of freedom (EChemDID33,47), details of which can be found in Methods.

We find that when a positive voltage is applied, the metal atoms along the surface of the top electrode become electropositive, while the metal atoms at the surface of the bottom electrode become electronegative. Acquiring partial charges, Ni atoms start interacting with the nearest vacancies. After a critical voltage, only a few Ni atoms get adsorbed into the vacancy centers (Supplementary Fig. 4b). However, no continuous filament is formed as the monovacancies cannot provide enough paths for ion migration. In ML h-BN, adsorption of one metal atom can raise the device current by a few orders21,43; however, when multilayer h-BN is used, such adsorption of metal ions in discreet locations will not change the device conductance significantly. There must be some continuous conductive path joining the two electrodes. Sufficient interstitial spaces are required for making such continuous filaments. In experiments, native defects were observed in the h-BN layers24,29, which consist of lattice disorders and thickness fluctuations and are extended vertically through the h-BN stack. Realizing the exact atomic configurations in those defect regions is abstruse. Monovacancies are not responsible for forming such a wide defect region. Among the typical defects found in h-BN, the lattice disorder and thickness fluctuations can be found in the grain boundary defects34, and they can also extend vertically through the h-BN stack.

To evaluate the filament formation through such wide defect regions, we construct grain boundaries in a tri-layer h-BN film (Fig. 2) and place it in between two Ni electrodes (Fig. 3a). When a voltage is applied, the metal atoms at the surface of the two electrodes become oppositely charged. As the voltage increases, the metal atoms near the grain boundary region start detaching from the electrodes (Fig. 3b). The substantial interstitial gaps inside the grain boundary region favor the dissolution of metal ions in h-BN. At a critical voltage, a large number of metal ions from both electrodes penetrate through the grain boundary region and form a metallic bridge that eventually short-circuits the two electrodes (Fig. 3cf). As a result, a high conductance path is created between electrodes, and the device switches into LRS. We first equilibrate the device at 0 V for 0.25 ns and then apply a positive voltage pulse of 34 V with 0.25 ns duration is applied to SET the device. The requirement of such high voltage in simulation has already been discussed in the preceding section. We also find that the filament remains stable when the external voltage is withdrawn (Fig. 4a).

Fig. 2: Grain boundary formation in h-BN.
figure 2

a top-view image of the supercell of h-BN. The h-BN is first divided into two grains at the center of the y-plane. The grains are then rotated by ±34° around the z-axis. The red arrows show the centers of rotation angles of each grain. b top view image of grain boundary along the middle of the h-BN layer. The dotted box indicates the grain boundary region.

Fig. 3: Atomic snapshots of metal filament formation in hBN through grain boundary during SET.
figure 3

side view of Ni/h-BN/Ni a at 0 V after 0.02 ns; at 34 V after b 0.005 ns, c 0.0075 ns, d 0.01 ns, e 0.015 ns and f 0.02 ns. The lateral dimension of the device is about 3.0 × 6.7 nm2. The grain boundaries are created vertically at the middle of the h-BN layers. As periodic boundary conditions are applied at in-plane directions, the grain boundaries are also formed at the in-plane edges. Ni, B, and N atoms are denoted by yellow, green, and silver balls, respectively. For clear visualization, the radius B and N atoms are reduced compared to Ni atoms.

Fig. 4: Atomic snapshots of filament disruption during RESET.
figure 4

Side views of Ni/h-BN/Ni a at 0 V for 0.02 ns MD run after the SET cycle; at −15 V after b 0.05 ns, c 0.1 ns, d 0.25 ns, e 0.66 ns MD run. At this step, the local temperature of the metal atoms in the filament is increased to 2000 K. f side view when the device is returned to 0 V after the RESET process. Ni, B, and N atoms are denoted by yellow, green, and silver balls, respectively. For clear visualization, the radii B and N atoms are reduced compared to Ni atoms.

The charge distributions in the atoms during the filament formation are shown in Supplementary Fig. 5. According to the EchemDID method, when a positive voltage of 34 V is applied, the electronegativity of the atoms in the bottom electrode is reduced, whereas that of the top electrode is increased. As a result, the atoms at the bottom and top electrodes become negatively and positively charged, respectively (Supplementary Fig. 5b). The electronegativities of the metal atoms are changed linearly according to their distance from the electrodes. As the charge equilibration method is coupled with ReaxFF, in every step of MD simulations, the atomic charges are updated according to the electronegativities and the position of atoms. Due to the opposite charge, atoms from the two electrodes experience a Coulombic attraction force that promotes atomic migration. As we have used the same materials for both electrodes, the atoms from both sides start migrating simultaneously. As the atoms detach from the electrode and move through the grain boundary, they gain more charge, i.e., the atoms from the bottom electrode become more negative, and atoms from the top electrode become more positive (Supplementary Fig. 5be). During filament formation, some atoms from one electrode also penetrate the other (Supplementary Fig. 5e). The atomic charge of B and N atoms at the grain boundary region also changes due to their interaction with metal ions. At the beginning of the filament formation, the average partial charges of B and N atoms in the grain boundary region are about +0.47e and −0.47e, respectively. However, at the end of filament formation, the partial charges reduced to +0.39e and −0.38e, respectively. When the voltage is withdrawn, the partial charges of the metal atoms in the electrodes become almost zero. However, a small positive charge exists in the metal atoms at the grain boundary region due to their interactions with the B and N atoms (Supplementary Fig. 5f).

In experiment35, both bipolar and unipolar switching are observed in a multilayer h-BN-based device, which implies RESET process is independent of the bias polarity. It is also found that in bipolar devices if the reverse bias further increases to a relatively large value after the RESET, the h-BN film is “re-SET” to LRS35,48. During RESET, as the current compliance limit is not used, the external bias will induce a very high-density current flow through the filament and cause Joule heating49,50 in a very short time. If the polarity reversal of voltage is only responsible for the back diffusion of metal ions, then both RESET and “re-SET” cannot be obtained at the same polarity. Therefore, Joule heating plays the dominant part in RESET. Our test simulations also reveal filament rupture is impossible only by applying reverse bias (Supplementary Fig. 7). The filament temperature should be raised. To reset the device, we have applied a reverse voltage of -15V and increased the temperature of the atoms in the conductive filament to 2000 K. As a result, the metal ions start returning to the electrodes, and the dissolution of the filament begins (Fig. 4bf). The atomic charge distributions during RESET are depicted in Supplementary Fig. 8. Such a high temperature is used to reset the device in a shorter time. In experiment51 also, it was reported the filament temperature could reach about 1300 °C during steady state operation. After 0.66 ns of simulation, about 50% of metal atoms return to the electrodes (Fig. 4e). Some metal atoms remain inside the grain boundary (Fig. 4f); however, the connection between the two electrodes breaks, resulting in switching to HRS. The presence of metal ions inside the h-BN matrix in HRS was also detected from STEM images46,48. In experiments, it is found that the current in the HRS in the regular switching cycles is higher than that in the primary state before the initial breakdown29. This may be due to these residual metal ions in the HRS. The device cannot completely restore its primary state during the first RESET. Some metal atoms remain in the h-BN stack, resulting in the difference between the currents. It might appear that these metal atoms cause the SET voltage to decrease significantly in the following cycles. To examine this, we have applied different positive voltages on the device geometry obtained from the first RESET process and ran simulations for the same amount of time for each structure. Although partial filament formation is seen at lower voltages, the complete filament production happens nearly at the same voltage as in the first cycle (Supplementary Fig. 9). Since it is computationally infeasible to execute such reactive MD simulations for very long-time scales, accurate prediction of SET voltage is challenging. It was not possible to further demonstrate the RESET process of the second cycle due to the considerably higher computing budget required to manually alter the electrochemical potentials of the metal atoms. The videos of filament formation and disruption are included in Supplementary files.

As shown in Fig. 2, a grain boundary is created by rotating two grains of h-BN around the vertical axis. By changing the rotation angle, different grain boundary configurations can be achieved. We have designed another h-BN-based device with a different grain boundary configuration (Supplementary Fig. 10a). B and N atoms in this grain boundary are more closely packed than the prior structure. When the same amount of voltage is applied, metal ions migrate through the GB region; however, their numbers are much less. A very thin filament is formed (Supplementary Fig. 10b). Therefore, the width of the metal filament depends on the interstitial gaps present in the grain boundary region. The filament breaks when the voltage is withdrawn (Supplementary Fig. 10c), implying volatile switching. The coexistence of volatile and nonvolatile switching has also been reported in experiments24,34. The on/off current ratio in volatile switching devices was shown to be less than the nonvolatile device34, implying the widths of filaments in the volatile devices are less than in nonvolatile devices. In ref. 24 it was shown that volatile switching even occurs at a very low compliance current of about 110fA. As the RESET voltage is near zero, for such a small current flow, the temperature rise would be insignificant. Therefore, in volatile devices, Joule heating does not appear to play a prime role in the filament disruption during RESET. When a comparatively thin filament is formed, it becomes unstable, resulting in RESET the device in the absence of external bias.

Au-Mo force field development

In our previous work, we reported the possible mechanism for switching in the passive electrode-based ML MoS2 device42. Here, we focus on the active (Au) electrode-based MoS2 device. Au is selected as it is one of the most common metals to be interfaced with MoS2 to fabricate the memristive device. The first fabricated atomristor based on monolayer MoS2 used Au as the primary electrodes20,31. Au is preferred to interface with MoS2 to avoid the formation of metal oxides and hence to ensure that the 2D layer has the major role in the switching process. To describe the Au-MoS2 interaction, Au/S and Au/Mo ReaxFF parameters are required. Au/S parameters are taken from ref. 52, while the Au/Mo parameters are optimized against quantum mechanical (QM) training sets using the covariance matrix adaptation evolution strategy (CMA-ES) optimizer53. Figure 5a shows the comparisons of QM and ReaxFF data for the dissociation of the Au-Mo bond. Although ReaxFF somewhat overestimates the QM data in the tail area, it largely exhibits the same change in energy with respect to Au-Mo distance as the QM predictions. Our main objective is to establish Au-Mo pair potential that can enable the simulation of Au adsorption in MoS2, and hence, we emphasize periodic DFT calculations based on the MoS2-Au bulk geometries in the training sets. To make such geometries, four layers of <111> plane is cleaved from bulk Au and interfaced with ML MoS2. Figure 5b depicts the comparison of DFT-Climbing image NEB (CINEB)54 and ReaxFF calculated energy barriers to adsorb one Au atom in the nearest S vacancy center present in MoS2. The initial geometry consists of an Au/MoS2/Au-based vertical device with a S vacancy in the lower S plane. In the final geometry, an Au atom from the bottom electrode nearest to the S vacancy is placed in the vacancy centers. Before the CINEB calculations, the initial and final geometries are relaxed. The energies along the reaction paths are considered in the ReaxFF training sets. ReaxFF slightly overestimates the QM energies; however, the nature of changing energies along the reaction path is quite similar. ReaxFF predicts the forward barrier height is 1.1 eV which is a little higher than the DFT calculated value of 0.72 eV. However, the ReaxFF predicted reverse barrier height (0.83 eV) agrees very well with the DFT value (0.85 eV). The training sets also consist of the variation of binding energies of pristine, and vacancy inhabited MoS2 on Au <111> plane with changing interlayer distances. The comparisons of DFT and ReaxFF calculated binding energies of pristine ML MoS2 and an S vacancy inhabited ML MoS2 on Au with different interlayer distances are depicted in Fig. 5c, d, respectively. Both DFT and ReaxFF show that creating S vacancy does not significantly change the binding energies. The equilibrium distance between Au and MoS2 obtained from ReaxFF (2.6 Å) is slightly different from the DFT evaluated value (2.8 Å); however, the DFT calculated energy values can be well reproduced by ReaxFF. Figure 5e shows the change in binding energies with Au-MoS2 interlayer distances when an Au atom from the Au layer is placed inside the S vacancy center. Although a slight overestimation is observed in the tail of the curve, ReaxFF can accurately predict the equilibrium interlayer distance between Au and MoS2 consisting of an adsorbed Au atom. The training sets also include the adsorption energies of Au atoms in different S vacancy locations. Figure 5f shows DFT and ReaxFF calculated Au adsorption energies in four different geometries. ReaxFF significantly underestimates the adsorption energies of Au atoms in two neighboring S vacancies. However, in the other three geometries, ReaxFF calculated energies agree well with the DFT data. The FF parameters are uploaded in the Supplementary file. This optimized FF is further used to run MD simulations on Au-MoS2-Au vertical devices. We first apply this FF on the ML MoS2-based device to check if it can validate the phenomena of Au adsorption as reported in ref. 31, as discussed in the next section.

Fig. 5: Au-Mo parameter optimization.
figure 5

Comparisons of ReaxFF and DFT calculated values of: a Au-Mo bond energies with varying interatomic distances; b energies along the path of Au atom adsorption in the S vacancy (Initial image of the CINEB calculation is Au/MoS2/Au based device with an S vacancy at the lower S plane, the final image is Au adsorbed in the S vacancy. The black arrow denotes the S vacancy location. The lateral dimension of the device is about 1.24 × 1.24 nm2.); c binding energies of pristine MoS2 with Au with varying interlayer distances; d binding energies of a S vacancy inhabited MoS2 with Au with varying interlayer distances. The S vacancy (Vs) is located in the S plane that is in contact with Au; e binding energies of Au adsorbed MoS2 with Au with varying the interlayer distances (The Au atom is adsorbed in the S vacancy location); f adsorption energies of Au at different S vacancy locations.

Metal atom adsorption in monolayer MoS2

The effect of external voltage in the Au/ML MoS2/Au device is depicted in Fig. 6. The MoS2 layer consists of S mono vacancies on both sides of the S plane (Fig. 6a). EchemDID is used to apply external voltage along the electrodes. As a positive voltage is applied between the top and bottom electrodes, the metal atoms near the free surface of the top electrode become electropositive, while near the free surface of the bottom electrodes, they become electronegative. After a critical voltage, the charged Au ions nearest to the S vacancies detach from the electrode and adsorb into the vacancy centers. Figure 6b shows the adsorption of Au ions in the S vacancy locations when a voltage pulse of 25 V and 0.25 ns duration is applied between the electrodes. Such a large voltage is selected to get switching in a lower time scale accessible to MD simulation. For several reasons, the applied voltage values in simulation might appear much higher than in experiments. First, the switching time in the experiment is around 15 ns20, which is extremely difficult to reach in atomic scale simulation. Second, the ReaxFF charge is significantly underestimated compared to the Bader charge, resulting in higher voltage requirements42. Also, the switching voltage is dependent on the applied methodology. In EchemDID method, the electronegativities of both the electrode atoms have been changed. However, if the electronegativities of the atoms on only one side of electrodes are varied, then much lower voltage is required to desorb Au ions from the electrodes (Supplementary Fig. 11). Therefore, matching the simulation voltage values with experiments is quite challenging. However, MD simulations can capture the physics behind the RS in these devices. Hence, theoretical simulations can interpret the experiments qualitatively.

Fig. 6: Au adsorption in ML MoS2.
figure 6

a The left panel shows the side-view image of the Au/ML-MoS2/Au device, the right panel depicts top views of upper and lower S planes. Red arrows point to the S mono vacancies present in MoS2. Total 12 S vacancies (8 in upper Splane, 4 in lower S plane) are present in the sample. b atomic snapshot at 25 V after 0.25 ns MD run. It shows Au atoms get adsorbed in the S vacancy locations at both planes. c atomic snapshot when the positive voltage is withdrawn and the device is run at 0 V for 0.25 ns. Out of 12 adsorbed Au atoms 11 remain in the S vacancy locations. d atomic snapshot during RESET at −15 V after 2 ns. During the RESET, the local temperature of atoms around the adsorbed atoms is increased to 1800K. Au, Mo, and S atoms are represented by gold, purple and yellow balls. The blue arrows point to the adsorbed Au atoms in the S vacancy locations.

The adsorption of Au atoms leads to the formation of conductive paths around the S vacancy centers, resulting in switching to LRS. As the voltage is withdrawn most of the adsorbed Au atoms remain in the vacancy locations, implying nonvolatile switching (Fig. 6c). DFT-CINEB simulations (Fig. 5b) show that the Au adsorbed state is energetically stable, and the reverse energy barrier is significantly high. Therefore, significant force is required to return the atoms to their initial locations. Our test simulations reveal that a combination of reverse voltage and high local temperature to emulate Joule heating is required to restore the initial state (Supplementary Fig. 12). To reset the device, we applied a reverse voltage of -15V and increased the local temperature around the nanofilaments to 1800 K (Fig. 6d). In this setting, after 0.5 ns MD run, 8 out of 11 adsorbed Au atoms returned to the electrode. Therefore, with this FF, we can effectively exhibit the Au adsorption and desorption mechanism during the SET and RESET cycle.

In our previous work42, we have postulated S atom popping as one mechanism of RS in ML MoS2-based devices, especially devices with passive electrodes like graphene. In any active electrode-based devices, both metal ion adsorption and S atom popping may occur simultaneously, which is difficult to demonstrate in simulations. The most challenging part of the simulation is the representation of external voltage. As discussed earlier, during MD simulations, we can model external voltage using two ways: applying direct electric fields on the atoms or changing the electronegativities of the metal electrodes according to the voltage value. However, the first methodology is not useful in designing the migration of electrode atoms, while the second methodology is unsuitable for generating any atomic movements inside the 2D insulating layer. Therefore, the simultaneous observation of intrinsic atomic movements and metal atom adsorption is inaccessible in the present simulation framework.

Metal atom migration in multilayer MoS2

To evaluate the RS process in multilayer MoS2-based devices, we consider two layers of MoS2 sandwiched between two Au electrodes, which is effectively a six-layer structure. First, we create random scattered S vacancies in both MoS2 layers (Supplementary Fig. 13a) and then we apply external voltage at the electrodes using EchemDID. After a critical voltage, the Au atoms from the electrodes adsorb only in the S vacancies in the surface S layers close to the electrodes (Supplementary Fig. 13b). With further increase of voltage, we find that the adsorbed Au atoms do not migrate through the MoS2 layers. In many-layer MoS2, the adsorption of Au atoms only in the surface S layers will not create any conductive paths between the two electrodes as the middle MoS2 layers remain insulating. Hence, the device current will not change significantly. Like h-BN, in MoS2 also, grain boundary-like defects can serve as leaky paths to penetrate metal ions. To demonstrate this, we have modeled a bilayer MoS2-based MIM device consisting of grain boundaries in the middle of the MoS2 layers (Fig. 7a). The structure of grain boundary is shown in Supplementary Fig. 14.

Fig. 7: SET process in multilayer MoS2.
figure 7

Side view of Au/MoS2/Au: a before MD simulation b at 0 V after 0.02 ns; at 40 V after c 0.06 ns, d 0.08 ns, e 0.09 ns, and f 0.1 ns. The lateral dimension of the device is about 3.4 × 7.9 nm2. The grain boundaries are created along the middle of the MoS2 layers. As periodic boundary conditions are applied at in-plane directions, the grain boundaries are also formed at the in-plane edges. Au, Mo, and S atoms are denoted by golden, purple, and yellow balls, respectively. For clear visualization, the radius of Mo and S atoms are reduced compared to Au atoms.

At 0 V, the device remains in the HRS, no significant atomic movements are found (Fig. 7b). As a positive voltage is applied, the surface Au atoms in the top electrode become positively charged while Au atoms in the bottom electrode become negatively charged (Supplementary Fig. 15). As the voltage increases, the partial charge difference promotes the dissolution of surface Au atoms. After a critical voltage, the dissolved atoms from both the electrodes start migrating through the grain boundary region (Fig. 7c). Further increasing the voltage leads to a significant rise of Au ions inside the grain boundary region, forming a conductive filament. The device switches into LRS when the Au ions form a bridge connecting the two electrodes through the grain. The atomic snapshots at different timescales illustrating the metal filament formation at 40 V are shown in Fig. 7cf. As discussed earlier, the simulation voltage value used to SET the device is not comparable with the experiments. Such grain boundary inserted structures require a high computational cost, so achieving even 1 ns time in MD simulation is extremely expensive. In experiments, the switching time of the multilayer MoS2-based device was reported to be greater than 30 ns to a few ms32,55. Such a time scale is inaccessible in MD simulation with our limited computational recourses. Therefore, we have applied a significantly high voltage to accelerate the filament formation. The other reasons for such high simulation voltage have been discussed in the previous section.

The filament remains stable as the applied voltage is reduced to zero (Fig. 8a). To RESET the device, a negative voltage of -15V is applied, and the local temperature around the filament is increased to 2000 K. Au ions from the grain region start returning to the electrodes, resulting in the rupture of the conductive bridge (Fig. 8bf). Like h-BN, Joule heating plays a significant role in filament rupture. However, a few metal ions remain inside the 2D layer after RESET (Fig. 8f). In experiments, it was reported that consecutive positive and negative voltage sweeps continue to decrease and increase the resistance, respectively, implying the existence of many internal resistance states32. If, during RESET, all the atoms in the filament return to the electrodes, the multi-resistance states cannot be obtained by changing the voltage pulses. As few Au atoms always stay inside the grain boundary region, the resistance of each state is determined by the overall width of the filament. To check if the remaining metal atoms cause a significant reduction in the next SET voltage, we have separately applied 30 V and 40 V on the device after the first RESET cycle (Supplementary Fig. 16). At 30 V, no significant movements of atoms are observed. The filament formation occurs at 40 V, the same as in the first cycle.

Fig. 8: RESET process in multilayer MoS2.
figure 8

Side views of Au/MoS2/Au a at 0 V for 0.02 ns MD run after the SET cycle; at −15 V after b 0.2 ns, c 0.5 ns, d 0.8 ns, e 1 ns f 1.95 ns MD run. At this step, the local temperature of the metal atoms in the filament is increased to 2000 K. Au, Mo, and S atoms are denoted by golden, purple, and yellow balls, respectively. For clear visualization, the radius of Mo and S atoms are reduced compared to Au atoms.

To gain insight into the electrical conductance change during the filament formation process, we have evaluated transport properties based on DFT- NEGF (non-equilibrium Green’s function) formalism. Though such formalism has earlier been adopted for oxide-based memristor56,57, the challenge for such atomistic quantum transport simulation is the atom counts. For an oxide-based memristor, it is possible to conduct both the (classical) MD simulation and transport calculation within the same atomic structure with limited atom counts. However, in our reactive MD simulation, the dimension of the Au/MoS2/Au system is about 3.4 × 7.9 nm consisting of 4883 atoms. As the quantum transport simulation of such a large system is intractable, we had to develop a minimalist model. However, because of the presence of grain boundaries, even this minimalist model contains 1408 atoms (2.2 × 3.8 nm) as shown in Fig. 9a. Two layers of MoS2 are vertically interfaced with four Au layers on both sides. The outer three layers on each side are considered electrode regions, while the inner Au layer along with the MoS2 layers are set as the central scattering region. To mimic the filament formation, we have manually removed Au atoms from the innermost Au layers and placed them randomly inside the grain boundary regions as shown in Fig. 9be. We have increased the number of Au atoms inside the grain boundary and accordingly calculated their transmissions at zero bias. The zero-bias transmission spectra in the energy range −0.2 to +0.2 V are shown in Fig. 9f. From the transmission spectra, the electrical conductance (G) at room temperature has been evaluated from Eq. 1.

$$G=\frac{2{q}^{2}}{h}{\int_{-\infty }^{+\infty }}\tau (\varepsilon )\left(-\frac{\partial f(\varepsilon ,\,{\varepsilon }_{{\rm{F}}},\,T)}{\partial \varepsilon }\right)d\varepsilon$$
(1)

where τ(ε) is the transmission coefficient, ε is the energy, \(f\left(\varepsilon ,{\varepsilon }_{{\rm{F}}},T\right)\) is Fermi-Dirac distribution function with εF being the Fermi energy. The change of conductance with different numbers of Au atoms inside the grain region is plotted in Fig. 9g.

Fig. 9: Transport calculation of Au-MoS2-Au system.
figure 9

a Side view of Au/MoS2/Au device (Au0) consisting of two MoS2 layers vertically interfaced with four Au layers on both sides. The outer three layers on each side are considered as electrode regions, while the inner one layers along with the MoS2 layers are set as the central scattering region. Side views of the Au/MoS2/Au device where b 5 Au atoms (Au5), c 13 Au atoms (Au13), d 24 Au atoms (Au24), and e 30 Au (Au30) atoms are removed from the innermost Au layers and placed randomly inside the grain boundary regions. f plot of zero-bias transmission spectra calculated for device configurations shown in ae, where εF = 0 g plot of change of electrical conductance with the number of Au atoms in the grain region of MoS2.

The conductance increases as the number of Au atoms increases. However, the increase is not linear. When 5 Au atoms are placed inside the grain, the conductance slightly increases. The reason is that although the Au atoms are inside the grain, they do not create a continuous path extending from one electrode to another. As the Au atoms start creating continuous paths the conductance increases significantly. Raising the number of Au atoms from 5 to 13 and from 13 to 24 significant changes in conductance are observed. Further increasing the number to 30 no significant rise in conductance is found. The conductance starts saturating after a sufficiently thick continuous path is formed. This transport calculation can give an idea about the qualitative change of conductance during the filament formation. However, comparing quantitative change with the experiments is extremely difficult due to several reasons. The experimental device dimension can never be achieved in DFT simulations. Due to the very small size of the device, two grain boundaries are located very close to each other which will affect the OFF-state conductivity. The number of metal atoms inside the filament is significantly higher than that of the simulation resulting in a huge change in ON state current. Also, the present transport simulations are performed at zero bias. The finite bias calculations are not included as they are more expensive, and SCF convergence is extremely difficult. The selection of high-fidelity basis sets is expected to improve accuracy, but computation becomes impossible due to high memory demand. Even with all these limitations, our calculation clearly shows the difference in conductances during the filament formations.

Intrinsic changes in multilayer MoS2

Similar to h-BN, to evaluate the intrinsic changes in multilayer MoS2, we have created random S vacancies in a tri-layer MoS2 flake and applied an electric field (Supplementary Fig. 17). We have found that on the application of an electric field the S atoms sitting immediately opposite to the S vacancies “pops” into the Mo plane and gets arrested there. The details about the S atom popping in monolayer MoS2 are described in ref. 42 In multilayer h-BN, interlayer bridges are formed due to external fields. However, in multilayer MoS2, only the S atoms get popped at different layers, no interlayer bridge is formed. Therefore, S atom popping is only responsible for intrinsic RS in MoS2.

Discussions

Several mechanisms suggested for resistive switching in 2D memristors have been compiled in a flow chart and presented in Fig. 10. It is worth noting that the intrinsic switching mechanisms are distinctive to the 2D materials. They were never observed in the traditional oxide-based devices. The metal filament formation is analogous to the amorphous oxide-based device. However, in amorphous oxides metal filaments can be formed in any region of the oxide layer, while in 2D materials metal ions can migrate only through the grain boundaries. All these mechanisms differ from single crystalline oxide-based memristors58,59, in which the switching mechanism is mainly attributed to oxygen vacancy diffusion-assisted modulation of Schottky barrier height near the metal electrode-oxide interface. Unlike oxide-based devices, not all 2D devices require electroforming process24,32. In this work, we found that filament formation occurs almost at same voltages in two consecutive cycles indicating forming free switching. However, the exact determination of SET voltages requires gradual rise of voltage, long time simulation and conductivity calculations at each voltage level which is unattainable in this study. In experiments it is also found that the requirement of forming steps depends on several factors like reactivity of electrode atoms, device dimensions and thickness of 2D layers24,32. The evaluation of formation process and cycle-to-cycle variability of SET voltage can remain as future scope of this work.

Fig. 10: Flow Chart.
figure 10

Flow chart for various resistive switching mechanisms in MoS2 and h-BN.

Our study is limited to h-BN and MoS2-based devices since ReaxFF is available only for limited 2D materials. Development of reactive force field for any 2D material is highly challenging and computationally demanding. In addition, ReaxFF needs to be developed for the interaction between constituent metal atoms of the electrode and the 2D material. However, the theory of the metal filament formation that we have proposed here can be applied to other 2D transition metal dichalcogenides as their atomic configurations are like MoS2. However, they might have additional intrinsic mechanisms, which can be explored with the further development of ReaxFF.

In summary, we present the atomistic simulations of the operation of vertical MIM devices based on h-BN and MoS2. The use of reactive molecular dynamics with the charge equilibration method enables real-time descriptions of all potential mechanisms governing the RS process in both active and passive electrode-based devices. We mainly demonstrate three mechanisms: electric field-induced intrinsic changes in multilayer h-BN, metal atom adsorption in ML MoS2, and metal atom migration in multilayer h-BN and MoS2. For realizing the active electrode-based MoS2 device, we have also parameterized the Au-Mo reactive force field. We found that in a passive electrode-based h-BN device, an electric field can induce interlayer B-N bonds involving undercoordinated atoms around a point defect. In active electrode-based devices, the primary switching mechanism involves metal ion migration from one electrode to another through the grain boundaries in the 2D layer. A detailed picture of metallic filament formation and dissolution during the SET and RESET process is shown. Unlike crystalline oxide-based devices, vacancy migrations have not been found in the 2D layers during the switching cycles. The simulation can qualitatively describe the experimentally observed phenomena. The coexistence of bipolar and unipolar switching operations reported in experiments is explained by Joule heating-assisted filament disruption. The presence of multi-resistance states is evaluated from the partial dissolution of filament during RESET. This simulation provides the role of individual defects in the switching cycle in active and passive electrode-based devices. This study is important for defect engineering of existing 2D materials and exploring new materials for next-generation memristive devices.

Methods

MD simulations setup

The MD simulations are performed using the LAMMPS60 package, and OVITO61 and VESTA62 are used for visualization. The interatomic forces during the MD simulation are computed using ReaxFF63,64 as it can model the chemical reactions with an accuracy close to ab initio simulations with much lower computational cost. In every step of MD simulations, the charge in each atom is updated using a charge equilibration (QEq)65 method coupled with ReaxFF. For Ni/h-BN system, ReaxFF parameters for Ni–Ni and B-N pairs are obtained from refs. 66,67, respectively, while the B–Ni and N–Ni potentials are taken from ref. 68. For Au/MoS2 system, Mo-S and Au-S parameters are obtained from refs. 52,69, respectively. The Au-Mo parameters are optimized here against DFT training sets using SCM-ParAMS package70. For making the DFT training sets, the energies of molecular structures are calculated using Amsterdam Density Functional (ADF) package71 with double-zeta polarized basis and GGA-PBE72 exchange-correlation functional. For DFT study of bulk structures, Vienna ab-intio simulation package (VASP)73,74 with PAW basis75 is used.

The velocity Verlet algorithm with a time step of 0.5 fs is used for the time integration of Newton’s equations of motion. During the simulations, a constant ambient pressure is maintained using the Nose–Hoover barostat. During the SET process, the temperature of the whole device is maintained at 300 K using Nose–Hoover thermostat (NPT). To model Joule heating during RESET in multilayer h-BN and MoS2, only the temperature of the metal atoms present in the grain boundary region are increased. In the case of single layer MoS2, the temperature of all atoms within 3 Å radius around the adsorbed metal atoms is increased. In LAMMPS, different Nose–Hoover thermostats cannot be used in the same sample. Therefore, to control the temperatures of different zones (the high-resistance bulk and conductive nano filament), separate Berendsen thermostats (NPH) are used. Periodic boundary conditions are applied in the two in-plane(x,y) directions, while a >30 Å thick vacuum region is inserted in the out-of-plane direction(z) to avoid spurious interactions between two periodic replicas.

Design of passive electrode-based device

No explicit electrodes are used to model the intrinsic RS in h-BN. Two flat walls are placed 3.3 Å away from the h-BN surfaces on the top and bottom of the flake. When an electric field is applied in the vertical direction, due to the external force, sometimes the entire h-BN moves vertically upward or downward according to the field direction. Therefore, virtual walls are used to bind the motion of atoms in the vertical direction. As in an active electrode-based h-BN device, Ni is used; we have considered the Ni/h-BN interactions using LJ 12-6 potential while designing the virtual walls. The parameter sets for LJ 12-6 potential are obtained by fitting the curve of binding energy vs. interlayer spacing of Ni/h-BN interface obtained from DFT calculations. The applied energy and distance parameters in this potential are ε = 1.067 eV, σ = 2.76 Å, and rc = 10.0 Å. To model the external field, we have used the “fix efield” command of LAMMPS that adds a force \(\vec{{\bf{F}}}=q\vec{{\bf{E}}}\) to the atom having charge q in the direction of the applied field (\(\vec{{\bf{E}}}\)).

Design of active electrode-based device

For modeling active electrode-based devices, four layers of <111> planes of Ni and Au are interfaced with h-BN and MoS2, respectively. The interfaces are created using QuantumATK interface builder module76. The mean strain and equilibrium distances between Ni/h-BN and Au/MoS2 interfaces are 0.31%, 3.3 Å and 0.29%, 2.82 Å, respectively. During MD simulations, the outer two layers of metal atoms on both sides of electrodes are kept fixed to emulate bulk nature. Grain boundary is created in the 2D layer using Atomsk77 tool. Two grains are rotated at opposite angles around the out-of-plane axis to create grain boundary. To model the external voltage along the electrodes, EchemDID33,47 package is used. In this package, the external voltage V is modeled by changing the electronegativities of the atoms in the bottom and top electrodes are set to \({\chi }_{0}-V/2\) and \({\chi }_{0}+V/2\) respectively, where χ0 is the standard electronegativity value of an atom in the given ReaxFF. During the filament formation, the electronegativities of the metal atoms vary according to their positions. Before applying the RESET voltage, we changed the electronegativities of the atoms in the filament to their standard value. The electronegativities of metal atoms assigned during SET and RESET are depicted in Supplementary Fig. 6.

Quantum transport simulation

QuantumATK78 transport calculation module is used to perform DFT- NEGF79 simulations of Au/MoS2/Au device. Double zeta polarized basis set, an energy cutoff of 60 Ha and a Monkhorst–Pack k-point grid of 4 × 4 × 150 are used. Grimme DFT-D3 van der Waal correction is employed. For solving Poisson equations, periodic boundary conditions are used in the in-plane (x–y) directions, while Dirichlet boundary condition is applied in the transport direction (z).