Band gap modulation in polythiophene and polypyrrole-based systems

In this paper, the structural and electronic properties of polythiophene and polyprrrole-based systems have been investigated using first-principles calculations both in periodic and oligomer forms. Of particular interest is the band gap modulation through substitutions and bilayer formation. Specifically, S has been substituted by Se and Te in polythiophene, leading to polyseleophene and polytellurophene, respectively, and N has been substituted by P and As in polypyrrole. The values obtained of the binding energy suggest that all the systems studied can be realized experimentally. Stacking (bilayer formation) of pure polythiophene, polypyrrole and their derivatives leads to linear suppression of the band gap or HOMO-LUMO gap as a function of the stacking. Mixed bilayers, including one formed from polythiophene on top of polypyrrole, have also been considered. Overall, a wide range of band gaps can be achieved through substitutions and stacking. Hybrid (B3LYP) calculations also suggest the same trend in the band gap as PBE calculations. Trends in the binding energy are similar for both periodic and molecular calculations. In addition, Γ-point phonon calculations were performed in order to check the stability of selected systems.

polythiophene and its derivatives are expected to be utilized in electronic memory devices. These materials have been in focus for the last two decades 54,62 . Injection of electrons from the highest occupied molecular orbital (HOMO) to the lowest unoccupied molecular orbital (LUMO) is achieved without difficulties in this class of materials 65 . Recently, synthesis of polyselenophene/polytellurophene (replacement/substitution of the S atoms by Se/Te) has been achieved 61,[66][67][68][69] . The material can be used as an active layer in field-effect transistors 68 . Moreover, in a recent experiment, it has been reported that such systems are promising for CO 2 capture 70 .
Using a conjugated polymer, a well-established barrier to Li-ion drift has been achieved experimentally using polythiophene and polypyrrole, which in fact provides a mechanism for creating high-performance memory devices 71 . For such a system, the conjugated polymer barrier layer made of polypyrrole remains conducting at the interface between the metal oxide and Li + ion doped polythiophene. Moreover, the structural and electronic properties of polythiophene doped by Li/Cl in various stacking schemes in both periodic and oligomer forms have been investigated 53 . It has been suggested that these types of study will be useful for understanding the structural properties and the tunability of the electronic states, which should be an important step toward construction of polythiophene-based electronic devices. In this paper, we investigate the structural and electronic properties of S substituted by Se and Te in polythiophene and N substituted by P and As in polypyrrole using first-principle density functional theory (DFT) based calculations. It is believed that the comprehensive analysis of our investigation will be very useful for understanding the structural properties and the band gap or HOMO-LUMO gap of the systems under study, which provides a basis for constructing polythiophene and polypyrrole-based electronic devices. Moreover, in case of the periodic calculations, we also performed hybrid (B3LYP) calculations in order to determine the effect of the hybrid functional on the band gap. Furthermore, Γ -point phonon calculations were performed to confirm the stability of selected systems.

Methods
Periodic calculations were performed using DFT within the generalized gradient approximation in the Perdew, Burke, and Ernzerhof (PBE) parametrization 72 as implemented in the Quantum-ESPRESSO code 73 . The effects of spin-orbit coupling (spin-orbit relativistic effects with PBE pseudopotential) were also taken into account. For the systems with stacking configurations, the van der Waals interactions (DFT-D) were included in order to obtain correct dispersion 74 . A relatively high plane wave cutoff energy of 800 eV with a larger Monkhorst-Pack 32 × 1 × 1 k-mesh were employed. The considered supercell contains four monomers of thiophene as well as pyrrole and has lattice constants of a = 15.59 Å and b = 15.00 Å. A vacuum layer of 20 Å was used in order to nullify any spurious interactions due to the periodic boundary conditions. The atomic positions were optimized very well with all the forces converged to 0.0005 eV/Å. The following systems were considered with a vacuum along the y-and z-directions (see Tables 1, 2, 3 and 4) (i) monolayer/bilayer of pure polythiophene, (ii) monolayer/bilayer of polythiophene substituted by Se (polyselenophene), (iii) monolayer/bilayer of polythiophene substituted by Te (polytellurophene), (iv) monolayer/bilayer of pure polypyrrole, (vi) monolayer/ bilayer of polypyrrole substituted by P, (vi) monolayer/bilayer of polypyrrole substituted by As, and (vii) bilayer made of polythiophene and polypyrrole. In addition, various mixed bilayers were considered as summarized in Tables 1, 2, 3 and 4. All of the above systems were also considered for the molecular case. In addition, the B3LYP hybrid functional 75 was employed in order to examine the effect of the hybrid functional on the band gap. Note that the B3LYP calculations were performed only for the periodic cases and not extended to the molecular cases due to limitations in computational resources. We believe that the trends in the band gap would be the same in molecular and periodic calculations.
In the molecular calculations (hexamers), the systems were optimized using DFT-D (PBE) 72 as implemented in the Amsterdam Density Functional (ADF) code [76][77][78] . Previously, we have shown that this setup provides reasonable results while comparing to the corresponding experimental findings 53 . Note that experimentally and theoretically, oligomers of six or less thiophene rings are found to be sufficient to reasonably model such systems 79 . All the calculations were performed using double zeta Slater-type orbital basis sets (ZORA-DZ). Relativistic effects including spin-orbit effects were included (ZORA with spin-orbit) [80][81][82] , they cannot be neglected due to larger values of the spin-orbit coupling and scalar relativistic effects especially for Se and Te atoms. All the geometries were optimized until the energy was converged to 0.0003 eV. A default integration accuracy parameter of 4.0 was used for geometry optimizations and single point calculations for all systems under study.

