LMucko commited on
Commit
2ec35bb
·
verified ·
1 Parent(s): eb3ed40

Use project README as model card

Browse files
Files changed (1) hide show
  1. README.md +68 -75
README.md CHANGED
@@ -1,113 +1,106 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- datasets:
4
- - the-matter-lab/clari-data
5
- tags:
6
- - chemistry
7
- - materials-science
8
- - crystal-structure-prediction
9
- - organic-crystals
10
- - diffusion-model
11
- - flow-matching
12
- - pytorch
13
- library_name: clari
14
- ---
15
-
16
- # CLARI
17
 
18
- CLARI predicts organic crystal structures from molecular inputs. The models in this repository are checkpoints for the paper **Fast Organic Crystal Structure Prediction with Unit Cell Flow Matching**.
19
 
20
- This repository contains model weights only. Dataset split metadata is kept separately in [`the-matter-lab/clari-data`](https://huggingface.co/datasets/the-matter-lab/clari-data), and the source code is expected at [`aspuru-guzik-group/clari`](https://github.com/aspuru-guzik-group/clari).
 
21
 
22
- ## Model Variants
23
 
24
- | Model name | File | Parameters | CLI alias |
25
- | --- | --- | ---: | --- |
26
- | CLARI-M | `clari-med.ckpt` | ~88M | `clari-m` |
27
- | CLARI-L | `clari-large.ckpt` | ~173M | `clari-l` |
28
 
29
- Both checkpoints are PyTorch Lightning checkpoints loaded by the `clari` Python package.
30
 
31
- ## Intended Use
32
 
33
- CLARI is intended for research on organic crystal structure prediction. Given a molecule specification, it samples candidate crystal packings including unit-cell and atomic-position information.
34
 
35
- Example use cases:
36
-
37
- - sampling candidate crystal structures for an organic molecule
38
- - reproducing CLARI evaluation runs on the paper test splits
39
- - ranking/exporting generated crystal candidates with the CLARI tooling
40
 
41
- ## Usage
42
 
43
- Install CLARI, then run inference with one of the Hub aliases:
44
 
45
  ```bash
46
- uv run sample \
47
- --from_hub clari-m \
48
- --output_dir out/ethanol \
49
- --smiles 'C([H])([H])([H])C([H])([H])O[H]' \
50
- --ids ethanol \
51
- --copies 4 \
52
- --n_samples 20
53
  ```
54
 
55
- For the larger checkpoint:
56
 
57
- ```bash
58
- uv run sample --from_hub clari-l ...
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  ```
60
 
61
- To reproduce evaluation sampling on the CSD-derived test subsets:
62
 
63
- ```bash
64
- uv run sample-test clari-m <num_samples> <experiment_dir> --subset teaching
65
- uv run sample-test clari-l <num_samples> <experiment_dir> --subset oxtal
66
  ```
67
 
68
- The first call downloads the selected checkpoint into the local Hugging Face cache. Subsequent calls reuse the cached file.
69
 
70
- ## Inputs and Outputs
 
 
71
 
72
- Inputs are explicit-hydrogen SMILES strings or multi-component molecule specifications accepted by the CLARI package.
73
 
74
- Outputs are sampled crystal candidates written as parquet rows containing sample IDs and CIF strings. The CLARI package can also export CIF files from generated predictions.
75
 
76
- ## Training Data
77
 
78
- The model was trained/evaluated using CSD-derived organic crystal data. The public split/refcode metadata is hosted in [`the-matter-lab/clari-data`](https://huggingface.co/datasets/the-matter-lab/clari-data).
 
 
 
 
 
 
79
 
80
  ## Evaluation
81
 
82
- Evaluation scripts in the CLARI repository support:
83
 
84
- - sampling on OXtal and teaching test subsets
85
- - collision checks
86
- - UMA energy computation
87
- - COMPACK packing similarity
88
- - summary metrics used in the paper
89
 
90
- Paper benchmark values should be reported in the repository README or paper release when finalized.
 
 
91
 
92
- ## Limitations
 
 
93
 
94
- - CLARI is a research model for organic crystal structure prediction, not a replacement for experimental validation.
95
- - Generated candidates may be physically implausible, may contain clashes, or may require downstream ranking/filtering.
96
- - Results depend on copy count, molecule representation, checkpoint choice, and sampling settings.
97
- - The Hub checkpoints are distributed as PyTorch Lightning checkpoint files rather than `safetensors` because they include CLARI-specific training/module state.
98
 
99
- ## License
 
100
 
101
- The model weights are released under the Creative Commons Attribution-NonCommercial 4.0 International license (`cc-by-nc-4.0`).
 
102
 
103
- ## Citation
 
 
104
 
105
- If you use CLARI, cite the associated paper once the arXiv entry is available:
106
 
107
- ```bibtex
108
- @article{clari2026,
109
- title = {Fast Organic Crystal Structure Prediction with Unit Cell Flow Matching},
110
- author = {Lo, Alston and Mucko, Luka and Cheng, Austin and others},
111
- year = {2026},
112
- }
113
  ```
 
1
+ <div align="center">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ # Fast Organic Crystal Structure Prediction <br> with Unit Cell Flow Matching
4
 
5
+ [![arXiv](https://img.shields.io/badge/arXiv-XXXX.YYYYY-b31b1b.svg)](https://arxiv.org)
6
+ [![data](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Data-blue)](https://huggingface.co/datasets/the-matter-lab/clari-data)
7
 
8
+ <br>
9
 
10
+ <img src="https://raw.githubusercontent.com/aspuru-guzik-group/clari/main/data/overview.png" width=600>
 
 
 
11
 
12
+ </div>
13
 
14
+ <br>
15
 
16
+ This repository contains code to reproduce the paper: Fast Organic Crystal Structure Prediction with Unit Cell Flow Matching (arXiv).
17
 
18
+ ---
 
 
 
 
19
 
20
+ ## Installation
21
 
22
+ Install everything needed for training, sampling, ranking, and most of the evaluation pipeline:
23
 
24
  ```bash
25
+ uv sync
 
 
 
 
 
 
26
  ```
27
 
28
+ ⚠️ To generate data and run COMPACK, we require the **CCDC SDK**, whose dependencies conflict with FairChem. Thus, some scripts run as standalone uv scripts that resolve their own isolated environments from the CCDC index. The first invocation of `uv run -s *.py ...` resolves and caches that environment. You will still need a valid CCDC license configured on the machine.
29
 
30
+ ## Data
31
+
32
+ ### Generation
33
+
34
+ We expect the final data folder to be structured as follows:
35
+
36
+ ```
37
+ data/
38
+ raw/
39
+ csd_metadata.parquet
40
+ csd_conquest.parquet
41
+ csd/
42
+ config.json
43
+ metdata.parquet
44
+ {train,val,test}.pt
45
  ```
46
 
47
+ To generate the data, first extract the metadata of entries in CSD:
48
 
49
+ ```
50
+ uv run -s scripts/data/0_metadata.py
 
51
  ```
52
 
53
+ This creates the `csd_metadata.parquet` file from above. Next, download **ALL** of CSD in `.mol2` and `.cif` format using ConQuest (not `csd-python-api` since it sanitizes molecules and removes some bond information) into the `csd_conquest.parquet` file. Finally, generate the `data/csd` folder with:
54
 
55
+ ```
56
+ uv run python -m scripts.data.1_process --num_workers=16
57
+ ```
58
 
59
+ For reference, the CSD refcodes we use and our dataset split are uploaded to [HuggingFace](https://huggingface.co/datasets/the-matter-lab/clari-data).
60
 
61
+ ## Usage
62
 
63
+ The model can be trained with:
64
 
65
+ ```
66
+ uv run train --help
67
+ ```
68
+
69
+ Checkpoints for Clari-M and Clari-L are uploaded to [HuggingFace](https://huggingface.co/the-matter-lab/clari).
70
+ To run inference, see the [README.md](https://github.com/aspuru-guzik-group/clari/blob/main/clari/inference/README.md) in `clari.inference`.
71
+ We also include a [SKILL.md](https://github.com/aspuru-guzik-group/clari/blob/main/clari/inference/SKILL.md) so that coding agents can run inference.
72
 
73
  ## Evaluation
74
 
75
+ ### OXtal and Teaching Test Sets
76
 
77
+ To reproduce the paper numbers for a Hub model or local checkpoint, run the stages below in order. Each stage writes into the same `<experiment_dir>` and reads what the previous stage produced.
 
 
 
 
78
 
79
+ ```bash
80
+ # 0. One-time: build the GT CIF cache the standalone compack script reads
81
+ uv run python clari/evaluation/build_test_cifs_cache.py
82
 
83
+ # 1. Sample the CSD test set, creates a folder results/experiment_dir.
84
+ # Use clari-m, clari-l, or a local checkpoint path as the first argument.
85
+ uv run sample-test clari-m <num_samples> <experiment_dir> --subset <teaching/oxtal>
86
 
87
+ # 2. Clash check (writes collision.csv)
88
+ uv run collision <experiment_dir>
 
 
89
 
90
+ # 3. UMA energies (writes energies.csv)
91
+ uv run compute-energies <experiment_dir>
92
 
93
+ # 4. COMPACK packing similarity (writes compack.csv, isolated uv script env)
94
+ uv run -s clari/evaluation/compack.py <experiment_dir> --num_processes n
95
 
96
+ # 5. Summary table (SolC per subset, all k)
97
+ uv run summarize <experiment_dir>
98
+ ```
99
 
100
+ ### Ablations
101
 
102
+ The exact commands used for to train our ablated and final models can be found in `scripts/train`. After running inference as above, the metrics used for ablations are defined in:
103
+
104
+ ```
105
+ from clari.pipelines.utils.metrics import assess_crystals_eval
 
 
106
  ```