1 Introduction

Protection of carbon steel from corrosion is very critical due to their application in many industry particularly the power plants and petroleum industry [1]. Certain industrial activities like descaling, pickling, including oil well acidizing brings carbon steel in contact with hydrochloric acid solution, extensively used as a cleaning mixture in most industries. These activities get the metal severely corroded. Several methods have been employed to protect metals from these corrosive agents. Strategies like coating, anodic protection, cathodic protection and the use of corrosion inhibitors have been studied and recommended as good methods to combat metal corrosion. The use of corrosion inhibitors have always been the most economical and effective method in reducing the undesirable carbon steel dissolution [2, 3]. Most well-known corrosion inhibitors, both natural and synthetic, are organic compounds possessing sulfur, nitrogen or oxygen atoms. The inhibitors act by adsorption on the surface of the metal, creating barriers between the corrosive solution and metal surface and reducing the metal dissolution [4, 5].

Recent years have seen scientists utilizing pharmaceutical agents as corrosion inhibitors for metals and its alloys in aqueous solutions [6,7,8,9]. Drugs represent a group of potential inhibitors of metal corrosion based on their structure which possesses aromatic rings and heteroatoms active centers for easy adsorption [9]. Some antibiotic drugs such as cefepime, cephapirin, moxifloxacin and cefdinir have been investigated by researchers as corrosion inhibitors for steel in acidic medium [8, 10,11,12]. Others like antihypertensive, anti-diabetic and antifungal drugs [13,14,15] have also been utilized. The inhibitory action of these drugs was due to their ability to form insoluble complexes which block the steel surface and prevent the metal from further dissolution.

The investigated drug, spironolactone (SPR), is a medication used primarily in the treatment of fluid build-up due to heart failure, kidney disease or liver scarring [16]. It is also used as a potassium-sparing diuretic for the treatment of high blood pressure. It has a molecular formula C24H32O4S with a molecular weight 416.574 g mol−1 and the IUPAC nomenclature of the drug is 7α-acetylthio-17α-hydroxyl-3-oxopregn-4-ene-21-carboxylic acid γ-lactone. The use of spironolactone as corrosion inhibitor, to the best of our knowledge, has not been previously investigated. In the present work, the adsorption and inhibitive effect of spironolactone drug on C38 carbon steel corrosion in hydrochloric acid environment have been studied using weight loss, electrochemical impedance spectroscopy, potentiodynamic polarization and scanning electron microscopy. The choice of studying corrosion inhibition property of SPR is based on its size, functionalities and geometry of the molecule. The chemical structure and the 3D optimized structure of the spironolactone drug are shown in Fig. 1. A comparison of the inhibition efficiency of the reported SPR drug with different investigated drugs on steel in various acidic media is presented in Table 1.

Fig. 1
figure 1

Chemical structure (a) and 3D optimized structure (b) of the Spironolactone drug

Table 1 Comparison of inhibition efficiency of spironolactone (SPR) with other drug corrosion inhibitors on steel in acidic medium

2 Experimental Methods

2.1 Metal Preparation and Solutions

Specimens of C38 carbon steel with dimensions 2 × 2 × 0.3 cm were used for weight loss, electrochemical and surface studies. The chemical composition of the C38 steel specimen (in weight %) is 0.36 C, 0.27 Si, 0.66 Mn, 0.020 P, 0.016 S, 0.21 Cr, 0.02 Ni, 0.02 Mo, 0.22 Cu, 0.060 Al and the rest Fe. The steel specimens were polished with different emery paper grades (600–1200), washed with distilled water, rinsed with acetone, finally dried and stored in a desiccator after taking the accurate weight. For electrochemical tests, 1 cm2 of the steel surface area was exposed to corrosive medium and the rest were covered with epoxy resin. The 10% HCl corrosive solution was prepared by dilution of AR grade 37% HCl with distilled water.

2.2 Inhibitor

