Introduction

Corrosion is a slow, continuous, spontaneous process that occurs naturally”. Lately, “there have been significant financial losses, environmental harm”, and even potential concealed concerns to human safety as a result of metal corrosion1. “Thus, effectively preventing metal corrosion has long been the primary goal of concerned researchers. High carbon steel is a type of carbon steel that has excellent mechanical and flexible capabilities. It can be used to make wire products, plates, and body parts for automobiles. Sadly, mild steel rusted easily over extended periods of service due to exposure to harsh and complex environments2.

The authors selected hydrochloric acid (HCl) solution as the corrosive medium due to its widespread industrial relevance and aggressive corrosive nature. HCl is commonly used in acid cleaning, pickling of metals, descaling, and oil well acidizing operations, where metallic materials are frequently exposed to highly acidic environments3. Also, HCl, H2SO4 are particularly significant because they promote uniform and localized corrosion, allowing researchers to assess inhibitor efficiency, material resistance, and surface film stability under severe chemical stress.

The purpose of inhibitor is to stop CS corrosion. The inhibitors’ ability to establish an adsorbing layer on CS by physisorption or chemisorption is connected to their efficacy in inhibiting corrosion4. The kind of corrosive media, the chemical makeup of the inhibitors, and the kind and state of the metal surface all have an impact on the adsorption5,6. Good corrosion inhibitors are heterocyclic organic compounds with plenty of bonds and heteroatoms like O, N, and S that can be adsorbed on the metal surface7. The primary outcome of corrosion inhibition is the mitigation of potential hazards resulting from the thinnest metal in tanks and pipes which could cause material leak and catastrophic events like explosions and fires. Stated differently, the suppression of corrosion raises concerns regarding environmental protection and safety8. Plant extracts encompass a variety of organic compounds such as polyphenols, flavonoids, tannins, and alkaloids, which have established corrosion inhibition properties9,10,11,12,13. Numerous studies have explored the corrosion inhibition potential of plant extracts on metal and its alloys across different media. These extracts are typically derived from leaves, stems, seeds, or fruits of various plant species. Some commonly studied plant extracts for metal alloy corrosion inhibition include those from neem, aloe vera, green tea, mango leaves, and garlic14,15,16,17,18. By creating a barrier on the metal surface, plant extracts prevent corrosion by slowing down the corrosion process. The adsorption of phytochemicals onto the metal surface, which prevents corrosive substances from entering and stabilizes the passive oxide layer, may be one of the specific mechanisms behind inhibition19,20,21,22. Therefore, CPS extract is eco-friendly substance to inhibit the corrosion of CS in acidic media”.

Capparis spinosa, the caper bush, also called Flinders rose is a perennial plant that bears rounded, fleshy leaves and large white to pinkish-white flowers. Capparis spinosa (Caper) leaf extracts have been studied in Egypt for various medicinal properties, including antioxidant, anti-inflammatory, anti-diabetic, anti-cancer, and antimicrobial activities. The extracts are rich in bioactive compounds like flavonoids and phenolic acids, which are responsible for these beneficial effects (Figs. S1-S4 see supplementary file)). Studies have focused on the anti-carcinogenic properties of Caper leaf extracts against specific cell lines and their potential use for gastrointestinal issues. The below Table 1 shows list of extract sources used for corrosion inhibition of metals in different media.

Table 1 Lists of plant extracts used as corrosion inhibitors for metals and alloys in different solutions.

The novelty statement for a green inhibitor (such as a CPS extract) is the claim that the study closes a knowledge gap by offering a new, environmentally friendly, and efficient solution and/or by offering previously unheard-of, comprehensive information on its protective mechanism, thus contributing both theoretically and practically to sustainable corrosion control.

The present study offers an advantage by providing a detailed investigation of corrosion behavior in HCl medium, emphasizing the effectiveness of the proposed protection method under realistic acidic conditions using different methods [weight loss (WL) method, (PDP), and (EIS)]. This not only contributes to understanding the underlying corrosion mechanisms but also supports the development of more durable and sustainable corrosion control strategies for industrial applications.

