Introduction

Corrosion is a natural destructive phenomenon where pure metals interact with the environment to form non-desirable metallic compounds. Protection of metals from corrosion is one of the major economic issues. Mild steel (MS) is an important metal which is widely applied in oil wells, constructional materials, automobiles and many other industries due to its excellent mechanical properties and low cost [1]. Hydrochloric acid solutions (approximately 0.5–1 M) are widely used in several industrial processes, some of the important fields of application being acid pickling of steel, chemical cleaning and processing, ore production and oil well acidification [2]. Corrosion of MS when exposed to aggressive acids, such as hydrochloric acid and sulfuric acid results in such damage that needs either repair or replacement of the part leading to huge loss of resources. Corrosion of MS is worth investigating because such corrosions cause damage to pipelines, bridges, marine structures and construction materials bringing heavy economic losses worldwide. Corrosion is also one of the major concerns in the durability of materials and structures; and studies are continuously carried out to develop effective methods for corrosion control [3]. There are a number of methods for corrosion control but the choice depends on economics, safety requirements and technical considerations. Mitigation of MS corrosion is achieved through such means as galvanisation, organic coating (enamel, polymer, oils etc.) and using corrosion inhibitors [46] which form film by adsorbing on the metal surface. The organic corrosion inhibitors although proved to be the best for the protection of MS, but they are restricted in some cases because of their toxicity. Therefore, the best means of protection is to adapt an inhibitor which is eco-friendly, easily soluble and effective at low concentration. The class of organic compounds which satisfy these conditions are drugs and their derivatives which are highly water soluble.