The spironolactone drug was purchased from Naiviv Pharmaceuticals, Port Harcourt, Nigeria and used as obtained. Stock solution of 0.5 M SPR was prepared by dissolving weighed amount of SPR in ethanol and stored at 5 °C in the dark. Required concentration of the drug was prepared daily by dilution in dark polyethene bottles just before use. The stock solution was properly protected from light while the experiments proceed to prevent the drug from degradation before use. The concentration range of investigated drug was 2.4 × 10–3–7.2 × 10–3 M in 10% HCl.

2.3 Weight Loss Measurements

The C38 steel specimens which have been previously weighed were immersed in stagnant 100 mL of the test solution in uncovered 250 mL beakers. The weight loss experiments were performed according to the ASTM practice standard G-31 [17]. The specimens were retrieved from the various test solutions after 6 h, washed, dried, and re-weighed. Triplicate experiments were performed and the average weight loss values were recorded. The corrosion rates (\(R_{{{\text{corr}}}}\)) were calculated using the following equation:

$$R_{{{\text{corr}}}} { }\left( {{\text{g m}}^{ - 2} {\text{h}}^{ - 1} } \right) = { }\frac{W}{{{\text{St}}}}$$
(1)

where W is the average weight loss, S is the C38 steel total area and t is immersion time. From the deduced corrosion rates, the surface coverage (\(\theta\)) and inhibition efficiency (EW %) were calculated as follows:

$$\theta = { }\frac{{R_{{{\text{corr}}}}^{0} - { }R_{{{\text{corr}}}}^{i} }}{{R_{{{\text{corr}}}}^{0} }}$$
(2)
$$ E_{{\text{W}}} {\text{ \% }} = { }\frac{{R_{{{\text{corr}}}}^{0} - { }R_{{{\text{corr}}}}^{i} }}{{R_{{{\text{corr}}}}^{0} }} \times 100, $$
(3)

where \(R_{{{\text{corr}}}}^{0}\) and \(R_{{{\text{corr}}}}^{i}\), respectively, represents the corrosion rates in the absence and presence of inhibitor.

2.4 Electrochemical Measurements

The electrochemical tests were performed on the stable open circuit potential (OCP) using Gamry (model 300) Potentiostat/Galvanostat three-electrode glass cell and Gamry E-Chem software for data analysis. The cell consists of C38 steel as working electrode, platinum foil as counter electrode and saturated calomel electrode (SCE) as reference electrode immersed in 100 mL of aggressive electrolyte and maintained at 30 °C. To stabilize the corrosion potential, a time interval of 30 min was allowed for each experiment. The same cell was used for impendence measurements and potentiodynamic polarization. Impedance measurements were performed utilizing AC signals of 10 mV amplitude at OCP in the frequency range of 10–2 to 105 Hz. The potentiodynamic polarization curves were made in a potential range of − 1500 mV to 100 mV with a sweep rate of 1 mV s−1. Each experiment was run in triplicate and the average values were recorded to verify the reproducibility of the experiments.

2.5 Surface Examination

The C38 steel specimens used for surface morphological studies were immersed in 10% HCl in the absence and presence of 7.2 × 10–3 M of the examined spironolactone drug at 30 °C for a period of 6 h. At the expiration of the immersion time, the specimens were dried and analyzed using JEOL JSM-5500 model of scanning electron microscope.

2.6 Quantum Chemical Calculations

Quantum chemical calculations were performed on the studied drug in order to provide a theoretical explanation of the inhibition action of SPR on the C38 steel surface. The calculations were performed using the density functional theory (DFT) electronic structure programs as contained in the Spartan 14.0 software. Molecule optimization was done by utilizing the 6-31G (d, p) basis sets, and the hybrid B3LYP functional was used to treat the exchange–correlation. The quantum chemical parameters of the most stable ground state geometries were used in all cases to provide theoretical explanations for the corrosion inhibition properties of the studied drug. Different parameters such as lowest unoccupied molecular orbital energy (ELUMO), highest occupied molecular orbital energy (EHOMO) and dipole moment (μ) were generated and recorded. Other parameters like energy bandgap (∆E), absolute electronegativity (χ) of the inhibitor molecule, global hardness (η), global softness (σ) and fraction of electron transferred from the inhibitor molecule to the Fe surface (ΔN) were calculated using the following equations [18, 19]:

$$\Delta E = { }E_{{{\text{LUMO}}}} + E_{{{\text{HOMO}}}}$$
(4)
$$\chi = \frac{1}{2}{ }\left( {E_{{{\text{LUMO}}}} + E_{{{\text{HOMO}}}} } \right)$$
(5)
$$\eta = \frac{{E_{{{\text{LUMO}}}} - E_{{{\text{HOMO}}}} }}{2}$$
(6)
$${\upsigma } = { }\frac{1}{\eta }$$
(7)
$$\Delta N = \frac{{\chi_{{{\text{Fe}}}} - \chi_{{{\text{inh}}}} }}{{2\left( {\eta_{{{\text{Fe}}}} + \eta_{{{\text{inh}}}} } \right)}},$$
(8)

where \(\chi_{{{\text{Fe}}}}\) and \(\chi_{{{\text{inh}}}}\) represent the electronegativity values of Fe and inhibitor, respectively, while \(\eta_{{{\text{Fe}}}}\) and \(\eta_{{{\text{inh}}}}\) are the hardness values of Fe and inhibitor, respectively. For bulk Fe, Pearson’s electronegativity scale assigns a value of 7 eV for \(\chi_{{{\text{Fe}}}}\) and 0 eV for \(\eta_{{{\text{Fe}}}}\) [20].

3 Results and Discussion

3.1 Weight Loss Measurements

3.1.1 Effect of Inhibitor Concentration and Temperature

The values of corrosion rate (\(R_{{{\text{corr}}}}\)) and inhibition efficiency (\(E_{{\text{W}}} {\text{ \% }}\)) obtained from weight loss studies in the absence and presence of different concentrations of SPR in 10% HCl at 30, 40, 50 and 60 °C are summarized in Fig. 2 and Table 2. The results clearly show that the corrosion rates and inhibition efficiency of SPR are dependent on the inhibitor concentration. Figure 2a indicates that the corrosion rate decreases as the inhibitor concentration increases at all studied temperatures. Again, Fig. 2b reveals that gradually increasing the concentration of SPR from 2.4 × 10–3 to 7.2 × 10–3 M increases the inhibition efficiency of the drug at all studied temperatures. The observed increase in \(E_{{\text{W}}} {\text{ \% }}\) with increasing inhibitor concentration is ascribed to the adsorption of the molecules of SPR on the C38 steel surface and thus increases the surface coverage of the metal [21, 22]. However, Table 2 shows that the corrosion rate increases while the inhibition efficiency decreases on increasing the solution temperature from 30 to 60 °C. This could be attributed to diminishing coverage of the metal surface by the inhibitor due to desorption.

Fig. 2
figure 2

Variation of SPR concentration with a corrosion rate (\(R_{{{\text{corr}}}}\)) and b inhibition efficiency of SPR (\(E_{{\text{W}}} \%\)) in 10% HCl at different temperatures

Table 2 Effect of temperature on corrosion rate (\(R_{{{\text{corr}}}}\)) and inhibition efficiency (\(E_{{\text{W}}} {\text{ \% }}\)) for C38 steel in 10% HCl without and with 7.2 × 10–3 M SPR

3.1.2 Kinetic and Thermodynamic Consideration

Making use of the corrosion rates (\(R_{{{\text{corr}}}}\)) from weight loss measurement, the activation energy (\(E_{{\text{a}}}\)) at various concentrations of SPR in 10% HCl is deduced from the Arrhenius equation (Eq. 9) and the thermodynamic parameters such as the enthalpy of activation (ΔH*) and the entropy of activation (ΔS*) were calculated from the transition-state equation expressed in Eq. (10).

$$\log R_{{{\text{corr}}}} = \log A - { }\frac{{E_{{\text{a}}} }}{{2.303{\text{RT}}}}$$
(9)
$$\log \left( {\frac{{R_{{{\text{corr}}}} }}{T}} \right) = { }\left[ {\log \left( {\frac{R}{{{\text{N}}_{{\text{A}}} {\text{h}}}}} \right) + { }\frac{{\Delta S^{*} }}{{2.303{\text{R}}}}} \right] - { }\frac{{\Delta H^{*} }}{{2.303{\text{RT}}}},$$
(10)

