Introduction

Water is a vital component of ecosystems for both living organisms and non-living elements1; hence, its purity is important for potential reuse. Pharmaceutical and personal care products (PPCPs)2,3 comprise diverse chemical compounds infiltrating water systems through multiple routes4,5, including wastewater treatment plants6,7, septic systems8,9, and runoff from agricultural10,11 and urban regions12,13. These organic pollutants, characterized by their potential stability and solubility14,15, present a substantial environmental risk16,17. The migration capability of PPCPs over long distances and their potential for decomposition contributes to extensive pollution, resulting in the depletion of dissolved oxygen and the subsequent collapse of aquatic ecosystems. Therefore, the presence of PPCPs in water systems can adversely affect human health and ecosystems16,17, presenting significant risks18,19. Hence, removing these pollutants from water sources is paramount in safeguarding the environment and public well-being.

Aquatic systems often serve as the primary recipients of these pharmaceutical discharges. Pharmaceuticals can enter water bodies through various pathways, primarily via direct introduction from both treated and untreated sewage (resulting from patient use and excretion), pharmaceutical manufacturing waste streams, and improper disposal of unused or expired medicines20,21,22,23,24,25. Active pharmaceutical ingredients have been widely detected in surface waters, groundwater, and wastewater treatment plant effluents26,27,28, their levels and frequencies of active pharmaceutical ingredient detection generally exhibit a positive correlation with the extent of their usage. The increasing occurrence and concentration of these compounds in the environment raise significant concerns, particularly due to their potential adverse effects27. Consequently, water eutrophication poses a severe environmental threat with negative repercussions on aquatic life and, by extension, the entire ecological cycle29.

PPCPs can be classified based on their purpose and their characteristics30. For instance, anti-inflammatory drugs, such as dexamethasone (DZM)30, diclofenac31, indomethacin32, ibuprofen33, naproxen34, and ketoprofen34 are commonly used to relieve pain and reduce inflammation35,36. Antibiotics, including clarithromycin (CMC)37,38, erythromycin (EMC)39, azithromycin (AZM)40, danofloxacin (DAN)41, sulfamethoxazole (SMZ)42, orbifloxacin (ORB)43, ciprofloxacin (CIP)44, tetracycline (TC)45, and cefotaxime (CTX)46, are used to fight bacterial infections. Analgesics such as acetaminophen are commonly used to relieve pain47. However, the efficient mitigation of pharmaceuticals in aquatic environments is challenging due to their low concentrations and distinct physicochemical attributes48. Different methods, such as photocatalysis49,50, adsorption40, membrane separation51, advanced oxidation process51, and biological treatments52, have been reported to decrease pharmaceuticals. Therefore, researchers’ unremitting efforts on adsorption-based approaches have led to the successful development of many porous materials, such as metal-organic frameworks, covalent organic frameworks, carbon-based nanomaterials and adsorbent organic polymers to remove contaminants. Covalent organic frameworks (COFs)53,54 are porous materials that have shown promise in removing various pollutants, including pharmaceuticals, from wastewater55.

COFs represent a fascinating modern type of crystalline porous materials, initially discovered by Yaghi and his colleagues in 200556. COFs are assembled through covalent bonds, involving light elements such as carbon, nitrogen, hydrogen, oxygen, and boron57. The ability to design COFs with diverse pore sizes and their inherent hydrophilicity makes them promising contenders for desalination and selective removal of organic contaminants from aqueous solutions. Tailoring the pore size(s) in the design and production of COFs is crucial for their practical utility. Two-dimensional (2D) COFs possess distinctive characteristics due to their layered structure. Specifically, covalent bonds link the repetitive units within each layer, while van der Waals (vdW) interactions are responsible for binding these layers together. Additionally, attributes such as surface charge and hydrophilicity play a significant role in determining performance57.

To utilize COF materials for water treatment, it is imperative to ensure their stability when exposed to water. Furthermore, it is noteworthy to investigate various environmental factors, including reaction time and temperature, in order to gain a comprehensive understanding of the removal mechanism58.

However, with their well-defined crystalline structures59, highly modifiable functionalities60 give COF materials great potential in high porosity61 adjustable thermostability57, and high porosity62. 2D COFs are particularly noteworthy due to their layered structures, with the repeating units within each layer being connected by covalent bonds55,63,64. COFs possess several advantages, including good chemical stability65, low density66, regular pore structure67, facile functional design, and high specific surface area64,68,69,70,71. COFs have emerged as widely utilized for the elimination of organic pollutants due to their ability to engage with target pollutants through multiple forces68,71,72,73. These forces include π–π interactions74, hydrophobic effects75, intermolecular hydrogen bonding75,76, electrostatic interactions77, pore-filling adsorption78, and dispersion forces79. As a result, their environmental application potentials are increasingly recognized and valued. In addition, compared to some irregular materials, such as porous carbon, COFs have a uniform and predictable atomic distribution and position80, which provides excellent convenience for studying the adsorption mechanism of pollutants by theoretical means, such as molecular dynamics (MD) simulation68,81,82,83. However, to enhance their ability to remove pharmaceutical pollutants, COFs can be functionalized (F-COFs). It is noteworthy that functional groups on the COFs’ structure can modify their surface properties and enhance their adsorption capacity. For instance, hydroxyl groups can create more active sites for chemical interaction with pharmaceuticals and improve the COFs’ affinity towards these compounds. This approach can lead to the highly selective and efficient removal of pharmaceuticals from wastewater, crucial for mitigating their adverse effects on the environment and public health. Furthermore, this technology can complement existing wastewater treatment methods and provide a more comprehensive approach to addressing the global challenge of pharmaceutical pollution.

Until now, only a few studies concerning removing pharmaceutical pollutants uses of COF-based materials and their adsorption mechanism for eliminating contaminants. Since Côté et al. reported the structures of COFs in 201056, these compounds have consistently garnered the attention of researchers in the fields of medicinal and biochemical sciences.

For instance, Ghahari et al.84 performed a study where they designed a 2D covalent organic framework to evaluate its efficacy in capturing and eliminating environmental pollutants. In a similar vein, Ghasemi et al.55 investigated the removal of emerging contaminants in aquatic ecosystems via the COFs. They found the COFs as a promising adsorbent for removing pharmaceutical pollutants. The results showed that the significant factor for the equilibrium of the COF complex structures is the hydrogen bond (HB) and vdW forces. Aslam et al.85 demonstrated the effective and rapid adsorption as well as detection of cationic antibiotics from wastewater using COFs-TpPa-SO3Na. They found that TpPa-SO3Na displays remarkable selectivity towards the amine groups present in organic pollutants, thereby enhancing both adsorption selectivity and capacity. More recently, Bala et al.86 also investigated the class of polyhedral oligomeric silsesquioxanes (POSS) COF-S12 and COF-S7, Octa (amino phenyl) silsesquioxane (OAPS), which is synthesized via a Schiff base reaction (R1R2C = NR′) for efficient adsorption of naproxen and AIDs (NAP) from aqueous solution. The results revealed that POSS COF-S7 and COF-S12 materials have a high adsorption capacity for the adsorption treatment of pharmaceutical waste.

Herein, a computational technique of MD and well-tempered metadynamics simulations are employed to assess the adsorption affinity of a 2D TPB-DMTP-COFs for the removal of four different emerging contaminants, including dexamethasone, clarithromycin, Erythromycin, and azithromycin from aquatic ecosystems. We employed MD simulations to explore the influence of two distinct temperatures, 298 and 310 K, on the adsorption of pharmaceuticals from wastewater by COFs.

Moreover, we assessed the role of functional groups in driving the adsorption of pharmaceuticals pollutant on COF surfaces. Specifically, we investigated well-tempered metadynamics to analyze the free energy surface to adsorb pollutants on COFs functionalized (F-COF) with OH groups. Our objective was to determine whether the presence of functional groups is the primary factor driving the adsorption process or if other factors also play a significant role. Hydrogen bond formation and vdW forces are identified as the primary adsorption mechanisms. Therefore, it highlights the exceptional ability of 2D COF, TPB-DMTP-COFs, with a pore-based structure to remove pollutants and proposes the development of efficient and COFs as a promising adsorbent for removing pharmaceutical contaminants.

Result

MD simulation

MD simulation is a powerful tool for studying the adsorption process of pharmaceutical pollutants on COF substrates. GROMACS is a widely used MD simulation software that can accurately simulate the behavior of molecules in various environments. In this study, MD simulations were performed to investigate the adsorption behavior of four different pharmaceutical pollutants on COF substrates. The simulation results demonstrated the high adsorption capacity of 2D COF substrates towards the contaminants, which can be attributed to the stable and efficient adsorption facilitated by the COF compounds. The distribution profiles of pharmaceuticals in the perpendicular direction with respect to the COF surface are effective indicators for analyzing the structure of the adsorption interface. In addition, the 2D structure of COFs also provides a large surface area for the adsorption and desorption of contaminants during the simulation process. Based on the structural models the thickness of the COFs is approximately 10 Å. Consequently, the adsorption space can be separated into two regions: the internal region (<10 Å), and the external region (>10 Å)84,87. To compare the capacity of COF to adsorb pharmaceutical pollutants, a series of analyses were conducted on outputs from MD simulations. These analyses offer valuable insights into various aspects, including the energy of interacting particles, the spontaneity of the process, the distribution of pharmaceutical pollutant molecules surrounding the adsorbent, and the stability of the systems. A qualitative assessment is performed to analyze the adsorption behavior of pharmaceutical pollutants (CMC, DEG, AZM, and EMC) onto 2D COFs in two simulation stages: the initial stage (0 ns) as depicted in Fig. 1, and the final stage (60 ns) at 298 K and 310 K, as shown in Fig. 2 and Supplementary Figs. 13. These figures demonstrate that the EMC/COFs, CMC/F-COFs (at 310 K) and DEG/COFs&F-COFs (at 298 K) systems exhibit a progressive increase in the adsorption of pharmaceutical pollutant molecules onto the surface of the adsorbent over time. To accurately evaluate the adsorption capacity of the chosen COFs, additional quantitative assessments are required, which will be explained in detail below. Our simulations are divided into eight setups: F-COFs/CMC, COFs/CMC, F-COFs/DEG, COFs/DEG, F-COFs/AZM, COFs/AZM, and, F-COFs/EMC, COFs/EMC, which are summarized and listed in Table 1.

Fig. 1: The initial snapshot of the studied systems.
figure 1

And also, molecular structure of PPMs: a Erythromycin b dexamethasone, c azithromycin, d Clarithromycin. Color code COF: cyan, phenol: gray, ions: green, and blue.

Fig. 2: The final snapshots of the PPMs-COFs.
figure 2

PPMs: a DEG, b EMC, c AZM, d CMC, water molecules, and ions are not shown (at 298 K).

Table 1 Detail of the simulation boxes used in this study (at 310 and 298 K)

Based on the final snapshots, it is evident that nearly some of the pharmaceutical pollutant molecules are adsorbed either on the inner cavity or outer surface of COFs/F-COFs after 60 ns of MD simulation. Upon closer inspection of these snapshots, following approximately 20 ns of MD simulations, it becomes apparent that pharmaceutical pollutant molecules have the ability to form hydrogen bonds (H-bonds) and π–π interactions with the adsorbent surface. In the DEG/COFs&F-COFs (at 298 K), and EMC/COFs&CMC/F-COFs (at 310 K) systems, all pharmaceutical molecules are adsorbed onto the adsorbent surface. However, it should be noted that in the other systems, some of the pharmaceutical pollutant molecules is located further away from the surface of the COFs. On the other hand, at 298 K, only a few pharmaceutical molecules in AZM/CMC-COFs systems are adsorbed onto the active sites of the substrate’s surfaces. According to the simulated results (at 298 K), DEG/COFs&F-COFs showed a better adsorption performance compared to other pharmaceutical molecules. It was found that the temperature significantly affects the adsorption capacity of PPMs. In the case of (at 298 and 310 K) DEG and EMC molecules, strong π–π stacking interactions are formed with the COFs surface through their benzene rings. These interactions, namely C-H…π, N-H…π, and O-H…π, occur in an arrangement that closely resembles a parallel geometry, maintaining a distance of approximately 0.39 nm. Moreover, it is noteworthy that the aromatic rings of the adsorbents and the pharmaceutical pollutant molecules aromatics rings have significant intermolecular interactions, including XH–π interactions (such as NH–π, OH–π, and CH–π). These interactions highlight the growing significance of the synergistic effect between these two components in facilitating the adsorption process. Experimental works88,89,90,91 emphasize that the functionalization of COFs increases their adsorption capacity. In line with the experimental works, our results also confirmed that the functionalization of COFs with OH groups enhances the adsorbent’s capacity to adsorb the pharmaceutical pollutant molecules. Upon comparing the intact COFs, a notable observation reveals that the pharmaceutical pollutants tend to adsorb close to the OH groups within the F-COFs structure. Furthermore, these pollutants form hydrogen bonds with the COFs, establishing a significant interaction.

Strength of interactions

The calculation of the interaction energies is crucial in gaining a deep understanding of the adsorption mechanism of the pharmaceutical pollutant on the COF carriers. A higher absolute value of interaction energy indicates stronger interactions between pharmaceutical pollutants and COFs/F-COFs. The greater adsorption of pharmaceutical pollutants onto COFs results in the energy of the simulated systems becoming more negative. This analysis is important in evaluating the effectiveness of COFs/F-COFs as adsorbents for pharmaceutical pollutants.

Analysis of the data in this table indicates that the vdW interaction between the PPM and the COF cavities plays a dominant role in the adsorption of pollutants (except for CMC/COFs) even though the inclusion of functional groups in the COFs leads to an increase in the electrostatic energy of the systems (in the case of AZM, CMC). However, the electrostatic energies also have a significant contribution to the total energy values. It is noteworthy that in the most investigated systems, functionalization of COF caused the electrostatic energy to increase. This fact is in excellent agreement with Bu et al.88 experimental work, which showed electrostatic interaction between COFs and pollutants increases with functionalization. Furthermore, the negative values of the interaction energies presented in Table 2 and Supplementary Table 1 confirm that COFs have good potential for removal of pharmaceutical pollutants molecules.

Table 2 The vdW and electrostatic (Elec) energies (kJ mol−1) (at 298 K)

Regarding the average values of the interaction energies between COFs and pharmaceutical pollutants, the stability of the studied (310 and 298 K) systems has the following order: EMC-COFs > DEG-COFs > AZM-COFs > CMC-COFs and DEG-COFs > EMC-COFs > AZM-COFs > CMC-COFs. In addition, Table 2 and Supplementary Table 1 show that all systems have negative energy values, indicating favorable conditions for adsorbing the pharmaceutical pollutant. The systems with the lowest total negative interaction energies AZM-CMC/COFs (at 310 K) were −178.44 and −87.1267 kJ mol−1, and for 298 K systems for AZM/COFs and CMC/COFs were −74.36 and 22.9 kJ mol−1, respectively. Furthermore, our results show that EMC/COFs (at 310 K) and DEG/COFs (298 K) systems have the most negative interaction energies compared to other systems; therefore, two EMC and DEG antibiotics are the best candidates for adsorption on the COF’s surface. It is important to note that increasing the temperature enhances the ability of COFs to adsorb drugs. Table 2 and supplementary Table 1 shows that decreasing the temperature from 310 to 298 K leads to a decrease in the total interaction energy values. This is mainly because the number of contacts of investigated molecules with substrate decreases as the temperature drops. The energy analyses make it clear that there is a decrease in attraction56,58,92. As a result, it can be concluded that rising temperatures have a positive effect on the ability of TPB-DMTP-COFs to adsorb pharmaceutical molecules.

Our results confirm that covalent porous functionalized COFs with OH groups enhance the stability of the PPMs-COFs complex. As a result, the interaction energies between the pharmaceutical pollutant molecules and the COFs are stronger in the presence of -OH functional groups compared to pristine COFs. Supplementary Fig. 4 and Fig. 3 illustrates the total interaction energies obtained for each simulation system over a duration of 60 ns. The stability of the studied systems for 310 and 298 K has the following order:

CMC-F-COFs > DEG-F-COFs >AZM-F-COFs >EMC-F-COFs and DEG-F-COFs > AZM-F-COFs >EMC-F-COFs >CMC-F-COFs, respectively. As it is apparent from Table 2, the negative electrostatic (elec) and vdW energy values for the interaction of PPMs with the active sites of the COFs/F-COFs confirm the adsorption process is spontaneous. The interaction energies results imply that the values of the interaction of the pharmaceutical molecules with the F-COFs are stronger than the COFs, especially in DEG/COFs and DEG/F-COFs, whereas the vdW interactions weaken. Notably, both vdW and electrostatic energies play significant roles in the adsorption process, as evident from the composition of the interaction energies. A close examination of Supplementary Table 1 reveals the crucial role of vdW interactions between the pharmaceutical pollutant molecules and the COFs cavities in the adsorption process. Additionally, the obtained energy values indicate that pharmaceutical pollutant molecules exhibit good stability on the surface of the F-COF nanostructure. The results suggest that pharmaceutical pollutant molecules preferentially interact with the F-COFs through hydrogen bonds.

Fig. 3: The interaction energies.
figure 3

Between PPMs and COFs/F-COFs (at 298 K).

Stability of systems

To further validate our results, we computed the root mean square deviation (RMSD) between the pharmaceutical pollutants and the COF cavities. By examining the time-dependent RMSD, we can assess the stability of the artificial materials studied, such as COFs exposed to pharmaceutical pollutant like AZM/CMC/EMC/DEG. This analysis serves as an indicator of the precision of our design and confirms that our systems are in a state of conformational equilibrium.

Equation (1) presents the RMSD, which measures the difference between the initial and final configurations:

$${\rm{RMSD}}={\surd}\, \mathop{\sum }\limits_{i=1}^{N}m\left({r}_{i}-{r}_{{{\rm{ref}}}}\right)/\mathop{\sum }\limits_{i=1}^{N}{m}_{i}$$
(1)

