1 Introduction

C-steel is utmost commonly appropriated as the basic structural material in a variety of fields due to its superior mechanical and economic advantages, including chemical processing, maritime applications, the oil and gas industry, and purifying equipment [1, 2]. In plentiful applications, it suffers from corrosion that reason thousands of millions of USD lost [2, 3]. Acidic media, substantial solutions of HCl acid, are broadly exercised in chemical and high-quality industrial techniques together with acid pickling, acid descaling, acid cleaning, and oil wet cleansing of metals and their alloys [4,5,6,7,8]. Different methods are applied to decrease the rate of corrosion, like utilizing inhibitors [9, 10]. Plentiful surveys had been achieved on reduce C-steel corrosion in acidic media [11,12,13,14].

It is well known that organic molecules can effectively suppress corrosion, particularly those that contain heteroatoms like nitrogen, sulfur, and oxygen [15]. The ability of these chemical inhibitors to bind to the metallic surface is correlated with their efficacy [16]. It is appreciated that with organic heterocyclic compounds, the coordinate links are stronger and exhibit high inhibition efficiencies. Following a number of research concerning, it has been determined that the attitude of the corrosion inhibitor is connected to the inhibitor’s molecular structure, molecular electronic distribution, surface charge occupation, and attraction to metal surfaces [17]. So varied structures have been created to value their corrosion inhibition abilities [18]. Utilized inhibitors can also have some hazards because it’s far hurtful to humans and surroundings and expensive. It may overcome these flaws by utilizing expired drugs. Several pharmaceuticals are returned to their manufacturers since they will expire, causing economic losses to the manufacturers. A wealth of substances found in the returned (or expired) drugs can sometimes be recycled and utilized for diverse purposes, like corrosion prevention [19,20,21,22,23,24,25,26,27,28]. The aim of this paper is to look at the inhibiting behavior of 1-(4-tert-butylphenyl)-4-(4-(benzhydryloxy)piperidin-1-yl)butan-1-one, known as Ebastine drug, on the corrosion of C-steel X52 in HCl (1.0 M) solution. In the investigation, potentiodynamic polarization (PDP), weight loss (WL), SEM and AFM methods have been used. Additionally, the activation energy (Ea) and heat of adsorption (Qads) were estimated and described. In order to comprehend the corrosion inhibition mechanism, DFT and MC simulation were also utilized to investigate the Ebastine.

2 Experimental

2.1 Test Solutions

All the tested solutions have been prepared to utilize analytical-grade chemical substances and distilled water. The 1-(4-tert-butylphenyl)-4-(4-(benzhydryloxy)piperidin-1-yl)butan-1-one, known as Ebastine, was gained from a medication called evastine that was made in Egypt by the Marcyrl Company. The medicine contains 5 mg of Ebastine per 5 ml. The volume needed to achieve the desired concentration was determined then created through dilution. Ebastine has a molar mass of 469.658 g/mol and the chemical formula C32H39NO2. Figure 1 depicts the Ebastine structure.

Fig. 1
figure 1

The chemical structure of Ebastine

2.2 Weight Loss (WL) Experiments

The WL tests had been carried out utilizing C-steel X52 (CSX52) specimens which have the following composition: 0.28% C, 1.4% Mn, 0.03% S, 0.03% P, ≤ 0.06% Np, ≤ 0.06% V ≤ 0.06% Ti, and residuum iron. The pieces of CSX52 were utilized for WL measurements with dimensions (1.4 × 1.2 × 4 cm). The CSX52 coupons were cleaned with distilled water, CH3COCH3 and then distilled water once more after being polished with various emery paper grades. The pieces were correctly weighted and subsequently sunken in HCl (1.0 M) solution lack and existence specific Ebastine concentrations at a temperature of 30 °C. The temperature for weight reduction tests became controlled by employing a water bath furnished with thermostat control ± 1 °C. After 24 h exposure, the tested pieces have been removed, rinsed very well with distilled water, desiccated, and meticulously weighed. In this research, all evaluations were conducted in a naturally aerated environment [1]. To achieve reproducibility, each experiment was carried out at least twice.

2.3 Potentiodynamic Polarization Measurements (PDP)

The running electrode had an exposed surface area of 2.24 cm2 and was made from CSX52 implanted in epoxy holders. Before being applied, the electrode has been polished with diverse emery paper grades up to 2500 grade, degreased with CH3COCH3, then cleaned with distilled H2O. As counter and reference electrodes, a Pt sheet and a calomel electrode were used, respectively. Using a PS potentiostat and PS6 software, PDP tests were completed [4, 29] at a scan rate of 1.0 mV/sec. To achieve reproducibility, each experiment was carried out at least twice.