where R is the gas constant, A the Arrhenius pre-exponential factor, T the absolute temperature, \(N_{{\text{A}}}\) is the Avogadro’s number and h the Planck’s constant. The values of \(E_{{\text{a}}}\) listed in Table 3 were calculated from the slopes of the straight line graphs obtained by plotting \(\log R_{{{\text{corr}}}}\) vs. 1/T (Fig. 3a). The linear regression coefficients (R2) of the graphs are close to 1, suggesting that C38 steel corrosion in 10% HCl can be explained using the kinetic model. A plot of \({\text{log }}(R_{{{\text{corr}}}} /T)\) vs. 1/T gave a straight (Fig. 3b) with a slope of (\(- \Delta H^{*}\)/2.303R) and an intercept of \(\left[ {\log (R/N_{{\text{A}}} h} \right) + { }\Delta S^{*} /2.303{\text{R}})]\) from which ΔH* and ΔS* values were computed and are listed in Table 2. It is clearly revealed from Table 3 that \(E_{{\text{a}}}\) and ΔH* values increased with increasing concentration of SPR. The increase in \(E_{{\text{a}}}\) could be due to appreciable increase in desorption of SPR molecules from the C38 steel surface with temperature rise. The positive values of ΔH* indicate the endothermic nature of the corrosion process, meaning that the dissolution of C38 steel does not occur readily [23, 24]. The negative values of ΔS* in the blank and the presence of SPR drug indicate that the corrosion process is accompanied by a decrease in entropy [25].

Table 3 Activation energy (\(E_{{\text{a}}}\)), entropy change (ΔS*) and enthalpy change (ΔH*) for the corrosion of C38 steel in 10% HCl with and without various concentrations of SPR
Fig. 3
figure 3

a Arrhenius plot and b transition-state plots for C38 steel in 10% HCl with and without different concentrations of SPR

3.2 Electrochemical Measurements

3.2.1 Electrochemical Impedance Spectroscopy

The Nyquist plots of C38 steel in 10% HCl solution without and with different concentrations of SPR are depicted in Fig. 4a. It is observed from Fig. 4a that the nature of the impedance of C38 steel changed significantly when SPR was introduced but the common features of the Nyquist plots were not affected. This clearly shows that the presence of SPR inhibited C38 steel corrosion without inducing any change in the corrosion mechanism [26, 27]. The Nyquist plots displayed a depressed semicircular capacitive loop and the semicircle diameter increases with increasing concentration of SPR. The semicircles suggest that C38 steel corrosion in the HCl medium is controlled by a charge transfer process and increasing diameter of the semicircle with increase in SPR concentration is attributed to the formation of dense protective layer by molecules of the inhibitors on the metal surface [13, 28,29,30]. The impedance spectra were fitted to the equivalent circuit model consisting of the charge transfer resistance (\(R_{{{\text{ct}}}}\)) in parallel connection with the constant phase element (CPE) connected in series with the solution resistance (\(R_{{\text{s}}}\)). The equivalent circuit is shown in Fig. 4b. The CPE is used in the equivalent circuit in place of a double-layer capacitor (\(C_{{{\text{dl}}}}\)) to give a more accurate fit [31]. The impedance of the CPE (ZCPE) is deduced by the following expression:

$$Z_{{{\text{CPE}}}} = { }Y_{0}^{ - 1} { }({\text{j}}\omega )^{ - n},$$
(11)

where Y0 is a proportionality factor representing the CPE magnitude, j is the imaginary unit, ω is the angular frequency in Rad s−1(ω = 2πf, f is the frequency in Hz), and n is the phase shift used to obtain information about the degree of surface inhomogeneity. The ideal capacitance (\(C_{{{\text{dl}}}}\)) values were derived using the expression [32, 33]:

$$C_{{{\text{dl}}}} = { }Y_{0} { }(\omega_{{\max}} )^{{{\text{n}} - 1}},$$
(12)

where \(\omega_{{\max}}\) is the angular frequency at which the impedance imaginary part of the has a maximum. The obtained \(R_{{{\text{ct}}}}\) values were used to compute the inhibition efficiency (\(E_{{{\text{EIS}}}} {\text{ \% }}\)) according to the following equation:

$$ E_{{{\text{EIS}}}} {\text{ \% }} = \left( {1 - { }\frac{{R_{{{\text{ct}}}}^{0} }}{{R_{{{\text{ct}}}}^{i} }}} \right){ } \times 100, $$
(13)

where \(R_{{{\text{ct}}}}^{0}\) and \(R_{{{\text{ct}}}}^{i}\) are the charge transfer resistances in the absence and presence of SPR, respectively. The EIS parameters for SPR deduced from the Nyquist plots and \(E_{{{\text{EIS}}}} {\text{ \% }}\) values are listed in Table 4. From Table 3, the \(R_{{{\text{ct}}}}\) and \(E_{{{\text{EIS}}}} {\text{ \% }}\) values are seen to increase while the \(C_{{{\text{dl}}}}\) values diminish with increase in SPR concentration, suggesting protective film formation on C38 steel surface. The high values of \(R_{{{\text{ct}}}}\) are usually associated with slower metal dissolution process [33,34,35]. The decrease in the \(C_{{{\text{dl}}}}\) may be attributed to a decrease in the local dielectric constant or from the increase of thickness of the electrical double layer [36]. Moreover, addition of SPR and increase in its concentration increases the values of n and these values are close to unity, indicating that the CPE relates with the capacitance [35].

Fig. 4
figure 4

a Nyquist plots for C38 steel uninhibited and inhibited with SPR in 10% HCl, b Equivalent circuit used to fit the EIS data for SPR in 10% HCl

Table 4 EIS parameters for C38 steel in 10% HCl without and with different concentrations of SPR at 30 °C

3.2.2 Potentiodynamic Polarization

Polarization plots have been recorded for C38 steel in 10% HCl solution in the absence and presence of different concentrations of SPR inhibitor at 30 °C as depicted in Fig. 5. The associated polarization parameters, such as corrosion current density (\(I_{{{\text{corr}}}}\)), corrosion potential (\(E_{{{\text{corr}}}}\)) and Tafel slopes (βa, βc), obtained by extrapolation of the Tafel lines are listed in Table 5. From the polarization curves (Fig. 5), the presence of SPR as expected considerably reduced the current densities at both cathodic and anodic sites. This result indicates that the addition of SPR decreased the rate of corrosion by reducing anodic dissolution and also retarding hydrogen evolution. Table 5 clearly reveals that the \(I_{{{\text{corr}}}}\) values continually decrease by increasing SPR concentration, suggesting that SPR is a good corrosion inhibitor and it decreases C38 steel dissolution after addition of the drug in the corrosive acid solution. The inhibition efficiency (\(E_{{{\text{PDP}}}} {\text{ \% }}\)) was calculated using the expression:

$$ E_{{{\text{PDP}}}} {\text{ \% }} = \left( {1 - { }\frac{{I_{{{\text{corr}}}} }}{{I_{{{\text{corr}}}}^{0} }}} \right){ } \times 100, $$
(14)

where \(I_{{{\text{corr}}}}^{0}\) and \(I_{{{\text{corr}}}}\) represent the corrosion current density in the absence and presence of SPR, respectively. The values of \(E_{{{\text{PDP}}}}\) are also listed in Table 4 and the inhibition efficiency is found to increase with increasing SPR concentration. Maximum inhibition efficiency of 95.8% was obtained at 7.2 × 10–3 M concentration. Furthermore, the displacement in \(E_{{{\text{corr}}}}\) with SPR addition with regard to the \(E_{{{\text{corr}}}}\) without inhibitor is less than 85 mV as revealed in Table 5. Literature has reported that displacement in \(E_{{{\text{corr}}}}\) > 85 mV implies that the inhibitor is either anodic or cathodic type, while displacement in \(E_{{{\text{corr}}}}\) < 85 means the inhibitor is mixed type [37, 38]. The range of the shift in \(E_{{{\text{corr}}}}\) values (21 mV to 42 mV) in the present study suggests that SPR acted as a mixed-type inhibitor [39, 40]. More so, the results from Table 5 reveal that the presence of different concentrations of SPR changed the values of βa and βc as compared to the values in blank acid solution. However, the shifts in values of βa were slightly more pronounced as compared to shift in βc values suggesting that SPR acts more like an anodic type inhibitor.

