Skip to content

About

Interactive 3D molecular viewer and analyzer powered by PubChem data and RDKit.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

Scientific Molecular Visualizer

Python RDKit Matplotlib License Scientific Molecular Visualizer is a sophisticated desktop application designed for real-time 3D visualization and analysis of chemical compounds. It leverages PubChemPy for data retrieval and RDKit for computational chemistry calculations (MMFF optimization), rendered within a modern CustomTkinter interface. Application Demo

Overview

This tool allows researchers, students, and developers to generate accurate 3D molecular structures simply by entering a compound name (e.g., Caffeine, Aspirin). Unlike static image viewers, it calculates atomic hybridization, detects bond types, and identifies potential ionic/metallic interactions in real-time.

Technical Architecture & Features

The project is built using a modular Python architecture, highlighting several advanced integration techniques:

  • Computational Chemistry (RDKit):
    • SMILES to 3D: Converts isomeric SMILES strings into 3D coordinate systems.
    • MMFF Optimization: Utilizes the Merck Molecular Force Field to calculate the most stable 3D conformation (energy minimization).
    • Hybridization Analysis: Automatically detects and displays atomic hybridization states (sp, sp2, sp3).
  • Advanced Visualization (Matplotlib Embedding):
    • GUI Integration: Embeds interactive Matplotlib 3D plots directly into the CustomTkinter window using FigureCanvasTkAgg.
    • Event Handling: Implements a "picking" mechanism (pick_event). Users can click on individual atoms or bonds to retrieve specific metadata (Element, Bond Type, Distance).
    • CPK Standards: Atoms are rendered according to international CPK coloring and radius standards, defined in a custom data.py layer.
  • Concurrency (Multithreading):
    • API requests (PubChem) and heavy mathematical optimizations run on background Daemon Threads, ensuring the UI remains responsive and fluid during calculations.
  • Data Export:
    • Supports exporting processed molecular data to .PDB (Protein Data Bank) and .XYZ (Cartesian Coordinates) formats for use in other scientific software.

Installation

Follow these steps to set up the project locally:

  1. Clone the repository:
    git clone https://github.com/cagatay005/Scientific-Molecular-Visualizer.git
    cd Scientific-Molecular-Visualizer
  2. Install the required dependencies:
    pip install customtkinter matplotlib numpy rdkit pubchempy
  3. Run the application:
    python main.py

!!! You can also use a one click to download: Second way to install.

Standalone Version (Powered by PyInstaller)

This application has been compiled into a standalone executable (.exe) using PyInstaller. This means you can run the application immediately without installing Python, RDKit, or any other dependencies.

Download Latest Version (v1.0.0)

Important Note: Since this application is not digitally signed with a paid certificate, Windows Defender SmartScreen may trigger a warning stating "Windows protected your PC" upon the first launch. To bypass this and run the app:

  1. Click on "More info".
  2. Click the "Run anyway" button.

Usage Guide

  1. Search: Enter a chemical compound name (English) in the sidebar (e.g., Serotonin) and press "Analiz Et" (Analyze).
  2. Interact:
    • Rotate: Click and drag with the left mouse button.
    • Transation: Click and drag with the middle mouse button(scroll wheel button).
    • Zoom/Scale: Click and drag with the right click mouse button.
    • Inspect: Click on any atom or bond to view detailed properties in the info panel.
  3. Export: Use the "Save as PDB", "Save as XYZ", "Save as OBJ Wireframe", "Save as OBJ MESH", "Save as STL" and "Save as GLB" buttons to save the 3D structure to your disk. All mesh formats (OBJ Mesh, STL, GLB) generated by SciMolViz are manifold (solid) and ready for import into 3D modeling software like Blender or directly into 3D printer slicer applications. Users must use the File > Import command within Blender (do not use File > Open) to load these files. The STL (.stl) format is the universal standard recommended for direct 3D printing.

Project Structure

  • main.py: Core Application. Handles the GUI logic, Matplotlib embedding, threading, and main event loop.
  • data.py: Data Dictionary. Contains the CPK color codes, atomic radii, and element metadata.
  • demo.gif: Preview Asset. Demonstration of the application in action.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Interactive 3D molecular viewer and analyzer powered by PubChem data and RDKit.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages