Introduction

In our metal-based society, metals play a crucial role in our daily lives. However, these metals are often vulnerable to corrosion1. Corrosion is defined as the deterioration or destruction of metallic materials through chemical, electrochemical, and/or metallurgical interactions with the environment. This natural process transforms metals back into their native oxide forms or other combined states, such as the minerals from which they were originally extracted1,2. Mild steel is widely used in both commercial and residential structures—such as bridges, cars, and railroads—due to its advantageous mechanical properties and affordability1,3. Mild steel typically contains C (0.3%), Mn (0.7%), Si (0.5%), Ni, Mo, Cu, P, S (0.05%) and Fe and due to its unique physical properties, it is widely used in industrial applications4. Due to the harsh conditions metals are in, corrosion is sometimes inevitable5. It equates to a global loss according to the National Association of Corrosion Engineers (NACE) of US$ 2.5 trillion, around 3.5% of global GDP4,5.

Hydrochloric and sulfuric acid solutions are often used to clean internal surfaces of pipes in industries. Hydrochloric acid finds wide applications in pickling of metals, removal of scale and acidizing of oil wells because it is more economical and trouble-free4. In a hydrochloric acid medium, mild steel easily corrodes due to the dissolution of the cementite phase (Fe3C) usually present in steel. The application of corrosion inhibitors is the most economical and practical method to mitigate electrochemical corrosion. These corrosion inhibitors are usually mixed with acids when cleaning the internal surfaces of pipes in the industry, to trap protons that initiate the corrosion process. Over the years, inorganic compounds such as nitrites, chromates etc. (anodic inhibitors), were used to reduce corrosion. From the standpoint of safety, the development of non-toxic and effective inhibitors is very important and desirable6. The most efficient and cost-effective corrosion protection technique is the use of natural and/or synthetic organic molecules as inhibitors. Many heterocyclic compounds containing N, O, P and S have been reported to be effective inhibitors (cathodic inhibitors) of steel corrosion in acid media3,5. Generally, the tendency to form stronger coordination bonds and thus the inhibition efficiency follows the trend: P < S < N < O. A broad range of organic adsorption inhibitors presently applied in the corrosion domain are expensive. This has urged the search for cheaper alternatives, such as Schiff bases. Schiff bases act as effective corrosion inhibitors for mild steel in an acidic medium due to the presence of the azomethine group \(\:(=C=N-\)). Schiff bases inhibit corrosion by getting adsorbed on the metal surface via the oxygen and nitrogen atoms7. Recently, Schiff bases have gained much importance as corrosion inhibitors because of their good inhibition activity, low cost, ease of synthesis, high synthetic yield and eco-friendly or less toxic nature34,35,36.

Evaluating the effectiveness of EMAB and its pyrrole derivative as corrosion inhibitors for mild steel is crucial. Mild steel is the most used construction material and is frequently found in fuel systems exposed to varying concentrations of corrosive solutions. Additionally, EMAB is an eco-friendly molecule, making it a promising candidate for sustainable corrosion protection. It is well known that species with heteroatoms and/or unsaturated rings serve as good corrosion inhibitors and therefore, the pyrrole substituent of EMAB was selected herein because it has been reported in our previous studies to be reactive and a better electron donor than EMAB8. The structure of EMAB is presented in Fig. 1.

Fig. 1
figure 1

Structure of Ethyl 4-[(E)-(2-Hydroxy-4-Methoxyphenyl)Methyleneamino] Benzoate (EMAB).

The effectiveness of a molecule as a corrosion inhibitor hinges on its capacity to strongly adhere to the metal surface it aims to protect, which consequently reduces the molecule’s reactivity9. To evaluate the reactivity of EMAB, several electronic properties—known as global reactivity descriptors are important to consider. This includes calculations of ionization potential, electron affinity, hardness, softness, electrophilicity index, and chemical potential, based on the following relationships.

$$\:I={-E}_{HOMO},\:\text{a}\text{n}\text{d}\:EA={-E}_{LUMO}$$

where \(\:I\) and \(\:EA\) respectively represent the vertical ionization potential and the electron affinity9,46.

$$\:\chi\:=\frac{I+EA}{2}$$
(1)
$$\:\mu\:={\left[\frac{\partial\:E}{\partial\:N}\right]}_{v\left(r\right)}=-\chi\:\:\:$$
(2)

where \(\:\chi\:\) is the electronegativity.

Using the finite difference approximation, the chemical potential is defined as

$$\:{\upmu\:}\approx\:-\frac{1}{2}\left(I+EA\right)$$
(3)

Considering the Koopmans’ theorem which states that \(\:{\upmu\:}\approx\:\frac{1}{2}\left({E}_{LUMO}-{E}_{HOMO}\right)\:\:\:\:\:\),

the global hardness, defined as the resistance to charge transfer, is expressed as:

$$\:\eta\:=\frac{1}{2}{\left[\frac{{\partial\:}^{2}E}{{\partial\:N}^{2}}\right]}_{v\left(r\right)}=\frac{1}{2}{\left[\frac{\partial\:{\upmu\:}}{\partial\:N}\right]}_{v\left(r\right)}=\frac{I-EA}{2}$$
(4)

while the global softness, naturally defined as the inverse of the global hardness, is expressed as:

$$\:S=\frac{1}{2\eta\:}={\left[\frac{\partial\:N}{\partial\:{\upmu\:}}\right]}_{v\left(r\right)}\:$$
(5)

Electrophilicity and nucleophilicity concepts are very important concepts especially in organic reactions, as they have been used in predicting reaction mechanisms10,11. The global electrophilicity index is defined as

$$\:\omega\:=\frac{{{\upmu\:}}^{2}}{2\eta\:}=\frac{{-\chi\:}^{2}}{2\eta\:}$$
(6)

Hirshfeld population analysis (HPA) along with the finite difference (FD) approximation method introduced by Yang and Mortier12 were used to determine the ionization potential and electron affinity. The vertical ionization potential (I) and electron affinity (EA)  were calculated as follows:

$$\:EA\:={\:E}_{N}\:-\:{E}_{N+1}\:\text{a}\text{n}\text{d}\:\:\:I\:=\:{E}_{N-1}\:-\:{E}_{N}$$
(7)

where \(\:{E}_{N},\:{E}_{N-1}\) and \(\:{E}_{N+1}\) are the total (single point) energies of neutral, cationic, and anionic systems of the optimized molecular configuration respectively.

The Fukui function serves as a reactivity index within the framework of conceptual Density Functional Theory (DFT), reflecting how the electron density of a molecule shifts with changes in the number of electrons. Atom-condensed Fukui functions offer insights into the electrophilic and nucleophilic active sites of organic inhibitors49. This function aids in predicting which atoms in a molecule are more susceptible to nucleophilic or electrophilic attacks. The first order Fukui functions \(\:{f}_{k}^{+}\) and \(\:{f}_{k}^{-}\) respectively correspond to nucleophilic and electrophilic attacks and are determined using Eqs. 8 and 9.

$$\:{f}_{k}^{+}={q}_{k}\left(N+1\right)-{q}_{k}\left(N\right)$$
(8)
$$\:{f}_{k}^{-}={q}_{k}\left(N\right)-{q}_{k}\left(N-1\right)$$
(9)
$$\:\varDelta\:f\left(\text{r}\right)={2q}_{k}\left(N\right)-{q}_{k}\left(N+1\right)-{q}_{k}\left(N-1\right)\:\:\:\:\:\:\:\:\:\:\:\:$$

where \(\:{q}_{k}\left(N+1\right)\) represents the charges on atoms of the molecules in their anionic state, \(\:{q}_{k}\left(N\right)\) is the charges on atoms of the molecules in their neutral state and \(\:{q}_{k}(N-1)\) is the charges on atoms in the molecules in the cationic state.

The second-order Fukui function quantifies molecular reactivity by identifying sites prone to nucleophilic and electrophilic attacks, reflecting how electron density changes with variations in electron count. This information is essential for predicting chemical behavior and guiding the design of inhibitors and catalysts49,50.

It is estimated using the following relationships:

$$\:\text{N}\text{u}\text{c}\text{l}\text{e}\text{o}\text{p}\text{h}\text{i}\text{l}\text{i}\text{c}\:\text{A}\text{t}\text{t}\text{a}\text{c}\text{k}:\:{f}_{nuc}^{\left(2\right)}\:=\:E\left(N+1\right)-2E\left(N\right)+E\left(N-1\right)\:\:\:\:$$
(10)
$$\:\text{E}\text{l}\text{e}\text{c}\text{t}\text{r}\text{o}\text{p}\text{h}\text{i}\text{l}\text{i}\text{c}\:\text{a}\text{t}\text{t}\text{a}\text{c}\text{k}:\:{f}_{elec}^{\left(2\right)}\:=\:E\left(N-1\right)-2E\left(N\right)+E\left(N+1\right)$$
(11)

where \(\:E\left(N\right)\) is the single point energy of the neutral species, \(\:E(N+1)\) is the energy of the species containing one electron more than the neutral species i.e. the anion and \(\:E(N-1)\) is the energy of the cation. For the calculation of second-order Fukui functions in this study, energy-based derivatives are favored over direct electron density analysis due to their grounding in Density Functional Theory (DFT). DFT fundamentally relates the ground state energy of a system to its electron density, making energy derivatives a natural and theoretically consistent starting point for defining reactivity descriptors like Fukui functions51. Furthermore, using energy helps address challenges associated with integer discontinuities in the number of electrons and avoids the arbitrariness introduced by density partitioning schemes. This approach aligns with conceptual DFT, where chemical concepts are linked to the electronic structure through energy derivatives, providing a robust framework for analyzing chemical reactivity52.

Equally, the \(\:\varDelta\:\)N value which shows an inhibitor’s efficiency to donate electrons to the metal surface (if < 3.6), is determined from

$$\:\varDelta\:N=\frac{{\chi\:}_{Fe-}{\chi\:}_{inh}}{2\left({\eta\:}_{Fe}+{\eta\:}_{inh}\right)}$$
(12)

where.

\(\:{\chi\:}_{Fe}\) is often considered to be \(\:7\:\text{e}\text{V}/\text{m}\text{o}\text{l}\) while \(\:{\eta\:}_{Fe}\) is \(\:0\:eV/mol\). According to Pauling’s electrophilicity scale5,28,45. Therefore,

$$\:\varDelta\:N=\frac{7-{\chi\:}_{inh}}{2\left({\eta\:}_{inh}\right)}$$

To identify the reactive sites of a molecule, its electrostatic potential map is usually determined. Electrostatic potential \(\:\varvec{V}\left(\varvec{r}\right)\) is an effective guide to a molecule’s reactive behavior. In atomic units, the \(\:V\left(\varvec{r}\right)\) around a molecule at any point \(\:\varvec{r}\) is the sum of nuclear and electronic contributions13.

$$\:V\left(r\right)=\sum\:_{A}\frac{{Z}_{A}}{{|\text{R}}_{A}-\text{r}|}-\int\:\frac{\rho\:\left(\mathbf{r}\right)d{\text{r}}^{{\prime\:}}}{{|\mathbf{r}}^{\mathbf{{\prime\:}}}-\mathbf{r}|}$$
(13)

where \(\:{Z}_{A}\:\)is the charge on the nucleus \(\:A\) located at \(\:{\text{R}}_{A}\) and \(\:\rho\:\left(\varvec{r}\right)\) is the molecule’s electronic density. On the color-coded surface MEP maps, nucleophilic centers are colored in red/orange and those prone to nucleophilic attack are colored blue. The red/orange and blue regions of a molecule’s MEP map correspond to its most negative and positive sites respectively. The regions colored in green indicate neutral sites in the molecule. Generally, V(r) increases in the order: red < orange < yellow < green < blue.