2.4 SEM Measurements

After being abraded with diverse emery papers up to a 2500 grade, the C-steel X52 coupons were maintained for 24 h in HCl (1.0 M) with and without 17.03 × 10–5 M of Ebastine. The samples were then dried, desiccated, and placed into the spectrometer after being cleaned with distilled water. At Egypt’s Mansoura University, the SEM observation is carried out with the JSM-6510LV.

2.5 Computational Details

DFT calculations employing the B3LYP functional [29] and the 6–31 g (d, p) basis set implemented in the Gaussian 09 program [30] were used to thoroughly optimize the Ebastine molecule. In the gas phase, the computations were carried out. The simulation findings include the following: the highest occupied molecular orbital (HOMO), dipole moment (µ), hardness (\(\eta\)), energy gap (ΔE), and the lowest unoccupied molecular orbital (LUMO), the number of electrons transferred (ΔN), and global softness (\(\sigma\)) were investigated. The global softness, hardness and the number of electrons transferred were calculated as follows:

$$\eta = \frac{{E_{LUMO} - E_{HOMO} }}{2}$$
(1)
$$\sigma = \frac{1}{\eta }$$
(2)
$$\Delta N = \frac{{\phi - \chi_{inh} }}{{2(\eta_{Fe} + \eta_{inh} )}}$$
(3)

where \(\varphi ,{\upchi }_{\mathrm{inh}}\), \({\eta }_{\mathrm{inh}}\mathrm{ and }{\eta }_{\mathrm{Fe}}\) are the function work of Fe (110) (4.820 eV), Ebastine electronegativity, Ebastine chemical hardness and, iron chemical hardness (0 eV Ebastine) respectively.

2.6 MC Simulations

For the purpose of this work, a single inhibitor molecule was chosen to be adsorbed to the Fe (110) surface. The adsorption locator module performed the MC simulation. By constructing a 12 × 12 supercell with a 20 vacuum height above the surface, the surface Fe (110) was improved. Condensed-phase optimized molecular potentials for atomistic simulation studies (COMPASS) were applied to the adsorption process. For electrostatic summation, the Ewald methodology was adopted, and for van der Waals, the atom-based strategy. The following equation was used to compute the inhibitor's adsorption energy:

$$E_{{{\text{ads}}}} \, = \,E_{{{\text{complex}}}} \, - \,E_{{{\text{Fe}}}} \, - \,E_{{{\text{inh}}}}$$
(4)

where Ecomplex, Einh, and EFe are the total energies of inhibitor on Fe (110) surface, the energy of Ebastine molecule, and energy of iron(110) surface, respectively.

3 Results and Discussion

3.1 Potentiodynamic Polarization (PDP)

At a scan rate of 0.001 V/sec, the PDP curves of CSX52 in HCl (1.0 M) solutions were shown, Fig. 2, both uninhibited and with varying amounts of Ebastine. Table 1 presents the competent electrochemical parameters, including surface coverage (θ), the percentage of inhibitory efficacy (%IE), anodic and cathodic Tafel slopes (βa and βc), corrosion current (icorr), corrosion potential (Ecorr). In order to calculate the (%IE) and surface coverage (θ), the following equations [31, 32] were used:

$$\% {\text{IE}}\, = \,\left( {1\, - \, \, i_{{{\text{inh}}}} / \, i_{{{\text{Free}}}} } \right) \, \,100$$
(5)
$$\theta \, = \,\% {\text{IE }}\,/\, \, 100$$
(6)
Fig. 2
figure 2

a Potentiodynamic polarization graphs of CSX52 electrode in (1.0 M) HCl solution containing different amounts of Ebastine, b the effect of increasing concentration of Ebastine on the current density and the inhibition efficiency

Table 1 Corrosion parameters of CSX52 electrode in HCl (1.0 M) solutions free and containing diverse concentrations of Ebastine at 303 K

where iFree and iinh are the (icorr) of the CSX52 electrode in the lack and presence of Ebastine drug, respectively.