Fig. 5
figure 5

Polarization curves for C38 steel in 10% HCl without and containing various concentrations of SPR

Table 5 Potentiodynamic polarization parameters for N80 steel corrosion in 10% HCl in the absence and presence of various concentrations of SPR

3.3 SEM Morphology

Scanning electron microscopy (SEM) analyses were performed to establish the formation of protective film by adsorption of SPR molecules on the C38 steel surface. The SEM micrographs of the steel after 6 h immersion in 10% HCl solutions without and with optimum concentration of SPR (7.2 × 10–3 M) at 30 °C are depicted in Fig. 6a, b. The image in Fig. 6a is that of the steel surface after 6 h immersion in 10% HCl solution without SPR inhibitor. The image clearly reveals that the C38 steel surface was severe damage due to metal dissolution by the corrosive acid. Several cracks were noticed in the image which indicated direct acid attack. Figure 6b shows the C38 steel surface after SPR addition. The image showed reduced surface damage compared to that without the inhibitor except traces of emery paper polish. This observation indicates effective corrosion inhibition due to protective film formation on the C38 steel surface.

Fig. 6
figure 6

SEM micrographs of C38 steel after 6 h immersion in a 10% HCl without SPR, b 10% HCl with 7.2 × 10–3 M SPR

3.4 Adsorption Isotherm

The values of the degree of surface coverage (\(\theta\)) obtained from weight loss measurement for different concentrations of SPR were fitted to various adsorption isotherms in order to establish the mode of adsorption. Langmuir, Temkin, Freundlich and El-Awady’s kinetic/thermodynamic model of adsorption isotherms were studied according to the following equations:

$${\text{Langmuir}};\frac{C}{\theta } = C + { }\frac{1}{{K_{{{\text{ads}}}} }}$$
(15)
$${\text{Temkin}};\;\theta = { }\frac{ - 2.303}{{2a}}\log K_{{{\text{ads}}}} - { }\frac{2.303}{{2a}}\log C$$
(16)
$${\text{Freundlich}};\;\log \theta = \log K_{{{\text{ads}}}} + 2.303n\log C$$
(17)
$${\text{El}} - {\text{Awady}};\;\log \left( {\frac{\theta }{{1 - { }\theta }}} \right) = \log K + y\log C,$$
(18)

where C is the SPR concentration, \(K_{{{\text{ads}}}}\) is the adsorption equilibrium constant, a is the attractive parameter and n is the interaction parameter. For El-Awady’s kinetic/thermodynamic model, \(K = { }\sqrt[y]{{K_{{{\text{ads}}}} }}\) or \(K_{{{\text{ads}}}} = { }K^{1/y}\) and y represents the number molecules of the inhibitor occupying a given active site. Figure 7a–d shows the plots of various adsorption isotherms for SPR drug on the C38 steel surface. The data deduced from these plots are presented in Table 6. From the results, the linear regression coefficients (R2) for Langmuir isotherm at all studied temperature are the closest to unity, indicating that Langmuir isotherm is the best fit and suggesting that SPR molecules were adsorbed on C38 steel surface according to Langmuir adsorption isotherm [41]. However, the slopes of the Langmuir isotherm deviated from unity, which indicates that the isotherm is not rigidly accurate, hence the need to consider other isotherms. It is seen from Temkin isotherm that in all cases the attractive parameter (a) values is negative, suggesting that repulsion exists in the adsorption layer [42, 43]. Freundlich isotherm shows that the values of 1/n are within the range; 0 < 1/n < 1 with confirms the ease of adsorption of SPR on the steel surface. From El-Awady’s model (Table 6), the values of 1/y are less than unity indicating that the inhibitor occupied more than one active site. Table 6 also reveals that \(K_{{{\text{ads}}}}\) values for all studied isotherms decrease with rise in temperature suggesting that SPR adsorption on the C38 steel surface was diminished at higher temperatures [44].