Usually, molecular electrostatic potential maps indicate charge distribution in a molecule. Indeed, the unsymmetrical distribution of charge in a molecule indicates charge transfer14.

Monte Carlo and molecular dynamics simulations

Monte Carlo (MC) and molecular dynamics (MD) simulations are vital computational techniques for investigating the anticorrosion properties of organic molecules on steel surfaces. These methods are useful in modeling atomic-level interactions between corrosion inhibitors and metal surfaces, providing insights that are often difficult to obtain through experimental approaches. Research indicates that these simulations can effectively explore the adsorption mechanisms of corrosion inhibitors, revealing how molecular structure impacts their efficiency33,37,38. Three key parameters in this analysis are: Adsorption Energy values, which reflect the strength of the interaction between an inhibitor and a metal surface. Higher adsorption energies correlate with more stable protective layers, crucial for effective corrosion prevention, radial distribution functions RDFs which analyze how particle density varies with distance from a reference particle, offering insights into the spatial arrangement of inhibitors around the metal surface. This helps assess the orientation and effectiveness of the protective layer, and lastly the binding energy which indicates the energy required to detach an inhibitor from the surface. Elevated binding energies suggest a more stable attachment, which enhances the inhibitor’s corrosion prevention capabilities39,41,42.

Computational details

All quantum chemical calculations were performed using the Gaussian 09 Rev. D.01 software package15. Input files were generated with Gauss View 6.0.1616. The results were processed using Multiwfn17 and Chemcraft18. To identify the most stable conformer of EMAB, a conformational analysis was conducted through relaxed potential energy surface (PES) scans of the dihedral angles. 1(C2-C3-C17-H19) and 2(C17-N18-C20-C22) at the B3LYP-D3(BJ)/6–31 + G** level of theory from 0 to 3600 in 18 steps of 200 each. The structure corresponding to minima on the PES scan was selected as the most stable conformer of EMAB. This conformer was further optimized, and frequency calculations performed at the B3LYP/6-311 + + G** and M06-2X/6-311 + + G** levels of theory and compared with the experimental parameters from Pahontu and co-workers19. Furthermore, EMAB’s derivative was optimized at the B3LYP/6-311 + + G** level of theory. Analysis of the harmonic vibrational frequencies in all cases indicated the absence of imaginary frequencies and this ascertained that the structures were true minima on the Potential Energy Surface.

All calculations related to reactivity descriptors were done at the CAM-B3LYP-(D3)/Def2TZVP and ωB97-XD/Def2TZVP levels of theory in the gas phase and in HCl solvent for comparison. These functionals were used owing to their ability to model long-range interactions effectively43,44. Hydrochloric acid, with dielectric constant (ε \(\:=\:78.3\)) was incorporated as a solvent since it is always used in cleaning the internal surfaces of pipes in industries20.

Monte Carlo and molecular dynamics simulations

Monte Carlo and Molecular Dynamics simulations were conducted to elucidate the adsorption mechanisms of inhibitors on the metal surface21. These simulations aimed to identify the most probable adsorption configurations as the temperature decreased22,23. For the Monte Carlo simulations, the Adsorption Locator module from the Material Studio MS 2017 suite by Biovia Accelrys, USA, was utilized24. Additionally, the Forcite module was employed for the geometry optimization of the adsorbate, adsorbent, and water molecules24. The optimization of the adsorbate molecules (EMAB and its pyrrole derivative) was performed using the Forcite module, applying the Smart algorithm with a specified energy cut-off of\(\:{\:1.0\:x10}^{-4}\) kcal/mol The Fe (110) crystal surface was generated by cleaving the crystal structure of iron along the (110) planes. This orientation was selected for the simulation study due to its inherent stability and is recognized as the most likely exposed face of iron25. The Fe (110) surface was optimized to achieve minimum energy using the COMPASS force field. The Fe (110) surface was chosen due to its well-defined crystallographic structure and its common use in both experimental and computational corrosion studies. This allows for a direct investigation of the interactions between the organic molecules and the iron surface, facilitating comparison with existing literature and enabling detailed computational modeling. The Fe (110) has also been reported to be the most stable form of iron, with low miller index53,54. The COMPASS (Condensed Phase Optimized Molecular Potentials for Atomistic Simulation Studies) field was employed for the simulations of all molecules and systems. COMPASS is a robust force field developed through fitting to a diverse array of experimental data for both organic and inorganic compounds. It facilitates atomistic simulations of condensed phase materials, allowing for accurate and simultaneous predictions of structural, conformational, vibrational, and thermophysical properties across a wide range of temperatures and pressures.

A \(\:10\times\:10\) supercell of the Fe (110) surface was constructed from the optimized crystal structure, and a vacuum slab of 20 Å was added above the plane to mitigate the influence of periodic boundary conditions on the system. To ensure that the selected atoms did not interact with their periodic images, six layers were included in the structure25. The Fe (110) surface was then optimized with the lower layers fixed in place. The simulation methodology employed an atom-based approach for electrostatic interactions and a group-based approach for Van der Waals interactions.

Using the Adsorption Locator module, simulated annealing was performed to identify the ten most favorable configurations for the adsorption of molecules onto the metal surface. The Smart algorithm was utilized in conjunction with the COMPASS force field for this process. The top layer of the slab was designated as the target for adsorption, with a maximum distance of 5 Å for interactions. Atoms were categorized into groups (adsorbate, adsorbent, and target atoms), and the atom volumes along with solvent surfaces were generated with a solvent radius of 1.4 Å. Water molecules were subsequently incorporated using the Amorphous Cell module in BIOVIA Materials Studio, with a specified packing density of \(\:{1\:g\:cm}^{-3}\). A total of \(\:250\) water molecules were incorporated.