Corrosion inhibition studies of many drugs, such as β-lactam antibiotics {penicillin G [7], ampicillin [8], amoxicillin [9]}, quinolones {ofloxacin [10], ciprofloxacin [11], quinoline [12]}, tetracyclines {doxycycline [13]}, sulphonamides {sulfamethazine [14], dapsone [15] antifungal {ketoconazole [16]}, antiviral {rhodanine [17]}, have been reported.

Levofloxacin is a member of the fluoroquinolone class of antibacterial used in the treatment of chronic bronchitis, respiratory tract infection, pneumonia, skin infection and urinary tract infection [18]. Its structure has extended π- electron systems, good number of hetero atoms and two electron donating methyl groups which facilitate its adsorption on the MS surface. Fluoroquilones have been established as potential class of inhibitors, P1 and P2 which belong to the same class are expected to give good inhibition because similar molecules tend to behave alike [19]. Eddy et al. [20] studied derivatives of fluoroquinolone (ofloxacin, amifloxacin, enofloxacin, pefloxacin) on MS corrosion in sulfuric acid medium by gravimetric technique supported by quantum chemical calculations and obtained inhibition efficiency up to 94 %. Levofloxacin was previously studied by Pang et al. [21] as MS corrosion inhibitor in sulfuric acid medium by weight loss and electrochemical methods and maximum inhibition efficiency obtained was 90 %. In this study, Levofloxacin is being studied as MS corrosion inhibitor in HCl medium using gravimetric and electrochemical techniques at lower concentrations and the results are supported by theoretical studies. Comparison of inhibition efficiency of Levofloxacin with its synthesized derivative has been made to study the effect of an extra heterocyclic ring and an amine group transformed into amide bond present in P2.

In continuation of our previous work [2226] the present paper reports the comparative study of the anticorrosion potential of levofloxacin (P1) and its newly synthesized amide derivative (P2) in 0.5 M HCl media using weight loss method, electrochemical impedance spectrosocpy (EIS) and potentiodynamic polarization measurements. Morphological study has been done using scanning electron microscope (SEM). Quantum chemical calculations were done and different parameters, such as energies of highest occupied molecular orbital (E HOMO) and the lowest unoccupied molecular orbital (E LUMO), the energy gap (∆E), hardness (η), softness (σ), electron affinity (A), electronegativity (χ), ionization potential (I) of P1 and P2 were determined and correlated with experimental results.

Experimental

Materials and sample preparation

The chemical composition by wt% of MS coupons used for experiment was as follows: C, 0.051; Mn, 0.179; Si, 0.006; P, 0.005; S, 0.023; Cr, 0.051; Ni, 0.05; Mo, 0.013; Ti, 0.004; Al, 0.103; Cu, 0.050; Sn, 0.004; B, 0.00105; Co, 0.017; Nb, 0.012; Pb, 0.001 and the remaining is iron. Before the commencement of experiment, samples were mechanically cut into 2 cm × 2 cm × 0.1 cm, abraded with different grades of silicon carbide emery paper, washed with double distilled water, degreased, dried and stored in desiccator until use. For polarization and impedance measurements, the MS specimens were embedded in epoxy resin to expose a geometrical surface area of 1 cm2 to the electrolyte. Solutions of P1 and P2 in optimized concentration range of 0.14–0.35 mM were prepared from stock solution made of using 0.5 M HCl. Melting range was determined using Veego Melting Point VMP III apparatus.

Synthesis of 8-fluoro-3-methyl-9-(4-methyl-piperazin-1-yl)-6-oxo-2,3-dihydro-6H-1-oxa-3a-aza-phenalene-5-carboxylic acid-(5-methyl-pyridin-2-yl)-amide (P2)

The reported procedure [26] of acid–amine coupling was used for the synthesis of P2. Scheme for the synthesis of P2 is given in Fig. 1. To a mixture of 8-fluoro-3-methyl-9-(4-methyl-piperazin-1-yl)-6-oxo-2,3-dihydro-6H-1-oxa-3a-aza-phenalene-5-carboxylic acid (1 equivalent) and 5-methyl-pyridin-2-ylamine (1 equivalent), triethylamine (2.1equivalent) and O-(Benzotriazol-1-yl)-N,N,N’,N’-tetramethyluronium tetrafluoroborate (TBTU) (1.2 equivalent) were added in dichloromethane (MDC). The reaction mixture was stirred at room temperature for 16 h. Reaction completion was monitored by TLC using solvent system, ethyl acetate: methanol (1:1). Reaction mixture was washed with 1 M HCl, 10 % bicarbonate solution followed by water and brine, dried over sodium sulfate, and concentrated to remove solvent under reduced pressure. The solid obtained was crystallized using ethanol to get the pure form. The yield of the product was 90 % and melting range was 606–607 K. Spectral data: IR (cm−1) 1673 (C=O, Amide), 3398 (N–H, Amide), 1673 (C=O, ketone), 1003–1095 (C–F), 1450–1599 (Ar C=C),1H-NMR (400 MHz, DMSO-d6) δH ppm:1.56 (s, 3H, CH3), 1.57 (s, 3H, CH3), 2.04–2.16 (m, 4H, piperazine), 2.17–2.35 (m, 4H, piperazine), 2.54 (s, 3H, N–CH3), 4.42–4.38 (m, 3H, CH2CH), 7.25–7.26 (d, 1H, phenyl), 7.48–7.51 (d, 1H, phenyl), 7.69 (s, 1H, phenyl), 8.188 (s, 1H, phenyl), 8.61 (s, 1H, phenyl), 12.55 (s, 1H, N–H). MS: 452.12 (M + 1), 453.12 (M + 2).

Fig. 1
figure 1

Scheme for the synthesis of inhibitors

Weight loss measurements

MS specimens were immersed in 0.5 M HCl solution without and with varying amounts of inhibitor for 4 h in a thermostatically controlled water bath (with an accuracy of ±0.2 K) at constant temperature, under aerated condition (Weiber limited, Chennai, India). The coupons were taken out after 4 h of immersion, rinsed in water followed by drying in acetone. Weight loss of the specimens was recorded by analytical balance (Sartorius, precision ±0.1 mg). Experiment was carried out in triplicates and mean weight loss was calculated. The procedure was repeated for all other concentrations and temperatures.

Electrochemical measurements

Potentiodynamic polarization and EIS experiments were carried out using a CHI660D electrochemical workstation. A conventional three-electrode cell consisting of |Ag/AgCl| reference electrode, a platinum auxiliary electrode and the working MS electrode with 1 cm2 exposed areas was used. Pre-treatment of the specimens was same as gravimetric measurements. The electrochemical tests were performed with P1 and P2 concentrations ranging from 0.14 to 0.35 mM at 303 K. Potentiodynamic polarization measurements were performed in the potential range from −850 to −150 mV with a scan rate of 0.4 mV s−1. The exposure time before polarization measurements was 30 min. Prior to EIS measurement; 30 min were spent for making open circuit potential a stable value. The EIS data were taken in the frequency range of 10 kHz–1 Hz.

Quantum chemical calculations

The geometrical optimization of the investigated molecules was done by Ab initio method at 6-31G** basis set for all atoms. For energy minimization, the convergence limit at 1.0 and rms gradient 1.0 kcal/Amol was kept. The Polak–Ribiere conjugate gradient algorithm which is quite fast and precise was used for optimization of geometry. In DFR calculation B3LYP combined exchange-corelation potential functional has been used. The HYPERCHEM 7.52 (Hypercube Inc., Florida, USA, 2003) professional software was employed for all calculations.

Scanning electron microscopy (SEM)

The SEM experiments were performed using a Zeiss electron microscope with the working voltage of 15 kV and the working distance 10.5 mm. In SEM micrographs, the specimens were exposed to 0.5 M HCl in the absence and presence of inhibitors under optimum conditions after 4 h of immersion. The SEM images were taken for polished MS specimen and specimen immersed in acid solution with and without inhibitors.

Results and discussion

Weight loss measurement

Effect of inhibitor concentration

The effect of concentration of inhibitors P1 and P2 on MS corrosion in 0.5 M HCl was studied at concentrations from 0.14 to 0.35 mM and temperature range of 303 to 333 K by weight loss measurement and results are presented in Table 1. The corrosion rate and inhibition efficiency were calculated using the formulae (1) and (2).

Table 1 Weight loss data in the absence and presence of inhibitors in 0.5 M HCl at different concentrations and temperatures
$$C_{\text{R}} = \frac{\Delta W}{St}$$
(1)
$${\text{IE }}\left({\text{\%}} \right) = \frac{{(C_{\text{R}} )_{\text{a}} - (C_{\text{R}} )_{\text{p}} }}{{(C_{\text{R}} )_{\text{a}} }} \times 100$$
(2)

where, ΔW is the weight loss, S is the surface area of the specimen (cm2), t is the immersion time (h), and (C R ) a , (C R ) p are corrosion rates in the absence and presence of the inhibitor, respectively.

As the concentration increases, IE (%) increases for both P1 and P2. As the concentration increases, availability of number of molecules to block reaction sites increases. The highest inhibition efficiency of 96 and 94 % were shown by P2 and P1 at 0.35 mM concentration, respectively. After that although concentration was raised and there was no much difference in inhibition efficiency.

Effect of temperature

Inhibition performance of P1 and P2 on MS in 0.5 M HCl was studied in the temperature range of 303–333 K (Table 1). The influence of temperature on corrosion reaction is very complex, because many changes take place on the metal surface, such as etching, desorption and inhibitor itself may undergo decomposition [27]. The corrosion rate of MS increases as the temperature of the surrounding solution increases both in the absence and presence of inhibitors. That is IE (%) decreases as the temperature increases. This is due to decrease in hydrogen evolution over potential which in turn increases the evolution of anodic hydrogen at higher temperatures. There is also possibility of desorption of adsorbed inhibitor film, as the inhibitor molecules gain sufficient energy to overcome interaction between metal empty orbital and inhibitor electrons at higher temperature.

The relationship between corrosion rate of MS and temperature of the environment is given by Arrhenius equation

$$C_{\text{R}} = k\, { \exp }\left( { - \frac{{E_{\text{a}}^{*} }}{RT}} \right)$$
(3)

Enthalpy and entropy of the activation are calculated based on transition state theory using the alternative form of Arrhenius equation, which takes the form as

$$C_{\text{R}} = \frac{RT}{Nh}\exp \left( {\frac{{\Delta S_{\text{a}}^{*} }}{R}} \right)\exp \left( {\frac{{ - \Delta H_{\text{a}}^{*} }}{RT}} \right)$$
(4)

where, E *a is activation energy, ∆S *a is the entropy of activation, ∆H *a is the enthalpy of activation, k is Arrhenius pre‐exponential factor, h is Planck’s constant, N is Avogadro’s number, T is the absolute temperature and R is the universal gas constant.

The plot of ln C R versus 1/T is a straight line (Fig. 2), computing the values of slope and intercept, the values of E * a and k were calculated for both the inhibitors at various concentrations. Using the Eq. (4), another linear plot of ln C R/T versus 1/T was drawn (Fig. 3) with slope (−∆H * a /R) and intercept [ln(R/Nh) + ∆S *a /R]. This was used for the calculation of ∆H *a and ∆S *a . Different parameters involving Arrhenius equations were calculated and listed in Table 2.

Fig. 2
figure 2

Arrhenius plots in the absence and presence of different concentrations of a P1 and b P2

Fig. 3
figure 3

Alternative Arrhenius plots in the absence and presence of different concentrations of a P1 and b P2

Table 2 Activation parameters in the absence and presence of P1 and P2 in 0.5 M HCl

Review of these data indicates that all the activation parameters of dissolution reaction of MS in 0.5 M HCl are higher in the presence of inhibitors than in their absence. E *a is higher for inhibited solution than for uninhibited solution and increases upon increasing concentration of inhibitors. Such a trend suggests that corrosion reaction will be further pushed to surface sites which are characterized by progressively higher value of E *a as concentration of the inhibitor becomes higher [28]. At higher concentration E *a increases further, because extent of surface coverage is close to saturation [29]. The higher values of E *a in inhibited solution might also be correlated with the increased thickness of double layer [30]. Further from the value of E *a which is greater than 20 kJ mol−1 for both inhibited and uninhibited solutions, it is confirmed that the whole process is surface controlled [31]. The positive sign of enthalpies shows endothermic nature of MS dissolution process i.e., dissolution of steel is difficult [32]. After the addition of P1 and P2 there is increase in the value of enthalpy of activation which suggests that the dissolution becomes more difficult. Entropy of activation is negative in the presence and absence of P1 and P2 which becomes more positive on increasing concentration of inhibitor. This indicates that the dissolution of MS is characterized by an activated complex which is associative. This might be due to the adsorption of P1 and P2 molecules from HCl solution which could be regarded as quasi- substitution between the inhibitors in the aqueous phase and water molecules on MS electrode surface. In such a situation, the adsorption of P1 and P2 on MS surface which results in decrease in entropy was accompanied with desorption of water molecules from the electrode surface which increases the entropy. Here entropy is the sum of solvent entropy and solute entropy. Thus, increase in entropy of activation for P1 and P2 was attributed to predominance of solvent (H2O) entropy [33].

Adsorption isotherm

The efficiency of a compound as successful corrosion inhibitor mainly depends on its adsorption ability on the metal surface. It is essential to know the mode of adsorption and the adsorption isotherm that can give valuable information on the interaction of inhibitor and metal surface [34]. The adsorption of an organic adsorbate at a metal/solution interface can be presented as a substitution adsorption process between the organic molecules in aqueous solution and the water molecules on a metallic surface. All isotherms are having general formula

$$f\left( {\theta , x} \right){ \exp }( - 2\alpha \theta ) = K_{\text{ads}} C$$
(5)

where, \(f\left( {\theta , x} \right)\) is the configurational factor which depends upon the physical mode of adsorption. Here θ is the surface coverage, C is the concentration of the inhibitor, \(x\) is the size factor ratio, α is the molecular interaction parameter and K ads is the equilibrium constant of the adsorption process [35]. Depending on the value of correlation co-efficient the best fitter of the isotherm can be determined. After trying to fit the values to many isotherms like Temkin, Frumkin, Freundlich and Langmuir, the best fit was obtained with Langmuir adsorption isotherm for the inhibitors. A plot of C/θ versus C (Fig. 4) gave a straight line with an average correlation coefficient of 0.9995 and 0.9995, for P1 and P2, respectively and a slope of nearly unity (1.0706 and 0.9995 for P1 and P2, respectively) suggests that the adsorption of both the molecules obeys Langmuir isotherm, which can be expressed by the following equation:

Fig. 4
figure 4

Langmuir isotherm for the adsorption of a P1 and b P2 in 0.5 M HCl at different temperatures

$${\raise0.7ex\hbox{$C$} \!\mathord{\left/ {\vphantom {C \theta }}\right.\kern-0pt} \!\lower0.7ex\hbox{$\theta $}} = \frac{1}{{K_{\text{ads}} }} + C$$
(6)

From Eq. (6), K ads can be calculated from intercept of \({\raise0.7ex\hbox{$C$} \!\mathord{\left/ {\vphantom {C \theta }}\right.\kern-0pt} \!\lower0.7ex\hbox{$\theta $}}\) Vs C plot. Free energy of adsorption can be calculated from K ads using the Eq. (7).

$$\Delta G^{o}_{\text{ads}} = - RT\ln (55.5 K_{\text{ads}} )$$
(7)

where, R is gas constant and T is the absolute temperature of the experiment and the constant value 55.5 is the concentration of water in solution in mol dm−3.

Entropy of adsorption and enthalpy of adsorption process can be calculated using the following thermodynamic equation:

$$\Delta G^{o}_{\text{ads}} = \Delta H^{o}_{\text{ads}} - T\Delta S^{o}_{\text{ads}}$$
(8)

The values of all thermodynamic parameters are listed in Table 3. A plot of ∆G oads versus T gives a straight line (Fig. 5) which can be used for the calculation of ∆H oads and ∆S oads . Calculated values of free energy of adsorption and adsorption equilibrium constant together represent spontaneity of the process and stability of the adsorbed layer on the metal surface. Large values of K ads obtained for P1 and P2 indicate that they are efficient adsorbents which imply that they have better inhibition efficiency. In general, the values of ΔG oads up to −20 kJ mol−1 are compatible with the electrostatic interaction between the charged inhibitor molecules and the charged metal surface (physisorption), and those which are more negative than −40 kJ mol−1 involve charge sharing or charge transfer from the inhibitor molecules to the metal surface (chemisorption) [36]. The calculated values of free energy of adsorption for P1 and P2 lies between −20 and −40 kJ mol−1 at lower temperatures and little higher than −40 kJ mol−1 at higher temperatures. Many authors reported that the adsorption of organic molecules on the solid surfaces cannot be considered as purely physical or as purely chemical [3739]. Initially inhibitor may adsorb on the MS surface by electrostatic force of attraction but at later stage charge transfer also takes place. Therefore, it is concluded that the adsorption of P1 and P2 is neither totally physical nor chemical but complex comprehensive kind of adsorption involving both with a slight dominance of chemisorption. Similar type of observations have been reported in the literature [4043].

Table 3 Adsorption thermodynamic parameters in the absence and presence of various concentrations of inhibitors
Fig. 5
figure 5

Plot of ΔG ads vs T for P1 and P2

Electrochemical impedance spectroscopy

The corrosion behavior of P1 and P2 was studied using EIS and results are tabulated in Table 4. Nyquist plot, bode modulus plot and phase angle plot of P1 and P2 are given in Figs. 6 and 7, respectively. Nyquist plots for all concentrations are characterized by one capacitive loop whose diameter increases on increasing concentration of the inhibitor. The capacitive loop was related to charge transfer in the corrosion process, whereas the depressed form of the higher frequency loop reflects the surface non-homogeneity of structural or interfacial origin, such as those found in adsorption processes [44]. Here contribution of all resistances correspond to the metal/solution interface, i.e., charge transfer resistance (R ct), diffuse layer resistance (R d), accumulation resistance (R a), film resistance (R f), etc. must be taken into account. So charge transfer resistance must be replaced by polarization resistance (R p) [45]. Nyquist plots can be represented by equivalent circuit (Fig. 8) where solution resistance (R s) is shorted by constant phase element (CPE) that is placed in parallel to polarization resistance (R p).

Table 4 Impedance parameters for the corrosion of MS in 0.5 M HCl in absence and presence of different concentrations of inhibitors at 303 K
Fig. 6
figure 6

a Nyquist plot. b Bode modulus plot. c Phase angle plot in the absence and presence of different concentrations of for P1

Fig. 7
figure 7

a Nyquist plot. b Bode modulus plot. c Phase angle plot in the absence and presence of different concentrations of for P1

Fig. 8
figure 8

Equivalent circuit model

The values of R p were calculated from the difference in impedance at lower and higher frequencies [46]. The inhibition efficiency was calculated using polarization resistance according to the following equation:

$${\text{IE}}\, \left( \% \right) = \frac{{(R_{\text{p}} )_{\text{p}} - (R_{\text{p}} )_{\text{a}} }}{{(R_{\text{p}} )_{\text{p}} }} \times 100$$
(9)

where (R p)a and (R p)p are the polarization resistances in the absence and presence of inhibitor, respectively. After the addition of inhibitors the polarization resistance (R p) increases for both inhibitors. The increase in R p value is due to the film formed on the steel surface which prevents the charge transfer. Such results were reported by many authors [47, 48]. Inhibition efficiency increases with the increase in the concentration of the inhibitors. As any other electrochemical process corrosion also has two phases: (1) Oxidation of metal (charge transfer process). (2) The diffusion of metal ions from metal surface to the solution [49]. The film formed by the inhibitors P1 and P2 protects the metal by acting as a barrier to the diffusion of ions. Even though both P1 and P2 exhibit good inhibition efficiency, maximum efficiency is obtained for compound P2 because of the presence of plenty of electrons and an additional pyridine ring compared to P1.

CPE is a special element whose admittance is a function of angular frequency and whose phase is independent of frequency [50]. The impedance function of the CPE can be represented as follows:

$$Z_{\text{CPE}} = Y_{\text{o}}^{ - 1} (i\omega )^{ - 1}$$
(10)

where, Y o is magnitude of CPE, ω is angular frequency (in rad s−1), i 2 = −1 is the imaginary number, n = α/(π/2) in which α is the phase angle of CPE. The value of n signifies interphase parameter of working electrode. In this study n value for blank is 0.76, which increases by the addition of P1 (varying between 0.86 and 0.92) and P2 (0.87 and 0.92). Increase in the value of n by P1 and P2 addition represents capacitive behavior because for ideal capacitor n value is 1. The double layer capacitance (C dl) can be calculated from CPE parameters using the equation,

$$C_{\text{dl}} = (Y_{\text{o}} R_{\text{ct}}^{1 - n} )^{1/n}$$
(11)

The decrease in C dl is due to adsorption of inhibitors which displaces water molecules originally adsorbed on the MS surface which further decreases the active surface area [48]. Irregular trend in C dl indicates the complexity of adsorption–desorption phenomenon. Such results were reported by many authors [5153].

The single peak obtained in Bode plots for P1 and P2 indicates that the electrochemical impedance measurements fit well in one-time constant equivalent model. There is only one phase maximum in the Bode plot for both inhibitors, indicating only one relaxation process, which would be the charge transfer process, taking place at the metal–electrolyte interface [54]. The shift in phase angle is due to the protective film formed on the MS surface. The shift increases with increase in concentration of the inhibitors. Phase angle value for P1 and P2 varies between 60o and 80o, whereas an ideal capacitor will be having by slope value of 90o.

Potentiodynamic polarization

Polarization measurements were performed to gain information regarding the kinetics of anodic and cathodic reactions. Tafel plots were drawn to study the mechanism of the inhibition process of P1 and P2 (Fig. 9). The electrochemical parameters, such as corrosion potential (E corr), corrosion current density (i corr), Tafel slopes (b a , b c) and linear polarization resistance are listed in Table 5.

Fig. 9
figure 9

Tafel plots for MS in 0.5 M HCl containing different concentration of a P1 and b P2

Table 5 Potentiodynamic polarization parameters for the corrosion of MS in 0.5 M HCl in absence and presence of different concentrations of P1 and P2 at 303 K

Inhibition efficiency (IE %) will be known by corrosion current density (i corr) calculated by the Tafel plot,

$${\text{IE}}\, (\% ) = \frac{{i_{\text{corr}}^{\text{o}} - i_{\text{corr}} }}{{i_{\text{corr}}^{\text{o}} }}\times100$$
(12)

where \(i_{\text{corr}}^{\text{o}}\) and i corr are the uninhibited and the inhibited corrosion current densities, respectively.

Polarization is the shift in electrode potential from equilibrium value. By the addition of inhibitors there will be a shift in the corrosion potential value towards anodic region which is large in case of P1 and P2. This indicates that anodic reaction is predominantly hindered in the presence of inhibitors P1 and P2. Shift in anodic and cathodic Tafel slope values of P1 and P2 indicates that inhibitors are of mixed type promoting retardation of both anodic dissolution of C-steel and cathodic hydrogen discharge reaction. The irregular trends of b a and b c values indicate the involvement of more than one type of species adsorbed on the metal surface [55]. The corrosion current values decrease with increasing concentration of P1 and P2 as a result of decrease in corrosion rate after the formation of adsorbed film. Linear polarization resistance increases with increase in concentration of inhibitors. According to Ferreira et al. the displacement in E corr is more than 85 mV relating to the corrosion potential of the blank, the inhibitor is considered as a cathodic or anodic type. If the change in E corr is less than 85 mV, the corrosion inhibitor is regarded as a mixed type [56]. In the present case for both P1 and P2 shift is more than 85 mV and it is anodic hence, the inhibitors are anodic.

Quantum chemical calculations

Quantum chemical calculations were done with complete geometry optimizations to explore the theoretical–experimental consistency of P1 and P2 using Ab initio method. This method reveals the binding ability of an organic compound thereby it is possible to predict the ability to retard the dissolution of metal in aggressive media. Inhibition efficiency is correlated to the molecular and structural parameters that can be obtained through theoretical calculations, such as chemical selectivity, reactivity and charge distribution [57]. In this way, various quantum chemical parameters, such as energies of highest occupied molecular orbital (E HOMO), and the energies of lowest unoccupied molecular orbital (E LUMO),the energy gap(∆E), hardness (η), softness (σ), electron affinity (A), electronegativity (χ) and ionization potential (I) of P1 and P2 were calculated and compared with results obtained by gravimetric and electrochemical methods. The computed parameters of P1 and P2 are listed in Table 6.

Table 6 List of quantum chemical parameters for P1 and P2

All the quantum chemical structures are given in Table 7. According to Frontier Molecular Orbital (FMO) theory of chemical reactivity, transition of electron is due to interaction between highest occupied molecular orbital (HOMO) and lowest unoccupied molecular orbital (LUMO) of reacting species [58]. High E HOMO facilitates adsorption by influencing the transport process through the adsorbed layer, whereas low lying E LUMO induces a back donation of charge from the metal to the molecule [59]. In this study, P2 has higher E HOMO value compared to P1, so it has better electron donating capacity. The better electron donation capacity of P2 can be correlated to the presence of nitrogen and oxygen atoms which contain lone pair of electrons and also aromatic electrons present on the ring. P2 has lower E LUMO value compared to P1, which reflects better acceptance of electrons which helps in back donation and hence, emerges as a better inhibitor. The electron density of HOMO is mostly distributed around the delocalised electrons in both P1 and P2 which shows involvement of these in adsorption. Lower value of ∆E ensures better efficiency because the energy required to remove an electron from the last occupied orbital will be low [60]. The trend for ∆E follows the order P1 > P2 which suggests that P2 has higher interactions with the metal surface compared to P1. Molecular orbital (MO) theory can also be used to re-establish the results. As Fe atom is an electron pair acceptor it can be termed as Lewis acid whereas inhibitors P1 and P2 being electron donors act as base. According to MO concept, the overlap between LUMO of acid and HOMO of base acts as ruling factor for the formation of adsorption bond. The electron affinity of acid (Fe) is 0.2 eV, the negative of which is the E LUMO of acid. The E HOMO of P1 and P2 are −8.387 and −7.271 eV, respectively. Calculated values of energy gap between LUMO of acid and HOMO of two bases P1 and P2 works out to 8.187 and 7.071 eV, respectively. Lower the HOMO–LUMO energy gap, higher will be the HOMO–LUMO overlap and stronger is the acid–base bond formation and higher the inhibition efficiency [49]. As the energy gap of P2 is less compared to P1, it can be deduced that the interaction between P2 and Fe surface can be easily established compared to P1, so P2 is more efficient in inhibiting MS corrosion. Ionization potential is a fundamental descriptor of chemical reactivity of atoms and molecules [61]. If the ionization potential is high then molecule is more stable and it is difficult to remove an electron to form adsorption bond. Among the two inhibitors, P1 has higher value for ionization potential as compared to P2. Hence, P1 is chemically more inert compared to P2, therefore, P2 has better inhibition efficiency. The dipole moment value is inconsistent on the use of dipole moment as a predictor of the direction of a corrosion inhibition reaction. In literature also, significant relation has not been mentioned between dipole moment and inhibition efficiency [62, 63]. Electronegativity describes the tendency of an atom to attract electron density towards itself. According to Sanderson’s electronegativity equalization principle [64], the molecule with high electronegativity quickly reaches equalization hence, low reactivity leads to lower inhibition efficiency. Among the studied molecules P1 has higher electronegativity hence, lower reactivity. Chemical hardness measures the resistance of an atom to a charge transfer whereas softness is the measure of the capacity of an atom or group of atoms to receive electrons [65]. According to HSAB theory of chemical reactivity, hard acids prefer to co-ordinate with hard bases and soft acids with soft bases. It is a well-known fact that Fe being a transition metal acts as soft acid. P2 had the least hardness and maximum softness so it stands out as the better inhibitor.

Table 7 List of quantum chemical structures for P1 and P2

Scanning electron microscopy

Morphologies of MS in the absence and presence of optimum concentrations of P1 and P2 at 300 K are presented in Fig. 10a–d. The polished and smooth surface of MS before immersion in HCl is shown in Fig. 10a. After exposure of MS to uninhibited solution, the corroded surface appears to be damaged with cracks and pits and it is shown in Fig. 10b. When the surface is treated with inhibitor solutions the adsorbed film formed on the steel surface retards corrosion. In Fig. 10c, d surface of MS covered with inhibitors P1 and P2, respectively can be observed.

Fig. 10
figure 10

SEM images of MS surface a polished, b immersed in 0.5 M HCl, c immersed in 0.5 M HCl in the presence 0.35 mM of P1, d immersed in 0.5 M HCl in the presence 0.35 mM of P2

Mechanism of inhibition

Inhibition mechanism can be proposed on the basis of adsorption of P1 and P2 on steel surface. As the studied inhibitors are basic (containing nitrogen atoms) there is a chance of protonation. So in acidic solution, both neutral and cationic forms of inhibitors exist. It is assumed that Cl ion first got adsorbed onto the positively charged metal surface by columbic attraction and then cationic form of inhibitor molecules can be adsorbed through electrostatic interactions between the positively charged molecules and the negatively charged metal surface [66]. The mechanism for the dissolution of Fe is reported by some authors [67].

$${\text{Fe + Cl}}^{ - } \leftrightarrow ({\text{FeCl}}^{ - } )_{\text{ads}}$$
(13)
$$({\text{FeCl}}^{ - } )_{\text{ads}} \leftrightarrow ({\text{FeCl}})_{\text{ads}} + {\text{e}}^{ - }$$
(14)
$$({\text{FeCl}})_{\text{ads}} \leftrightarrow {\text{FeCl}}^{ + } + {\text{e}}^{ - }$$
(15)
$${\text{FeCl}}^{ + } \leftrightarrow {\text{Fe}}^{ + 2} + {\text{Cl}}^{ - }$$
(16)

Protonated form of P1 and P2 adsorbs on metal surface through (FeCl) formed in step 13, forms (FeClInhH+) and hence, steps 14, 15 and 16 can be prevented. So anodic reactions will be retarded.

$${\text{Fe + H}}^{ + } \leftrightarrow ({\text{FeH}}^{ + } )_{\text{ads}}$$
(17)
$$( {\text{Fe}}{\text H^{ + }}) + {\text{e}}^{ - } \leftrightarrow ({\text{FeH}})_{\text{ads}}$$
(18)
$$( {\text{FeH)}}_{\text{ads}} + {\text{H}}^{ + } + {\text{e}}^{ - } \to {\text{Fe + H}}_{2}$$
(19)

Protonated inhibitors also adsorbs at the cathodic sites in competition with hydrogen ions so hydrogen evolution will be reduced.

Along with electrostatic force of attraction, inhibitors also adsorb on the MS surface through chemical adsorption. Both P1 and P2 contain hetero atoms (N and O), extended π electron system which helps in making effective co-ordinate bond with MS surface. Electron releasing methyl groups are also present which increases electron density on the ring. P2 contains an extended pyridine ring which also gives good contribution in decreasing corrosion rate. So inhibition takes place through both physisorption and chemisorption.

Conclusion

The following conclusions can be derived from the studies.

  1. 1.

    Levofloxacin derived amide (P2) and Levofloxacin (P1) showed very good activity in preventing corrosion of MS in hydrochloric acid media. P2 shows higher inhibition efficiency compared to P1.

  2. 2.

    Inhibition efficiency of MS varies directly with the concentration and inversely with the temperature.

  3. 3.

    Adsorption of both inhibitions follows Langmuir isotherm.

  4. 4.

    EIS measurements show that polarization resistance increases and double layer capacitance decreases on adding inhibitors.

  5. 5.

    Potentiondynamic polarization experiments reveal that P1 and P2 are anodic inhibitors.

  6. 6.

    Surface studies show the formation of adsorbed inhibitor layer on the metal surface.

  7. 7.

    From quantum chemical methods it is revealed that P2 has better electron donating ability compared to P1. This supports experimental results very well.