Metadata-Version: 2.4
Name: conformend
Version: 0.2.7
Summary: ConforMend ensemble-relational conformer generation and compact-library construction
Author: ConforMend developers
Keywords: molecular conformers,conformer generation,chemical informatics
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Chemistry
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23
Provides-Extra: full
Requires-Dist: torch>=2.3; extra == "full"
Requires-Dist: torch-geometric>=2.5; extra == "full"
Requires-Dist: rdkit; extra == "full"
Requires-Dist: scipy>=1.10; extra == "full"
Requires-Dist: tqdm>=4.66; extra == "full"
Requires-Dist: pyyaml>=6; extra == "full"
Provides-Extra: evaluation
Requires-Dist: pandas>=2.0; extra == "evaluation"
Requires-Dist: matplotlib>=3.7; extra == "evaluation"
Requires-Dist: scikit-learn>=1.3; extra == "evaluation"
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Provides-Extra: build
Requires-Dist: build>=1.0; extra == "build"
Requires-Dist: twine>=4.0; extra == "build"
Dynamic: license-file

<div align="center">
  <img src="docs/assets/ConforMend-logo.png" width="760" alt="ConforMend logo">

  <h3>Ensemble-derived relational priors for molecular conformer generation</h3>

  <p>
    <a href="https://pypi.org/project/conformend/"><img src="https://img.shields.io/pypi/v/conformend?color=718DA5&label=PyPI" alt="PyPI version"></a>
    <a href="https://pypi.org/project/conformend/"><img src="https://img.shields.io/pypi/pyversions/conformend?color=B39572" alt="Python versions"></a>
    <a href="#citation"><img src="https://img.shields.io/badge/arXiv-coming%20soon-A6ADB4" alt="arXiv coming soon"></a>
    <a href="#citation"><img src="https://img.shields.io/badge/Paper-coming%20soon-A6ADB4" alt="Paper coming soon"></a>
    <a href="#citation"><img src="https://img.shields.io/badge/DOI-coming%20soon-A6ADB4" alt="DOI coming soon"></a>
  </p>
</div>

---

## About

**ConforMend** is a graph-based framework for generating accurate and diverse
molecular conformer ensembles under a fixed output budget. It separates broad
basin exploration from local geometric refinement and keeps final selection
independent of the reference conformers.

The method has three main components:

1. **Ensemble-derived relational priors** learn pairwise mean and dispersion
   maps from reference conformer ensembles.
2. **Candidate-conditioned torsional refinement** applies bounded,
   bond-specific updates to each denoised seed while preserving its local
   basin context.
3. **Reference-free compact selection** combines local density and global
   centrality to retain a diverse library at the requested budget.

<div align="center">
  <img src="docs/assets/conformend-figure1.png" width="100%" alt="ConforMend framework">
  <p><i>Mechanism-focused view of the ConforMend training and serial inference workflow.</i></p>
</div>

## Method overview

At inference, the public `route2_paper` protocol uses the serial workflow

```text
ETKDG initialization → Denoiser → candidate-conditioned Refiner → reference-free selection
```

The same generated candidate budget, selector, and geometric post-processing
are used when comparing methods. Crystal/reference conformers are used for
training or evaluation, not to select the final inference library.

## Installation

The lightweight package is available directly from PyPI:

```bash
pip install conformend
```

For the checkpoint-backed PyTorch/RDKit pipeline, install the optional full
dependencies:

```bash
pip install 'conformend[full]'
```

The package does not bundle checkpoints or benchmark datasets. Install a
PyTorch build compatible with the local CUDA environment when using a GPU.

## Quick start: lightweight utilities

The base installation provides deterministic numerical utilities and does not
require a checkpoint. The following toy example computes ensemble-level
relational priors and selects a five-conformer compact library:

```python
import numpy as np
from conformend import density_centrality_select, ensemble_pairwise_prior

rng = np.random.default_rng(7)
conformers = rng.normal(size=(24, 12, 3))  # (conformers, atoms, xyz)

mean_prior, dispersion_prior = ensemble_pairwise_prior(conformers)
selected = density_centrality_select(conformers, k=5)
compact_library = conformers[selected]

print(mean_prior.shape, dispersion_prior.shape, compact_library.shape)
# (12, 12) (12, 12) (5, 12, 3)
```

For an `.npy` conformer array, the same selector is available from the command
line:

```bash
conformend-select conformers.npy -k 5 -o selected_indices.npy
```

## Full checkpoint-backed inference

The complete pipeline requires a compatible ConforMend checkpoint, a denoiser
checkpoint, and prepared molecular graph/conformer records. The public
launcher is:

```bash
conformend-infer \
  --protocol route2_paper \
  --base_checkpoint /path/to/stage2_best.pth \
  --denoiser_checkpoint /path/to/denoiser.pth \
  --dataset Drugs \
  --data_root /path/to/data \
  --raw_prefix geom_drugs \
  --split test \
  --device cuda \
  --output_dir results/conformend
```

Inspect the complete argument surface with:

```bash
conformend-infer --help
```

The equivalent Python entry point uses the same production runtime:

```python
from conformend import ConforMend

model = ConforMend.from_pretrained(
    "/path/to/stage2_best.pth",
    device="cuda",
    denoiser_checkpoint="/path/to/denoiser.pth",
)

model.generate(
    data_root="/path/to/data",
    output_dir="results/conformend",
    dataset="Drugs",
    raw_prefix="geom_drugs",
    split="test",
    protocol="route2_paper",
)
```

Every run writes generated conformers, evaluation outputs, logs, and a run
manifest below `output_dir`.

## Inputs and reproducibility

| Input | Required content |
|---|---|
| ConforMend checkpoint | Compatible Stage-II/base checkpoint (`.pth`) |
| Denoiser checkpoint | Compatible noise-conditioned denoiser (`.pth`) |
| `data_root` | Prepared graph and conformer records for the selected split |
| `raw_prefix` / `split` | Dataset record prefix and split identifier |

The repository includes a path-only configuration template and a launcher for
the paper protocol. Replace the external paths locally:

```bash
export CONFORMEND_CHECKPOINT=/path/to/stage2_best.pth
export CONFORMEND_DENOISER_CHECKPOINT=/path/to/denoiser.pth
export CONFORMEND_DATA_ROOT=/path/to/data
export CONFORMEND_DEVICE=cuda
bash examples/reproduce_route2_paper.sh
```

Checkpoints, benchmark data, credentials, and generated results are excluded
from this public tree.

## Repository structure

```text
src/conformend/ public API facade; `src/manimol/` remains the compatibility implementation
src/models/    model and training components
src/dataset/   molecular data processing
src/utils/     geometry, metrics, and checkpoint utilities
scripts/       training, evaluation, and reproduction scripts
configs/       reproducibility and external-artifact templates
examples/      runnable public examples
docs/assets/   README and method figures
tests/         regression and public-API tests
```

## Development

```bash
pip install -e '.[test,build]'
pytest
python -m build --outdir /tmp/conformend-dist
```

## Citation

The manuscript, arXiv page, and DOI will be linked here when they are public.
Citation metadata are available in [`CITATION.cff`](CITATION.cff).

## License

ConforMend is released under the MIT License; see [`LICENSE`](LICENSE).