A simulation of corrosion inhibitor molecules on the Fe (110) surface was conducted to identify low-energy adsorption sites for these molecules22. To investigate the adsorption behavior of EMAB and its pyrrole derivative on a mild steel surface in the presence of water, Molecular Dynamics (MD) simulations were performed using the Forcite Module within BIOVIA Materials Studio 2017. The simulations employed quench dynamics, with optimization occurring every 10,000 steps. Interatomic interactions were represented using the COMPASS force field, and the MD simulations were executed in the canonical (NVT) ensemble at 298 K, utilizing the Nose thermostat to maintain the thermodynamic temperature. The time step was set to 1 fs, with initial velocities assigned randomly. The total simulation time was 200 ps, and energy coordinates and velocities were recorded every 10,000 steps throughout the simulation26. This process yielded a total of 41 optimized structures.

Proton affinity

Proton affinity is defined as the negative of the enthalpy change associated with a real or hypothetical gas-phase reaction between a neutral chemical species and a proton, resulting in the formation of the conjugate acid of the original species27,28. Since these molecules possess multiple donor sites with varying basicities, calculations were performed on their protonated forms to investigate the potential for protonation in an acidic environment and its effect on inhibiting steel corrosion. Metal corrosion primarily occurs when an electron lost by a metal atom is replaced by a proton from the surrounding medium, such as HCl or H2SO4 during pickling, leading to the generation of hydrogen gas. Additionally, acidic gases like CO2, NO2, and SO2 can exacerbate corrosion by producing acids when dissolved in water. Thus, if the inhibitor molecule captures a proton, the corrosion rate may be reduced.

The inhibitors EMAB and its pyrrole derivative contain several nucleophilic active sites that enhance their adsorption onto mild steel surfaces. In both EMAB and its pyrrole derivative, the atoms act as electrophilic sites, while the nucleophilic sites include the carbonyl oxygen atoms, the methoxy oxygen atom, the hydroxyl oxygen, and the nitrogen atoms within the azomethine group and the pyrrole ring. For EMAB, the compounds were singly protonated at N18, O15, O10, O31, and O32, while for its derivative, protonation occurred at O27, O26, N13, O10, and N42. Gas-phase geometry optimizations and frequency calculations were performed for each mono-protonated species using the B3LYP/6-311 + + g** level of theory. This method has been utilized in anticorrosion studies27.

A neutral molecule is typically protonated as follows:

$$\:B\:+\:{H}^{+}\:\rightleftharpoons\:\:{BH}^{+}$$
(14)

Gas phase proton affinities for the species were calculated as the negative of the difference between the enthalpies of the product and the reactants as follows.

$$\:PA\:=\:-\varDelta\:H\:=\:-\:\left[\left({BH}^{+}\right)-\left(B\right)-\:\left({H}^{+}\right)\right]$$
(15)

Since energies of species are calculated based on electron density and \(\:{H}^{+}\) contains no electron, its energy was calculated as follows

$$\:{E(H}^{+})={E(H}_{3}{O}^{+})-{E(H}_{2}O)$$
(16)

Proton affinities (PA) and proton dissociation enthalpies (PDE) have a close relationship with site acidity, that is, the ease of deprotonation. Substituting \(\:14\) in \(\:13\) results to

$$\:PA=\left[E\left({BH}^{+}\right)-E\left(B\right)-\:{E(H}_{3}{O}^{+})+{E(H}_{2}O)\right]$$
(17)

where \(\:E\left({BH}^{+}\right)\) is the energy of the protonated species, \(\:E\left(B\right)\) is the energy of the neutral molecule,\(\:\:{E(H}_{3}{O}^{+})\) is the energy of the hydroxonium ion and \(\:{E(\text{H}}_{2}\text{O})\) is the energy of the water molecule respectively46. Experimental determination of proton affinities is challenging and requires specialized experimental techniques. As a result, many proton affinities are determined using computational chemistry methods especially the Density Functional Theory (Albrakaty et al., 2018).

Results and discussion

Geometrical analysis

The optimized geometries for EMAB and its substituted pyrrole derivative are shown in Fig. 2, along with their respective numbering schemes. These structures were optimized at the B3LYP/6-311 + + g** level of theory. The XYZ coordinates for the optimized structures of EMAB and its pyrrole derivative are presented on Table S1 of the supplementary information. Equally, some selected geometrical parameters of EMAB and its derivative are presented in Table 1, alongside its existing geometrical parameters for EMAB. It is important to note that in Table 1, the parameters in EMAB that correspond to those of the derivatives are indicated in brackets for comparative purposes.

Fig. 2
figure 2

Structure of EMAB and its pyrrole derivative, optimized at the B3LYP/6-311 + + g** level of theory, obtained from Gaussian output files15 and using the chemcraft software18.

Table 1 Some selected theoretical geometric parameters of EMAB computed at B3LYP/6-311 + + G** level of theory for EMAB and its pyrrole derivative compared with experimental values from Pahontu and co-workers.

Results from Fig. 2; Table 1 indicate that the geometrical parameters, including bond angles, bond lengths, and dihedral angles, exhibit remarkable similarity between EMAB and its pyrrole derivative. This suggests that the substitution of the methoxy group in EMAB with the pyrrole group leads to minimal alterations in the molecular geometry. Additionally, our findings indicate that most dihedral angles in both molecules are close to 180 degrees, reinforcing the notion that these compounds are highly planar. This planarity is advantageous for their function as corrosion inhibitors, as planar molecules tend to align parallel to the metal surface they inhibit, thereby enhancing the efficacy of the inhibition process. Furthermore, our theoretical values for EMAB closely align with the experimental results reported by Pahontu and colleagues19. This correspondence suggests that the level of theory employed in our calculations was appropriate, as it effectively predicts the geometrical parameters in close agreement with the experimental data.

Monte Carlo simulation