Results and Discussion
Polythiophene and its derivatives (Periodic approach). Vibrational properties. Vibrational Raman and infrared frequencies are really useful to provide information on a molecular or atomic level. The vibrational frequencies can easily be detected in experiment and the frequencies can vary between different materials as well as due to distortions in the structures arising from doping or defects [83][84][85] . Therefore, first of all, we performed a series of phonon calculations at the Γ -point phonon for polythiophene and its derivatives in order to check the structural stability. Indeed, only stable structures are presented in this paper as listed in Table 1. Each atom has three degrees of vibrational freedom, each monolayer of polythiophene and its derivatives have a total of 28 atoms in the system, thus, the total number of phonon modes in these structures is 84, see Fig. 1(a), whereas the number of phonon modes becomes 168 for identical and non-identical bilayers (28 atoms in each layer), see Fig. 1(b,c). The highest phonon frequency for a monolayer of polythiophene is found to be 3195 cm −1 at the Γ -point, which agrees well with an experimental observation 83 . Note that no imaginary phonon frequencies are observed at the Γ -point for all the system under study, which confirms that the systems are stable. The highest phonon frequency for monolayers of polyselenophene and polytellurophene is 3124 cm −1 and 3077 cm −1 at the Γ -point, respectively. Our obtained values show good agreement with a previous theoretical prediction 86 . It is clear that the phonon frequencies are decreasing while moving from polythiophene to polytellurophene (S to Te), which is called phonon softening 87 . The phonon softening occurs due to the the weakening of C-Se and C-Te bond lengths as compared to C-S bond lengths. However, the phonon frequencies become harder in case of identical as well as non-identical bilayers as compared to their monolayer counterparts because the interlayer interactions (out-of-plane vibrations) play a pivotal role. The obtained value of the phonon frequencies for the bilayers are found to be 3207 cm −1 , 3178 cm −1 , 3198 cm −1 , 3210 cm −1 , 3260 cm −1 , and 3310 cm −1 for S-S, Se-Se, Te-Te, S-Se, Se-Te, and S-Te (see Fig. 1(b,c), respectively.
Furthermore, similar to the polythiophene derivatives, we also performed a series of phonon calculation at the Γ -point for polypyrrole and its derivatives to check the structural stability. Only stable structures are presented in Table 1, Fig. 3(b). Each monolayer of polypyrrole and its derivatives has a total of 32 atoms in a unit cell; therefore, the total number of phonon modes in these structures is 96, see Fig. 2(a). But the number of phonon modes becomes 192 for identical and non-identical bilayers (32 atoms in each layer) as depicted in the Fig. 2(b,c). We observe a highest phonon frequency of 3559 cm −1 at the Γ -point for the monolayer of polypyrrole, which agrees well with a previously reported value 88 . No imaginary phonon frequencies are observed at the Γ -point for all the system under consideration, which confirms that the structures presented in the paper are stable. The highest phonon frequency for P and As amounts to 3103 cm −1 and 3074 cm −1 at the Γ -point. It should be noted that we do not have any previously published data to be compared with our results for these systems. Similarly to the polythiophene, it is clear that the phonon frequencies are decreasing while moving from N to P to As; the weaker bonding is responsible for the softening of the phonon as we move from N to P to As, see Fig. 2(a). However, the phonon frequency becomes softer/harder in case of identical/non-identical bilayers as compared to their monolayer counterparts because the interlayer interactions (out-of-plane vibrations) play a crucial role. In contrast to polythiophene bilayers, the phonon frequencies in case of identical bilayers become softer due to the fact of a strong deformation in the atomic structure in both of the layers, while non-identical bilayers follow the same trend as the polythiophene derivatives (non-identical bilayers). The calculated values of the highest phonon frequencies for bilayers are found to be 3094 cm −1 , 2828 cm −1 , 2640 cm −1 , 3533 cm −1 , 3195 cm −1 , and 3541 cm −1 for N-N, P-P, As-As, N-P, P-As, and As-N (see Fig. 2(b,c)), respectively.
Structural arrangements. The structure of monolayer polythiophene is shown in Fig. 3(a). The polyselenophene and polytellurophene have very similar structures. Side views of the optimized structures of various bilayers are presented in Fig. 4. The considered supercell of the monolayer has 16 carbon (C) atoms, 8 Hydrogen (H) atoms, and 4 Sulphur (S) or Selenium (Se) or Tellurium (Te) atoms. The structural parameters, which consist of various System X-H C-C C-X C-X-C C-C-C X-C-C bond lengths and bond angles, are summarized in Table 1. The values obtained of bond lengths and bond angles agree well with the available experimentally and theoretically obtained values 53,66,89 . Polythiophene, containing S atoms in the pentagonal rings of the polymer backbone, has been well studied in both experiment and theory, whereas the effect of Se or Te instead of S is not well understood. Recently, replacement/substitution of S by Se has been successfully realized experimentally, resulting in polyselenophene 53,61,90 . It has been found that such a substitution is crucial in order to control the electronic properties of the polythiophene based polymer, especially the band gap. For pristine polythiophene, the buckling, which is defined as the perpendicular out-of-plane distance between atoms in the same layer, is found to be 0.10 Å (Table 2), C-C bond lengths are found to be 1.38-1.41 Å, and the C-S bond length amounts to 1.73 Å. While the C-S-C, C-C-C, and S-C-C bond angles are found to be 93°, 113-128°, and 109-119°, respectively. The calculated structural parameters for polyselenophene are found to be similar to those of polythiophene except for the C-Se bond length, which grows as compared to the C-S bond length in polythiophene and is found to be 1.88 Å. At the same time, the C-C bond length shrinks slightly, in good agreement with the experimentally obtained value 61 .
Our calculated values for the structural parameters of polytellurophene are listed in Table 1 as well. The buckling is found to be 0.17 Å, slightly increased as compared to polythiophene (0.10 Å) and polyselenophene (0.12 Å). The C-C bond lengths shrink to 1.35-1.38 Å as compared to the C-C bond lengths in polythiophene and polyselenophene, while the C-Te bond length grows to be 2.08 Å. All other parameters are similar to those of the previous cases. It should be noted that C-C bond lengths decrease from S to Te and the C-X (X = S, Se, Te) bond length grows from Se to Te. Note that the exact structural modifications at finite temperature can be seen from molecular dynamics studies, which indeed is close to the experimental observations, as recently shown by Salvador and co-workers 91 .
In addition, we have studied bilayers of polythiophene, polyselenophene, and polytellurophene in two scheme (i) both layers are identical (S-S, Se-Se, and Te-Te) and (ii) the two layers are not identical (S-Se, S-Te, and Se-Te). The side views of the optimized structures are depicted in Fig. 4    and polytellurophene, respectively. The buckling is found to increase from polythiophene to polytellurophene and the C-C bond lengths are found to decrease from polythiophene to polytellurophene, respectively. Whereas the C-X bond length is found to be increasing from polythiophene to polytellurophene, almost identical to the monolayers. The other structural parameters vary in a similar pattern as in case of the corresponding monolayers, compare Table 1.
The interlayer spacing amounts to 3.42-3.62 Å, 3.39-3.65 Å, and 3.39-3.68 Å, respectively, in case of scheme (ii). Importantly, the buckling is quite large as compared to that of scheme (i); the probable reason for the increment in the buckling is the interaction between the X atoms, e.g. the S atom of one layer with the Se atom of another overlying layer. This is not the case for scheme (i) because both the layers are identical. In addition, C-S, C-Se, and C-Te bond lengths of 1.73-1.88 Å, 1.74-2.06 Å, and 1.88-2.07 Å are found for S-Se, S-Te, and Se-Te bilayers, respectively, again this is different from scheme (i).
Furthermore, polymers that contain alternating S, Se and Te atoms in consecutive rings have also been considered, either in a monolayer or bilayer form (referred to S-Se-Te 1 and S-Se-Te 2 in Tables 1, 2, 3 and 4). It is found that the buckling in the bilayer is about 6 times larger than that of the monolayer because of multi-atomic interactions, i.e. S-S, Se-Se, and Te-Te atomic level interactions (note that AA stacking has been considered). The remaining structural parameters are consistent with the other systems discussed above. Based on our calculations, such systems are promising to reduce the band gap, which will be discussed in detail below.
Electronic structure. Polythiophene and its derivatives are a class of materials that have been widely used as conjugated materials in electronic devices such as optoelectronics 90,92 . Nevertheless, there are certain difficulties to integrate polythiophene in devices mainly due to the limited absorption profile. In order to improve device performance, lots of research activities have been focused on the development of new low band gap polymers made from polythiophene and its derivatives. In Fig. 5, the electronic structures of polythiophene, polyselenophene, and polytellurophene are addressed. The calculated value of the valence bandwidth (which is defined as the energy difference between the first band located right below the Fermi level at Γ -point to the M-point) is found to be almost constant at about 0.74 eV, whereas the conduction bandwidth (which is defined as the energy difference between the first band located right above the Fermi level at Γ -point to the M-point) increases significantly from 0.63 eV to 0.69 eV and 0.81 eV, respectively for polythiophene, polyselenophene, and polytellurophene, see Table 2. Concurrently, the value obtained of the band gap is reduced from 1.12 eV to 0.68 eV to System X-H C-C C-X C-X-C C-C-C X-C-C    Fig. 3(a) and left panel of Fig. 4. 0.26 eV for polythiophene, polyselenophene, and polytellurophene, respectively, compare Fig. 5(a-c). Whereas the experimental value of the band gap for polythiophene was found to be 2.0 eV, which indeed agrees well with our calculated band gap in the framework of the hybrid (B3LYP) calculations of 2.08 eV. Using the same functional, the obtained values of the band gap are 1.53/0.97 eV for polyselenophene/polytellurophene. It has already been established that the band gaps obtained from the hybrid (B3LYP) calculations reproduce the experimental band gaps very well 61 . Note that the trend in the band gap using hybrid (B3LYP) calculations (reduction in the band gap) from polythiophene to polytellurophene and their derivatives follows the same trend as the PBE calculations, see Table 2. The values obtained of the band gap for polythiophene and polyselenophene agree well with previous reports 62, 89,93 , however, there is no previous experimentally/theoretically obtained value of the band gap for polytellurophene to be compared. Note that replacing the S atom in polythiophene by heavier atoms such as  Se or Te results in lowering the band gap. Previous studies indicated that the HOMO is not contributed by the S atom; on the other hand the LUMO has significant contributions from the S atom 90,94 . Thus, replacement of S by Se or Te should have a large contribution to the LUMO. Because of the lower ionization potential of the Se or Te atoms, their incorporation into polythiophene should lead to a lowered LUMO energy level, and hence, provide for a smaller energy gap as compared to its S counterpart. Importantly, lowering the band gap along with increasing the conduction bandwidth make the material a good candidate to be n-doped, and it should possess a large n-type conductivity as compared with the systems with larger band gap 95 . Moreover, the conductivity, ionization potential, and electron affinity should be largest for polytellurophene amongst the three materials. Similarly, the effective masses of holes and electrons in the valence as well as conduction bands should follow the same trend as conductivity, ionization potential, and electron affinity. The calculated value of the binding energy [E binding = (E supercell − E X − E Y − E Z )/N, where E supercell , E X , E Y , and E Z are the total energy of the supercell, total energy of isolated C atoms, total energy of isolated S or Se or Te atoms, and total energy of isolated H atoms, while N is the total number of atoms in the system] decreases slightly from polythiophene (− 0.483 eV) to polytellurophene (− 0.455 eV). Note that, essentially, all the three systems should be easily realized experimentally because of only slight differences in the binding energy. Likewise, the nature of the bonding is expected to be quite similar in the whole network/backbone. Indeed, polytellurophene and polyselenophene have been synthesized 34,38,39,68,[96][97][98] .
The electronic band structures of bilayer polythiophene, polyselenophene, and polytellurophene, where both the layers are identical, are addressed in Fig. 6. The calculated value of the valence bandwidth decreases from polythiophene to polytellurophene, while the conduction bandwidth increases, similar to the monolayer counterparts, see Table 2. The band gap is reduced substantially as compared to the monolayer counterparts; the reduction in the band gap can be understood as a result of the interaction between the two identical layers 53 . The obtained value of the band gap using the hybrid (B3LYP) functional becomes larger than the value obtained from the PBE functional, as expected, and, importantly, the band gap trend is similar as compared to the PBE functional, see Table 2. A number of synthetic routes have been proposed experimentally to produce various low band gap polymers using bulk or bilayer schemes, including donor-π-acceptor conjugated polymers, for example 99 , as well as polythiophenes grafted with side chains 100 copolymerized with fluorene moieties 101 . Such low band gap materials are promising for harvesting solar photons 102 . Therefore, our results point to new forms of conducting polymers that would be useful in solar cells. Moreover, a sizeable band gap is found for two immediate valence and conduction bands; the values of the band gap in the valence as well as conduction bands edges are found to be increasing from polythiophene to polytellurophene, see the data summarized in Table 2. Importantly, there are two possible optical transitions during light absorption and exciton formation for bilayer systems. These are π − π transitions. Such transitions have been observed experimentally for doped π-conjugated polymers and supported by theoretical calculations for doped polythiophene 28  to be similar to those of the monolayer counterparts, which means that the bonding of the atoms is quite similar for monolayer and bilayer. However, a significant variation in the valence and conduction band gap is found for mixed bilayers of polythiophene and polyselenophene or polythiophene and polytellurophene or polyselenophene and polytellurophene (compare Fig. 7(a-c)) because of the interaction between the two different layers. This can also be understood from the strong modification in the structural geometry (Fig. 4) as compared to the identical bilayers discussed above. On the other hand, the other parameters including bandwidths, band gap and E binding follow similar trends to those of the identical bilayers discussed above.
In addition, we have investigated the electronic properties of the S-Se-Te 1 and S-Se-Te 2 systems, where the composition of these systems has been discussed above in the structural arrangements section. These systems have the highest values of the E binding among the systems under consideration. Hence, it is expected that such systems should be energetically very stable, and the constituent atoms should be bonded strongly in the pentagonal backbone. Thus, these systems could be utilized for device application, for example solar cells 102 . All the calculated parameters are summarized in Tables 1 and 2. The electronic band structure is addressed in Fig. 8(a,b). The value obtained of the band gap is 0.70 eV (1.54 eV using B3LYP functional) for the monolayer and 0.64 eV (1.48 eV using B3LYP functional) for the bilayer with valence and conduction band gaps of 0.17 eV and 0.14 eV for S-Se-Te 2 . Because of the interlayer interaction, we observe two bands immediately below and above the Fermi level, making the system promising for optical transitions 28 .

Molecular calculations.
The structures under consideration for the molecular calculations are addressed in Fig. 9 along with their corresponding HOMO and LUMO orbitals. Whereas, the HOMO and LUMO energies, HOMO-LUMO gap, E binding , interlayer distance, buckling, bond distances, and bond angles for all the systems are summarized in Tables 3 and 4. Note that there are significant differences in the calculated values of the structural  parameters, energies, and HOMO-LUMO gap between periodic and molecular calculation, however both approaches maintain internal consistency. These differences in the parameters can be understood due to the fact that in periodic calculations, the systems are fixed along the y-or z-directions, while in molecular calculations the structures are subjected to modifications in all three directions. Thus, in our opinion, molecular calculations provide slightly better results for comparing with the real experimental situation, especially regarding geometries, whereas, periodic structures are also important because electronic devices has been synthesized using crystalline structures 103 . Note that, in case of mixed bilayers, the second layer is shifted as compared to the first layer, see Fig. 9. This indicates that in case of scheme (ii) (see section 3.1.1) a slipped ABA stacking pattern is energetically stable as compared to AAA non-slipped stacking pattern in case of scheme (i). In a recent experiment, both types of stacking patterns have been observed for two-dimensional π-conjugated polymers 104 . The fact is that the unshifted layers are energetically less favourable, which means that this arrangement is only a local minimum on the potential energy surface for these particular systems.
The calculated energy of the HOMO is slightly increasing (decreasing in magnitude) and that of LUMO decreasing (becoming more negative) from polythiophene to polytellurophene and a similar trend is achieved for the HOMO-LUMO gap, see Table 4. The values obtained of the HOMO-LUMO gap are higher (1.51 eV to 1.14 eV for polythiophene to polytellurophene) then those of the periodic approach due to the reasons as discussed above. The E binding is found to be significantly higher as compared to the periodic approach; it amounts to − 0.596 eV, − 0.582 eV, and − 0.569 eV for polythiophene, polyselenophene, and polytellurophene, respectively. This clearly indicates that the constituent atoms are more strongly bonded with each other in a molecular form as compared  to the crystalline form (periodic arrangement along x-and y-directions). The C-C bond lengths are again found to be shrinking upon substitution of the S atom in polythiophene by Se or Te. The C-S, C-Se, and C-Te bond lengths are found to be 1.75 Å, 1.91 Å, and 2.08 Å, respectively. The bond length between C and the heteroatom increases with increasing atomic number due to the larger ionic size of the heteroatoms, in good agreement with previous reports 87, [105][106][107] .
The C-X-C bond angle is found to decrease with increasing size of the heteroatoms (S, Se, and Te) and becomes 92° for polythiophene and 82° for polytellurophene. The other angles are found to be quite similar to those of the periodic approach, compare Tables 1 and 3. Essentially, the obtained parameters are more or less following similar trends as their periodic counterparts. The values obtained of the band gap for polythiophene, polyselenophene, and polytellurophene agree well with previous experimental and theoretical reports 53,61,68,95 .
In case of bilayers composed of two identical layers of polythiophene, polyselenophene or polytellurophene, the averaged value of the interlayer separation amounts to 3.41 Å to 3.53 Å, see Table 3. We observed variable values of the interlayer separation because significant buckling is induced in both the layers due to the interlayer interactions. This agrees well with experimental observation in case of π stacked conjugated polymers 108,109 . The buckling is found to be 0.25 Å to 0.46 Å for polythiophene to polytellurophene, respectively; such a buckling has already been observed for similar systems 53 . The values obtained of the band gap are reduced significantly (1.16 eV for S, 1.07 eV for Se, and 0.89 eV for Te atoms in the backbone) as compared to those of their monolayer counterparts because of additional molecular orbitals that have developed close to the Fermi level. Similar behavior has been obtained previously for bilayer polythiophene with different chain lengths 53 . However, in the case of mixed bilayer (see Fig. 4), variable values of the interlayer spacing, buckling and bond lengths between C atoms and the heteroatoms are found. The reason for obtaining variable values is the interaction between the two different heteroatoms layers. The values obtained of the various parameters are listed in Table 3. The HOMO-LUMO gap is slightly higher then those of identical bilayers ( Table 4). The variable value of the band gap which is close to 1.0 eV is promising for optical devices operated in low band gap regimes. Here, we obtain significant and predictable changes in the band gap of the polymers either by substituting heavier heteroatoms in the conjugated backbone or by creating bilayers. The significant lowering of the band gap (HOMO-LUMO gap) is due to the reduced aromaticity of a selenophene ring compared to a thiophene ring. The lower aromaticity in the main ring of the system lowers the HOMO-LUMO gap due to increased contributions of the quinoid structure of the main chain 61 . A HOMO-LUMO gap lower then that of the monolayers and slightly higher then that of either of the bilayers is achieved for monolayer as well as bilayers of the systems where adjacent S atoms are substitutes by Se and Te atoms, the systems are also called S-Se-Te 1 and S-Se-Te 2 , see Table 4. In summary, the calculations show that polythiophene-based systems can have wide ranges of the HOMO-LUMO gap (band gap), and they could be utilized for various electronic as well as optical devices accordingly. Therefore, synthesis of these systems would be useful.

Polypyrrole and its derivatives (Periodic approach). Structural arrangements.
The polypyrrole-based structures are presented in Fig. 3(b) and right panel of Fig. 4, where X refers to N, P, and As atoms. The supercell of the pristine monolayer of polypyrrole consists of 16 carbon (C) atoms, 12 Hydrogen (H) atoms, and 4 Nitrogen (N) or Phosphorus (P) or Arsenic (As) atoms. The calculated values of the structural parameters using periodic and molecular approaches are listed in Tables 1 and 3, respectively. For polypyrrole, the values obtained of the bond angles agree well with the available report 95 . In case of polypyrrole, N atom is connected to each of the pentagonal rings of the backbone and one H atom, which is well explored 110 . Experimentally, it has been suggested that the N atom can be replaced by a P or As atom 68 . Therefore, we have extended our study by replacing N by P and As, such that these materials could be utilized in electronic devices such as optoelectronics.
For pristine polypyrrole, the buckling is found to be 0.11 Å with a N-H bond length of 1.01 Å. The C-C bond length is slightly longer than that of the polythiophene-based structures. The C-N bond length is 1.44 Å, the C-X-C bond angle is 113°, which is much larger than the C-X-C bond angle in the polythiophene counterpart, while the other bond angles are similar to those of polythiophene-based structures, see Table 1. Moreover, buckling, X-H bond lengths, and C-X bond lengths are increasing when replacing N by P and As, see Table 1.
We also extended our study to two different types of bilayers systems, (i) both the layers are identical, i. e. N-N, P-P, and As-As, and (ii) the two layers are not identical i.e. N-P, N-As, and P-As, see Fig. 4. Variable interlayer distances of 3.18-3.68 Å, 1.73-2.69 Å, and 1.73-2.72 Å are obtained for the identical bilayer systems N-N, P-P, and As-As with a strong buckling, respectively. This indicates that there are strong structural modifications upon creating bilayers. In case of P and As monolayers or P-P and As-As bilayers, the P-H and As-H bonds point out-of-plane in order to get a stable structure, while the N-H bond points in-plane in case of N monolayer or bilayer of N-N. This is the reason why the interlayer distance in case of P-P and As-As bilayers is significantly smaller (1.73-2.72 Å) than that of the N-N bilayer (3.18-3.68 Å). Pristine polypyrrole bilayers (N-N) have been realized in experiment 111 . At this point, we believe that the other bilayers should also be realized experimentally, which would widen the research area. Experimentally it has been proposed that the bilayers made of polpyrrole (N-N) are promising for applications in amperometric ion sensing 112 . The buckling is found to be smaller and slightly less structural modifications are obtained in case of bilayers made of two non-identical layers (N-P, N-As, and P-As), see Table 1 and Fig. 4. Moreover, the electronic structure of the structures presented in the right panel of Fig. 4 are addressed in Fig. 10. Note that, in case of bilayers, the second layer is shifted as compared to the first layer, which indicates that the ABA kind of stacking is energetically favourable in these cases similar to bilayers made of polythiophene-based systems, as discussed above 104 . Electronic structure. Polypyrrole is a wide band gap organic polymer with many applications, such as flexible batteries, semiconductors, large-area optical displays, and sensors 113 . It has a larger band gap and hence, lower conductivity in the neutral state as compared to polythiophene. It has been reported that the effective mass of holes and electrons is comparatively higher than that of other polymers such as polythiophene, polyacetylene, and polyfuran 95 . The calculated band structures of polypyrrole and its P and As analogues are presented in Fig. 10(a-c).
The calculated values of the valence and conduction bandwidths along with the band gaps are summarized in Table 2. The value obtained of the band gap is found to be 1.88 eV, which agrees well with a previously calculated value using first-principles calculations 95 . The band gap shrinks significantly and becomes 0.34 eV and 0.61 eV for N atom replaced by P atom and As atom (see Fig. 10(b,c)), respectively. Moreover, the value of the band gap is found to be larger as compared to the PBE functional when using the hybrid (B3LYP) functional, as expected, see Table 2 for the comparison. This fact is true for all the calculations for polypyrrole and its derivatives. As discussed above, such a replacement is quite feasible in a real experimental situation 70 . A similar trend is found for the E binding as compared to the corresponding polythiophene-based monolayers.
The calculated electronic band structures for bilayers, where both the layers are identical, are addressed in Fig. 11. It is clear from the figure that there are two bands immediately above and below the Fermi level with a finite gap, contributed from each of the layers. The valence and conduction bandwidths are growing from the N-N to As-As bilayers, while the band gap shrinks from N-N to As-As. A similar trend is also found to the corresponding polythiophene-based bilayers discussed above. The E binding again follows the same trend as for the corresponding monolayers. Because of strong structural deformation, non-identical bilayers made of N-P and P-As do not provide two bands immediately above the Fermi level; rather they provide two bands immediately below the Fermi level. Whereas, in case of the N-As bilayer, two bands immediately above and below the Fermi level are obtained, which is due to less modification in the structure, compare Fig. 12(a-c). Moreover, the other parameters including bandwidths, band gap and E binding have similar trends to those of the bilayers made of two identical layers.   Fig. 13 with their corresponding HOMO and LUMO. The HOMO and LUMO energies, HOMO-LUMO gap, E binding , distance between the two layers, buckling, bond distances, and bond angles for all the structures under investigation are presented in Table 3. The electronic and structural parameters calculated using the molecular approach are slightly different from those of the periodic approach. The reason behind that is again the fact that in the periodic calculations, the systems are forced not to be moved along the y-or z-directions whereas in molecular calculations this is not the case. The values obtained of the HOMO and LUMO energies are significantly increasing in magnitude from N to P or As, which was not the case for the polythiophene-based systems, compare Table 4. The value obtained of the HOMO-LUMO gap for polypyrrole (N) is found to be 2.25 eV and decreases to as low as 0.89 eV and 0.81 eV for N replaced by P and As in polypyrrole, respectively. The HOMO-LUMO gap is larger than that calculated using the periodic approach (1.88 eV) and close to the experimentally and theoretically obtained value of the HOMO-LUMO gap of 2.8 eV 95,114,115 .
The E binding is found to be significantly larger than that obtained from the periodic approach, indicating a strong bonding of atoms in this approach. The E binding are − 0.609 eV, − 0.562 eV, and − 0.548 eV for N, P, and As systems, respectively, see Table 2. The buckling is also irregular and higher than that of the periodic approach. Whereas, other structural parameters such as bond lengths and bond angles are found to be similar to the values obtained using the periodic approach. For bilayers (made of the two identical layers), a slight reduction in the HOMO and LUMO energies is achieved with slightly smaller HOMO-LUMO gaps of 2.20 eV, 0.89 eV, and 0.76 eV for bilayers of N-N, P-P, and As-As, respectively. Note that the HOMO is contributed by one of the layers and the LUMO is contributed by the other layer in case of N-N and P-P, while in case of As-As, the HOMO and LUMO both are contributed from both the layers, in agreement with previous findings 53 . Due to the very strong structural modification and corrugation, we observed variable values of the interlayer separation with significant buckling; this agrees well with experimental observation in case of π stacked conjugated polymers as discussed above 108,109 . The trends for the other structural parameters remain similar to those obtained from periodic calculations. Moreover, in case of mixed bilayers N-P, N-As, and P-As (Fig. 10), the N-P bilayer system has significantly larger LUMO energy as compared to N-N but N-As and P-As bilayers have similar trends of HOMO or LUMO to the P-P and As-As bilayers. The value obtained of the HOMO-LUMO gap is strongly reduced (0.41 eV, 0.40 eV, and 0.73 eV, for N-P, N-As, and P-As bilayers, respectively) as compared to their identical bilayer counterparts (see Table 2). The strong reduction in the HOMO-LUMO gap can be understood from the different interlayer interactions and structural modifications. Again in these bilayers, the HOMO is contributed from one layer and the LUMO is contributed from the other layer. The E binding is slightly smaller than that of the identical counterparts, and larger interlayer separation and smaller buckling are found. Variable X-H bonds are found due to strong structural modification. All other structural parameters are found to be following similar trends as compared to N-N, P-P, and As-As bilayers.
Bilayer of polythiophene and polypyrrole. In addition, we further studied the structural and electronic properties of mixed bilayers made of polythiophene and polypyrrole (S-P). The structural and electronic parameters using both the periodic and molecular approaches are summarized in Tables 1 and 2. Valence and conduction bandwidths of 0.60 eV and 0.67 eV, a band gap of 0.72 eV using PBE functional and 1.72 eV using hybrid (B3LYP) functional, a band gap immediately above the Fermi level of 1.03 eV, and a band gap immediately below the Fermi level of 0.41 eV are obtained. Other structural parameters are similar to those of other systems under study. A HOMO-LUMO gap of 0.87 eV is found in the molecular calculation, which is close to that obtained in the periodic calculation (0.72 eV), see Tables 1 and 2. Other structural parameters (bond lengths and bond angles) have again similar trends as other systems under study. It should be noted that such systems are promising to achieve low band gap π-conducting polymers, and could therefore be utilized in electronic devices 90,92 .

Conclusion
Using first-principles calculations, the structural and electronic properties (the band gap modulation) of polythiophene and polyprrrole-based systems (in periodic as well as in oligomer approaches) have been investigated. The effects in the structural and electronic properties for S substituted by Se and Te in case of polythiophene and N substituted by P and As for polypyrrole have been addressed. Furthermore, the effect of the stacking in pure polythiophene as well as in pure polypyrrole have been studied and a linear reduction of the band gap or HOMO-LUMO gap as function of the stacking was found. In addition, we also employed hybrid functional based calculations for periodic cases in order to understand the effect of the hybrid functional on the band gap. It was found that the band gap is larger using hybrid (B3LYP) calculations as expected, while the trend in the band gap is similar to that of the PBE calculations.
This study has also been extended to polythiophene and polytellurophene and to polypyrrole derivatives where the N atom is substituted by P and As atoms. In addition, we performed Γ -point phonon calculation for selected systems to check the stability of these systems. The values obtained of the E binding suggest that all the systems under consideration are thermodynamically stable and can therefore be realized experimentally. The trends in the E binding as a function of stacking as well as substitution remain similar for both the periodic and molecular approaches. Moreover, the bilayer constructed from polythiophene on top of polypyrrole has also been investigated. It is believed that the comprehensive analysis of this investigation will be useful for fundamental understanding of the structural and electronic properties and the band gap or HOMO-LUMO gap, which could be very important for constructing polythiophene and polypyrrole-based electronic devices because a wide range of the band gap can be obtained.