This Python script calculates the Hückel molecular orbitals for a given molecule, based on its SMILES representation. It uses the RDKit library for cheminformatics and NumPy for numerical calculations. Matplotlib is used for plotting the energy levels.
- Hückel Matrix Construction: Builds the Hückel matrix for a molecule based on its SMILES input.
- Energy Level Calculation: Solves the Hückel equations to compute molecular orbital energy levels and coefficients.
- Charge and Bond Order Calculation: Calculates atomic charges, bond orders, and electron density.
- Visualization:
- Displays the molecular structure.
- Plots molecular orbital energy levels in an Aufbau-like diagram.
- Results Export: Saves the computed results (charges, bond orders, energy levels, etc.) to a text file.
- Solves the Hückel equation to obtain eigenvalues (energy levels) and eigenvectors (molecular orbital coefficients).
- Visualizes the energy levels using a Matplotlib plot, highlighting degenerate orbitals.
- Handles molecules containing C, N, and O atoms (can be extended to other atom types).
- Python 3.x
- NumPy
- RDKit
- Matplotlib
- PubChemPy
- Colorama
You can install the required packages using pip:
pip install -r requirements.txt
To use the program open a terminal in the folder of the python file and type
python Huckel.py
-
Run the Program: Execute the script in your Python environment.
-
Input the SMILES Code: When prompted, enter the SMILES representation of the molecule you want to analyze.
-
View Results:
- The program will display molecular properties such as charges, bond orders, and energy levels in the terminal.
- Use the interactive menu to:
- Visualize the molecular structure. (1)
- Plot the molecular orbital energy levels. (2)
- Save the results to a text file. (3)
-
Exit: Select the
q
option in the menu to close the program.
- Run the program.
- Input the SMILES code when prompted, e.g.,
C1=CC=CC=C1
for benzene. - View the calculated properties in the terminal.
- Use the menu options to visualize the molecule or save the results.
The program saves results in a text file located in the output
directory. The filename includes the date and time of the analysis, e.g., risultati_huckel_2025-03-25_12-30-45.txt
.