Introduction

Ionic liquid (IL) compounds are widely utilized as anticorrosive agents due to several advantages, including high efficiency, environmental compatibility, and cost-effectiveness1,2,3,4. Owing to their inherent hydrophilic-lipophilic properties, ILs can readily form micelles by reducing surface tension, thereby optimizing the balance between adhesion and cohesion forces. This leads to improved adhesiveness and enhanced adsorption capacity5. Their distinctive characteristics make ILs an excellent alternative to replace hazardous materials in industrial applications, and they are frequently employed as solvents in numerous chemical processes6. Recently, researchers have shown increasing interest in exploring the behavior of ILs as corrosion inhibitors (CIs)7,8,9,10,11.

Deyab and Mohsen investigated the corrosion inhibition performance of a phosphate-based IL, specifically Tributylmethylphosphonium Bis(trifluoromethanesulfonyl)imide (PBIL), for steel structures exposed to brine water containing H₂S and CO₂ at a pH = 2. Their findings demonstrated that PBIL achieved an inhibition efficiency of nearly 92% at a concentration of 100 ppm12. In another study, Pisanenko, Klimko et al. synthesized three IL derivatives—3-(N-arylcarboxamido)-N-benzyl pyridinium chlorides—where the aryl groups were phenol (I), 1-naphthyl (II), and 2-naphthyl (III). These compounds were evaluated for their anticorrosion performance against 08 kp steel in 3 M hydrochloric acid within the temperature interval of 20–80 °C. The results indicated that ILs II and III exhibited significant anticorrosion activity13.

To accurately describe the behavior of these molecules, factors such as the aromatic structure, along with accessible π-electrons or free electron pairs outside the coordination sphere, play a crucial role in determining their adsorption on metal surfaces. Once adsorbed, these molecules obstruct active sites, thereby mitigating the corrosion rate14,15,16.

Oilfield corrosion creates numerous operational challenges, triggering leaks in critical infrastructure, including tanks, casings, tubing, and pipelines, that adversely affect both production processes and maintenance procedures17,18. Such issues often lead to repeated partial or complete shutdowns, accounting for over 20% of the maintenance budget, resulting in substantial financial losses19. “Despite their extensive use in industrial processes such as pickling, cleaning, and descaling, acids accelerate the degradation of steel-based equipment, especially C-steel. Therefore, this study is dedicated to synthesizing four ILsand assessing their corrosion inhibition performance for C-steel in 1 M HCl.”

Experimental

Materials

  1. 1.

    The precursor chemicals required for the synthesis four target ILs were procured. Benzylwasride (99%), 1-methylpiperidine (98%), 2-picoline (98%), 3-picoline (98%), and 4-picoline (97%) were obtained from Alfa Aesar, while acetonitrile and diethyl ether were sourced from Merck. All chemicals and reagents were utilized as received without undergoing further purification.

  2. 2.

    Chemical Composition of the Tested C-steel.

The C-steel employed in this study had the following chemical composition (wt.%): Fe (balance), Mn 0.853%, C 0.093%, Al 0.032%, Cr 0.025%, Ni 0.013%, P 0.014%, Si 0.011%, and Cu 0.012%.”

  1. 3.

    Corrosion Medium.

A 1 M HCl solution was prepared as the corrosive medium by diluting 37% HCl (AR grade) with distilled water. The concentration range of the synthesized ILs compound used in the study varied between 20 and 100 ppm.

Synthesis of ionic liquids (ILI-ILIV)

The four compounds (ILI–ILIV) have been synthesized previously using various methods20,21,22. In this study, they were prepared following the procedure described in the reference23, as illustrated in Fig. 1. A solution of benzyl chloride (0.05 mol) in acetonitrile was mixed with equimolar amounts (0.05 mol) of 1-methylpiperidine, 2-picoline, 3-picoline, and 4-picoline. The reaction mixture was subjected to reflux at 80 °C for 6 h. After completion, the resulting solution was evaporated under vacuum, and the obtained products (ILI–ILIV) were thoroughly washed multiple times with diethyl ether20,21,22. A flowchart of the research method in Fig. S1.