figure a

Experimental techniques

Materials and solutions

“The CS (1018) sheets which were used in this study had the following chemical composition, expressed as a weight%”: “0.0003 Silicon, 0.024 Phosphorus, 0.35 Manganese, 0.20 Carbon, and Fe the remaining percentage. By diluting the 37% hydrochloric acid utilizing bidistilled water, a 1 molar of the corrosive solution was created. A 1 cm by 1 cm work surface was the sole part of the CS electrodes that was not sealed with epoxy and submerged in the corrosive test solution (HCl 1.0 mol./L). The CS electrode was sequentially polished using the emery sheets (grades 250–1200) before to electrochemical tests”. After rinsing with bidistilled water, the polished CS was allowed to cool before being dried with cold air.

Preparation of CPS extract

After being cleaned with deionized water, the (CPS) were dried. CPS was subsequently ground into tiny fragments. “Ten grams of dried leaves were weighed and placed to a 150 mL conical flask. The mixture was then mixed with one hundred milliliters of 70% ethanol. After being soaked for 48 hrs at 25 °C, the mixture was shaken for four hours at 25°C. After filtering the mixture through filter paper, it was kept at 0–5°C for later testing. Following the filtering process, the CPS extract was vacuum-concentrated to a precise volume of around 100 mL, and the extract dose was determined. A 1000 ppm stock solution was made by mixing one gram of the extract with one thousand milliliters of bi-distilled water. The extract used in the study was prepared by diluting CPS extract with bidistilled water, and its dose varied from 50 to 300 ppm”. The literature on the chemical components of CPS extract indicates that ferulic acid (c), p-coumaric acid (b), Syring aldehyde31. The toxicity of CPS extract is generally low under normal conditions. Capparis spinosa extract contains a diverse array of bioactive compounds, including flavonoids, alkaloids and other components like tocopherols, carotenoids, and various phenolic acids. These compounds are found in different parts of the plant, including the flowers, fruits, leaves, stems, and roots, and contribute to its various medicinal properties, such as antioxidant, anti-inflammatory, and antimicrobial effects. Quercetin, part of a subclass of flavonoids called flavonols, has received considerable attention because of its.

beneficial impact on health. Its biochemical activity is well documented. It is one of the most potent antioxidants among polyphenols32. Quercetin has also been to demonstrate to display the antiviral, antibacterial, anticarcinogenic and anti-inflammatory effects33. Also, is a strong antioxidant due to its ability to scavenge free radicals and bind transition metal ions. These properties of quercetin allow it to inhibit lipid peroxidation34. Its structural formula is presented in Scheme 1.

figure b

Scheme 1: List of some phytochemical constituents isolated from CPS extract

WL experiment

The CS coupons used in this WL method were established in accordance with the ASTM G 31–7235 standard. “The CS samples sized at 2 cm x 2 cm x 0.01 cm, the CS specimens underwent mechanical polishing and abrading emery sheets with a grade range of 250–1200. After being cleaned utilizing bi-distilled water and acetone, they were dried using filter sheets in accordance with standard procedure. The specimens were weighted and then immersed in 100 mL solution in 150 mL beakers with varying concentrations of CPS extract and 1 M HCl at temperatures between 25 and 45°C. The CS specimens were removed from the solution, cleaned, dried, and weighed again after different durations” (30 to 180 min)36. All experiments were carried out in stagnant aerated solutions. The following equation was used to determine the metal sample’s corrosion rate (CR)37:

$$\:CR=\:\frac{\varDelta\:W}{AT}$$
(1)

where A (cm2) is the area of the specimen, t (min) is the time of immersion, and ∆W (mg) is the weight reduction. The surface coverage (Ɵ) and inhibition effectiveness (% IE) can be derived as described below38:

$$\% IE = \theta \times 100 = \left( {1 - \frac{{\Delta {W_1}}}{{\Delta {W_2}}}} \right) \times 100$$
(2)

where ∆W1 represents WL while the extract is present and ∆W2 represents WL when it is not.

Electrochemical measurements