where ri (ri,x, ri,y, ri,z) represents the coordinates of atom i at a specific instance, while rref (rref,x, rref,y, rref,z) denotes the coordinates of atom i at its reference position. Additionally, mi stands for the mass of atom i. The RMSD diagrams of the investigated complexes indicate that all systems reached equilibrium within 60 ns, as shown in Supplementary Figs. 5 and 6. The RMSD curves for the stable systems (F-COFs) exhibit regular geometric fluctuations. As can be seen in Supplementary Figs. 5 and 6, all systems have reached equilibrium after 5 ns and also demonstrates that the morphology of F-COF materials in the AZM/CMC/EMC and DEG systems remained stable throughout the entire simulation period. It is important to note that the structure of the F-COFs provides a short pathway with a large contact surface area, facilitating the adsorption and diffusion of AZM/CMC/EMC and DEG systems. This unique feature enhances both the stability and the speed of pollutant removal in aquatic environments. Therefore, the 2D F-COF TAPB-OMeTA is a suitable candidate for the removal of pharmaceutical pollutants.

The obtained results showed that the exceptional stability of COFs/F-COFs is a good candidate for adsorbing pharmaceutical pollutants92,93,94,95,96,97,98,99,100. There is almost no limit to the entry of guest molecules into the active sites of the COFs for the adsorption of pollutants. Khedri et al.92 studied the nanoporous metal/covalent-organic frameworks (MOF/COF) adsorbent, for the removal of phenazopyridine (PHP) as a pharmacological contaminant from water and wastewater. Their findings indicated that the modification of hydroxyl groups to Isoreticular MOFs and grafting with the COF significantly enhanced its effectiveness in eliminating PHP. Therefore, these modifications heightened the surface’s negative net charge, leading to enhanced interactions with positively charged PHP molecules.

Dispersion of molecules in water

Solvent-accessible surface area (SASA) analysis in MD simulations enables the investigation of the contact area between various molecules, including pharmaceutical pollutants and the aqueous environment. SASA is used to quantify the number of unadsorbed molecules and is defined as the surface area of a molecule accessible to a solvent. The average SASA is used for determining the number of molecules dispersed in water.

This analysis compares the ability of COFs to provide sufficient accessible areas for removing pharmaceuticals. Generally, when pharmaceutical pollutant molecules are adsorbed onto COFs, they disperse less in water, resulting in a lower average SASA value. However, in this study, a lower contact area between PPMs and COFs indicates more significant adsorption of pharmaceutical pollutant molecules, which is desirable. During the simulations, the average contact area of pharmaceutical pollutant molecules increases as the contact area between pharmaceutical pollutant molecules and COFs increases (see Fig. 4 and Supplementary Fig. 7). This creates favorable conditions for the interaction of pharmaceutical pollutant molecules with substrates, leading to a more significant accumulation of PPMs around the COF structure.

Fig. 4: The solvent-accessible surface area.
figure 4

Between a PPMs/COFs and b PPMs/F-COF systems (at 298 K).

Furthermore, Fig. 4 and Supplementary Fig. 7 shows that the hydrophobic SASA for all systems decreases with increasing time. This decline is attributed to the formation of π-π interactions between the hydrophobic surface of the F-COFs and the aromatic rings of the pharmaceutical pollutant molecules. Thus, the better an adsorbent performs the adsorption of pharmaceutical pollutants, the less surface area of these molecules will be accessible to the solvent.

Obtained results confirm that the average SASA values for the EMC/F-COFs (310 K), and CMC/F-COFs (298 K) structure were higher than that of the other systems (about approximately EMC/F-COFs = 105.011 nm2, CMC/F-COFs = 70.17 nm2 (310 K) and DEG/F-COF = 43.91 nm2, CMC/F-COFs = 75.88 nm2 (298 K)). Inspection of Fig. 4 and Supplementary Fig. 7 shows the following order for the hydrophobic SASA in F-COF systems for 310 and 298 K: EMC/F-COFs > DEG/F-COFs > AZM/F-COFs > CMC/F-COFs and DEG/F-COFs > AZM/F-COFs > EMC/F-COFs > CMC/F-COFs, respectively. The higher SASA value for system EMC/F-COFs and CMC/F-COF confirms that it has a greater surface area for interacting with water molecules.

Additionally, according to Fig. 4 and Supplementary Fig. 7, the F-COFs have excellent adsorption performance, with the pharmaceutical pollutant molecules having the lowest contact area with the solvent. The obtained results align well with the recent experimental and computational findings presented by Ghasemi et al., Jahromi et al., and Hashemzadeh et al.55,101,102.

Hydrogen bonds’ formation potential

In order to gain a deeper understanding of the changes in hydrogen bonding patterns, the “gmx h-bond” module in the GROMACS software is employed to calculate the hydrogen bonds between the components of interest. The analysis of hydrogen bonds in the investigated systems focused on donor-acceptor pairs within a cutoff distance of approximately 3.5 Å. Figure 5 and Supplementary Fig. 8 visualizes the fluctuations in hydrogen bond formation among different components throughout the simulation duration. Hydrogen atoms form hydrogen bonds when they come into contact with highly electronegative atoms. These bonds create a more stable system between the adsorbent and pharmaceutical pollutants, especially when there are more H-bonds present. The selected pharmaceutical pollutant molecules are polar, allowing for physisorption through hydrogen bonding and dipole interactions. For hydrogen bonds to form, it is essential to have proper spatial coordination of atoms, including the presence of electronegative atoms and an appropriate angle of <30°.

Fig. 5: The number of hydrogen bonds against the simulation time.
figure 5

Between PPMs/F-COF with water (a), PPMs/COF with water (b), between PPMs and F-COFs (c) (at 298 K).

