1 Introduction

Polypyrrole (PPy) is one of the most recognized conducting polymers [1, 2]. This polymer is nontoxic and environmentally stable and evaluated for different applications includes dye-sensitized solar cells [3], corrosion protection of metals [4], absorption of electromagnetic radiation [5], sensors [6], and electrodes in super-capacitors[7]. Recent research on conducting polymers has centered on controlling the morphologies of conducting polymers, particularly at the nanoscale. Nanorods, nanotubes, and nanofibers are examples of one-dimensional structures. Because of their potential applications in energy storage, sensors, electrocatalysis, and electromagnetic interference shields, these morphology forms seem promising. These structures are better for charge transmission than spherical shapes [8]. Polypyrrole (PPy) was effectively produced as a conducting polymers with various surface morphologies, containing particles, nanowires, and nanotubes, using or removing several types of surfactants by a chemical oxidative polymerization process. The findings demonstrate that the surface morphologies of the resultant PPy can be efficiently manipulated and have distinct consequences on their behavior [9]. The conductivity and shape of the resultant polypyrrole are affected by modifying the reaction conditions by changing the acidity, temperature, and adding additives such as surfactants or dyes [10]. Polypyrrole, on the other hand, has been made utilizing a variety of initiators, including ammonium persulfate, hydrogen peroxide, and metal salts. Iron (III) chloride is one of these initiators, and it is a simple and cost-effective procedure that can be done in an aqueous medium, at room temperature, open air, short time, and high conversion rate [11, 12]. The spherical morphology transforms to nanotubes, and nanofibers and, one-dimensional type under particular polymerization circumstances, such as in the presence of certain surfactants [13, 14]. Surfactants aid in the formation of polypyrrole chains into nanotubes or nanowires. During polymerization, the micelles produced by surfactants function as soft templates [15]. Methyl orange dye (MO), which plays a significant role in the production of polypyrrole nanotubes [16], is the most fascinating in-situ-generated template type. When ferric chloride is added to the pyrrole monomer in the presence of methyl orange, ferric ions form needle-like crystals in combination with the methyl orange. The resulting complex acts as a rigid template for the pyrrole polymerization process. Which pyrrole reduces ferric ions to ferrous ions and then, the generated insoluble ferric complex becomes soluble, and the methyl orange can be incorporated into polypyrrole nanotubes [17,18,19,20]. The role of the generated complex is supported by the fact that other oxidants, such as ammonium peroxydisulfate and failed to produce nanotubes [21]. The scattering effect is frequently reduced by directing electron transport along fibers or tubes [22]. electronic devices, polymeric batteries, and functional thin films, among other things, are commercial applications of PPy. Polypyrrole coatings are thermally stable and well suitable for use in carbon composites [23,24,25]. There are different routes to convert PPy from an insulator form to a conductor form. One of them involves doping PPy with reducing agents, which supplies electrons to the unfilled band of the polymer chains during polymerization process. The oxidative polymerization route was used to prepare doped polypyrrole in one dimension and two dimensions using methyl orange as an in-situ-generated template and SDS as a surfactant. The distinction between these two types was made and used to create polymer solar cells.

2 Experimental step

2.1 Raw materials

Pyrrole monomer, ethyl alcohol, ferric chloride (anhydrous), MO, hydrochloric acid, and sodium dodecyl sulfate (SDS) were purchased analytical grade from Sigma-Aldrich, Steinheim, Germany (99.99%). The reagents were not further purified before use.

2.2 Procedures

Polypyrrole samples were synthesized according to our previous work [26]. A simple chemical oxidative polymerization method was used to prepare PPy samples. 3.5 g methyl orange (MO) and 3.45 g sodium dodecyl-sulfate (SDS) were typically dissolved separately in 100 mL of ethyl alcohol. The solutions were diluted by distilled water up to 400 mL at room temperature using a magnetic stirrer (875 rpm). The solutions' pH was adjusted to 1.6 by adding few drops of concentrated HCl. Then, for 20 min, 4 mL of pyrrole was added up to the MO and SDS solutions separately under the same conditions. Then, for about 2 h, 160 mL (0.5 M FeCl3) was added to each solution drop wisely. The resulting obtained HCl doped polypyrrole was stirred with a magnetic stirrer for a further hour. HCl doped polypyrrole that resulted was allowed to settle overnight. To remove the MO or SDS, unreacted monomer, and extra ferric chloride, resulting in ferrous chloride during the reaction, the obtained polypyrrole samples were filtered and washed numerous times by distilled water before being washed with ethanol. The collected polypyrrole samples were dried for two days at 65 degrees Celsius and labeled with [PPy-S] and [PPy-M], respectively.