Fig. 7
figure 7

Adsorption Isotherms plots of SPR for C38 steel in 10% HCl at different temperatures: a Langmuir, b Temkin, c Freundlich and d El-Awady’s kinetic/thermodynamic model

Table 6 Adsorption isotherm parameters from various models for SPR adsorption on C38 steel in 10% HCl at different temperatures

The relationship between the standard free energy of adsorption (\(\Delta G_{{{\text{ads}}}}^{{0}}\)) and the adsorption equilibrium constant (\({\text{K}}_{{{\text{ads}}}}\)) for the various adsorption isotherm models is expressed as follows:

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

where R is the gas constant (R = 8.314 J K−1 mol−1), T is the absolute temperature and 55.5 is the molar concentration of H2O in solution. The calculated values of \(\Delta G_{{{\text{ads}}}}^{0}\) from Eq. (14) are presented in Table 6. The \(\Delta G_{{{\text{ads}}}}^{0}\) values for the various isotherm models were negative and range from − 13.73 to − 34.33 kJ mol−1. These negative values make certain the spontaneity of the adsorption of SPR on the C38 steel surface. From the range of values of \(\Delta G_{{{\text{ads}}}}^{0},\) it is shown that SPR adsorption is a mixed type involving physisorption and chemisorption [45, 46].

3.5 Density Functional Theory Calculations

The ground state geometry of the highest occupied molecular orbital (HOMO) and lowest unoccupied molecular orbital (LUMO) of the neutral (SPR) and protonated (SPR-H+) spironolactone is depicted in Fig. 8. As shown in Fig. 8, the HOMO of SPR and SPR-H+ comprises essentially π-orbitals and few σ-type orbitals and delocalized mainly in the rings contained in the molecules and the nearby O atoms. This indicates that the compounds can interact with a metal atom by donating its HOMO π- or σ-orbital electrons to the vacant d-orbitals of Fe. The LUMO distribution of SPR and SPR-H+ is similar, and it shows that the S-atom does not contribution to the LUMO. Based on this observation, and in agreement with the calculated EHOMO and ELUMO in Table 7, it is suggested that the neutral (SPR) and protonated (SPR-H+) species may exist in equilibrium. This situation implies that the HOMO of SPR-H+ donates electrons to the surface of Fe, while the LUMO of SPR accepts feedback donations from the Fe surface [18].

Fig. 8
figure 8

The frontier molecular orbital density distribution of SPR and SPR-H+

Table 7 Calculated quantum chemical parameters for SPR and SPR-H+

The calculated DFT electronic parameters of the two species, SPR and SPR-H+, such as EHOMO, ELUMO, dipole moment (μ), ΔE, global electronegativity (χ), chemical hardness (η), chemical softness (σ) and number of transferred electrons (ΔN) are listed in Table 7. The HOMO gives information about the inhibitor molecular orbitals which may interact with the metal atomic orbitals through charge donation to the appropriate partially filled or vacant metallic orbitals. Generally, higher values of EHOMO facilitate adsorption due to the increased tendency of the inhibitor molecule to donate electrons to acceptor molecule, and therefore enhance the inhibition efficiency. The LUMO values predict the electron accepting ability of the inhibitor. The lower the ELUMO value, the greater the tendency for the molecule to accept electrons [47, 48]. The energy bandgap (ΔE) shows the reactivity and inhibition efficiency of the compound with smaller value of ΔE indicating greater efficiency [47]. When comparing inhibitors with similar molecular structures, the compound with a higher EHOMO, a lower ELUMO and a lower ∆E usually exhibits higher inhibition efficiency [18]. Table 7 clearly shows that SPR exhibits lower EHOMO and higher energy gap, while SPR-H+ presents higher ELUMO and lower energy gap. The results indicate that SPR has a higher tendency to accept electrons donated from the metal (Fe) orbital, while SPR-H+ has a higher tendency to donate electron to the Fe surface. The lower energy gap of SPR-H+, which indicates high reactivity, allows it to easily get adsorbed onto the mild steel surface leading to increase in its inhibition efficiency when compared to SPR. However, the values of ELUMO listed in Table 7 do not agree with the observed order of inhibition efficiency. The higher value of dipole moment (μ), which is also associated with good inhibition performance, also favors SPR-H+ molecule [49]. An inhibitor with low hardness (η) value is expected to be stronger compared to another inhibitor with higher value, which also favors SPR-H+ molecule [50]. The higher value of global softness (σ) supports the fact that SPR-H+ will have higher chances of donating electrons to the Fe surface [51]. However, the higher value of global electronegativity (χ) displayed by SPR shows the strong attracting ability of SPR molecule to accept the electrons from the Fe surface, indicating better interaction with Fe surface [52]. Table 7 also shows that the ΔN values of SPR and SPR-H+ are all greater than zero (ΔN > 0), which indicates that the inhibitor may donate electrons onto the Fe surface through the formation of a coordinate covalent bond.