Besides vdW forces, the adsorption process between COFs and pharmaceutical pollutants is influenced by the formation of hydrogen bonds, which play a significant role in their interaction. During the simulation time, Fig. 5 and Supplementary Fig. 8 demonstrates the formation of hydrogen bonds between different components of the systems. As illustrated, the functionalized systems, particularly system CMC (at 310 K), and DEG (at 298 K) exhibit more H-bonds with the pollutants. In other words, the presence of active functional -OH groups on the COF’s surface leads to a more significant number of host-guest H-bonds. Our results show that in the CMC/F-COFs (in 310k) and DEG/F-COFs (in 298 K) system, only two pharmaceutical pollutant molecules are adsorbed inside the F-COFs cavities, and the remaining PPMs interact with the F-COF’s surface. Notably, the F-COFs/EMC and F-COFs/CMC system (at 310 K) and F-COFs/DEG (at 298 K) displays the lowest number of H-bonds, and it is observed that in this system, the number of H-bonds between pharmaceutical pollutant molecules and water molecules increases (seen in Fig. 5 and Supplementary Fig. 8). Moreover, the average distance between pharmaceutical pollutant molecules and COFs cavities is smaller in the presence of OH groups compared to other systems. As shown in Fig. 5 and Supplementary Fig. 8, it can be confirmed that pharmaceutical pollutant molecules remain in close proximity to the surface of COFs due to the hydrogen bond interactions between the amine and glycol groups of pharmaceutical pollutant molecules and the active sites of the COFs materials. Based on our findings, it appears that when there are more hydrogen bonds between the pharmaceutical pollutant molecules and the carrier’s surface, there are fewer hydrogen bonds between the pharmaceutical pollutant molecules and water molecules. The diagrams in Fig. 5 and Supplementary Fig. 8 show that, when the -OH functional group is added to the COFs, it leads to an increase in the number of H-bonds formed between the F-COFs and PPMs. This increase in H-bonds indicates that the carrier’s solubility has increased due to functionalization. Therefore, it can be inferred that hydrogen bonding was the primary driving force in the adsorption process of pharmaceutical pollutant molecules on the COFs’ surface. This finding is in agreement with the experimental work of Mi et al.90, which showed the functionalization of COFs with the hydroxyl group increases the adsorption of the dug pollutant diclofenac and attributed this fact to the increase of hydrogen bonding in the functionalized COF. Finally, it is essential to acknowledge that many other published papers have used MD to study biological phenomena, and our findings are consistent with these studies.

Mean square displacement (MSD)

MSD calculations can be used to present these results more effectively. MSD is a statistical mechanics term used to quantify the displacement of a particle from a reference point over time. In the context of removing pharmaceutical pollutants using COF structures, MSD is a valuable tool to evaluate the efficacy of the COFs material in capturing and eliminating contaminants. By measuring the MSD of pollutants in the presence of COFs, researchers can determine the extent to which COFs reduce particle movement and design unique systems for removing pharmaceutical pollutants from the surrounding environment.

MSD can be calculated using the following equation to investigate the adsorption behavior of pharmaceutical pollutants:

$${\rm{MSD}}(t)=\frac{1}{N}\mathop{\sum }\limits_{n=1}^{N}\left\langle {[{{x_n}(t)}^{2}]-{x_n}({t}_{\rm{o}})\left]\right.}^{2}\right\rangle$$
(2)

where N is the number of particles to be averaged, xn (0) is the referenced position of each particle and xn (t) is the specific position of a particle at time t.

The diffusion coefficient (D) can be calculated using Eq. (3)

$$D=\frac{1}{6{Nt}}\mathop{\mathrm{lim}}\limits_{t\to {{\infty }}}\frac{{\rm{d}}}{{{\rm{d}}t}}\Big\langle\mathop{\sum }\limits_{n=1}^{N}\left\langle {[{{x_n}(t)}^{2}]-{x_n}({t}_{\rm{o}})\left]\right.}^{2}\right\rangle$$
(3)

where \(\frac{{\rm{d}}}{{{\rm{d}}t}}\) represents the slope of the MSD curve.

The linear relationship between MSD and simulation time suggests that various pharmaceutical pollutant molecules diffuse linearly onto the surface of COFs. Plotting the mean square displacement on a linear scale facilitates the determination of the diffusivity coefficient, D, through graphical methods. This approach proves particularly valuable in obtaining initial estimates of diffusivity in environmental systems. The diffusivity constants for all pharmaceutical pollutant molecules are calculated from the slope of the logarithmic plot, where D = Slope/(2n), and n is the dimensionality of the diffusion process. The diffusion coefficient indicates the speed at which a molecule passes through a unit COFs surface in a unit of time when the concentration gradient is equal to one. The higher the value of “D,” the greater the mobility of the pharmaceutical pollutant molecules on the surface of the carriers. The MSD curves for all studied pharmaceutical pollutant molecules are also depicted in Supplementary Figs. 9 and 10. The MSD curves show that each of the PPMs has a different tendency to diffuse onto the COFs/F-COFs surface. Specifically, the slope of the MSD curves for the CMC/COFs and EMC/F-COFs (at 310 K) are more than other PPMs/COFs and PPMs/F-COFs, likely due to the stronger repulsive interactions between the CMC/EMC molecules and the COF/F-COFs structures. Moreover, this behavior is in agreement with the total interaction energies between the PPMs and the adsorbents. It is obvious from Table 2 and Supplementary Table 1 that the total interaction energies for CMC/COFs, EMC/F-COFs at 310 K and CMC/F-COFs&COFs at 298 K systems are considerably lower than the other PPMs/COFs&F-COFs systems, respectively. Remarkably, COFs exhibit good selectivity when adsorbing certain PPMS, irrespective of the size of the molecules involved. The diffusion of drugs onto the structures are reaches the highest in the DEG/F-COFs&COFs (at 298 K) and COFs/EMC, F-COFs/CMC (at 310 K) systems. This result indicates the strong interaction of PPMs with the F-COFs/COFs active sites of adsorption.

The results obtained from the MSD analysis indicate that the “D” for pharmaceutical pollutant molecules in systems EMC/COFs, EMC/F-COFs and CMC/COFs, CMC/F-COFs (at 310k) are approximately 0.0183 (+/−0.0064) × 10−11 cm2 s−1, 0.0244 (+/−0.0008) × 10−11 cm2 s−1 and 0.0232 (+/−0.0008) × 10−11 cm2 s−1, 0.0122 (+/−0.0020) × 10−11 cm2 s−1, respectively.