2.3 Fabrication of the thin films by a PVD technique

A thin film of hydrochloric-doped polypyrrole was created using a physical vapor deposition approach (PVD). Figure 1a, b shows the manufacturing and synthesis process for thin films utilizing the PVD method. The thin films were precipitated on the substrate of a (p-Si) single-crystal wafer and an ITO/glass at 5103 Pa, with interdigitated-electrodes separated by 75 µ. The deposition rate of 3/s was carried out a UNIVEX 250 Leybold, the W-boat tantalum at a rate of 2–3/s through a shadow mask to create a channel with a length and width of 110 m and 1.2 mm, respectively, with a continuous vacuum at all times [27]. The film thickness was 150 ± 5 nm as determined by a quartz-crystal microbalance on a UNIVEX machine. Figure 1a. From the substrate interface to the film surface, There is no reaction between the film and the substrate was noticed [28, 29].

Fig. 1
figure 1

a, b Synthesis and fabrication scheme for thin films using PVD method

2.4 Computational study

The molecular-structure performance and frequency studies for the [PPy-S]TF isolated molecule in the gas phase were determined using the DMol3 computation. Natural pseudo-positive conservators, functional PBE/GGA association, and a basic DNP set designed for acceptable compounds were all investigated using DMol3 [30]. The entire value of the plane wave power cut off was calculated to be 830 eV. The physical and spectroscopic parameters of an isolated [PPy-S]TF molecule were determined using the IR properties of DMol3, resulting in the GP frequency. Becke's functional connection is also influenced by three elements [31]. The shape and vibrant consistency (IR), [PPy-S]TF in the gas phase, and nanofluids in the gas phase were improved by forming a Lee–Yang–Parr-purposeful (B3LYP) [32] connection with WBX97XD/6-311G. The GAUSSIAN 09 W System researches symmetrical variables, images of arrangements, and the thin film's vibration process complications. The B3LYP method built on WBX97XD/6-311 G has yielded valuable findings for the connection between setup and spectrum reported [33]. The GAP technique was utilized to evaluate the characterizations of Gaussian and DMOl3 doped v in isolated molecules, as well as deliberate descriptor alterations and the combined usage of suitable modification with varied complexities [34].

3 Results and discussion

3.1 Combined between the experimental FTIR spectra and Gaussian DFT method

FTIR spectra of the PPy samples are represented in Fig. 2. The following characteristic bands are located at 855, 1035, 1175, 1460, and 1557 cm−1. The peak at 855 cm−1 can be due to C–H wagging, while that at 1035 cm−1 is corresponding to the N–H stretching vibration and C–H in-plane deformation. The C–N stretching vibration mode in the PPy five membered ring is responsible for the following two bands, which are positioned at 1175 and 1460 cm−1, respectively, whereas the symmetric ring vibration of C–C bonding is responsible for the band at 1557 cm−1 [35]. The theoretical FTIR spectrum, on the other hand, was approximated using the isolated molecule's spectroscopic indications. Figure 2 depicts the modest differences between evaluated frequencies and the expected. The primary distinction is that the count was performed in a vacuum, whereas the calculations were calibrated in a solid state. Because the polymer's vibrational modes are complex, low symmetry results, and it's tough to attribute torsion as well as all plane modes because ring modes degenerate alongside imitative ones. However, the graph shows some noteworthy changes [36]. The following equation for [PPy-S] shows the direct association between computed \(\left({\lambda }_{\text{Cal}.}\right)\) and experimental wavenumbers \(\left({\uplambda }_{\text{Exp}.}\right)\) Polypyrrole. \({\lambda }_{\text{Cal}.}=0.961\,{\lambda }_{\text{Exp}.}+10.13\) with correlation coefficient (\({R}^{2}= 0.99\)). For [PPy-S] polymers: \({\lambda }_{\text{Cal}.}=0.957\,{\lambda }_{\text{Exp}.}+15.08\) with correlation coefficients (\({R}^{2}= 0.999\)).

Fig. 2
figure 2

FTIR of experimental and theoretical polypyrrole

3.2 SEM of [PPy]TF

Nanotubes frequently have different features than the standard spherical shape, which is why one-dimensional morphology is of great interest in both basic and practical science. Polypyrrole's ability to self-organize into forms with specified morphology and characteristics suggests that its molecular and macromolecular structure is highly defined and that it is not simply a combination of diverse oxidation products. MO is employed as an in-situ produced template for the production of doped polypyrrole tubes, and methyl orange has played a unique role in the fabrication of polypyrrole nanotubes. The properties of nanotubes depend on the concentrations of pyrrole, ferric chloride, and methyl orange, and medium solvent [37, 38]. Figure 3a, b shows tubes form clearly in agreement with Kopecká et al. [37]. Figure 3c, d) displays a sheet form clearly of PPy-M with uniform particles in two dimensions.