Monte Carlo simulation for EMAB and its derivative indicated that both inhibitors have the potential of being adsorbed on the Fe (110) surface. The adsorption energy refers to the energy released when the inhibitor adsorbs onto the Fe(110) surface in its stable configuration (also known as the geometric optimization step), while the deformation energy is the energy released when the adsorbed inhibitor is detached from the Fe(110) surface. The negative values of the adsorption energies would indicate spontaneous adsorption on the Fe(110) surface, while a positive value would indicate non-spontaneous adsorption33. The adsorption energies for EMAB and its derivative are presented in Table 1. The total energy and adsorption energies for EMAB were generally lower than those of the pyrrole derivative. This indicates the ability of EMAB to spend more time closer to the iron surface than its derivative and therefore, EMAB exhibits stronger adsorption on the metal surface due to its more negative adsorption energy.

Rigid adsorption energy and deformation energies

Adsorption energy is the energy released when the unrelaxed inhibitor molecules (i.e. before the geometry optimization step) are adsorbed on a metal surface, while the deformation energy represents the energy released when the adsorbed inhibitor molecules are relaxed on the substrate surface1. Both adsorption and deformation energies were negative, indicating the stability of the adsorbed species on the metal surface. Generally, the inhibitors under study had parallel or flat orientations with respect to metal surface, thus covering more surface area and providing better corrosion inhibition protection. Inhibitors which have vertical orientation will not have this property29. The total energy, adsorption and deformation energies for the studied species are depicted in Table 2.

Table 2 The total energy, adsorption, and deformation energies for MC simulation.

Based on the results in Table 2, the individual contributions to the total energy for EMAB are lower than those for the derivative, yet the total energy for EMAB is higher. Despite the individual energies being less negative, the highly negative total adsorption energy indicates that additional stabilization mechanisms are at play. This could involve:

Cooperative Effects: Interactions between the adsorbate and the surface, or among multiple adsorbates, may lead to enhanced stability that is not fully captured by rigid adsorption or deformation energy alone.

Solvation or Environmental Effects: The presence of solvent molecules or other environmental factors could contribute to the overall stability after adsorption, resulting in a more favorable total energy. The various views of the stable configurations from the Monte Carlo simulation are presented in Fig. 3.

The most stable configuration was obtained from among the best 10 configurations sampled during the simulation. From Fig. 3.

Fig. 3
figure 3

Top and side views of MC simulation of EMAB and its derivative adsorbed on Fe (110) surface, obtained from output files from Material Studio MS 2017 suite24.

Specifically, it has been noted that the orientation of inhibitors, such as organic molecules, plays a crucial role in their effectiveness. Inhibitors that align parallel to the metal surface can enhance their protective capabilities by maximizing the interaction area and forming a stable protective layer38. Both EMAB and the pyrrole derivative align parallel to the iron (110) surface, which is a characteristic feature of effective inhibitors. This orientation typically enhances their ability to interact with the surface, promoting stronger adsorption and potentially improving their performance in preventing corrosion or degradation.

Molecular dynamics simulation

Molecular Dynamics (MD) simulations conducted on the species under study provided valuable insights into their behavior and interactions at the molecular level. The simulations revealed the following key findings:

Radial Distribution Functions or pair correlation functions.

The radial distribution function is the probability distribution to find the center of a particle in each position at a radial distance \(\:r\) from the the center of a reference sphere. In other words, it is a measure of average density around atoms, which indicates the average distance where an inhibitor molecule spends most of its time during simulation. The Radial Distribution Functions for EMAB and its pyrrole derivative were determined using the total trajectory33 and are presented in Fig. 4.

The details regarding the radial distribution function data used to generate the graphs are provided in the Supplementary information Table S2.

Fig. 4
figure 4

Radial distribution functions for EMAB and its derivative, obtained through molecular dynamics trajectory analysis.

From the results, both EMAB and the derivative have high probabilities of being adsorbed at very close distances to the surface of iron (\(\:\:110\)) i.e. at about \(\:1.1\) Å, indicating a high level of adsorption, due to the presence of the heteroatoms. The peak (g(r)) value for EMAB at this radius is 489.56, and 437.6 for the derivative. This further indicates that EMAB is a better inhibitor than its pyrrole counterpart. In addition, the next highest peak is around 1.4 Å, with a higher value for the derivative (\(\:326.2\)) than for EMAB (\(\:303.1\)). Therefore, the derivative is adsorbed at a greater distance from the iron surface compared to EMAB. Based on these findings, it can be inferred, though not with absolute certainty, that EMAB and its derivative were chemosorbed at 1.1 Å from the metal surface, and at 1.4 Å. This aligns with literature indicating that chemisorption typically occurs at distances of approximately 1.5 to 3 Å, involving the formation of strong chemical bonds (either covalent or ionic) and exhibiting higher adsorption energies, generally exceeding 40 kJ/mol40. In contrast, the effective range for physisorption is usually observed within several angstroms (typically 3–5 Å) from the surface, characterized by the interaction range of van der Waals forces. In radial distribution function (RDF) plots, distinct peaks can indicate preferred distances where the density of adsorbed particles is heightened, suggesting stable adsorption sites. Although the ranges of 3–5 Å for physisorption and less than 2 Å for chemisorption provide useful benchmarks, they should not be considered absolute limits. Careful analysis and consideration of the specific system are essential for accurately determining the nature of adsorption.

Adsorption and Binding Energies.

Adsorption energy refers to the energy released when the relaxed inhibitor molecules are adsorbed onto the metal surface. It can also be defined as the sum of the rigid adsorption energy and the deformation energy associated with the adsorbate components. The adsorption energy is mathematically expressed as:

$$\:{E}_{ads}={E}_{complex}-\left({E}_{metal\:}+{E}_{inh}\right)$$
(18)

Binding energy

It is defined to be the negative of the adsorption energy22,28.

$$\:{E}_{bind}\:=\:-{E}_{ads}$$
(19)

