Ultra-fast prediction of supramolecular stability using Graph Neural Networks
Project description
KNF Predictor
Ultra-fast prediction of supramolecular stability using the Kulkarni-NCI Fingerprint (KNF)
A Python package for predicting the Non-Covalent Interaction Score (SNCI) of supramolecular complexes using a physics-informed, 9-dimensional molecular descriptor. Powered by a Graph Attention Network (GAT) surrogate model for 416× acceleration over quantum mechanical calculations.
📌 What is KNF?
The Kulkarni-NCI Fingerprint (KNF) is a state-of-the-art descriptor for supramolecular stability prediction:
- R² = 0.793 on 2,649 Deep Eutectic Solvent (DES) complexes
- 47% improvement over traditional SOAP descriptors (14,560 features)
- 99.9% dimensionality reduction (9 features vs. 14,560)
- Universal generalization across hydrogen-bond and dispersion-dominated systems
The 9 KNF Features
| Block | Features | Physical Meaning |
|---|---|---|
| Geometric | f₁, f₂ | Center-of-mass distance, H-bond angle |
| Electronic | f₃, f₄, f₅ | Wiberg bond order, dipole moment, polarizability |
| NCI Statistics | f₆, f₇, f₈, f₉ | Attractive point count, mean/std/skew of NCI field |
🚀 Features
✅ Command-line interface for batch predictions
✅ GPU acceleration (CUDA support)
✅ 416× faster than quantum mechanical calculations
✅ Validated performance: R² = 0.997 on test set
✅ Handles large datasets: 200,000+ molecules/hour
✅ Production-ready: Robust error handling, progress tracking
📦 Installation
Prerequisites
- Python 3.8+
- PyTorch 2.0+
- CUDA 11.7+ (optional, for GPU)
Quick Install
Clone repository git clone https://github.com/Prasanna163/knf-predictor.git cd knf-predictor
Install in development mode pip install -e .
text
Dependencies
pip install torch>=2.0.0 torch-geometric>=2.3.0 rdkit>=2023.3.1 numpy pandas tqdm
text
⚡ Quick Start
Command-Line Usage
Single molecule (SMILES) knf-predict -s "CCO" -o output.csv
Batch prediction from folder knf-predict -i molecules/ -o results.csv --device cuda
From CSV with SMILES column knf-predict -i dataset.csv --smiles-col "SMILES" -o predictions.csv
text
Python API
from knf_predictor import KNFPredictor
Initialize predictor predictor = KNFPredictor(device='cuda') # or 'cpu'
Predict from SMILES results = predictor.predict_smiles([ "CCO", # Ethanol "CC(=O)O", # Acetic acid ])
print(results)
Output: DataFrame with 9 KNF features per molecule text
📊 Performance Benchmarks
Throughput (Molecules/Hour)
| System | CPU | GPU |
|---|---|---|
| KNF Surrogate | 1,872 | 216,886 |
| QM Pipeline | 520 | - |
| Speedup | 3.6× | 416× |
Prediction Accuracy (Test Set, N=398)
| Feature | R² | MAE |
|---|---|---|
| f₁ (Distance) | 0.866 | 0.243 Å |
| f₃ (WBO) | 0.860 | 0.0087 |
| f₅ (Polarizability) | 0.938 | 8.23 Bohr³ |
| f₇ (NCI Mean) | 0.741 | 0.0034 a.u. |
| Overall | 0.997 | - |
🛠️ Advanced Usage
GPU Batch Processing
Optimize batch size for your GPU knf-predict -i molecules/ -o output.csv --device cuda --batch-size 64 # Adjust based on GPU memory
text
Hybrid Screening Workflow
from knf_predictor import KNFPredictor
predictor = KNFPredictor(device='cuda')
Step 1: Fast screening (GAT surrogate) results = predictor.predict_folder('library/', batch_size=64)
Step 2: Refine top candidates (QM if needed) top_100 = results.nlargest(100, 'f7_nci_mean')
... perform QM calculations on top_100 ... text
📁 Input Formats
1. XYZ Files (Recommended)
12 Ethanol molecule C 0.000 0.000 0.000 H 1.000 0.000 0.000 ...
text
2. SMILES Strings
knf-predict -s "CCO" -o output.csv
text
3. CSV with SMILES
ID,SMILES,Property 1,CCO,78.5 2,CC(=O)O,60.05
text undefined knf-predict -i data.csv --smiles-col SMILES -o predictions.csv
text
📖 Citation
If you use this package in your research, please cite:
@article{kulkarni2025knf, title={A Physics-Informed Fingerprint for Generalizable Prediction of Supramolecular Stability}, author={Kulkarni, Prasanna P.}, journal={Journal Name}, year={2025}, doi={10.xxxx/xxxxx} }
text
🧪 Validated Datasets
| Dataset | Size | Domain | R² |
|---|---|---|---|
| DES | 2,649 | Hydrogen-bonded | 0.793 |
| S66×8 | 528 | Mixed interactions | 0.955 |
| S30L | 30 | Dispersion-bound | 0.803 |
| Experimental DES | 40 | Lab-validated | 0.893 |
⚙️ Configuration
Model Files
Place the following files in knf_predictor/models/:
models/ ├── gat_surrogate_best.pt # Pre-trained GAT model ├── scaler_X.pkl # Feature scaler └── scaler_y.pkl # Target scaler
text
Download from: Releases
GPU Requirements
- Minimum: 4 GB VRAM (batch_size=16)
- Recommended: 6 GB VRAM (batch_size=64)
- Optimal: 8+ GB VRAM (batch_size=128)
🐛 Troubleshooting
Common Issues
Problem: CUDA out of memory
Solution: Reduce --batch-size or use CPU
Problem: python: command not found
Solution: Add Python to PATH (see Installation Guide)
📜 License
MIT License - see LICENSE for details.
🤝 Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-descriptor) - Commit changes (
git commit -m 'Add new descriptor') - Push to branch (
git push origin feature/new-descriptor) - Open a Pull Request
📞 Contact
Prasanna P. Kulkarni
Institute of Chemical Technology, Mumbai
📧 prasannakulkarni163@gmail.com
🔗 GitHub | LinkedIn
🙏 Acknowledgments
- Google Gemini Pro for manuscript assistance
- PyTorch Geometric team for graph neural network framework
- RDKit community for cheminformatics tools
⚡ Built for computational chemists, by computational chemists.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file knf_predictor-2.0.0.tar.gz.
File metadata
- Download URL: knf_predictor-2.0.0.tar.gz
- Upload date:
- Size: 22.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ddaaf85db0de7287420d5603c48e034e4709c87d7341d92f4038131f361c04b
|
|
| MD5 |
beec6227d2d1501f81ec1c0ab9962017
|
|
| BLAKE2b-256 |
37d5fdbe1852fc07c90c6573ce895cdfdd4518c09864344987c4fb5ec124ee21
|
File details
Details for the file knf_predictor-2.0.0-py3-none-any.whl.
File metadata
- Download URL: knf_predictor-2.0.0-py3-none-any.whl
- Upload date:
- Size: 22.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08dd55262dad56b0dfb4e676fb48f9b26092e418ea7f025d798b3ab8226a1829
|
|
| MD5 |
e3d92b20be48e0e3dc49adeff3f153e6
|
|
| BLAKE2b-256 |
af0a99a62adfc3a28ac53a49d73c8fdeecb81546691d19b5e78fbe48f962fd51
|