Fig. 3
figure 3

a, b SEM images for [PPy-M] and c, d [PPy-S] at two different magnifications

SDS plays an important role as a soft surfactant during the polymerization process at the considered condition of the experiment. This confirms that the surface morphology of the resulting polypyrrole depends on the organic compound used during the polymerization process. With alternating the organic compound types and conditions of the experiment, the resulting surface morphology also varies. The difference in the surface morphology and physical properties of the resulting polypyrrole depends on the surfactant types, which are used. MO produces one-dimensional- PPy-M (nanotubes Fig. 3a, b) while SDS produces two-dimensional-PPy-S (sheet Fig. 3c, d).

3.3 Combined between the experimental XRD and Gaussian DFT method

[PPy-S]TF and [PPy-M]TF phases were observed within the instrumental sensitivity, as shown in Fig. 4. The XRD pattern obtained from the fabricated [PPy-S]TF is amorphous, with one peak appearing at 2θ = 25.57°. On the other hand, The XRD pattern obtained fabricated [PPy-S]TF had correlated to the isolated system matrix. The predicted crystallite size (D) and miller indices (hkl) are both dependent on the full width at half-maximum (FWHM) values, as given in Table 1. The code data basis are cod_database_code 1007186 and database_code_amcsd 0012305agrees well with the interplanar distances d-spacing [39]. To denote peak lines studied by diffraction that are close to the results obtained, the TDDFT-DFT and Crystal Sleuth-Microsoft programs are employed [40]. The Debye–Scherrer was applied to measured XRD for [PPy-S]TF, the range of 5 ≤ 2θ ≤ 45 with \(1/dhkl= 0.0566\,{\text{ \AA }}^{-1}-0.7446\,{\text{ \AA }}^{-1}\), \(\lambda = 1.540562\, \AA \), \({I}_{2}/{I}_{1}=0.5\), polarization = 0.5, and function Pesedo-Voigt. From Scherer’s formula, \(D = 0.9\,\lambda /(\text{FWHM}.\text{cos}\theta )\), where λ is the X-ray wavelength (1.541838 Å). The produced [PPy-S]TF XRD data from the XRD pattern was utilized to examine variables and features such FWHM, crystallite size, hkl indices, d-spacing (d), and peak intensity, as shown in Table 1. Between 39.56 and 97.25 nm, the crystalline size was Dav = 69.79 nm. The theoretical X-ray diffraction models (version 7.0) were calculated by Polymorph using content studio software (see Fig. 4). The integrals were performed on the Brillouin zone with 2 × 2 × 1 inset Fig. 4. (Polymorph [PPy-S]TF). For [PPy-S]TF, Between experimental X-ray structures and observed PXRD patterns, an experimental comparison was done. While the intensity and location of specific peaks differ significantly between experimental and PXRD models, the emphasis here is on their general closeness. As a result, only the most essential comparison qualities between the measured and experimental data should be assessed. Instrumentation and data collection techniques are just two of the many factors that can influence the experimental PXRD pattern. The simulated [PPy-S]TF in polycrystalline as an isolated position and offer a Triclinic in the group \({\overline{P} }_{1}\). A thorough examination of the computed and experimental PXRD patterns for [PPy-S]TF, demonstrating good agreement and supporting the PXRD patterns' accuracy. As demonstrated in Fig. 4, combining physically based diffraction with density functional theory calculations yields a reasonable estimate of the atomic scale for [PPy-S]TF (2θ at hkl (\(\overline{2 }\overline{2 }2\)).

Fig. 4
figure 4

Combined between the experimental ([PPy-S]TF and [PPy-M]TF) and simulated PPy-S XRD patterns, inset Fig. 3D Triclinic (polymorph computation method)

