Skip to main content

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.

Python 3.8+ PyTorch License


📌 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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-descriptor)
  3. Commit changes (git commit -m 'Add new descriptor')
  4. Push to branch (git push origin feature/new-descriptor)
  5. 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.

Metadata

Release files for knf-predictor 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for knf-predictor 2.0.1
File Size Uploaded Provenance
knf_predictor-2.0.1.tar.gz 22.7 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for knf-predictor 2.0.1
File Interpreter ABI Platform
knf_predictor-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 45.3 MB

Release files / knf_predictor-2.0.1.tar.gz

Download URL knf_predictor-2.0.1.tar.gz
Size 22.7 MB
Tags Source
SHA-256 checksum
How to use checksums
1d5a5f84d6d0495e7ce3a9e8e201e0fa024359d27aa79fc875a0e6cca30f01ce
BLAKE2b-256 checksum
How to use checksums
61b65d46d8424ab6ccdc09f10eba993868dd45664a737a973b598d760784fbb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.8

Release files / knf_predictor-2.0.1-py3-none-any.whl

Download URL knf_predictor-2.0.1-py3-none-any.whl
Size 22.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d86670219cd7f11b324a189024c88eff484c1a504b267f6ad7d8dd5f49a051ca
BLAKE2b-256 checksum
How to use checksums
b36ac1ac3b2882b1195a0df5b3936e961279eeaac37e31e9e5b710254e584db6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.8

Security for knf-predictor 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page