Skip to main content

Adaptive sampling on MD trajectories via clustering and policy-driven seed selection

Project description

AdaptivePy

Adaptive sampling for molecular dynamics trajectories

Clustering-based and frame-level adaptive policies for MD workflows, including entropy-based MaxEnt VAMPNet seed selection.

Documentation PyPI Python


Overview

AdaptivePy helps you identify under-sampled or high-uncertainty regions of conformational space and select seed frames for new simulations. It loads per-trajectory feature arrays, optionally clusters frames, applies adaptive policies, and writes reproducible metadata and optional PDB structures.

Most policies select seeds from clusters. MaxEnt VAMPNet (maxent_vampnet) is frame-level: it trains a VAMPNet on lagged features and selects frames with the highest Shannon entropy of softmax state probabilities — no clustering required.

Full documentation: https://hnadeem2.github.io/AdaptivePy/

Input Feature arrays (.npy / .pkl), optional coordinate trajectories
Clustering KMeans, MiniBatch KMeans, regular-space (optional for frame-level policies)
Policies Least counts, random, FAST, MA-REAP, kNN-AS, MaxEnt VAMPNet (extensible)
Output Seeds, cluster assignments, model, logs, policy scores, optional PDBs

Installation

pip install adaptivepy-sampling

For MaxEnt VAMPNet (requires PyTorch and deeptime):

pip install adaptivepy-sampling[maxent]

For development:

git clone https://github.com/hnadeem2/AdaptivePy.git
cd AdaptivePy
pip install -e ".[dev,docs]"

For MaxEnt development:

pip install -e ".[dev,docs,maxent]"

Quick start

  1. Prepare features — one file per trajectory, shape (n_frames, n_features):

    features/
    ├── traj_0.npy
    └── traj_1.pkl
    
  2. Configure — edit examples/config.yaml (or create your own).

  3. Run:

    adaptivepy run examples/config.yaml
    

See the Getting Started guide for a complete walkthrough.

CLI

adaptivepy run config.yaml       # run adaptive sampling
adaptivepy validate config.yaml  # validate inputs only
adaptivepy list-policies         # list available policies

Python API

from adaptivepy import run_adaptive_sampling

results = run_adaptive_sampling("config.yaml")

Policies

Built-in seed-selection policies:

Policy Use case
least_counts Target under-sampled clusters
random Baseline random sampling
fast Goal-directed sampling via feature columns (Zimmerman & Bowman 2015)
ma_reap Multi-agent coordinated sampling with learned CV weights (Kleiman & Shukla 2022)
knn_as k-nearest-neighbors adaptive sampling over cluster representatives (Rovers et al. 2025)
maxent_vampnet Entropy-based frame selection via VAMPNet soft state assignments (Kleiman & Shukla 2023); no clustering

fast, ma_reap, knn_as, and maxent_vampnet accept extra YAML under policy_params. MA-REAP requires mapping each trajectory to an agent. MaxEnt VAMPNet requires the [maxent] install extra (pip install adaptivepy-sampling[maxent]). See the Policies guide and Configuration.

AdaptivePy also supports opt-in metapolicy ensembles with majority polling or per-policy seed allocation through the metapolicy YAML block.

Documentation

Guide Description
Getting Started First run in minutes
Configuration YAML options and defaults
Feature Inputs File formats and layout
Policies Seed selection strategies
API Reference Module documentation

Contributors

  • Hassan

License

MIT. See LICENSE for details.

Project details


Download files

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

Source Distribution

adaptivepy_sampling-0.3.0.tar.gz (49.0 kB view details)

Uploaded Source

Built Distribution

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

adaptivepy_sampling-0.3.0-py3-none-any.whl (54.1 kB view details)

Uploaded Python 3

File details

Details for the file adaptivepy_sampling-0.3.0.tar.gz.

File metadata

  • Download URL: adaptivepy_sampling-0.3.0.tar.gz
  • Upload date:
  • Size: 49.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for adaptivepy_sampling-0.3.0.tar.gz
Algorithm Hash digest
SHA256 03410f73b7181d15db52f4a61ba169344321b21432bdd890bfa0feff3d819a27
MD5 aa9de8369a864edda632997637e057b5
BLAKE2b-256 22d4f6a94b8ffed6ec171e89badddff623941fc0dde9aaefe66501b3ec959a14

See more details on using hashes here.

Provenance

The following attestation bundles were made for adaptivepy_sampling-0.3.0.tar.gz:

Publisher: publish.yml on hnadeem2/AdaptivePy

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

File details

Details for the file adaptivepy_sampling-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for adaptivepy_sampling-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a4633042e2bb1048b7741c3eef6e939e3fa99235bb8c46b070296f18b1277aa
MD5 64b4eca322704cf5cf68f4804468c60b
BLAKE2b-256 634dd8718ef39c12b21a0b9fe411b6930067c73380beacc9ddf9a05aa9cd4371

See more details on using hashes here.

Provenance

The following attestation bundles were made for adaptivepy_sampling-0.3.0-py3-none-any.whl:

Publisher: publish.yml on hnadeem2/AdaptivePy

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