Skip to main content

A blisteringly fast Fortran engine for molecular cycle perception.

Project description

RingDetect-HPC

PyPI version License: MIT

A blisteringly fast command-line utility and Python library for detecting specific molecular rings (cycles) from static structural coordinate files (XYZ, PDB, MOL, CSV), Python objects (ASE, RDKit), and massive Molecular Dynamics (MD) trajectories.

Built for computational chemistry pipelines (like EDDB, topological analysis, and materials science), RingDetect-HPC pairs a C/Python frontend for dynamic memory management with a Fortran 2008 backend for heavy graph traversal. It is deeply parallelized using OpenMP to process massive macromolecular systems and crystal lattices in fractions of a second.

🚀 Key Features

  • Big Data Streaming (NEW): Generate flat CSV streams capable of processing 80,000+ frames in under 40 seconds, perfectly optimized for Apache Parquet compression.
  • MD Trajectory Analysis: Natively parse multi-frame .xyz files or read directly from standard input pipelines to analyze ring dynamics over time.
  • Dual Interface: Run it as a standalone, zero-dependency command-line executable, or import it natively into your Python workflows with zero-copy array pointers.
  • Universal Periodic Table: Automatically calculates dynamic bond cutoffs based on comprehensive covalent radii for the entire periodic table (Elements 1-96).
  • Fragment Masking (Subsetting): Instantly isolate specific active sites or ligands in massive proteins by passing a binary mask, entirely bypassing the O(N^2) graph math for ignored atoms.
  • Periodic Boundary Conditions (PBC): Seamlessly handles MOFs, zeolites, and crystal lattices by applying the Minimum Image Convention (MIC).
  • Zero-Allocation Search: Uses in-place array mutation during Depth-First Search (DFS) to completely eliminate RAM allocation locks.

📦 Installation

You can install RingDetect-HPC in two ways, depending on your workflow.

Option 1: Python Library (Recommended)

Pre-compiled binaries (wheels) are available for Linux and macOS via PyPI. This requires zero C/Fortran compilers on your end.

pip install ringdetect-hpc

(Note: While the PyPI package is ringdetect-hpc, the Python module is imported as ringdetect.)

Option 2: Bare-Metal CLI (For HPC Clusters)

If you want the standalone executable, you can compile from source. Zero dependencies required other than standard compilers (gcc, gfortran, make).