“The Gamry device cell (PCI4/750). Potentiostat./Galvanostat./ZRA comprises three electrodes”: “a SCE reference electrode, the counter electrode, which is a platinum wire, and a CS serving as the working electrode. A 1 × 1 centimeter square-shaped sample was connected electrically using a copper wire weld. It was then placed inside a Teflon tube and secured with an adhesive to function as a working electrode. Similar to the WL method, the electrode’s surface underwent treatment. Every electrochemical measurement was run at 25°C. The testing was started after allowing the CS to stabilize for 30 min prior to measurement. Tafel curves were developed using PDP analysis, applying potentials between − 1.5 and 0.5V versus OCP with sweep rate of 0.2 mVs[─ 1. Using the Tafel extrapolation method, the values of the corrosion potential (Ecorr) and corrosion current density (icorr) were calculated”. The PDP test yielded the following values for ʔ and % IE, as indicated below39:

$$\:\% {\text{IE = }}\theta \:\:{\text{x100 = }}\left[ {\:{\text{1 - }}\frac{{{{\text{i}}_{{\text{corr}}\left( {{\text{inh}}} \right)}}}}{{{{\text{i}}_{{\text{corr}}\left( {{\text{free}}} \right)}}}}} \right]{\text{x}}\:{\text{100}}$$
(3)

“where icorr(inh) represents the density of the corrosion current while the extract is present and icorr(free) represents the density of the corrosion current when it is absent. The equation Ɵ = [1 – (icorr(inh)/icorr(free))] is derived from the postulate that the inhibitor operates via a blocking mechanism. The EIS tests were run at the OCP over the frequency range 105 – 10− 2 Hz with a signal amplitude perturbation of 10 mV”. Below is the equation used to determine the values of θ and % IE from EIS tests40:

$$\:\% IE = \:\:x100 = \left[ {\:1 - \frac{{{R_{ct\left( {free} \right)}}}}{{{R_{ct\left( {ich} \right)}}}}} \right]x100$$
(4)

where the charge transfer resistance in the blank solution is denoted by Rct(free), and the charge transfer resistance in the inhibited solution by Rct(inh). To determine the impedance parameters Rct and Cdl, the impedance data was fitted to a suitable equivalent circuit. All tests were conducted in air-exposed stationary solutions. We conducted experiments in triplicate to ensure the reliability of our results.

Surface morphology

AFM examination

An effective method for examining the form of metal surfaces at the nano and micro scales is the AFM technique. This analysis’s ability to measure surface roughness is its main benefit. The 2 × 2 cm CS specimen was prepared as previously described in the WL method, and it was then submerged in 1.0 M HCl for three hours with and without a 300 ppm extract from CPS. The Japanese-made Shimadzu Wet-SPM (Scanning Probe Microscope) type was used for AFM testing.

FT-IR spectroscopy analysis

FT-IR investigations were carried out to determine the spectrum inhibitors structure that produces peaks with values in order to “learn more about the functional groups” of the extract both before and after its adsorption on CS. Following the WL technique, the 2 × 2 cm CS specimen was prepared, immersed for 3 h in 1 M HCl containing 300 ppm CPS extract and then directly investigated utilizing FT-IR spectra by (ATR-IR Affinity-1, Shimadzu, Japan).

Results and discussion

WL measurements

“The effect of adding varying amounts (50–300 ppm) of CPS extract on CS corrosion in a 1.0 M HCl solution was evaluated utilizing the WL method”. “The association between the impact of various doses of CPS extract on CS surface WL- time curves at 25 °C was depicted in Fig. 1. It is evident that the WL of CS with the extract present was significantly lower than the WL in the free extract solution. As the extract dose grow, the layer created by the extract molecules adsorbed on the metal surface causes the WL to drop. This layer protects the metal’s corrosive sites and keeps the metal from corroding in the corrosive environment. The WL-time curves are roughly linear, signifying that the CS surface is free of oxide films41. Exceeding the optimal extract dose of 300 ppm results in solution saturation. Additionally, the possibility exists of powerful interactions between extract molecules anchored to the metal and those within the solution, as reported in the literature42 This interaction may induce desorption of the adsorbed extract layer into the solution”.

Fig. 1
figure 1

Impact of increasing dose of CPS extract on WL at 25 °C for CS in 1 M HCl”.

Temperature effect

Using WL tests, the impact of different temperatures (25–45 °C) on “CS corrosion in 1.0 M HCl with and without varying extract doses was investigated”. “Table 2 displays the evaluations of CR and % IE derived from the WL tests for varying extract doses in 1 M HCl solution at altered temperatures. The findings showed that a rise in the dose of the extract leads to a reduction in CR value and a growth in % IE. This is an outcome of the extract’s growing degree of adsorption and subsequent covering of the CS surface as extract dose increases”. “The percentage of IE that increases as temperature rises shows that the extract may be chemisorbed on the CS surface”43.

Table 2 Variations of CPS extract dosages and their impact on kcorr, θ and % IE of CS in 1 M HCl at different temperatures.

“Using the Arrhenius relationship, we can estimate the energy of activation (Ea*) as follows”44:

$$\log {\text{CR}} = \log A - \left( {\frac{{E_{\text{a}}^*}}{{2.303RT}}} \right)$$
(5)

A is the pre-exponential multiplier. As displayed in Fig. 2, “the log C.R against 1/T plots attendance and without doses of CPS extract produced straight lines with slopes from which the Ea* values were obtained”. “The next equation was used to calculate ΔH* and ΔS* of activation for the corrosion of CS[“ 45:

$${\text{CR}} = \left( {\frac{{RT}}{{Nh}}} \right)\exp \left( {\frac{{\Delta {S^*}}}{R}} \right)\exp \left( {\frac{{ - \Delta {H^*}}}{{RT}}} \right)$$
(6)

“Plot (1/T) vs. log (CR/T) produced linear graphs (Fig. 3) and from their slopes and intercepts”, “the values of ΔH* and ΔS* were obtained, respectively. Table 3 contains the computed values for Ea*, ΔH*, and ΔS*, both with and without the extract present. The results in Table 3 indicates that the values of Ea*of the molecules adhered to the metal surface through chemical adsorption. It is suggested that disorder arises when the reactant changes into the activated complex due to the negative ΔS* values, which showed that an association phase rather than a dissociation phase is included in the activated complex within the rate-limiting step46. The positive ΔH values indicate that the adsorption of CPS molecules onto the CS surface is endothermic. A decrease in ΔH* in the presence of the extract compared to the blank solution suggests a lower energy barrier for the corrosion reaction”. The close agreement between Ea* and ΔH* values (differing by approximately RT) supports a single-step, single-molecule dissolution mechanism for CS in the acidic medium47.

Fig. 2
figure 2

Log “CR” vs. “1000/T” for CS in a 1 M HCl solution with and without CPS extract.

Fig. 3
figure 3

Log “CR/T” vs. “1000/T” for CS in a 1 M HCl solution with and without CPS extract.

Table 3 Values of Ea*, ΔH* and ΔS* for CS in a 1 M HCl solution in presence and absence of CPS extract”.

Isotherms of adsorption

The information required to comprehend the corrosion mechanism was obtained by the analysis of adsorption isotherms. “The Temkin adsorption isotherm equation (Eq. 7)48 is the most appropriate isotherm to fit the data after applying the different adsorption isotherms.” This isotherm demonstrates that the part of the CS surface that is protected by the inhibitor, θ, is determined by the inhibitor dose, Cinh.

$$\ln K{C_{{\text{inh}}}} = a\theta$$
(7)

Kads represents the equilibrium constant for adsorption in the adsorption–desorption process. Three presumptions underpinned the Temkin adsorption isotherm: (i) a single layer of the adsorbate was adsorbed at a predetermined number of adsorption locations; (ii) there was no lateral interaction or steric hindrance among the adsorbed molecules; and (iii) all adsorption points on the adsorbent had constant activation energy, adsorption, and enthalpy. Temkin isotherm diagrams at different temperatures result in straight lines with R2 almost equal to unity, as seen in Fig. 4. The adsorption’s free energy (ΔGoads)49 values were obtained using the following equation:

$${K_{{\text{ads}}}} = \left( {\frac{1}{{55.5}}} \right)\exp \left( {\frac{{ - \Delta G_{{\text{ads}}}^\circ }}{{RT}}} \right)$$
(8)

where 55.5 is the dose of water, in mol/L, at the metal/solution interface. Adsorption free energy (ΔG°ads) values were calculated, considering water concentration (55.5 mol/L) at the metal/solution interface”. The negative ΔG°ads values in Table 4 indicate spontaneous and stable adsorption of the extract onto the CS surface. Based on general guidelines, adsorption is considered physical for values around − 20 kJ/mol and chemical for values below − 40 kJ/mol. The calculated ΔG°ads values between − 38.1 and − 49.3 kJ/mol suggest a predominantly chemisorptive mechanism50. Enthalpy of adsorption (ΔH°ads) was determined using51:

$$\log {K_{{\text{ads}}}} = \frac{{ - \Delta H_{{\text{ads}}}^\circ }}{{2.303RT}} + {\text{constant}}$$
(9)

“Plots log Kads vs. 1/T for dissolving of CS in a 1 M HCl solution contains CPS is displayed in” Fig. 5. show straight line with regression constant R2 = 0.9139 “offerings positive ΔHoads data, suggesting an endothermic adsorption process”. “This elucidates the reason for the experimental results where the IE rises with temperature”. Finally, the entropy of adsorption (ΔSoads) can be found using the following formula25:

$$\Delta S_{{\text{ads}}}^\circ = \frac{{\Delta H_{{\text{ads}}}^\circ - \Delta G_{{\text{ads}}}^\circ }}{T}$$
(10)

The negative signs of ΔS° indicate reduced disorder upon transition from the reactant to the adsorbed metal. This supports the potency and adsorption power of extract.

Fig. 4
figure 4

Temkin isotherm for adsorption of CPS extract on the surface of CS in a 1 M HCl solution at different temperatures”.

Fig. 5
figure 5

log Kads vs. 1/T plots for CS dissolving in 1 M HCl.

Table 4 “Adsorption parameters for CPS extract on CS surface at different temperatures”.

Electrochemical measurements

PDP curves

PDP curves were obtained for carbon steel (CS) in 1 M HCl solution with and without various concentrations of CPS extract at 25 °C (Fig. 6). “A shift of both anodic and cathodic curves to more positive and negative potentials, respectively, indicates the mixed-type inhibitory behavior of the extract. Corrosion current density (icorr) and corrosion potential (Ecorr) values were determined from the extrapolation of the linear portions of the polarization curves. These data were subsequently used to investigate the adsorption mechanism. The corrosion rate will be computed using these parameters. The results of electrochemical parameters at different CPS extract doses were recorded in Table 5. The addition of 300 ppm produced the best inhibitory efficiency value of 79.7% (Table 5). “This finding suggests that raising the dose to 300 ppm will effectively slow down the step of CS corrosion”. “The connection between the rise in inhibition efficiency and the fall in current density is linear”. “The adsorption mechanism was examined using the PDP measurement findings”. The anodic (βa) and cathodic (βc) Tafel slope values are essentially unchanged, as demonstrated in Table 5, resulting in an almost parallel collection of cathodic and anodic lines. Consequently, in these solutions, the adsorbed extract molecules decrease the surface area susceptible to corrosion without affecting the underlying corrosion mechanism of CS52,53. Conversely, the Ecorr data does not show any regular displacement pattern, indicating that the CPS extract functions as a mixed-type inhibitor. According to multiple studies54, the behavior of CPS extract as anodic, cathodic, or mixed-type inhibitor depends on the magnitude of Ecorr displacement relative to the blank”. The extract has an anodic or cathodic function if this displacement beats 85 mV. However, when the displacement is less than 85 mV, as in our case (27 mV), the extract exhibits mixed-type inhibition characteristics. As shown in Table 5, icorr dropped from 205 to 47.4 mA/cm2 and the CR altered from 93.8 to 21.8 mpy in the existence of 300 ppm of the extract. It’s owed to the molecules of the extract covering a great portion of the metal surface, impeding its corrosion”. A comparison of PDP curves with and without varying doses of CPS extract reveals that increasing the extract’s dose shifts the Ecorr towards less negative values and diminishes the anodic process55.

Fig. 6
figure 6

PDP curves at 25 °C for CS in a 1 M HCl solution with and without multiple doses of CPS extract.

Table 5 PDP parameters for the dissolution of CS at 25 °C with and without multiple doses of CPS extract.

EIS measurements

EIS was employed to investigate the kinetics and surface properties of the carbon steel (CS) electrode. Nyquist and Bode plots obtained at 25 °C (Figs. 7 and 8) illustrate the behavior of CS in 1.0 M HCl solution in the absence and presence of various CPS extract concentrations. “EIS parameters, including double-layer capacitance (Cdl) and charge transfer resistance (Rct), were extracted from the data and are summarized in Table 6. The increasing diameter of the semicircle in the Nyquist plots (Fig. 7) with increasing extract concentration indicates that the corrosion process is predominantly controlled by charge transfer. The semicircular Nyquist plot form (Fig. 7) indicates the roughness and inhomogeneity properties of the electrode surface. “Moreover, the semicircle at the top of the frequency area is related to the time constant, which is also connected to CPE (Y0 is its magnitude) which is considered a surface irregularity of the electrode and ct. The values of Y0 decrease as dl by improving doses of extract. The analogous circuit model (Fig. 9) shows a general instance of the frequency response of an interface defined by charge transfer and diffusion processes. The development of a protective layer on the surface of CS is responsible for the increase in log (Z) values for varying inhibitor concentrations in the Bode diagram (Fig. 8), which also shows a drop in frequency values. However, when compared to the blank (40o), the phase angle values rise to a more negative value of roughly 60o for an ideal concentration of 300 ppm, suggesting that the tested inhibitor is effective. Table 6 illustrates that when extract dose rises, Rct values rise and Cdl values drop. This is explained by water molecules exchanging with extract-adsorbed molecules and/or thicken the double layer”. Higher Rct values with increasing CPS extract doses are consistent with superior resistance to electrochemical corrosion at elevated extract doses. But when the extract is added to 1.0 M HCl, the “n” values decrease (from 0.985 to 0.977) in comparison to the results obtained in the reference electrolyte (0.991). This means that the “n” value lessens with the increase in extract dose, suggesting that the extract does not adsorb onto the CS surface uniformly, hence the surface is comparatively homogeneous56,57. The precision of the fitting results was assessed utilizing the chi-squared method”. “The achieved results for all outcomes reveal that the fitted results strongly concur with the experimental data, as indicated by the modest chi-squared values” (Table 6). “This method’s 83.7% inhibitory efficiency (Table 6) is in good accord with the PDP method”.

Fig. 7
figure 7

Nyquist diagrams at 25 °C for CS in a 1.0 M HCl solution with and without multiple doses of CPS extract”.

Fig. 8
figure 8

Bode diagrams 25 °C for CS in a 1.0 M HCl solution with and without multiple doses of CPS extract”.

Fig. 9
figure 9

The analogous circuit models.

Table 6 EIS parameters 25 °C for CS in a 1.0 M HCl solution with and without multiple doses of CPS extract.

Examining the surface

AFM tests

When discussing the inhibitory effect on the metal/solution interface, “AFM has proven to be a useful instrument for estimating surface morphology investigations58. An essential test for determining a metal’s surface roughness at the maximum resolution in nanometer fraction is AFM. This method can provide information about the metal surface’s shape, which is helpful for studies on corrosion science. Figure 10 displays three-dimensional AFM pictures. In contrast, the CS sample treated with 300 ppm CPS has low roughness (147 nm) and a smoother surface when compared to the blank sample”. This is significant because the CPS adsorbed on the surface of the CS metal creating a protective film59. The average roughness (Ra) shows that the metal surface after being submerged in 1.0 M HCl is destroyed and the roughness rises (581 nm) as in Table 7.

Table 7 3D AFM scans of the surface of CS samples with and without CPS extract.
Fig. 10
figure 10

AFM Micrograph for CS in 1 M HCl without (a) and with 300 ppm of CPS extract (b).

FT-IR analysis

FT-IR spectroscopy was employed to identify functional groups involved in the formation of the protective layer on the metal surface. Comparative spectra of pure CPS extract and extract adsorbed on the CS surface (Fig. 11) revealed key functional groups. A broad band at 3272 cm⁻¹ indicated the presence of O-H, C-H, and N-H groups, while bands at 2905 cm⁻¹ and 2798 cm⁻¹ corresponded to C-H stretching vibrations. The peak at 1262 cm⁻¹ was attributed to C = O and C-O (acidic) groups, and the band at 1067 cm⁻¹ was assigned to C-O stretching. A shift in peak positions between the spectra of pure and adsorbed extract suggests the involvement of these functional groups in the interaction between CPS and the CS surface60.

Fig. 11
figure 11

FT-IR spectra of CPS extract (black) and the extract adsorbed on the CS surface” (blue).

Theoretical calculations

Quantum chemical parameters

It was found that the content of quercetin varied from 1.7 mg/g to 12.8 mg/g among different parts of caper. So, we try to calculate the DFT and MC for this main component in caper extract (see Fig. S2 and Fig S3) in the supplementary files. According to the DMol3 module built within the Materials Studio version 7.0 software, quantum chemistry was used for all calculations in the current study. “Fig. 12 displays the examination of the inhibitors’ optimal geometry, Molecular electrostatic potential (MEP) map, highest occupied molecular orbital EHOMO denotes the ability of the molecule to donate electron, whereas ELUMO describes the ability of the molecule to accept electron. Thus, the highest value of EHOMO refer to a major affinity for the donation of electrons to unoccupied molecular orbital that was d-orbital of iron atoms and lowest unoccupied molecular orbital (LUMO) density distributions. HOMO and LUMO can determine the donation-acceptance capacity and the molecular reactivity of the inhibitor. The inhibition efficiency increases with an increase in EHOMO values along with a decrease in ELUMO values. The increasing values of EHOMO imply a superior tendency to donate electrons to the molecule with empty orbitals. The dipolar moment (µ) is a measure of the polarity with the covalent bond. The energy band gap ΔEg was defined as: ΔE = EHOMO − ELUMO. A smaller ΔE value indicates greater molecular reactivity. Generally, a smaller energy gap means a molecule can more easily donate or accept electrons, which facilitates stronger adsorption onto the metal. Therefore, a lower energy gap value corresponds to a highly reactive molecule with good corrosion inhibition efficiency on the metal surface61. Table 8 displays the calculated dipole moments (µ), which indicate the polarity of the covalent bonds within the studied compounds. The higher µ value of inhibitor (15.94 Debye) suggests greater asymmetry in its charge distribution. This larger dipole moment increases inhibitor polarity, leading to stronger electrostatic interactions between the inhibitor and the charged CS surface in acidic HCl media.

Table 8 “The quantum parameters for the investigated drug utilized (PM3)”.
Fig. 12
figure 12

Molecular structure of the investigated drug, and its Frontier molecular orbital density distribution (HOMO and LUMO) and the optimized molecular structure”.

Monte Carlo (MC) simulation

The side and top observations of the most suitable adsorption formations for the “inhibitor tested on CS surface obtained from the adsorption locator module are thus shown in Fig. 13. Adsorption energy is characterized as declining energy, when materials are mixed during the adsorption process in which an electron, ion, or molecule (adsorbent) is bound to the solid surface. Table 9shows that inhibitor has a greater adsorption energy, indicating that unused inhibitor will heavily adsorb on the toughened surface of CS to form adsorbed stable layers that will prevent corrosion62.”.

Table 9 Results and descriptors measured by the Monte Carlo simulation for adsorption of inhibitor molecule on Fe (1 1 0).
Fig. 13
figure 13

“The inhibitor’s equilibrium adsorption configuration on the surface of Fe (1 1 0): top and side views “.

This configuration, leading to greater surface coverage than other orientations, improves the overall inhibition efficiency (η). These findings support previous research in this study, which indicates that improved surface coverage results in more effective corrosion protection. Table 9 quantitatively illustrates this interaction. The most favorable adsorption interactions are associated with the lowest adsorption energies, which correspond to the most stable configurations observed in the system. The adsorption energy of inhibitor is calculated as 1566.677 kJ mol− 1, led to interact strongly with the surface63. The greater magnitude of adsorption energies in the aqueous phase indicates stronger adsorption interactions compared to the gas phase, as solvation effects in water enhance the stabilization of the inhibitor-metal complex. The results demonstrated that inhibitor with its higher dipole moment, lower HOMO-LUMO gap, and greater electron-donating ability, exhibits superior adsorption and interaction with the Fe (1 1 0) surface. This is further supported by the adsorption energies obtained from Monte Carlo simulations,

Mechanism of corrosion Inhibition

Based on electrochemical and WL studies, “it was found that the examined extract works by adsorbing on the metal surface in accordance with the Temkin isotherm, providing strong protection against corrosion of CS in a 1.0 M HCl solution. The co-adsorption of cationic species and Clions may account for the excellent inhibitive qualities of the CPS extract in HCl. Chemisorption and physisorption are the two types of coupled adsorption that are feasible. Both electrically charged metal surfaces and charged species in solution are necessary for physisorption to occur. The electric field’s metal surface charge as it appears at the metal/solution interface. On the other hand, in a chemisorption process, inhibitor molecules may transfer or charge-charge to the metal surface in order to form a coordination bond. It is possible to accomplish this when both positive and negative charges are present on the metal surface. Two different types of inhibitory mechanisms have frequently been proposed. Kind 1: the point where Cl ions have previously adsorbed on the metal surface and extract cations are adsorbed there. In the presence of Cl ions, extract cations may be able to adsorb due to the creation of an intermediate bridge and the negative ends of the halide metal dipoles facing the solution, which increase the adsorption of the extract cations onto the dipoles64,65. This would have the beneficial synergistic effect. This is an example of physisorption for the extract cations on the surface of the chloride bridge produced on the CS. kind 2: A large extract cations molecules is present at large extract dose. As a result, Cl ions may face competition from cationic species for adsorption sites on the CS surface”. In this case, inhibitor species are adsorbed as a result of interactions between donors (π-electrons delocalized within the rings) and recipients (Vacant low-energy d-orbitals of the surface atoms of Fe). The electron density of the rings is greatly increased by the oxygen groups’ capacity to donate electrons66. Figure 14 represents the mechanism of inhibition.

Fig. 14
figure 14

Mechanism of inhibition.

Conclusions

The following conclusions can be drawn from the previous discussion:

  1. 1.

    1. The results of the study showed that the inhibition process rose with increasing both the concentrations of the extract and the temperature of the medium.

  2. 2.

    2.A maximum inhibition performance of 95.2% was shown by the extract at concentration 300 ppm in 1 M HCl and at 45 °C.

  3. 3.

    3.“The adsorption of CPS extract on the CS surface was mainly chemical adsorption and obeyed.

by the Temkin adsorption isotherm.”

  1. 4.

    4. According to the results of the PDP tests, the CPS extract is categorized as a mixed type inhibitor.

  2. 5.

    5. The results of EIS showed that the decrease of the Cdl values and the increase of the Rct when the concentrations of the CPS was added. That is due to the adsorption of CPS molecules on the metal surface.

  3. 6.

    6. FTIR spectra provide evidence of the interaction of the interaction between Fe2+ and the CPS tested.

  4. 7.

    7. AFM and SEM-EDX analysis surface studies showed that a protective layer of CPS extract covers the CS surface.

  5. 8.

    8. What was interesting was that the results in all the methods used were quite consistent with each other.