3.6 Inhibition Mechanism

The general believe is that inhibitor adsorption on the surface of metals is the vital step in the explanation of inhibition mechanism. The number of adsorption sites, mode of inhibitor interaction with metal surface and molecular size are the bases on which the inhibition efficiency of SPR against C38 steel corrosion in 10% HCl can be explained [46]. Both protonated and molecular species can adsorb on the surface of the steel. The adsorption of SPR molecules on the positive steel surface (Fe2+) can occur through the lone pairs (O=C, O=C–S–, –O–) in its structure as demonstrated in Fig. 9, decreasing the anodic dissolution of C38 steel [38]. The protonated species (Eq. 15) which the compound assumes in acidic solution get adsorbed on the cathodic sites of the C38 steel and decrease hydrogen evolution.

$${\text{C}}_{24} {\text{H}}_{32} {\text{O}}_{4} {\text{S}} + {\text{ xH}}^{ + } \to [{\text{C}}_{24} {\text{H}}_{32} {\text{O}}_{4} {\text{S}}]^{{{\text{x}} + }}.$$
(20)
Fig. 9
figure 9

Sketch of possible interaction mode in the adsorption of SPR on C38 steel surface in 10% HCl solution

These protonated \({\text{C}}_{24} {\text{H}}_{32} {\text{O}}_{4} {\text{S}}\) (SPR) could have been attached to the surface of the C38 steel by electrostatic interaction between the protonated specie and the chloride ion (Cl) as the steel surface is positively charged in the HCl medium [43]. The adsorption of SPR inhibitor molecules on the surface of the C38 steel can also be on the basis of donor–acceptor interactions between the vacant d-orbitals of surface Fe and the aromatic ring π-electrons.

4 Conclusions

From the results of the study on insight into the adsorption and inhibitive effect of spironolactone drug on C38 carbon steel corrosion in hydrochloric acid environment, the following conclusions can be drawn:

  1. 1.

    The spironolactone (SPR) drug exhibits a good performance as an inhibitor for C38 steel corrosion in 10% HCl solution and the inhibition efficiency increases with increase in SPR concentration but decreases with temperature rise.

  2. 2.

    Potentiodynamic polarization (PDP) curves revealed that SPR behaves as mixed-type inhibitor.

  3. 3.

    These negative values of \(\Delta G_{{{\text{ads}}}}^{0}\) make certain the spontaneity of the adsorption of SPR on the C38 steel surface.

  4. 4.

    Adsorption isotherm study revealed that Langmuir isotherm is the best fit which suggests that SPR molecules were adsorbed on C38 steel surface according to Langmuir adsorption isotherm and the adsorption is a mixed type involving physisorption and chemisorption

  5. 5.

    Scanning electron microscopy (SEM) analyses show effective corrosion inhibition due to protective film formation on the C38 steel surface.

  6. 6.

    The inhibition efficiencies obtained from the three methods, PDP, weight loss and EIS, are reasonably in good agreement.