The more negative the adsorption energy, the more affinity the adsorbate will have for the adsorbent. In the like manner, the larger (more positive) the binding energy, the more easily and tightly an inhibitor interacts with a metal surface, hence, the higher its inhibition efficiency. Results for adsorption and binding energies for EMAB and the derivative are presented in Table 3.

Table 3 Results for adsorption, binding energies for EMAB and its pyrrole derivative for molecular dynamics simulation.

Our results have shown a larger negative value for adsorption energy for EMAB. An adsorption energy of −312.78 kcal/mol strongly supports chemisorption. This value indicates that the inhibitor (EMAB) forms a very stable and strong interaction with the metal surface, likely through the formation of covalent or ionic bonds. It is important to note that the adsorption energies determined from both Monte Carlo and Molecular Dynamics simulations for EMAB and its derivative agree closely, with minimal discrepancies. This consistency affirms that EMAB, exhibiting a higher adsorption energy, is more stable on the metal surface compared to its derivative. Therefore, based on this adsorption energy, and adsorption distance, it is reasonable to conclude that the adsorption mechanism is indeed chemisorption and thus a more positive value for binding energy. EMAB is therefore a better corrosion inhibitor for mild steel than its pyrrole derivative based on MC and MD studies. This is promising because EMAB has already been synthesized, allowing its anticorrosion properties to be utilized immediately, unlike its pyrrole derivative, which requires further synthesis.

The most stable frames (those with the lowest energies) during the MD simulation have been isolated and their side and top views are presented in Fig. 5.

Fig. 5
figure 5

Top and side views of MD simulation of EMAB and its derivative adsorbed on Fe (110) surface, generated from Material Studio MS 2017 suite by Biovia Accelrys, USA24.

The results from Fig. 5 confirm the fact that EMAB and its pyrrole derivative are good species to be used for the protection of iron and steel.

Quantum chemistry studies

Quantum chemistry studies are frequently employed to correlate the corrosion inhibitor properties of molecules with their predicted molecular orbital (MO) energy levels, allowing for significant savings in time and costs by reducing the need for laboratory experiments30. The energies of the frontier molecular orbitals (E-HOMO and E-LUMO), and consequently the energy gap between them, are crucial in this context. These parameters serve as valuable descriptors for reactivity.

DFT results

The inhibitory effectiveness of EMAB and its derivatives have been examined by assessing local parameters and quantifying global parameters, including chemical hardness (η), softness (σ), electronegativity (χ), and electrophilicity (ω).

Global reactivity descriptors

The HOMO energy reflects a molecule’s capacity to donate a lone pair of electrons; higher HOMO energy levels correspond to a greater ability to donate electrons to electrophilic species. Similarly, the LUMO energy indicates a molecule’s ability to accept a lone pair of electrons, with lower LUMO energy levels enhancing the molecule’s capacity to receive electrons from nucleophilic agents. Table 4 presents the various reactivity descriptors for EMAB and its pyrrole substituent, calculated using the CAM-B3LYP-(D3)/def2TZVP and ωB97-XD levels of theory in both the gas phase and HCl solvent (using the SCRF solvation model).

Table 4 Global reactivity descriptors for EMAB and its pyrrole derivative calculated at the CAM-B3LYP-(D3)/def2TZVP and at the ωB97-XD/def2TZVP levels of theory in the gas phase and in HCl.

The results show that a smaller difference between HOMO and LUMO energies facilitates easier electron transfer from the donor molecular orbital to the acceptor molecular orbital. EMAB exhibits a significant energy gap, which decreases when the methoxy group is replaced by the pyrrole group. Additionally, global hardness values are generally higher for EMAB compared to its pyrrole substituent, while global softness values display the opposite trend. This suggests that the parent compound is less reactive than the substituted derivative, indicating that these molecules, particularly the pyrrole substitute, have the potential to adhere to surfaces and protect mild steel due to their chemical reactivity.

Both levels of theory employed to calculate the reactivity descriptors yield consistent results, reinforcing their validity. Furthermore, Table 3 illustrates that solvent effects have minimal impact on the global reactivity descriptors, as the values in gas phase and solvent are quite similar. Notably, the number of electrons transferred from the inhibitor to the mild steel surface is significantly below the threshold value of 3.6. The ΔN values do not accurately reflect the precise number of electrons transferred, leading to the recommendation that “electron-donating ability” is a more suitable term than “number of electrons transferred.” It is widely recognized that a ΔN value of less than 3.6 indicates good electron transfer capability22. In conclusion, the global reactivity descriptors indicate that both EMAB and its substituted derivative are promising candidates as anti-corrosion materials for mild steel.

Mulliken atomic charges

Mulliken charges are commonly used to assess atomic charges within a molecule and identify inhibitor adsorption centers. The propensity of a heteroatom to adsorb onto a metallic substrate through donor-acceptor interactions increases with a higher negative charge. Table 4 presents the Mulliken atomic charges for EMAB and its pyrrole derivative, calculated at the ωB97-XD/def2tzvpp level of theory.

From Table 5, the heteroatoms N and O are likely responsible for the ligand’s adsorption onto the metal surface due to their relatively high electronegativity values: O15 (−0.65126), N18 (−0.50445), O31 (−0.60214), and O10 (−0.4524) for EMAB, and O10 (−0.65442), N13 (−0.5002), O26 (−0.60138), and N42 (−0.48096) for the derivative. Therefore, EMAB and its pyrrole derivative are expected to serve as effective inhibitors, owing to the presence of heteroatoms with significant negative charges.

Table 5 Mulliken atomic charges for EMAB and its pyrrole derivative calculated at the ωB97-XD/def2tzvpp level of theory.

Proton affinity

Proton affinity is a critical parameter in anticorrosion studies, defined as the negative difference between the enthalpies of the products and reactants in reactions where a base acquires a proton and becomes protonated28. Research on Mulliken atomic charges indicates that heteroatoms, such as oxygen and nitrogen, demonstrate high proton affinity due to their elevated electronegativity. In this context, proton affinities were calculated for the protonated forms of EMAB and its pyrrole derivative.