Table 1 The results of the [PPy-S] program Refine Version 3.0 Software Program (Kurt Barthelme's & Bob Downs)

3.4 Geometry study and molecular electrostatic potential (MEP)

Before implementing modeling for isolated molecules [PPy-S]TF and [PPy-M]TF films, many statements on the influence of positive and negative surface ratios on electron levels were studied. The difference in the average field, as well as the negative and positive regions, for a sample of over 1000 electron density molecules. The results suggest an average 15% reduction in the total when MEPs are related with 0.01–0.002 au. The data also show that until a certain number of nuclear nuclei is reached, the positive surface density value remains constant while the number of negative sections decreases. 09 w/DFT Gaussian [41, 42]. At 0.002 au, the positive area percentage is roughly 68%; at 0.01 au, it is over 85%. Visual representations of the MEP Iso-surface value of − 15 kcal/mol may be employed in nanofluid pairs of fields [43, 44], as shown in Figs. 5a and 6a. The estimated MEPVmin 3D minimum values nearest to the lone pair region of both polymers are − 1.0461 × 10–1 and − 9.907 × 10–1 kcal/mol, respectively, for the [PPy-S]TF and [PPy-M]TF is given by MEP's topography. Using DMOl3/DFT designs, the established nanofluids MEPVmax values for the [PPy-S]TF and [PPy-M]TF are 2.436 and 1.685 × 10–1 kcal/mol, respectively. As predicted, the estimated MEP Vmax and MEP Vmim will take into account the presence of the electronic alternative. The robust electron life of his unusual partnership is reliant on nanofluid-donating replenished energy. In the lonely pair zone, the MEP Vmim value provides a simple way to define pair power. As an example, a copolymer with a donor engine. The negative MEP Vmimrange's key feature is that it raises the electron density in a single pair of nitrogen atoms. To lower the unfavorable life of MEP Vmim, an electron pull out of the cluster is also required. MEP Vmim focused on nanofluid electrical impact calculations, which might be more practical and transparent than structures based on a variety of values (NH). The polymer matrix-donating strength is employed in the imagining [PPy-S]TF and [PPy-M]TF. The energy exchange between [PPy-S]TF and [PPy-M]TF is entirely equal to the quantity of MEP Vmim [45], when nanofluid movement is not required. Figures 5b and 6b illustrate the electron density in [PPy-S]TF and DNP base sets [PPy-M]TF, 4.4 base file, 0.2 DIIS/magnitude density blend, 5 to 3 ha smearing, respectively. The macro-cyclical plane's negative electrostatic potential is symmetrically distinct in all computations [46], and the geometry of the positive and mutually negative sections differs per base group. Figures 5c and 6c show how the source range (DNP) is stretched to DN and then irrelevantly further extended with base folder (4.4), SCF lenience (0.0001), and maxi.

Fig. 5
figure 5

DFT computation of a MEP of the [PPy-S], b Electron density of the [PPy-S], c Potentials of the [PPy-S], and d DFT computation for HOMO and LUMO calculations of the [PPy-S] using the DMOl3 method

Fig. 6
figure 6

DMOl3 technique of a MEP of the [PPy-M]; b Electron density of the [PPy-M]; and c Potentials of the [PPy-M]

In global reactivity descriptors based on quantum predictions, the highest occupied molecular orbit (HOMO) and the lowest unoccupied molecular orbit (LUMO), depicted in Figs. 5d and 6d, are substantially standard [47, 48]. The molecule's equilibrium is determined by the difference in energy between FMOs, which is significant in estimating electrical conductivity and comprehending electricity transport. The presence of fully negative EH and EL values indicates that the isolated chemicals are stable [49, 50]. The measured FMOs are used to calculate the electrophilic sites of aromatic compounds. On the M–L sites, the Gutmannat variance approach was utilized to boost EH when M–L bonds expanded and bond length decreased [51]. The energy gap, kinetic stability of the molecule, and the chemical reactivity under study were shown using \({E}_{g}^{\text{Opt}}\) [52, 53]. Softness and hardness are the most critical factors in determining stability and reactivity [54, 55]. The operational formula (\({\varepsilon }_{H}+{\varepsilon }_{L}/2\)) has been given in the single-electron energy field of boundary molecular orbital HOMO (εH) and LUMO (εL), as described in Table 4. The energy bandgap, which describes the relationship of charge transport within the molecule, can also be seen on the same table. The highest-valued molecular orbital coefficients define the coordination position. As shown in Table, this is the oxygen of the C–N–H group. The HOMO level is frequently found on the −C=C−(2), −C=N, and N–H(4) atoms, which are prime targets for nucleophilic attack. The energy gaps shown in Figs. 5d and 6d are 2.888 and 1.502 eV, respectively, which is an extremely large value for [PPy-S]TF and [PPy-M]TF. This reveals high excitation energies and, as a result, high stability for [PPy-M]. The lower \({E}_{g}^{\text{Opt}}\) for [PPy-M]TF than for [PPy-S]TF can be attributed to the more polarizable and softer. Soft molecules are referred to as reactive molecules rather than hard molecules since they can provide electrons to an acceptor. The index electrophilicity (ω) of the quantified chemicals is the most intriguing characteristic. The device promises energy stability as it absorbs external electronic charges [56, 57].

3.5 Optical properties

Based on the experimental results of reflectance R(λ) and absorbance Abs. (λ), the transmittance T percent (λ) and extinction coefficient k (λ) of thin films were calculated using the formula (\(T\%\left(\lambda \right)={\left(1-R\left(\lambda \right)\right)}^{2}\times \text{Exp}(-\text{Abs}.))\) [58, 59]. The absorption coefficient is calculated using the equation = Abs./d, where d is the observed values of the film thicknesses, as shown in Table 3. Figure 7a illustrates the wavelength (λ) relationship of the transmittance T% (λ) for [PPy-S]TF and [PPy-M]TF films. In region 350 nm ≤ λ ≤ 600 nm, the new absorption band has existed at 433 nm and 473 nm assigned to π–π* electronic transitions for [PPy-S]TF and [PPy-M]TF films. Furthermore, these findings suggest that the formation of [PPy-M]TF can effectively control the optical properties of [PPy-S]TF [60]. Figure 7b demonstrates the dependence of theoretical calculations (TDDFT) of absorbance (Abs.) and wavelength spectra (λ) of the [PPy-S] and [PPy-M]as an isolated molecule in a gaseous state. The absorption of pure [PPy-M]TF is higher than that of the [PPy-S]TF as an isolated molecule in a gaseous state. When the area of absorption and curve behavior of [PPy-S]TF and [PPy-M]TF as isolated molecules in a gaseous state are compared to the λmax values obtained from the experimental approach and TDDFT/DMOl3 calculations, it is clear that there is good agreement in most of the wavelengths considered [61, 62].

Fig. 7
figure 7

a The absorbance spectra of [PPy-S]TF and [PPy-M]TF thin films (Experimental part). b TDDFT/DMOl3 calculation of [PPy-S]TF and [PPy-M]TF in a gaseous state, inset figure is 3D molecule of [PPy-M]TF

The \({E}_{g}^{\text{Opt}}\) values of [PPy-S]TF and [PPy-M]TF films are determined utilizing Tuac’ equation:\({(\alpha h\nu )}^{m}=\beta (h\nu -{E}_{g}^{\text{Opt}})\), where \(h\nu \) is incident photons energy and \(m= 1/2\) for indirect and 2 for direct allowed transitions. EgOpt is calculated by extrapolating the straight portion of the (\(\alpha \) h\(\nu \))2 against (h\(\nu \)) plot to the energy axis at a = 0 and assuming direct transitions between the valence band and the conduction band in [PPy-S]TF and [PPy-M]TF films (Fig. 8). The direct \({E}_{g}^{\text{Opt}}\) value for [PPy-S]TF and [PPy-M]TF films are 2.40 eV and 2.16 which is consistent with the informed values for [PPy-S]TF films in the literature [63].

Fig. 8
figure 8

The relationship photon energy with both (αhν)0.5 and (αhν)2 of [PPy-S]TF and [PPy-M]TF thin films

The analysis of the manufactured films' direct and indirect optical band gaps is shown in Fig. 8. Both \((\alpha {h\nu )}^{2}\) and \((\alpha {h\nu )}^{0.5}\) have a linear dependence at higher \((h\nu )\),, as seen in Fig. 8, indicating that both optical transitions are possible for these manufactured films. The optical band gaps, \({E}_{g}^{\text{Opt}}\) (direct) and \({E}_{g}^{\text{Opt}}\) (indirect), are computed by extrapolating the straight-line parts of the curves to zero, and the calculated values are shown in Table 2. \({E}_{g}^{\text{Opt}}\) (direct) of [PPy-S]TF is 2.35 eV, which lowers to 2.16 eV after the creation of [PPy-M]TF, as shown in Fig. 8 and Table 2 [64].

Table 2 Calculated εHOMO, εLUMO, electronegativity (χ), chemical potential (μ), global hardness (η), global softness (S), and global electrophilicity index (ω), ΔNmax and σ for the [PPy-S]TF and [PPy-M]TF polymers

The combination of [PPy-S]TF with the same another molecule may push energy levels inside the bandgap of [PPy-S]TF, leading to the contraction of its\({E}_{g}^{\text{Opt}}\). The same performance is also examined for \({E}_{g}^{\text{Opt}}\) (indirect) which decreases from 2.62 to 2.40 eV. The film thickness (d), optical properties of [PPy-S]TF and [PPy-M]TF thin films: Optical band gap \({E}_{g}^{\text{Opt}}\) indirect, \({E}_{g}^{\text{Opt}}\) direct, refractive index (n) has been tabulated in Table 3.

Table 3 Optical properties of [PPy-S]TF and [PPy-M]TF thin films thin films

HOMO and LUMO are key factors in quantum chemical simulations for the complexes analysis known as the boundary molecular orbits in the molecular orbit (FMOs) for TDDFT/DMOl3 computations (insert Fig. 8). The computed energy\({E}_{H}\), \({E}_{L}\) and \(\Delta {E}_{g}^{\text{Opt}}\) are presented in Table 4. The tabulated values of all these parameters were calculated using the following equations (\(\mu ={E}_{H}+{E}_{L}/2),\) (\(\upeta ={E}_{H}-{E}_{L}/2)\), \(\left(\chi =- \mu \right)\), \((S=1/2\upeta )\), (\(\omega =\mu 2/2\upeta \)), (\(\upsigma =1/\upeta \)) and (\(\Delta {N}_{\text{max}}=-\mu /\eta )\), respectively [65, 66]. The negative values of \({E}_{\text{HOMO}}\) and \({E}_{\text{LUMO}}\) energies can be ascribed to product stability for [PPy-S] and [PPy-M] as a matrix for isolated compounds. For the largest magnitude molecular orbital coefficients, coordination position simulation was used. A crucial quantum chemical property is the electrophilicity index (t), which analyzes energy stability when the device gets an extra electronic charge [67, 68].

Table 4 Geometry constant for [PPy-S] and [PPy-M] as isolated molecules

The values of \({E}_{g}=2.88 \text{eV}\) and 2.15 eV for TDDFT/DMOl3 computations (Inset Fig. 8) were determined by applying the DMol3 procedure in DFT based on the disagreement between HOMO and LUMO for [PPy-S] and [PPy-M] [69]. The simulation results utilizing DFT/DMOl3 and experimental data (Tauc's equation) are very similar. Electrical and energy transfer methods can be efficiently evaluated using the data received from two approaches [70].

3.6 The optical constants and refractive index of the films

The absorbance (Abs.), and the reflectance R(λ) were evaluated to establish the refractive index n(λ) and some dispersion factors. The reflectance is calculated using the formula \(R\left(\lambda \right)={(n-1)}^{2}+{k}^{2}/{(n+1)}^{2}+{k}^{2}\). Thus, the computed refractive index is \(n\left(\lambda \right)=(1+R)+\sqrt{4R-{(1-R)}^{2}{k}^{2}}/(1-R)\) [71]. Figure 9a demonstrates the n(λ) distributions of the fabricated thin films. The calculated \(k\left(\lambda \right)\) and \(n\left(\lambda \right)\) at \(h\nu =2.88\, \text{eV}\) and 2.61 eV are tabulated in Table 2. It is noted that \(n\left(\lambda \right)\) increases from \(n\left(\lambda \right)=1.48\) for [PPy-S] to \(n\left(\lambda \right)=1.62\) for [PPy-M], it increases with increasing the \(h\nu =2.61\, \text{eV}\) till reach 2.88 eV. Similarly, the \(k\left(\lambda \right)\) increases from \(k\left(\lambda \right)=3.53\times {10}^{-9}\) for [PPy-S]TF to \(k\left(\lambda \lambda \right)=1.24\times {10}^{-8}\) for [PPy-M], it increases with increasing the \(h\nu =2.88\, \text{eV}\) till reach \(1.24\times {10}^{-8}\). It has been determined that when incident light interacts with a material containing many particles, the refraction increases, and, as a result, the refractivity of the films increases [72]. From the behavior of [PPy-S] and [PPy-M] in Fig. 9b, the intensity of four peaks observed are increased with a formation of sheet [PPy-S]. The CASTEP/DFT computations were used to evaluate n(λ) and k(λ) values from the behavior of the simulated nanocomposite [PPy-S] and [PPy-M] as the isolated state in Fig. 9b, and when compared to the experimental values, the simulated values are close to those achieved by DFT with the CASTEP model [73].

Fig.9
figure 9

a Plot (n) and (k) vs photon energy () eV for [PPy-S]TF and [PPy-M]TF, b The simulated computation of (n) and (k) for [PPy-M] as isolated molecule by CASTEP/DFT and inset Fig. 3D Triclinic lattice type (polymorph computation method)

The frequency dependence of the optical dielectric constant is a parameter that provides information about the electronic excitations within the material. The real (\({\varepsilon }_{1}\)) and imaginary (\({\varepsilon }_{2}\)) parts were determined by the following equations: \({\varepsilon }_{1}={n(\lambda )}^{2}-{k(\lambda )}^{2}\) and \({\varepsilon }_{2}=2n\left(\lambda \right)k\left(\lambda \right)\) [74]. It is seen, from Fig. 10a, that with increasing photon energy, the \({\varepsilon }_{1}\) and \({\varepsilon }_{2}\) values increase and then increase at the higher values of photon energy (\(h\nu = 1.50 \,\text{eV\, and} 4\, \text{eV}\)). The maximum values of \({\varepsilon }_{1}\) are 2.19 and 2.63 at \(h\nu = 2.88\, \text{eV}\) and 2.61 eV for the [PPy-S]TF and [PPy-M]TF thin films. Using the CASTEP technique, the maximum value of ε1(λ) and ε2(λ) for [PPy-S] TF and [PPy-M] TF in isolate state is 0–3 at various frequencies (eV) ≅ 0–25, respectively (Fig. 10b). The experimental and simulation dimensions' average values ε1(λ) and ε2(λ) are discovered within the frequency range values of 1–6 eV [75]. As indicated in this figure of [PPy-S]TF and [PPy-M]TF, one peak in the dielectric constant parts performance was detected. The CASTEP/DFT computations were used to evaluate ε1(λ) and ε2(λ) values from the behavior of the simulated composite [PPy-S]TF and [PPy-M]TF as an isolated state in Fig. 10b, and compared to the experimental values for [PPy-S]TF and [PPy-M]TF, simulated values are close to those achieved by DFT with the CASTEP model.

Fig. 10
figure 10

a (\({\varepsilon }_{1}\) and\({\varepsilon }_{2}\)) vs (\(h\nu \)) eV for [PPy-S]TF and [PPy-M]TF thin films. b Simulation dielectric function for [PPy-M] as an isolated state by CASTEP method

ε1(λ) and ε2(λ) must be mixed according to the following relationship to generate the conductivity spectrum:

\(\sigma \times \left(\lambda \right)= {\sigma }_{1}\left(\lambda \right)+ {\sigma }_{2}\left(\lambda \right){; \sigma }_{1}\left(\lambda \right)= \omega {\varepsilon }_{2}\left(\lambda \right){\varepsilon }_{0} \,\text{and}\, {\sigma }_{2}(\lambda ) = \omega {\varepsilon }_{1}\left(\lambda \right){\varepsilon }_{0}\), optical-conductivity fragments, (ω) and (εo), respectively, the frequency of angular and dielectric-free space constants [76]. Figure 11a shows the optical-conductivity (real and imaginary portions) of [PPy-S]TF and [PPy-M]TF. The value of σ2 is higher than the value of σ1.For [PPy-S]TF and [PPy-M] TF, in the experimental-part (Fig. 11a), the σ1 (λ) showed the maximum values of 6.14 × 10–6, and 1.41 × 10–5/Ω/m at the photon energy value of 2.61 and 2.88 eV, respectively [77]. The σ2(λ) gives the maximum values of 8.41 × 103 and 2.51 × 103/m for [PPy-S]TF and [PPy-M] TF at the same photon energy value of σ1 (λ), respectively. The high value of the calculated ratio \({\sigma }_{1}\left(\lambda \right)/{\sigma }_{2}(\lambda )=7.30\times {10}^{-10}\) indicates that \({\sigma }_{2}\) is dominated [78]. The σ1(λ) and σ2(λ) of the [PPy-S]TF and [PPy-M] TF as isolate state depends on (\(h\nu \)) are validated in insert Fig. 11b. In the CASTEP technique, for [PPy-S] TF and [PPy-M] TF, the maximum values of σ1(λ) and σ2(λ) are (1.40 Ω/m, 5.96 eV) for the\({{\sigma }_{1}(\lambda )}_{[DCPPy]}\). For σ1(λ) and σ2(λ), the experimental method and the CASTEP technique produced similar findings.

Fig. 11
figure 11

a σ1 & σ2 with () eV for [PPy-S]TF and [PPy-M]TF thin films. b Simulation conductivity function for isolated state of [PPy-M] by CASTEP method

3.7 Fluorescence studies

The fluorescence emission and excitation spectra of [PPy-S]TF and [PPy-M]TF are depicted in Fig. 12a, b. Fluorescence emission peaks were examined at 557 nm and 594 nm for [PPy-S]TF and [PPy-M]TF, respectively. The observed Stokes shift,\(\Delta ={\lambda }_{\text{Emission}}-{\lambda }_{\text{Excitation}}\), was computed as ≅ 25 nm and 31 nm, for [PPy-S]TF and [PPy-M]TF, respectively. The excitation and absorption spectra are comparable, and both shapes are mirror reflections of one another. When compared to the absorption spectra, the excitation spectrum was a little red-shifted in terms of wavelength.

Fig. 12
figure 12

Excitation-emission spectra of a [PPY-S]TF; b [PPY-M]TF films and c at 298 K

Figure 12c illustrates a Commission Internationale de l'Eclairage (CIE) graphs of the emission colors of powders and different solution concentrations, as well as digital photographs obtained under UV light at \({\lambda }_{\text{max}}\)= 557 nm and \({\lambda }_{\text{max}}\)= 594 nm for [PPY-S]TF and [PPY-M]TF. All of the fabricated thin film and solutions emitted a deep-blue light with a CIE of y < 0.1. As a result, the researched manufactured polymers may be classified as crucial luminous since they emit white-light from a single material and deep-blue light from their solutions [79].

3.8 Photovoltaic properties of the Au/[PPY-S]TF/n-Si/Al and Au/[PPY-M]TF/n-Si/Al structure

Figures 13a, b demonstrate the illuminated IV characteristics of Au/[PPy-S]TF/n-Si/Al and Au/[PPy-M]TF/n-Si/Al heterojunctions. In the light, the current value of this device at a given voltage is higher than in the dark. This means that light absorption by the active layer creates excitons, which then dissociate into free charge carriers at the barrier, contributing to the photocurrent. The [PPy-S]TF–Si and [PPy-M]TF–Si interfaces, specifically. On the contrary way, light illumination has been discovered to dramatically boost the photocurrent in the device. This pattern offers vital information about the electron–hole pairs generated by incoming photons in the junction. Along the potential barrier at the interface, the electric field at the junction directed-free electrons and holes towards the electrodes. As demonstrated in Fig. 13, the device possesses photovoltaic qualities, with a high short-circuit photocurrent density \(\left({\text{J}}_{\text{sc}}\right)\) of 4.88 × 10–3 A/cm2 [80, 81].

Fig. 13
figure 13

a Current density_voltage and power_voltage characteristics. b Short_circuit current_power characteristics. Insert figure Schematic diagram of Au/[PPy-M]TF/n-Si/Al heterojunction

The open-circuit voltage (\({V}_{\text{oc}}\)) is 0.59 V (the difference in electrical potential between two terminals of a device when no external load is applied), and the fill-factor (FF) is 0.532 (the proportion of a solar (photovoltaic) cell's actual power to its power when both current and voltage are at their maximum), as well as the power-conversion efficiency (Z) (the quantity of energy generated as a proportion of the quantity of energy used). In the case of a photovoltaic device, the ratio of electric energy generated by the device under one-sun conditions to energy incident onto the cell) of 4.85%. In [PPY-S]TF–Si and [PPY-M]TF–Si devices, the fluctuation of short-circuit photocurrent (Jsc) with incident light intensity (Pin) is illustrated in Fig. 13b. The (Jsc) follows the power law with an exponent of 0.62, i.e., \(({J}_{\text{sc}}{\propto {P}_{\text{in}})}^{S}\). In ion processes, \(({J}_{\text{sc}}{\propto {P}_{\text{in}})}^{S}\) values of 0.5 and 1.0 correspond to bimolecular and monomolecular recombination, respectively [82]. The exponent for a continuous distribution of trapping centers is between 0.5 and 1.0. The presence of a continuous trap distribution is confirmed by the s values measured for the Au/[PPY-S]TF/n-Si/Al and Au/[PPY-M]TF/n-Si/Al diodes. Trap centers, according to its value, control the lifespan of photocarriers [83].

4 Conclusion

Using the oxidative polymerization process in the presence of MO and SDS, one-dimensional and two-dimensional hydrochloric acid-doped polypyrrole were synthesized. The synthesis technique and testing conditions have an impact on the polypyrrole's unique properties. [PPy-S]TF and [PPy-M]TF thin films with a thickness (150 ± 5 nm) were fabricated using PVD method. Geometric optimization, electronic spectra, infrared spectrum and MEP of the investigated [PPY] as isolated state were performed utilizing the DFT method. The crystalline size was \({D}_{\text{av}}= 69.79\,\text{ nm}\), and it was between 39.56 and 97.25 nm. Polymorph with symmetry Triclinic in the space group \({\overline{P} }_{1}\) used content studio software to calculate the theoretical X-ray diffraction models (version 7.0).The optical simulations show that polypyrrole tubes (one dimension) have a higher conductivity than polypyrrole sheets (two dimensions). For one and two-dimensional polypyrrole, \(\Delta {E}_{g}^{\text{Opt}}\) values of up to 2.88 eV and 2.15 eV were discovered. The observed Stokes shift, \(\Delta ={\lambda }_{\text{Emission}}-{\lambda }_{\text{Excitation}}\), was computed as ≅ 25 nm and 31 nm, for [PPy-S]TF and [PPy-M]TF, respectively. All of the fabricated thin film and solutions emitted a deep-blue light with a CIE of y < 0.1. Under 50 mW/cm2 white-light lighting, the heterojunction of one-dimensional polypyrrole exhibits photovoltaic performance with an open-circuit voltage of 0.59 V, a short-circuit current density of 4.88 mA/cm2, a fill-factor of 0.532, and a power-conversion efficiency of 4.85%.