Fig. 1
figure 1

Preparation of ionic liquids ILI-ILIV.

Characterization of ionic liquid

To confirm the molecular structure of the synthesized ILs, elemental composition was determined using a Perkin Elmer 240 C elemental analyzer. The infrared (IR) spectra were measured on a Nicolet iS10 spectrometer within the range of 4000 to 400 cm− 1, applying a resolution of 4 cm− 1 and a scanning speed of 32 cm/min. Additionally, proton nuclear magnetic resonance (1H NMR) spectra were recorded on a BRUKER 400.19 MHz spectrometer, equipped with a 5-mm broadband inverse Z-gradient probe, utilizing DMSO-d6 as the solvent.”

Electrochemical measurement

Steel (C-steel) with a surface area of 1 cm2 served as the working electrode. The reference electrode was a saturated calomel electrode (SCE), and a platinum wire acted as the counter electrode. Various electrochemical techniques, including impedance spectroscopy (EIS), polarization measurements, and electrochemical frequency modulation (EFM), were sequentially performed in the same experimental setup. The EIS measurements were carried out at open circuit potential (OCP) with a 10 mV alternating voltage applied, covering a frequency range from 100 kHz to 20 mHz at 25 °C. For EFM, a 10 mV AC amplitude was applied at 2 and 5 Hz frequencies. Polarization curves for anodic and cathodic surface interactions were also measured with a voltage sweep of ± 1.5 V/SCE relative to OCP at a scan rate of 5 mV/s. All data from the experiments were processed using the Echem Analyst software, with the measurements being carried out using a Gamry 3000 Potentiostat/Galvanostat/ZRA3,24,25,26,27.

Quantum chemical calculations

The present investigation focused on molecules that were designed and optimized geometrically through the DMol3 calculation model in Materials Studio v7.0. The geometry optimization process employed high-quality settings, utilizing the Local Density Approximation (LDA) functional and the DNP basis set, with all electrons treated for the core. Key quantum chemical parameters were evaluated, including the energies of the highest occupied molecular orbital (EHOMO) and the lowest unoccupied molecular orbital (ELUMO), as well as the energy gap (ΔE = ELUMO - EHOMO)28,29. The ionization potential (I) was determined from -EHOMO and the electron affinity (A) was calculated as -ELUMO. Electronegativity (χ) was derived as the average of I and A, while global hardness (η) was computed as their difference divided by 2. Softness (σ) was calculated as the reciprocal of η, and the electrophilicity index (ω) was given by ω = µ2/2η, where µ = (I - A)/2 denotes the chemical potential. For reference, the electronegativity and hardness of iron (χFe ≈ 7 eV and ηFe = 0) were assumed. Additionally, the Fukui indices for nucleophilic (f+) and electrophilic (f) local reactivity were calculated using the DMol3 method30,31,32,33,34,35.

Results and discussion

Characterization of ILI-ILIV structures

Elemental analysis

The data shown in Table 1 demonstrate that the calculated percentages for each element align with the theoretical predictions.

Table 1 Elemental analysis results of ionic liquid (ILI-ILIV).

FT-IR spectroscopy

Table 2 and Fig. 2 present the key IR Data about three distinct classes of compounds or chemical groups. FT-IR analysis was performed to verify the formation of the novel ILs, with the spectra shown in Fig. 2 and the recorded absorption bands summarized in Table 2. The absorption bands observed between 3339 and 3464 cm− 1 are ascribed to the stretching vibrations of hydrogen-bonded H₂O molecules. In the range of 3120–3170 cm− 1, the novel IL compound exhibits absorbance maxima associated with the stretching vibrations of C–H bonds in the aromatic ring. Additionally, the stretching vibrations of aliphatic C–H bonds are seen between 2855 and 2930 cm− 1. Bands in the 1383–1420 cm− 1 region are associated with C–N stretching modes in the piperidine and pyridine rings36,37,38.