Molecules with high electronegativity are expected to adhere strongly to metal surfaces, enhancing their adsorption. These high-affinity molecules tend to form dative bonds with protons from acids in their environment, thereby inhibiting corrosion through a dual mechanism: they adsorb onto the metal surface while also capturing protons from the medium. Consequently, H⁺ ions become less available to react with the metal, preventing the formation of H₂, a key step in the corrosion process. The findings related to proton affinity are summarized in Table 6.

Table 6 Proton affinity values in kcal/mol of protonated species of EMAB and its derivative, calculated at the B3LYP/6-311 + + g** level of theory.

Based on the results presented in Table 6, the proton affinity for the studied species is generally high. This property peaks in the oxygen atom of the hydroxyl group (–O–H), which exhibits the greatest electron affinity in both scenarios. High proton affinities suggest that these molecules can effectively attract protons from their environment, thereby inhibiting the corrosion process, which involves protons capturing electrons.

In particular, the proton affinity of EMAB is consistently higher than that of its derivative. Although global reactivity descriptors indicate that the pyrrole substituent may exhibit greater reactivity, its proton affinity values are lower. This discrepancy can be attributed to the differences in electronegativity between the nitrogen in the pyrrole substituent and the oxygen in the methoxy group. Oxygen, with its two lone pairs of electrons, has a greater capacity to hold protons compared to the nitrogen in pyrrole, which is also less electronegative.

The proton affinity values for O31 and O15 in EMAB are notably high, likely due to the low steric hindrance at these sites combined with the high electronegativity of oxygen. Conversely, N42 shows the lowest proton affinity, despite nitrogen typically exhibiting higher affinity when isolated. This is due to the aromatic stabilization in pyrrole, which reduces the nitrogen atom’s basicity and its ability to attract and bind protons, resulting in a lower proton affinity compared to that of isolated oxygen in the methoxy group.

These observations suggest that reactivity and energy gaps may not align with trends in proton affinity. Oxygen, having higher electronegativity, demonstrates a correspondingly higher proton affinity28. Substituting the methoxy group in EMAB with a pyrrole group enhances reactivity but decreases the overall proton affinity.

Molecular electrostatic surface potential (MESP) maps

The ESP map is related to nucleophilic and electrophilic activity sites in molecules; the red refers to the negative region and the green and blue ones refer to the positive regions33. In EMAB, high electron density areas include the ester end of the molecule, likely due to the presence of two oxygen atoms in that vicinity, as well as the oxygen-bearing –O–H group. To a lesser extent, the methoxy oxygen also contributes to this electron density. The nitrogen-hydrogen environment in the pyrrole ring shows blue regions, indicating some degree of positive charge. Consequently, the potential for attracting a proton in this area is low, as reflected in the proton affinity results. Figure 6 presents the molecular electrostatic surface potential maps for A (EMAB) and B (pyrrole derivative).

Fig. 6
figure 6

MESP maps for (A) (EMAB) and (B) (Pyrrole derivative), obtained from the Gaussian 09 Rev. D.01 software package15 output files, using the Gauss View 6.0.1616 visualization program.

In the case of the derivative, the high electron density still prevails on the ester oxygen and the hydroxyl oxygen. We also note that the pyrrole nitrogen does not seem to attract electrons. Thus, the oxygen atoms (ester) in both species according to MEP maps will easily pick up protons and become protonated. Equally, the hydroxyl and methoxy groups in EMAB have indicated a high degree of proton affinity and therefore, globally considering these aspects, EMAB would demonstrate a greater affinity for protons than its pyrrole substituent.

Local reactivity descriptors LRD-Fukui functions

In EMAB, regions of high electron density are predominantly located at the ester end of the molecule, likely attributable to the presence of two adjacent oxygen atoms, as well as the –O–H group. Additionally, the methoxy oxygen contributes to the electron density, albeit to a lesser extent. The nitrogen-hydrogen environment within the pyrrole ring displays blue regions, indicative of a partial positive charge. As a result, the capacity of this area to attract protons is diminished, as evidenced by the proton affinity data. Figure 6 illustrates the molecular electrostatic surface potential maps for both EMAB and its derivative.

The value of \(\:{f}_{k}^{+}-{f}_{k}^{-}\:\)condensed to the \(\:{k}^{th}\) atom in a molecule is calculated from atomic charges or Fukui functions. Table 7 depicts Fukui functions for the electrophilic and nucleophilic centers for atoms in EMAB and its derivative, calculated at the CAM-B3LYP(D3)/Def2-TZVP level of theory. The LRDs were calculated based on Hirshfeld population analysis as implemented in Gaussian 09 Rev. D01 program15.

The Hirshfeld population analysis scheme was used herein because it provides accurate and all-positive Fukui function values and because it is not basis set dependent48. In all cases under study, the values of the Fukui functions are non-negative and those of the dual descriptor \(\:{\varDelta\:f}_{k}\left(r\right)\) lie between − 1 and 1, the normal range47. This confirms that the LRDs computed in this work are valid. When \(\:{\varDelta\:f}_{k}\left(r\right)\) > 0, atom \(\:k\) acts as an electrophile or is favorable for nucleophilic attack. Conversely, if \(\:{\varDelta\:f}_{k}\left(r\right)\) < 0, atom \(\:k\) is susceptible to electrophilic attack or would act as a nucleophile32,47. It should be noted that although the dual descriptor is used to determine local reactivity, it is suitable for comparing only the reactivity of molecules of the same sizes or with the same number of electrons. In such cases where electron number or atom number changes for molecules to be compared, it is replaced with the local hyper softness \(\:\left(\varDelta\:S\right(r\left)\right)\) as follows:

$$\:\left(\varDelta\:s\left(r\right)\right)=\frac{\varDelta\:f\left(\text{r}\right)}{{\eta\:}^{2}}=\:\varDelta\:f\left(r\right){S}^{2}$$

The interpretations of \(\:{\varDelta\:f}_{k}\left(r\right)\) and \(\:\left(\varDelta\:S\right(r\left)\right)\)are similar; they are positive in electrophilic regions and negative in nucleophilic regions31,32. For EMAB, O10, O15 and N18 are nucleophilic and therefore will readily pick up protons from the surrounding medium, based on their \(\:\:{\Delta\:}\text{f}\:\text{a}\text{n}\text{d}\:{\Delta\:}\text{s}\:\) values (negative for electron-rich centers).

Table 7 First order Fukui functions, the dual descriptors for atomic charges and local hyper softness for EMAB and its derivative, calculated at the CAM-B3LYP(D3)/Def2TZVP level of theory.

i.e. 10 O −0.011768 and −0.00143746, for 15 O −0.002769 and 0.00033823, for 18 N. −0.015699 and − 0.00191763 respectively.

This indicates the ability of many atoms to have affinity for the protons in the surrounding medium. For the case of EMAB’s substituent, the only heteroatom with a negative value for \(\:\varDelta\:f\:\text{a}\text{n}\text{d}\:\varDelta\:s\) is \(\:42\) N, with values \(\:-0.01176\) and\(\:\:-0.00034424\). Thus, this is the only nucleophilic heteroatom. These results again agree with those obtained for proton affinity and molecular electrostatic surface potential maps, indicating that EMAB, based on its ability to attract protons, can be used as a good corrosion inhibitor for mild steel. Based on the results obtained from DFT and molecular mechanics methods, we conclude that EMAB, the parent molecule in this study, is a better corrosion inhibitor for mild steel, given that majority of the methods agree with this fact.

Second order Fukui functions

The second order Fukui Functions were calculated to determine the change in electron density of each molecule when an electron is added or removed from the neutral molecule. These calculations were based on the energies of the neutral, the anionic and cationic species, as earlier depicted in Eqs. 10 and 11. The energies of the various species (in Hartree) and the corresponding values for the second order Fukui functions for nucleophilic and electrophilic attacks (in Hartree/electron) for the molecules are presented in Table 8.

Table 8 Second order Fukui functions for nucleophilic and electrophilic abilities, alongside the energy values for EMAB and its pyrrole derivative.

The second-order Fukui functions of EMAB and its pyrrole derivative offer important insights into their potential as corrosion inhibitors, particularly regarding their nucleophilic and electrophilic properties. EMAB has a nucleophilic Fukui function of 0.243 H, indicating a stronger ability to donate electrons (through the methoxy group) compared to its derivative’s value of 0.221 H, (donating through a weaker pyrrole group). This suggests that EMAB may be more effective in stabilizing metal surfaces. In contrast, the pyrrole derivative has a less negative electrophilic Fukui function of −0.565 H, while EMAB’s is −0.594 H, indicating that the pyrrole derivative has a slightly better capacity to accept electrons and could potentially adsorb onto negatively charged sites.

Furthermore, the ability of these molecules to accept protons enhances their corrosion inhibition mechanisms. EMAB’s stronger nucleophilic character facilitates interactions with acidic environments, allowing it to capture protons that typically initiate corrosion processes in such conditions. As a result, EMAB is identified as a superior corrosion inhibitor, particularly in proton-rich environments, due to its higher nucleophilic Fukui function that enables more effective engagement, ultimately mitigating corrosion.

In conclusion, the results suggest that EMAB is particularly well-suited for use as a corrosion inhibitor especially in acidic or proton-rich environments, reinforcing its potential for practical applications in corrosion prevention.

Conclusion

Monte Carlo simulations indicate that both EMAB and its pyrrole derivative can effectively adsorb on the Fe(110) surface. The total and adsorption energies for EMAB are generally lower than those for the pyrrole derivative, suggesting greater stability for EMAB when adsorbed. Both inhibitors exhibit negative adsorption and deformation energies, indicating stability on the metal surface. Their parallel orientations enhance surface coverage and corrosion inhibition efficacy. Molecular dynamics (MD) simulations reveal a high probability of adsorption at approximately 1.1 Å from the iron (110) surface, attributed to the presence of heteroatoms. The peak radial distribution function (RDF) value for EMAB (489.56) surpasses that of the derivative (437.6), confirming that EMAB is a more effective inhibitor. Additionally, higher proton affinity values and more pronounced electrostatic potential around nucleophilic atoms in EMAB further support its superior inhibition capability. While global reactivity descriptors suggest the pyrrole derivative might be a better inhibitor due to a lower energy gap, solvent effects appear minimal, as both in-solution and out-of-solution results are similar. Our findings demonstrate that MD simulations, which capture dynamic processes over longer time scales, complement density functional theory (DFT) results, particularly in understanding transient states relevant to inhibition. In summary, local reactivity descriptors effectively elucidate the anti-corrosion properties of molecules by detailing interactions with the substrate, while global descriptors serve as a useful preliminary screening tool.

While computational descriptors indicate promising characteristics for the pyrrole derivative, the final assessment of corrosion inhibition effectiveness may be influenced by various factors, including molecular interactions with the steel surface, solubility, and environmental conditions.

To validate our findings, we will conduct the following experiments in our next study:

Electrochemical Impedance Spectroscopy (EIS): This will allow us to measure the transfer resistance and provide insights into the protective layer formed by both compounds.

Potentiodynamic Polarization Studies: These will help evaluate the corrosion rates and inhibition efficiencies of EMAB and the pyrrole derivative under standardized conditions.

Surface Analysis Techniques: Techniques such as Scanning Electron Microscopy (SEM) and Atomic Force Microscopy (AFM) will be employed to visualize the surface morphology and monolayer formation of the inhibitors on the mild steel surface.