Besides, the calculated self-diffusion coefficient for pharmaceutical molecules D (PPMs) (at 298 K) for DEG/AZM/EMC/CMC in F-COFs/COFs systems is shown in Supplementary Fig. 10. As it is obvious from Supplementary Fig. 10, the D (PPMs) for the DEG/COFs and DEG/FCOFs decreased. The MSD curve for the DEG/COFs system has a lower slope and less self-diffusion coefficient than the other PPMs/COFs systems. It is important to mention that the lower slope in the MSD curves indicates that the adsorption of PPMs onto the adsorbent surface limits the mobility of the PPMs, which is caused by the formation of strong hydrogen bonds between the carbonyl groups (C = O) of the DEG and the active sites of the adsorbent, also electrostatic forces, particularly X–Hπ (X = C, O; π = aromatic system) interactions. In summary, the diffusion of adsorbate molecules on the active sites of the COFs/F-COFs is enhanced and can be attributed to strong interaction with the inner pores or active sites of the porous structure of COFs/F-COFs. Based on the results at 310 K, it is found that the F-COF/COFs system exhibited higher Di and error values for EMC/CMC molecules compared to other systems. This observation can be attributed to the weaker interaction of EMC with F-COFs and CMC with COFs. This is further supported by the radial distribution functions (RDF) results presented in Supplementary Fig. 11, which indicate that the distance between EMC/F-COFs, CMC/COFs (at 310 K) and CMC/COFs&F-COFs (at 298 K) is shorter in comparison to the other three systems. Conversely, the lower Di values observed for the CMC/F-COFs and EMC/COFs (at 310 K) systems can be attributed to their strong interaction with the adsorbent’s adsorption sites.

In general, the functionalization of COFs cavities with OH-groups facilitates the adsorption of pharmaceutical pollutant molecules near these groups and enables interaction with the substrate through hydrogen bonding. After a 60 ns simulation, a significant majority of pharmaceutical pollutant molecules are adsorbed inside the inner cavity or on the outer surface of the COFs/F-COFs substrate. This finding shows that COFs/F-COFs effectively adsorb pharmaceutical pollutants by forming hydrogen bonds and π-π interactions. Moreover, since no external force is applied for pharmaceutical pollutant molecules entry into the substrate, the velocity of PPMs motion towards the COFs remains constant. Additionally, the absence of fluctuations in the MSD curves indicates that the systems have achieved convergence and a stable state during adsorption on the substrate, suggesting that the pharmaceutical pollutant molecules systems tend to converge and stabilize. Interestingly, this increase in stability with functionalization has also been noted in experimental works. According to experimental Bu et al.88 indicated that functionalized COFs with the carboxyl group show excellent chemical stability and outstanding adsorption performances for the adsorbing of quinolones. In this regard, Liang et al.89 also showed that the adsorption of three types of anti-inflammatory drug contaminants, namely Ketoprofen, Ibuprofen, and Naproxen, on COF materials with their functionalization with NO2 or NH2 groups increases. Their findings revealed that initially, the molecules rapidly loaded on the surface of COF-NO2 and COF-NH2, followed by subsequent adsorption within the material’s pores. It is worth noting that the excellent agreement that exists between the results obtained from this work and the experimental results well proves the validity of the results obtained from the MD simulation. Finally, this reality confirmed by experimental observations and MD results that the functionalization of COFs increases their adsorption efficiency can be described by the fact that the organic skeleton of COFs generally has hydrophobic properties and their functionalization with functional groups such as OH increases their hydrophilic properties and as a result, the penetration of pollutants from the water environment into their pores increases. Besides, Mi′s group90 reported the functionalization of COFs with OH groups can cause better its adsorptive ability for removal of diclofenac from aqueous media in comparison to pristine COFs. Although, their results revealed that both COF types can quickly capture most diclofenac molecules from water.

Computation of pair distribution functions

Additionally, to study molecular interactions, the radial distribution functions of adsorbate molecules situated at a particular distance (r) from the surfaces of the adsorbent slabs can be analyzed. In this analysis, the distribution of pharmaceutical pollutants molecules around the COFs structure is investigated using the RDF. The RDF (g(r)) is investigated as the following equation:

$$g(r)=n(r)/2\pi r\Delta r\rho$$
(4)

where g(r) is the radial distribution function, which describes the probability of finding a molecule at a distance r from a reference molecule, n(r) is the number density of molecules at a distance r from the reference molecule, Δr is the width of the shell at a distance r, and ρ is the total number density of molecules in the investigated system.

Figure 6 and Supplementary Fig. 11 presents the RDF analysis for the investigated systems, providing critical information about particle interaction. The height of the RDF peaks in pristine systems follows the order of EMC/COFs > DEG/COFs > AZM/COFs > CMC/COFs and for functionalized systems follows the order of CMC/F-COFs > DEG/F-COFs > AZM/F-COFs > EMC/F-COFs. Besides, the MD simulations at 298 K are follows: GEG/COFs > EMC/COFs > AZM/COFs > CMC/COFs and DEG/F-COFs > AZM/F-COFs > EMC/F-COFs > CMC/F-COFs. Results of RDF analysis show that after equilibration, all of the pharmaceutical pollutant molecules in the studied systems are positioned on the surface of COFs. In contrast, the highest peak of pharmaceutical pollutant molecules is located at 0.7–1.5 nm and ~1.0–1.5 nm away from the surface of the F-COFs and COFs, respectively (see Fig. 6 and Supplementary Fig. 11). After the EMC, the DEG pharmaceutical pollutant molecule exhibits a stronger peak than other PPMs, suggesting stronger intermolecular interactions with the COF substrate. Indeed, the presence of the highest peak in the specified region shows the positions of pharmaceutical pollutant molecules with respect to the COFs and F-COFs. RDF patterns have a similar trend at a distance of about 0.8 nm and shorter. As well as, the peak intensity of pharmaceutical pollutant molecules in the EMC/COF, CMC/F-COF (at 310 K), DEG/COF, and DEG/F-COF (at 298 K) systems are more than those of the other systems. These obtained results correlate well with the other obtained results in this work. Generally, the RDF diagram offers valuable insights into the intermolecular interactions between PPMs and COFs/F-COFs. These results are in good agreement with the recent reported data by Mousavi et al.103.

Fig. 6: RDF pattern.
figure 6

The RDF of the PPMs around the structures: a COFs, b F-COFs (at 298 K).

Density profile

The density map along the z-axis of the simulation box for water molecules and PPMs/F-COFs&COFs are investigated to determine the position of PPMs relative to the F-COFs surface, and the probability of water being present at a particular location.