Table 2 Infra-Red spectra of (ILI-ILIV) (wavenumber cm-1).
Fig. 2
figure 2

FTIR for ionic liquids ILI-ILIV.

1H-NMR

Tables 3 and Figs. 3, 4, 5 and 6 present the chemical shifts (δ ppm) observed in the proton nuclear magnetic resonance (NMR) spectra for the various compounds labeled as ILI, ILII, ILIII, and ILIV. These chemical shifts provide insight into the local chemical environment of specific protons in each compound. For example, in compound ILI, protons ‘a,’ ‘b,’ ‘c,’ ‘d,’ ‘e,’ ‘f,’ ‘g,’ and ‘h’ exhibit distinct chemical shifts at 7.58, 7.55, 7.51, 4.65, 3.35, 1.87, 1.86, and 1.85 ppm, respectively. The corresponding spectral descriptions (e.g., ‘t’ for triplet, ‘d’ for doublet, ‘s’ for singlet) offer additional information about the proton’s coupling and multiplicity. Similarly, compounds ILII, ILIII, and ILIV display their respective chemical shifts and multiplicity patterns for their protons. These chemical shifts are essential for elucidating the molecular structure and connectivity of the compounds, assisting in their identification and structural characterization through NMR spectroscopy.

Table 3 Chemical shifts for different types of protons in ILI-ILIV.
Fig. 3
figure 3

1HNMR for ionic liquid ILI.

Fig. 4
figure 4

1HNMR for ionic liquid ILII.

Fig. 5
figure 5

1HNMR for ionic liquid ILIII.

Fig. 6
figure 6

1HNMR for ionic liquid ILIV.

Electrochemical measurement

PP measurements

The plot of OCP against time for C-Steel in 1 M HCl solution in the absence and presence of different doses of ILs at 25 °C is shown in Fig. S2. After 900 s, the OCP became stable and steady values. Fig. 7 presents the Tafel polarization curves for C-steel in a 1 M (HCl) solution, both with and without inhibitors, at different concentrations of ILs at 25 °C. These curves provide insight into the electrochemical behavior of C-steel when exposed to the corrosive solution, with and without the presence of IL-based inhibitors. The polarization parameters associated with these curves are detailed in Table 4, including the current corrosion density (Icorr), which indicates the rate of electrochemical corrosion, as well as the Tafel slopes (βa and βc) that characterize the kinetics of the anodic and cathodic reactions, respectively. In addition to these parameters, the polarization resistance (Rp), which reflects the resistance of the material to corrosion, and the corrosion rate (C.R.), which quantifies the rate of material degradation, were also measured. Surface coverage (θ) was calculated, representing the fraction of the C-steel surface protected by the inhibitors, and the inhibitor efficiency (ηp%) was determined to evaluate how effectively the ILs prevent corrosion. As the concentration of ILs increases, a significant decrease in the corrosion current density (Icorr) is observed, which implies that the ILs are successful in reducing the rate of corrosion of C-steel in the HCl solution. This reduction in Icorr suggests that, at the optimal concentration, the ILs function effectively as corrosion inhibitors. Furthermore, both the anodic and cathodic branches of the polarization curves shift toward more negative current densities with increasing IL concentration. This shift indicates that the inhibitor acts in a mixed inhibition mode, simultaneously affecting both anodic and cathodic reactions. In other words, the inhibitor not only slows down the anodic dissolution of the steel but also reduces the cathodic reactions, thereby significantly decreasing the overall corrosion rate39,40. Furthermore, the adsorption of ILs onto the steel surface, which blocks the active sites, does not alter the underlying corrosion reaction mechanism41. The θ and ηp% were determined using the following Eqs.42,43:

Fig. 7
figure 7

PP for ionic liquids (ILI-ILIV).

Table 4 Polarization parameters for ILI-ILIV in 1 M HCl without and with various concentrations.
$$\Theta {\text{ }}={\text{ }}\left[ {\left( {{{\text{I}}_{0{\text{ corr}}}}-{\text{ }}{{\text{I}}_{{\text{corr}}}}} \right)/{{\text{I}}_0}{\text{corr}}} \right]$$
(1)
$${\text{\varvec{\upeta}p}}\% {\text{ }}={\text{ }}\left[ {\left( {{{\text{I}}_{0{\text{ corr}}}}-{\text{ }}{{\text{I}}_{{\text{corr}}}}} \right)/{{\text{I}}_{0{\text{corr}}}}} \right] \times {\text{ 1}}00$$
(2)

where Icorr and I0 corr represent the corrosion current densities in the presence and absence of the inhibitor, respectively, after calculating ηp%, we found that the inhibition efficiency of the ILs was approximately 96%.

EIS measurements

EIS offers crucial information regarding the dynamics of electrode processes as well as the surface properties of the system being studied. The patterns observed in the Nyquist plots reveal important mechanistic details about the interactions occurring at the electrode interface44,45. Fig. 8 displays the Nyquist plots for ILs in a 1 M HCl solution at 25 °C, showing data for both the absence and presence of different concentrations of the inhibitors. The impedance parameters obtained from the EIS measurements are summarized in Table 5. The Nyquist plots clearly indicate that the presence of the inhibitors significantly influences the impedance response of mild steel in the acidic solution. This observation suggests that as the concentration of the inhibitors increases, the impedance of the solution also rises. The plots display a single depressed semicircle common to both the uninhibited and inhibitor-containing solutions. However, the diameter of this semicircle expands considerably with higher inhibitor concentrations, reflecting a shift in impedance. This increase in diameter with rising IL concentrations indicates that the corrosion mechanism remains unchanged with the addition of the inhibitors46. The observed rise in impedance at low frequencies (Fig. 9) can be attributed to the adsorption of inhibitor compounds onto the surface of C-steel. To analyze the impedance spectra of mild steel corrosion in 1 M HCl, both with and without various concentrations of the inhibitor compounds, the Randle equivalent circuit was applied to model the data (Fig. 10). Furthermore, a single maximum in the Bode plots (Fig. 9) suggests that a single charge transfer primarily hindered the corrosion process47,48. The inhibition efficiency improves as the inhibitor concentration increases, with the highest concentration of 100 ppm showing a maximum inhibition efficiency of approximately 96%. The (ηp %) was determined by the following equations49:

Fig. 8
figure 8

Nyquist plots for ionic liquids (ILI-ILIV).

Table 5 EIS parameters for ILI-ILIV in 1 M HCl without and with various concentrations.
Fig. 9
figure 9

Bode plots for ionic liquids (ILI-IV).

Fig. 10
figure 10

Equivalent circuit used for EIS analysis.

$$\Theta {\text{ }}={\text{ }}[({{\text{R}}_{{\text{oct}}}} - {{\text{R}}_{{\text{ct}}}})/{{\text{R}}_{{\text{oct}}}}]$$
(3)
$${\text{\varvec{\upeta}p}}\% ={\text{ }}[({{\text{R}}_{{\text{oct}}}} - {{\text{R}}_{{\text{ct}}}})/{{\text{R}}_{{\text{oct}}}}] \times {\text{ 1}}00$$
(4)

where Rct and Roct represent the charge transfer resistances with and without inhibitors, respectively. The inhibition efficiency increases with higher inhibitor concentrations, reaching its peak at the maximum concentration.

EFM measurements