When the amount of Ebastine is increased, Table 1’s analysis reveals that the value of (icorr) falls and the inhibition activity rises. This finding demonstrates how the tested Ebastine inhibits the breakdown of CSX52 in HCl (1.0 M) solution. In the existence of Ebastine, the corrosion potential value is unaffected. Furthermore, the addition of rising Ebastine concentrations considerably changed the cathodic tafel constants. These findings lead to some confusion about the kind of metal sites at which the inhibitor molecules adsorb. The former suggests a mixed adsorption process, while the latter supports the cathodic adsorption mechanism. However, careful investigation of the figure of the Tafel technique reveals that the values of the Tafel constants are the mean criteria that determine the kind of inhibition process. Thus, based on this argument, Ebastine is considered to be a cathodic inhibitor. The molecules of cathodic inhibitor resort to being adsorbed on the cathodic sites on the metal rather than the anodic ones [33].

3.2 Weight Loss Studies

After 24 h, the corrosion of CSX52 in HCl (1.0 M) solution was examined for the impacts of rising the amounts of Ebastine on WL, (%IE), and the quantity of surface covering (θ), Table 2. Using the formula found in next equation [34], the inhibitory efficacy was determined:

$$\% {\text{IE}}\, = \,\left( {1\, - \, \, W_{{{\text{Inh}}}} /W_{{{\text{Free}}}} } \right)\, \times \,100$$
(7)

where WFree and WInh are the WL of CSX52 after 24 h in the existence and absence of Ebastine, respectively. The WL was discovered to be reduced when Ebastine concentrations rise, although surface coverage and inhibitory efficacy increase. The experimental outcomes of this work are compared with past iron corrosion drug inhibitors in various media, as shown in Table 3. The protective layer created by the Ebastine appears to have a high anticorrosive capacity than many other iron inhibitors, according to the findings of weight loss and potentiodynamic polarization measurements.

Table 2 The effect of adding various Ebastine concentrations on the weight loss of CSX52 in HCl (1.0 M) solution at 303 K
Table 3 Comparison of the inhibitory effectiveness of several drug inhibitors used for iron corrosion in various environments

The relations between (%IE) and Ebastine concentration as obtained from WL measurements and polarization technique were presented in Fig. 3. The figure shows that the inhibition efficiency values obtained from WL measurements are higher than those obtained from the Tafel technique, this also appears in much other literature, as seen in Table 3, especially at low concentrations. This discrepancy appears may be due to the different nature of the two techniques. However, the general dependence of inhibition efficiency on inhibitor concentration is the same for both. It could be easily seen that a very low concentration is needed to perform high inhibition efficiency. This result could be imputed to horizontal adsorption of the Ebastine molecules on the metal surface, covering a large surface area with a small number of them. Moreover, the figure shows that the value of inhibition efficiency then becomes almost independent of the inhibitor concentration. It could be concluded that, as the surface becomes almost saturated with adsorbed molecules, there is no longer an impact of increasing Ebastine concentration on the value of inhibition efficacy.

Fig. 3
figure 3

Relations between (% IE) and Ebastine concentration obtained from two different techniques

3.3 Morphology Measurements

Studying the morphology of the surface was an excellent gauge of how incisive the corrosion attack was. After being submerged in 1.0 M HCl, in the lack and containing17.03 × 10–5 M of Ebastine, CSX52 coupons were seen utilizing SEM, Fig. 4. The morphology, as revealed by SEM results, of CSX52 coupons in HCl (1.0 M) only revealed that the surface is strongly distorted. Otherwise, in HCl (1.0 M) solution containing Ebastine [35,36,37], the surface of CSX52 becomes smoother and less damaged, regardless of the presence of some small pits on the surface. These small pits may be another reason for the difference in the amount of protection efficiency obtained from chemical and electrochemical techniques.

Fig. 4
figure 4

SEM for CSX52 coupons after immersion in HCl (1.0 M) in lack and containing 17.03 × 10–5 M from Ebastine drug

AFM offers surface topography images with atomic or near-atomic resolution that can be used to determine a coupon's surface roughness. Figure 5 displays both the Ebastine-free and Ebastine-containing Ebastine, AFM morphologies for the CSX52 surface in HCl (1.0 M) solutions. According to Fig. 5, the average roughness and the root mean square for CSX52 surface in HCl (1.0 M), 978.76 × 10−9 m and 1234.9 × 10−9 m, have higher values than CSX52 sample in existence of Ebastine, 272.8 × 10−9 m and 336.58 × 10−9 m, respectively [23]. These findings demonstrate that Ebastine molecules are adsorbed on the CSX52 surface and have created a shielding a protective film that effectively protects the CSX52 surface from the aggressive ions [23].

Fig. 5
figure 5

AFM for CSX52 coupons after immersion in HCl (1.0 M) in free and containing Ebastine drug

3.4 Adsorption Isotherm

Finding an appropriate isotherm enables the interpretation of Ebastine's adsorption behavior on the CSX52 surface. To fit the exploratory data of WL measurements, various numerical relations for the adsorption isotherms were proposed [38]. The Freundlich, Langmuir, Frumkin, Temkin, Al Awady and Florry Huggins isotherms [38] were looked into to better understand the mechanism at play in the case of Ebastine, Fig. 6. Langmuir isotherm equation [39] fits our results:

$$C/\theta \, = \,1/K\, + \,C$$
(8)

where K and C stand for the equilibrium constant of the adsorption process and the Ebastine concentration, respectively. In Fig. 6, a graph of C/θ Vs. C is shown. The standard free energy of adsorption, ∆Goads, is related to the adsorption equilibrium constant, K, by the next equation [34, 39]:

$$K\, = \,1/55.5 \, \exp \, \left( { - \Delta G^{o}_{{{\text{ads}}}} /RT} \right)$$
(9)

where the number 55.5 denotes the molar concentration of water and the letters T and R stand for the absolute temperature and the ideal gas constant, respectively.

Fig. 6
figure 6

Isotherms for the Ebastine compound adsorbed on the CSX52 surface in HCl (1.0 M)

The equilibrium constant and the standard adsorption-free energy are equal to 33.3 × 104 and − 42.15 kJ mol−1, respectively. The spontaneous nature of Ebastine’s adsorption process on the CSX52 surface is indicated by the negative sign of ∆Goads. The obtained value of ∆Goads suggests a chemical adsorption process [34, 40].

3.5 Thermodynamic/Adsorption Calculations

The effect of temperature rise on the WL and corrosion rate of CSX52 in HCl (1.0 M) in the existence and absent of 17.03 × 10–5 M Ebastine are shown in Table 4 after a 24 h period. According to the research, Ebastine works well as an inhibitor at high temperatures, and the effectiveness of inhibition declines as temperature increases. This suggests that the adsorption took place via a physical mechanism [34, 41]. The apparent activation energy, Ea, for CSX52 corrosion in HCl (1.0 M) in the lack and existence of 17.03 × 10−5 M Ebastine was calculated utilizing the Arrhenius type equation [23, 42]:

$$\log \, \left( {r_{2} /r_{1} } \right)\, = \,\left( {E_{a} /2.303R} \right)\left( {\left( {1/T_{1} } \right)\,{-}\,\left( {1/T_{2} } \right)} \right)$$
(10)

where T is the absolute temperature, Ea is the apparent activation energy, R is the universal gas constant, A is the Arrhenius pre-exponential factor, and r1 and r2 are the corrosion rates derived at temperatures T1 and T2, respectively, after 24 h. The activation energy (Ea) values are listed in Table (4). The data show that the addition of the Ebastine results in an increase in the apparent activation energy value. This outcome confirms the physical adsorption process [23, 41].

Table 4 The adsorption parameters values of CSX52 in HCl (1.0 M) with 17.03 × 10–5 M Ebastine

The heat of adsorption of the Ebastine was computed utilizing the next equation [34]:

$$Q_{{{\text{ads}}}} \, = \,2.303\,R\,[\log \, \, (\theta_{2} / \, (1\, - \,\theta_{2} ))\, - \,\log \, \, (\theta_{1} / \, (1 - \theta_{1} ))\left] {\, \times \,} \right[T_{1} T_{2} / \, (T_{2} \, - \,T_{1} )]$$
(11)

where θ1 and θ2 are the fractions of surface coverage at temperatures T1 and T2, respectively. Table 4 displays the value of Qads after it has been calculated. The fact that Qads is negative indicates that the drug, Ebastine, under study is being adsorbed exothermically to the CSX52 surface.

A careful examination of the results reveals consistency regarding the mode of adsorption. While the value of adsorption-free energy suggests a chemical adsorption process, the temperature effect supports a physical adsorption mechanism. Both mechanisms can occur together when the molecules adsorb physically and then form a sort of chemical combination with dissolved metal cations upon arriving at the double-layer vicinity. If the formed compound is unstable, it will be decomposed by rising temperatures.

3.6 DFT Calculations

