NVALCHEMY Toolkit Ops

0.3.1 · active · verified Thu Apr 16

NVALCHEMY Toolkit Ops (pypi: `nvalchemi-toolkit-ops`) is a Python library providing high-performance NVIDIA Warp primitives for GPU-enabled computational chemistry and atomistic simulation workflows. It leverages NVIDIA Warp for accelerated calculations. As of version 0.3.1, it is under active development with frequent minor and patch releases, often introducing new features and refactorings.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates calculating a bond length using `toolkit_ops.mol_geom.get_bond_length`. It initializes NVIDIA Warp, converts a NumPy array of atomic positions to a Warp array, and then performs the calculation. An NVIDIA GPU and CUDA are required for `wp.init()` to succeed.

import warp as wp
from toolkit_ops.mol_geom import get_bond_length
import numpy as np

# Initialize Warp (requires an NVIDIA GPU and CUDA setup)
try:
    wp.init()
except Exception as e:
    print(f"Warning: Could not initialize Warp. GPU operations will fail: {e}")
    # In a real application, you might exit or provide fallback CPU logic here.

# Example usage:
positions_np = np.array([
    [0.0, 0.0, 0.0],
    [1.0, 0.0, 0.0]
], dtype=np.float32)
# Convert numpy array to Warp array
positions = wp.array(positions_np, dtype=wp.vec3)

# Calculate bond length
bond_length = get_bond_length(positions, index_0=0, index_1=1)

print(f"Calculated bond length: {bond_length.numpy()}")

view raw JSON →