Therefore, we investigated the density profile of (1) PPMs/F-COFs&COFs (see Fig. 7), (2) PPMs/F-COFs (see Supplementary Fig. 12), and (3) water molecules/COFs (Supplementary Fig. 13) along the z-axis of the simulation box for the studied systems. It is worth noting that the lowest peak in the density profile can be due to the decrease in the number of water molecules around the substrate’s surface where the most number of hydrogen bonds and π–π stack interaction between substrate and pharmaceutical pollutant molecules exist. As can be seen from Fig. 7, three distinct oscillatory density peaks can be observed for each system, indicating the existence of layered structures in COFs/F-COFs that confine pharmaceutical molecules. Specifically, the first hydrogen bond peak is observed at approximately 0.21 nm for DEG/COFs and 0.4 nm for DEG/F-COFs systems (at 298 K). These results can be attributed to the orientation of DEG to find a better adsorption configuration onto the substrates. Accordingly, DEG is more interacts with the active sites of the COFs such as (-C-C-), (C=O), and the (C=N), by hydrogen bond and electrostatic/vdW interactions. In addition, these observations confirm that DEG molecules rotated to form π -π interaction with COFs/F-COFs. Supplementary Fig. 13 presents the density distribution of water molecules across the COFs. Therefore, the water molecule distributions exhibit significant symmetry near the surface, demonstrating the influence of the COF structure on the adsorption of pharmaceutical pollutant molecules in water. According to the obtained results, it can be understood that the density of water molecules is low in the same regions where the concentration of pharmaceutical pollutant molecules near the surface is higher. However, in the EMC/COFs systems (at 310 K), it is observed that the higher water density coincided with the peak adsorption of pollutant molecules. Furthermore, Supplementary Fig. 12 illustrates the density distribution of pharmaceutical pollutant molecules across the F-COFs, highlighting the maximum adsorption of molecules near the adsorbent surface. While, the overall shapes of the density profiles are similar, noteworthy that the CMC/F-COFs (at 310 K) systems displays the highest peak, reaching a height of approximately 215 kg m−3 and also, for DEG/COFs, DEG/F-COFs are about 145.62, 220.627 kg m−3, respectively. Moreover, the short-range region exhibits six distinct peaks, corresponding to the local hydrogen bonding structure. The first peak, representing the hydrogen bond, is observed at around 0.55 nm for the CMC/F-COFs (at 310 K) and 0.21 nm for DEG/F-COFs at 298 K, while for the other systems, it appears between approximately 1.16 nm, 1.5 nm (at 310 K), and 0.6–0.30 nm (at 298 K), aligning with our expectations.

Fig. 7: Density profile.
figure 7

The profile density of PPMs onto the a COFs and b F-COFs surface. PPMs relative to the COF/F-COF surface (at 298 K).

In general, our results showed that the COFs as efficient and modifiable adsorbents have a great potential for removal of pharmaceutical pollutants that is in line with experimental observations. For example, Zhao et al. experimentally indicated that the COFs have a high efficiency for the removal of the antibiotic pollutant ofloxacin from water104. Also, Hao et al.94 synthesized the sulfonic acid-functionalized (COF-SO3H) components through a solvothermal condensation reaction to eliminate personal care products and pharmaceuticals from wastewater and water. The results showed that the COF-SO3H have ultra-high adsorption capacity for thirteen organic drugs, mainly for diclofenac, exhibited a maximum capacity capture of 770 mg g−1. In another example, Mellah et al. used unique fluorine-bearing COFs, for the removal of pharmaceutical contaminant ibuprofen from water. They reported that the high efficiency of ibuprofen capture as compared to other less lipophilic pharmaceuticals suggests that COFs can be pre-designed for the selective capture of contaminants97.

Metadynamics

Metadynamics has been established as a robust algorithm for assessing free energy in long-term processes, as supported by multiple studies. The well-tempered metadynamics simulation speeds up rare events and determines the free energy surface to explain intricate molecular systems. The Parrinello and Laio method, which calculates the free energy surface as a function of distances between the centers of masses of two components, was used in this study. Metadynamics simulations were conducted to explore the free-energy surface associated with the interaction between pharmaceutical pollutant molecules and the F-COFs surface in CMC/F-COF, DEG/F-COF, AZM/F-COF, and EMC/F-COF systems at 298 and 310 K. The diagrams shown in Fig. 8 and Supplementary Fig. 14 depict the free energy surface regarding the distance between the centers of masses of the PPMs and the F-COFs. As depicted in the Fig. 8 and Supplementary Fig. 14, when the pharmaceutical pollutant molecule is at a considerable distance from the F-COF’s surface, the free energy is set to zero. During the adsorption process, as the PPMs move toward the F-COF cavities, the free energy surface becomes increasingly negative. These systems encounter energetic boundaries and local minima before reaching their respective global minima. The free energy values for the F-COF/PPM complexes at their global minima at 298 K are about for DEG/F-COFs = −665.81, AZM/F-COFs = −638.53, EMC/F-COFs = −566.31 and CMC/F-COFs = −326.75 kJ mol−1. The results indicate that DEG has a more negative free energy surface in comparison to other pharmaceutical molecules. This heightened FES can be attributed to its composition, incorporating fluorination, carbonyl groups (C=O), and hydroxyl groups (O-H). Therefore, the DEG molecule exhibits increased interaction with the cavities of the F-COFs, further enhancing its FES. Also, at 310 K the FES are about ~−739.290, −602.46, −456.46, and −274.18 kJ mol−1 in the F-COFs/CMC, F-COFs/DEG, F-COFs/AZM, and F-COFs/EMC systems), respectively. These findings align well with the interaction energies presented in Table 2 and Supplementary Table 1. Furthermore, the CMC, DEG, AZM, and EMC pharmaceutical pollutant molecules experience a relative energy barrier of approximately (see Fig. 8) are about ~156.62, 410.33, 267.17, and 175.53 kJ mol−1 and at 310 K = 366.65, 2.34, 16.8, 24, and 21.47 kJ mol−1, respectively, at a distance of ~d1 = 1.48 nm when they reach the water–substrate interface. It is important to note that, as the pharmaceutical pollutant molecules get closer to the surface of the F-COFs, there is a noticeable decrease in the free energy value once the initial barrier is overcome. This gradual progress ultimately leads the system to a state of increased stability. These results are in good agreement with the recent data reported by, Pasban et al.105, Haghi et al.106, Razavi et al.107, and Ghahari et al.68,84,103.

Fig. 8: The free energy surface landscape.
figure 8

For the adsorption of PPMs on the F-COFs surface. EMC-DEG-AZM-CMC/F-COFs system as a function of their center of mass (298 K).

Discussion

In summary, the aim of this study is to investigate the behavior of pharmaceutical pollutants molecules when adsorbed on COFs/F-COFs in an aqueous environment using MD and metadynamics simulations. We performed MD simulations to investigate the effect of different temperatures on the adsorption of pharmaceuticals in wastewater using COFs/F-COFs materials. This work demonstrated that the F-COFs/COFs substrates of all examined systems spontaneously adsorb pharmaceutical pollutant molecules. Furthermore, it was found that the adsorption of pharmaceutical pollutant molecules is higher in the inner and outer cavities of COFs functionalized form with three functionalized hydroxyl groups in comparison to the pristine system. Indeed, the PPMs/F-COFs systems exhibit stronger hydrogen bond formations, leading to a higher propensity for pharmaceutical pollutant molecules to adsorb onto F-COFs surfaces compared to pristine COFs. The analysis of hydrogen bonding confirms that pharmaceutical pollutant molecules display a superior capability to establish hydrogen bonds with F-COFs when compared to the pristine COFs. In the environment temperature, the DEG molecule shows the most tendency for adsorbing on both investigated substrates, whereas with increasing temperature, the tendency of EMC and CMC drugs for adsorbing on COFs and F-COFs, respectively, will be increased.

The π–π interactions and hydrogen bonds are identified as the key determinant interactions in the studied systems. Moreover, the RDF analysis revealed that the strongest peak occurred at distances ranging from 1.0 to 1.5 nm/0.7 to 1.5 nm from the surface of the COFs/F-COFs. According to the free energy surface analysis, the pharmaceutical molecule must overcome an energy barrier in order to reach the global minimum. The obtained results at both temperatures showed that F-COF&COFs are effective substrates for adsorbing pharmaceutical pollutant molecules in wastewater.

Methods

MD simulations section

The MD simulation is utilized to examine the potential of COF materials as promising candidates for removing pharmaceutical pollutant molecules contaminated in wastewater. The initial geometry of the covalent organic framework material is inspired by Kang et al.’s, Sun et al.’s and Xu et al.’s work108,109,110.

It is noteworthy to mention that the synthesis of TAPB-DMTP-COF involves the amalgamation of two key linker units of monomer: 1,3,5-tris(4-aminophenyl)-benzene (TPB) and 2,5-dimethoxyterephthalaldehyde (DMTA). Also, [OH]-TPB-DMTP-COF synthesized with 2,5-dihydroxyterephthalaldehyde (DHTA) and DMTA as edge units109,110,111. This unique combination makes TPB-DMTP-COFs an exceptional material platform for functional development and guest encapsulation, due to its high crystallinity and large mesoporous channels110. Under ambient conditions, TPB-DMTP-COF adopts a structure with an interlayer distance of 3.5 Å. As for TPB-DMTP-COF with the stacking structure, pharmaceutical pollutant molecules are located around the adjacent COF layers; this position can partially outside the COF surface and interact with three COF layers simultaneously, maximizing the COF/PPM interaction strength.

Figure 9 depicts a schematic representation of both the COFs/F-COFs and their monomer structures. The COF structure is meticulously designed in three layers, employing the Gauss View software. MD simulations are then conducted using the GROMACS software package (version 2019.2)112 with the CHARMM force field113. The simulation box has dimensions of 9 × 9 × 10 nm3 and contains a central COFs nanocarrier surrounded by 8 pharmaceutical pollutant molecules. In fact, all simulations are performed in a controlled specific aqueous environment using the TIP3P water model114 with a salt concentration of 0.15 and 0.001 molar NaCl. This choice was made to closely mimic environmental conditions accurately. The small size and high mobility of these monovalent ions, as compared to other dissolved and suspended species, result in less hydration by water molecules. Therefore, it creates an effective pathway for contaminants to penetrate cavities and approach the adsorbent surface. However, these simulations focused on a specific aspect or phenomenon within this controlled environment, and the simplification of the water chemistry was made to adsorb pollutants via COFs and investigate this particular aspect more effectively. To prevent interactions between components and neighboring cells, the periodic boundary condition is implemented. The temperature of the systems is precisely regulated at 310 K (with 0.15 molar NaCl) and 298 K (with 0.001 molar NaCl) using the Nose–Hoover thermostat115 to keep the temperature constant, and the pressure is maintained at a constant value of 1 bar through the application of the Parrinello–Rahman barostat116. Non-bonded electrostatic and Lennard-Jones interactions are treated using the particle mesh Ewald method with a 1.4 nm cutoff. The linear constraint solver algorithm117 is employed to preserve the equilibrium length of all bonds during the simulation. Initially, the simulation system undergoes energy minimization through the steepest descent algorithm to alleviate any unfavorable interactions. Subsequently, MD simulations are carried out for 60 ns with a time step of 2 fs. The initial configuration of the systems under study is depicted in Fig. 1. To visualize the simulated products, the visual molecular dynamics (VMD) package118 is utilized.

Fig. 9: Schematic representation of COF formation.
figure 9

The structures of a COFs and b F-COFs. Color code: C: cyan O: red N: blue H: white.

Metadynamics simulations

The well-tempered metadynamics simulation technique to identify the free energy surface concerning the collective variables (CVs) established by Parrinello et al.119. The metadynamics simulations are carried out using the PLUMED plugin version 2.5.2120, which is integrated into the GROMACS software (version 2019.2) package. The initial Gaussian height of the well-tempered metadynamics algorithm is 1.0 kJ mol−1 with a width of 0.25 Å. Additionally, a bias factor of 15 is employed, and deposition occurs every 500-time steps. It should be emphasized that the metadynamics simulations are carried out for 60 ns across all systems investigated. Generally, the metadynamics simulations provide a reliability estimate offers of the free energy landscape for the F-COFs/EMC, F-COFs/DEG, F-COFs/AZM, and F-COFs/CMC systems.