The optimized Ebastine structure at the B3LYP level of theory is shown in Fig. 7, together with their frontier molecular orbitals. With a higher HOMO energy value, which indicates a greater electron donation of the Ebastine molecule to the steel's empty d-orbital, and a lower LUMO energy level, which indicates the ability of the Ebastine to gain electrons from the steel's d-orbital, the binding of Ebastine molecules to the C-steel interface increases. [42]. Ebastine has a high HOMO and a low LUMO energy value, as seen in Table 5, indicating that it has a strong inhibitory efficiency. The inhibitor's adsorption capacity improves as the energy gap narrows. The effectiveness of inhibition and chemical reactivity improves with diminishing energy gaps [43, 44]. Table 5 shows that Ebastine has a small energy gap.

Fig. 7
figure 7

The optimized structure, frontier molecular orbitals (HOMO and LUMO) and ESP for of Ebastine

Table 5 Quantum chemical descriptors of Ebastine

HOMO electron distribution for the Ebastine as seen in Fig. 7, was localized on the piperidyl moiety, while LUMO electron density was distributed on benzoyl moiety. An essential quantum descriptor that captures the overall polarity of a molecule is the dipole moment (µ). The µ is associated with inhibition efficacy. The inhibition efficacy rises with the increment of the µ. The Ebastine has a strong dipole moment, as indicated in Table 5.

Additionally, the electrons transferred number (ΔN) is meant. When ΔN values ˂ 3.6, the protective efficiency increases by incrementing the ability of the Ebastine molecule to contribute electrons to CSX52 surface [45, 46]. As demonstrated in Table 5, the ΔN value for Ebastine is positive, indicating that the Ebastine inhibitor has high inhibitory efficiency.

Table 5 shows the global softness (\(\sigma\)) and hardness (\(\sigma\)) of the Ebastine inhibitor, which affect the reactivity of the Ebastine molecule. The Ebastine has a high softness value and a low hardness value, indicating a strong inhibitory efficiency.

The Ebastine molecule’s reactive locations are identified using a visual tool called the molecular electrostatic potential map (ESP). The red and yellow areas represent negative ESP. The most reactive atoms are those with a higher negative charge. The nitrogen and oxygen atoms of the investigated inhibitors are where the negative ESP is situated, as can be observed in Fig. 7.

3.7 MC Simulation

MC simulation can be utilized to discover the majority of Ebastine molecule configurations that are adsorbed on a CSX52. The Ebastine was replicated in both the vacuum and gas phase. According to Fig. 8, Ebastine adsorbed on Fe (110) in a parallel configuration. Ebastine’s adsorption energy values on Fe (110) were discovered to be − 176.32 kcal/mol. The high adsorption energy of the Ebastine causes a strong contact of Ebastine inhibitor on Fe (110), resulting in the formation of a protective film on the CSX52 surface from the harsh environment (HCl solution), resulting in enhanced inhibition efficacy.

Fig. 8
figure 8

Adsorption of Ebastine on Fe (110) surface top and side view

3.8 Mechanism of Inhibition

The PDP results have suggested a cathodic inhibition mechanism. This mechanism may be explained by the existence of nitrogen and oxygen atoms in the inhibitor's molecule. Due to the existence of lone pairs of electrons at these atoms, protons are attached to them from the acidic solution, forming positive molecules. Thus, the adsorption of these formed positive structures is expected to be selectively adsorbed on the cathodic sites at the surface of the C-steel. Figure 8 represents a schematic drawing that illustrates the adsorption mode of the Ebastine molecule. As the Ebastine molecules reach the surface of C-steel under the effect of their charges, they form a weak bonding compound with the dissolved metal cations. The formed compound covers the metal surface, leading to the inhibition process. However, increasing temperature decomposes the formed layer, resulting in a lowering in the inhibition efficacy. The results also showed that a very small concentration of the compound is enough to reach the highest possible inhibition efficacy. Increasing the additive concentration beyond this concentration results in a steady increase in the inhibition efficacy. This finding leads to the conclusion that the compound molecules adsorb horizontally on the electrode surface. The adsorbent's horizontal position ensures a larger covered area for each adsorbed molecule. Thus, a smaller number of molecules is needed to reach the maximum attainable efficacy.

4 Conclusions

  • Ebastine reduces the CSX52 corrosion and its inhibitive effect depends upon its concentration.

  • In HCl (1.0 M) solution, Ebastine follows the Langmuir isotherm when adsorbing on CSX52 surfaces.

  • The adsorption of Ebastine on the surface of CSX52 is the cause of the conduct inhibition, which prevents charge and mass transfer and shields C-steel from harmful ions.

  • The morphology study is very important in case there is a difference between the amount of protection efficiency obtained from chemical and electrochemical techniques.

  • The findings of the practical experiments match the theoretical calculations.