git clone [https://github.com/ouielba90/RingDetect-HPC.git](https://github.com/ouielba90/RingDetect-HPC.git)
cd RingDetect-HPC
make

💻 CLI Usage

./ring_detector <molecule_file> [OPTIONS]

(Note: To read from standard input, use - as the <molecule_file> name).

Command Line Options

Flag Description Default Example
-h, --help Show the help menu. ./ring_detector -h
-f Set the input coordinate format (xyz, raw, csv, idx, pdb, mol). xyz -f pdb
-a Active atoms mask (comma-separated ranges or single indices). All -a 1-15,30,45-50
-c Set unit cell dimensions (X Y Z) for Periodic Boundary Conditions. 0.0 0.0 0.0 -c 15.5 15.5 15.5
-m Maximum ring depth to search (Safely capped at 100). 6 -m 10
-r Target specific ring sizes (comma-separated). Overrides -m. All -r 5,6
-p Number of OpenMP threads to use. (0 = All physical cores) 0 -p 8
-j Output results in strict JSON format. OFF -j
-v Output results in flat CSV format (Big Data optimized). OFF -v

📄 Output Formats & Big Data Workflow

The engine dynamically generates output using the base name of your input.

1. Flat CSV (-v) & Apache Parquet (Big Data)

For massive multi-frame MD trajectories, JSON becomes a bottleneck. The -v flag tells the C-engine to stream a flat CSV at maximum speed (~2,000 frames/sec on modern hardware).

Frame,RingSize,Planar,Indices
1,6,True,1-2-15-14-13-12
1,5,False,1-5-4-10-9

You can then instantly compress this into an Apache Parquet file using polars in Python (yielding ~94% file size reduction and microsecond load times):

import polars as pl
# See /examples/parquet/ for the full script!
pl.read_csv("trajectory.csv").write_parquet("trajectory.parquet")

2. JSON Format (-j)

Strict JSON payload, perfect for loading directly into web interfaces or smaller Pandas DataFrames.

{
  "molecule": "md_trajectory",
  "frames": [
    {
      "frame": 1,
      "total_atoms": 60,
      "rings": [
        {"size": 5, "planar": false, "indices": [1, 5, 4, 10, 9]}
      ]
    }
  ]
}

3. Standard Text (.rings)

The default output. Heavily optimized for downstream text parsing.

=== FRAME 1 ===
5-MR: 1-5-4-10-9
6-MR (PLANAR): 1-2-15-14-13-12

🏗️ Architecture Stack

  1. src/main.c / ringdetect/engine.py: Executes data parsing, manages multi-frame I/O streams, translates atomic symbols to covalent radii, allocates contiguous memory blocks, applies masking logic, and passes zero-copy pointers to Fortran.
  2. src/ring_engine.f90: Receives pointers via iso_c_binding, builds the OpenMP spatial hash (applying Minimum Image Convention if PBC is active), and launches an optimized, lock-free Depth-First Search with in-flight vector math to isolate and classify the Minimum Cycle Basis. Temp files are streamed dynamically and merged instantly upon completion.

---

### 📝 Release Notes for GitHub (v1.4.0)

**Title:** Release v1.4.0: The Big Data Update (CSV Streaming & Parquet Support) 📊

**Description:**
This release addresses the primary I/O bottleneck encountered when analyzing massive Molecular Dynamics trajectories (80,000+ frames). We have introduced a high-speed CSV streaming pipeline tailored specifically for modern Big Data architectures like Apache Parquet.

**✨ New Features:**
* **Flat CSV Streaming (`-v` flag):** Added the `-v` (values) flag to bypass JSON formatting overhead. The C-engine now streams a perfectly flat `Frame,RingSize,Planar,Indices` table directly to disk.
* **Blistering Trajectory Speed:** With the new CSV pipeline, the OpenMP engine can process and write **~2,000 frames per second** (tested on an Intel Core i7-14700HX for a 4,000-atom system).
* **Parquet Workflow Integration:** Added the `examples/parquet/` directory to demonstrate how to achieve **94% file size compression** and microsecond load times by piping the CSV output into Python's `polars` library.

**🛠️ Upgrades & Fixes:**
* Mutually exclusive output guards in the CLI parser to prevent JSON (`-j`) and CSV (`-v`) from clashing.
* Hardened internal string processing to ensure indices containing accidental commas in memory safely fallback to dashes in CSV mode.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ringdetect_hpc-1.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

ringdetect_hpc-1.4.0-cp313-cp313-macosx_15_0_arm64.whl (874.7 kB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

ringdetect_hpc-1.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

ringdetect_hpc-1.4.0-cp312-cp312-macosx_15_0_arm64.whl (874.7 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

ringdetect_hpc-1.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ringdetect_hpc-1.4.0-cp311-cp311-macosx_15_0_arm64.whl (874.7 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

ringdetect_hpc-1.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ringdetect_hpc-1.4.0-cp310-cp310-macosx_15_0_arm64.whl (874.7 kB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

ringdetect_hpc-1.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

ringdetect_hpc-1.4.0-cp39-cp39-macosx_15_0_arm64.whl (874.7 kB view details)

Uploaded CPython 3.9macOS 15.0+ ARM64

ringdetect_hpc-1.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

ringdetect_hpc-1.4.0-cp38-cp38-macosx_15_0_arm64.whl (874.5 kB view details)

Uploaded CPython 3.8macOS 15.0+ ARM64

ringdetect_hpc-1.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

Details for the file ringdetect_hpc-1.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 939b9f0610ef2a70067bca87c89f5e0ce56cbce0db8892747a72e2225823f812
MD5 9f6dca1c9561420929dd90a1b233d749
BLAKE2b-256 2ff1024e1e81b3764763220d714470327e3486efcb405efed2b1729b5c20448d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ba93e9c3f2d302bb4cc0a30c52214f4671427a3100373e04f80e454d61ddfb8f
MD5 31c4c60f3697ce8e1cf7996e7cb52c1d
BLAKE2b-256 705477a7641018f2aa9a4169d027ace6b0e9435d77d504c9be72fcd065291c48

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp313-cp313-macosx_15_0_arm64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ca70581f53d9e981713645d7247435a0a01e6bc1176a7de8ba041476fce299a
MD5 d8f73df6c4633cd674403c080560603c
BLAKE2b-256 a3d08f3d97fd1ff57730f5f50f7fa253c2c0dc1fa28e7ca39a01a380e5c35e73

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 76eb3b807e3e1985f5d44bcaf11653323372fd75a90cbd29e90879518785bdfa
MD5 c7b62bd1f959c86ebba7e54609a8aca5
BLAKE2b-256 a30568e7f3d41a0f80ce02e1578f50d608b7c2ae23b418d9a41fdb5a024de99a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bd2a9f38d5b38ae13fdc3116a7fd6a9cf0af2fcbc4b2ddc6dac173d2815eba5e
MD5 c70b976903c27e3280448e6c8fb88c6b
BLAKE2b-256 3c20223985b2662493f808c0e44096cbab7244bac82624dc18f63a4c964dbda5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3fdb6c6050e3e8009fd4aa13334c71314c163ff7236c8b29c6ad5a7cf401010f
MD5 e15a0378ba84c7ac36318f5e52bbcad5
BLAKE2b-256 ed422fa87cb3c69dd0b733dc2babf07bc0a06fdebb23f70067cb6d4ea23186d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp311-cp311-macosx_15_0_arm64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d50e91b0f4e5e51d9cbf89cdb0d5d1de1533b61ff43bf58770c6c1ebc27f453b
MD5 a6795d1574c07856e13659a5f739d52d
BLAKE2b-256 20936a03e3a361ce8eb0f19149f1c7a6731e150108b64943cb1fafd5186ea851

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ee17e0f88b51cc6a354087aee28e2d5bed67e6c913d25d1eaccb107245cd6e6a
MD5 977d1550a851c42657532a986f999c02
BLAKE2b-256 cc3221c07f472744f59190af4c2317ee3fb46377a6bfc7879cef448083f3d624

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp310-cp310-macosx_15_0_arm64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 76e28907df92572cbcf51f1355533d22db494b94c1772dd15e096501ae675382
MD5 0af43cda0e99a9f467ee5417ffd47a8a
BLAKE2b-256 b5442d0171a0a3e414ed593a705205648f59391d639e5469cb79b1d8e2446250

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp39-cp39-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp39-cp39-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 860f4770d6a683372084140572c4a163ec7d95e6e35295dbff9ee8566dcff4bc
MD5 e4e0c96c6ea3d043b5badff8dccb03e0
BLAKE2b-256 7691f6acd19018eb8c43b0ea820f706a2c7401ba35eba71ed320e1d4f870b660

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp39-cp39-macosx_15_0_arm64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2d52d65246435b9763104fd9aa1184aeb07084b666a5c0a05a12399f63e995d1
MD5 cd5f9a7bd3c78c239d9662e91916efe5
BLAKE2b-256 6f95394247e1df4fe939ff75d3cc0848c1a2db83e0ec35fff10b125fb8f5e857

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp38-cp38-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp38-cp38-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 606a69a7579e584c3e63d05655ca3b5db5796cb6ea5f03bf62926ed5d1ae6315
MD5 75623247b36f342cd08b7aeb0bef6036
BLAKE2b-256 fd7c9651c626bbe9cfb7b9f5811176612c3ba38b1adf32cd4077856ea768b2f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp38-cp38-macosx_15_0_arm64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ringdetect_hpc-1.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringdetect_hpc-1.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a746df1b7d342317abdc1c319d686e49b15ab95975b7a4f1636f412f9ca86973
MD5 06dae045becfef4dc0c4c15cb113bdbc
BLAKE2b-256 e3c21289b68a0a573f98838f1e4fef0f49d8299cd5f0d1a5d326f203bb365a84

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringdetect_hpc-1.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build_wheels.yml on ouielba90/RingDetect-HPC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page