Automated Descriptor Engine for SNCI, SCDI, and 9D KNF
Project description
KNF-CORE (KNF-GPU Branch)
KNF-CORE is an automated computational chemistry pipeline that generates:
- SNCI
- SCDI variance
- 9D KNF vector (
f1tof9)
from molecular structure files using xTB + NCI backend + KNF post-processing.
Current package version in this branch: 1.0.3
Branch Highlights
This KNF-GPU branch includes:
- Torch-based NCI backend (
--nci-backend torch) with CPU/CUDA execution. - Multiwfn backend still supported (
--nci-backend multiwfn). - GPU overlap scheduler in batch mode (CPU pre-NCI + single GPU post-NCI lane) when using
torch + cuda. - Storage-efficient default output behavior (intermediates removed by default, keep with
--full-files). - Robust filename/path artifact handling for mojibake/Unicode path variants.
- xTB optimization capped to 50 cycles (
--cycles 50) and pipeline continues ifxtbopt.xyzexists. - Batch aggregate outputs:
batch_knf.jsonandbatch_knf.csv.
Fragment Handling
1fragment:f1 = 0.0,f2 = 180.02fragments:f1= COM distance,f2= detected H-bond angle>2fragments:f1= average COM distance over unique pairs,f2 = 180.0
Requirements
- Python
>=3.8 - External tools in
PATH:xtbobabel(Open Babel)
Multiwfnis required only when using--nci-backend multiwfn
Optional:
torch(for Torch NCI backend; CUDA optional)
Install
From source:
git clone https://github.com/Prasanna163/KNF.git
cd KNF
pip install -e .
Install with Torch extra:
pip install -e ".[torch-nci]"
From PyPI:
pip install KNF
First-Run Setup
On first execution, KNF runs one-time setup that:
- checks external dependencies
- attempts automatic install for some tools (when available)
- computes multiprocessing recommendation
State file:
~/.knf/first_run_state.json
Force refresh:
knf <input_path> --refresh-first-run
Multiwfn Detection and Path Registration
Search order:
- current
PATH KNF_MULTIWFN_PATHenv var- saved path
~/.knf/tool_paths.json - common local locations + shallow scan
Manual registration:
knf <input_path> --multiwfn-path "E:\path\to\Multiwfn.exe"
You can also pass a folder containing Multiwfn.exe.
CLI Usage
Basic:
knf input_molecule.sdf
Core options
--charge <int>--spin <int>--force--clean--debug--processing <auto|single|multi>--multi/--single(shortcuts)--workers <int>--output-dir <path>--ram-per-job <MB>--refresh-autoconfig--quiet-config--full-files--refresh-first-run--multiwfn-path <path>
Backend options
--gpushortcut: setstorch + cuda + float64--multiwfnshortcut: setsmultiwfn + auto--nci-backend <torch|multiwfn>
Advanced NCI options (hidden in default --help, but supported)
--nci-grid-spacing <float>--nci-grid-padding <float>--nci-device <cpu|cuda|auto>--nci-dtype <float32|float64>--nci-batch-size <int>--nci-eig-batch-size <int>--nci-rho-floor <float>--nci-apply-primitive-norm
Examples
knf example.mol --force
knf ./molecules --processing multi --workers 4 --ram-per-job 200
knf example.mol --nci-backend torch --nci-device cuda --nci-dtype float64
knf example.mol --gpu
knf example.mol --multiwfn
Torch NCI Backend Notes
- Uses internal Molden parser + grid + RDG pipeline.
- Supports Cartesian shells for basis expansion.
- Spherical
d/f/gshell Molden inputs are currently not supported. - SNCI/statistics can be computed from either text grid (
.txt) or compressed grid (.npz).
Output Layout
Default output root:
- file input:
<input_parent>/Results/<input_stem>/ - directory input:
<input_dir>/Results/<file_stem>/
Final outputs:
knf.jsonoutput.txt
Batch root outputs:
batch_knf.jsonbatch_knf.csv
When --full-files is used, intermediate artifacts are retained (for example NCI grid artifacts and xTB/Multiwfn intermediates). Without it, storage-efficient cleanup runs automatically.
Compare Script
Use scripts/compare_nci.py to compare Multiwfn and Torch NCI outputs/correlation and timing behavior.
Docker
Build:
docker build -t knf-core:latest .
Run:
docker run --rm -v "$(pwd):/work" -w /work knf-core:latest example.mol --charge 0 --force
Compose:
docker compose up --build
See README.DOCKER.md for full details.
Releasing
Release steps are documented in RELEASE.md.
License
MIT (LICENSE)
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-1.0.3.tar.gz.
File metadata
- Download URL: knf-1.0.3.tar.gz
- Upload date:
- Size: 40.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf99885893323f5721e900e3fe9229b517e2ae57baca47d6111d9ab105fee18f
|
|
| MD5 |
8211003c633724c6f87671a0491f0ac8
|
|
| BLAKE2b-256 |
045185e9adddcab522b027b0ef8c4ee631e7f13ac82a9234c3d2eb66b48f1ffb
|
File details
Details for the file knf-1.0.3-py3-none-any.whl.
File metadata
- Download URL: knf-1.0.3-py3-none-any.whl
- Upload date:
- Size: 47.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d194608aba1fa241ba64ca477128eb9cbe8558e1910ba37f6920791eaa8673a7
|
|
| MD5 |
d237bf351de20ec2544668cd019f22e4
|
|
| BLAKE2b-256 |
d4f54899dd46e290844ed81fcc1b6674f943a634287e0c85c64c426b74e529f7
|