Fig. 11 presents a representative electrochemical frequency modulation (EFM) spectrum for C-steel in 1 M HCl at 25 °C for ILI, illustrating the harmonic and intermodulation current peaks. These prominent peaks were utilized to determine the Icorr, Tafel slopes (βc and βa) and causality factors (CF-2 and CF-3), with the extracted values summarized in Table 6. The corrosion rate of C-steel declines as the inhibitor concentration increases. A significant reduction in the C.R. from approximately 460 m.p.y to 11.40 m.p.y for ILIV demonstrates the high efficiency of the corrosion inhibitors studied. At the highest concentration, the inhibition efficiency reaches approximately 97%.

Fig. 11
figure 11

EFM for ILI.

Table 6 EFM parameters for ILI-ILIV in 1 M HCl without and with various concentrations.

Based on the data obtained from PP, EIS, and EFM, the four IL compounds (ILI-IV) effectively inhibit the steel erosion of 1 M HCl at a concentration of 100 ppm. The primary structural difference among these compounds lies in the number of aromatic rings and the position of methyl substitution, with all four compounds possessing nitrogen atoms with lone pairs of electrons. ILI, containing only a single aromatic ring, exhibits lower inhibition efficiency compared to ILII-IV. This can be related to the greater ability of multiple aromatic rings to donate e- to the vacant d-orbitals of Fe while simultaneously accepting electrons from Fe, thereby enhancing adsorption and corrosion inhibition (See supplementary fig.S3)47,48,49.

Adsorption isotherm

Isotherms are essential tools for characterizing the mode and extent of these interactions. In this research, adsorption is linked to the θ of the metal by the inhibitor and its concentration in the corrosive medium. A range of adsorption isotherm models including Langmuir, Freundlich, Temkin, Frumkin, and Flory-Huggins were applied to fit the potentiodynamic polarization data. The linear equations, along with the corresponding slope values, intercepts, and regression coefficients (R²), are summarized in Table 7. Among these models, the Langmuir isotherm provided the best fit, as indicated by R² values closest to unity, suggesting monolayer adsorption of the ILs on the C-steel surface50. The adsorption of ILs onto the mild steel surface is best represented by the Langmuir adsorption isotherm, which is mathematically described by the following expression50:

Table 7 Adsorption isotherm models for ILI–ILIV inhibitors, including R² values, slopes, and intercepts, based on data from potentiodynamic polarization measurements at 25 °C.
$$\:\frac{c}{\theta\:}=\:\frac{1}{\text{k}}+\:c$$
(5)

where Kads is the equilibrium constant of the adsorption process, and C represents the inhibitor concentration. By substituting the experimentally obtained θ values from PP measurements into this equation and plotting C/θ against C, Kads can be determined, as shown in Fig. 12.

Fig. 12
figure 12

Langmuir adsorption for ILs at 25 °C. Obtained from pp data.

The calculation of the standard free energy of adsorption (ΔG°ads) was carried out using the following equation51:

$$\Delta {{\text{G}}^0}{\text{ads}}\,=\, - \,{\text{RT ln }}\left( {{\text{55}}.{\text{5 }}{{\text{K}}_{{\text{ads}}}}} \right)$$
(6)

In this equation, the constant 55.5 corresponds to the molar concentration of water in the solution, R denotes the universal gas constant (8.314 J K− 1 mol− 1), and T represents the absolute temperature.

The calculated values of ΔG°ads are − 34.30, − 33.38, − 33.41, and − 29.89 kJ·mol⁻¹ for ILI, ILII, ILIII, and ILIV, respectively. The adsorption process can be categorized based on the values of ΔG°ads as follows:

  1. (i)

    When ΔG°ads exceeds − 20 kJ mol⁻¹, the adsorption is mainly due to physical interactions (physisorption), which are governed by electrostatic forces.

  2. (ii)

    When ΔG°ads is below − 40 kJ mol⁻¹, the adsorption is primarily chemical (chemisorption), involving the formation of bonds through electron transfer from the inhibitor to the metal surface.

  3. (iii)

    For values of ΔG°ads between − 20 and − 40 kJ mol⁻¹, a combination of both physical and chemical adsorption mechanisms occurs.

For the ILs studied here, the computed ΔG°ads values fall below − 40 kJ mol⁻¹, indicating that the adsorption mechanism is a blend of both physical and chemical adsorption52,53,54,55.

Quantum chemical calculations

Figs. 13 and 14 illustrate the optimized geometry structure, along with the HOMO, LUMO, and electron density distribution of the cationic inhibitor. The HOMO (Highest Occupied Molecular Orbital) signifies the ability of the inhibitor molecule to release electrons. In contrast, the LUMO (Lowest Unoccupied Molecular Orbital) represents its capacity to receive electrons from the metal surface53. The energy values of HOMO and LUMO correlate with parameters such as work function (Ø), chemical hardness (h), global softness (S), and electrophilicity index (ω). Table 8 presents the Fukui indices and Mulliken atomic charges for the four synthesized ionic liquids (ILI–ILIV)28 .

Fig. 13
figure 13

Optimized structures, HOMO and LUMO distributions of ILI-ILIV.

Fig. 14
figure 14

Electron density and Muliken charge for ILs.

Table 8 Calculated quantum-chemical parameters for the synthesized Azo phenol compounds ILI-ILIV.

According to frontier molecular orbital theory, an inhibitor molecule with a higher EHOMO value can more readily transfer electrons to the vacant d-orbitals of iron. Conversely, a lower ELUMO value enhances the molecule’s ability to accept electrons from Fe. A smaller energy gap (ΔE = ELUMO - EHOMO) generally indicates a higher adsorption capability of the inhibitor onto the surface of C-steel, enhancing its corrosion inhibition potential56,57. As shown in Table 9; Fig. 15, the ΔE values for ILII–ILIV are lower compared to ILI. This suggests that ILII–ILIV, which contains two aromatic rings, can more effectively donate and accept electrons in interactions with Fe. Among them, ILII exhibits the highest adsorption strength on C-steel and superior inhibition performance relative to the other ionic liquids. These findings align well with the experimental data, further confirming the theoretical calculations. Table 10 presents a comparative analysis of the inhibition efficiency (IE%) of various ionic liquids (ILs) used as corrosion inhibitors for carbon steel in acidic media, specifically at relatively high concentrations. The inhibition efficiencies were determined using Electrochemical Impedance Spectroscopy (EIS), a reliable technique for evaluating corrosion protection performance58,59.

Table 9 Calculated Fukui indices and mulliken atomic charges for ILI-ILIV.
Fig. 15
figure 15

ΔE values for compound ILI-ILIV.

Table 10 Comprehensive comparison of ILs as corrosion inhibitors at high concentration.

Conclusion

The structural characterization of the synthesized ionic liquids (ILI–ILIV) was comprehensively established using elemental analysis, FT-IR spectroscopy, and 1H-NMR spectroscopy. The elemental analysis results confirmed that the experimental composition of all inhibitors closely matched their theoretical values. FT-IR spectroscopy validated the presence of key functional groups, while 1H-NMR spectra provided deeper insights into the molecular environment and proton interactions within each compound.

Various electrochemical approaches, including PP, EIS, and EFM, showed that all four inhibitors effectively reduced the corrosion of C-steel by 1 M HCl, reaching up to 97% protection at an optimal concentration of 100 ppm. These inhibitors mainly function as dual-action inhibitors, where their adsorption onto the metal surface plays a crucial role in lowering the C.R. Further quantum chemical calculations confirmed these findings, revealing that ILII–ILIV exhibited better performance due to their ability to coordinately share electrons more effectively, which is attributed to their aromatic ring structures and narrower energy gaps.

Overall, both experimental and theoretical results confirm that the investigated ionic liquids serve as effective corrosion inhibitors for C-steel in acidic solutions.