File size: 8,448 Bytes
b9368c4
2fd49e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9368c4
01f16f6
b9368c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2fd49e8
 
 
 
 
 
 
 
 
b9368c4
 
01f16f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9368c4
2fd49e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
---
version: 1.1.1
language: en
license: gpl-3.0
size_categories:
- 1M<n<10M
task_categories:
- tabular-regression
pretty_name: Molecule3D
tags:
- molecular geometry
- molecular graph
dataset_summary: Curated dataset of ground-state geometries of 4 million molecules
  dervied from density functional theory, consisting of SMILES, sdf, and 3D properties
  of molecules.  Random split and scaffold split datasets are uploaded to our repository.
citation: '@misc{https://doi.org/10.48550/arxiv.2110.01717, doi = {10.48550/ARXIV.2110.01717},
  url = {https://arxiv.org/abs/2110.01717}, author = {Xu,  Zhao and Luo,  Youzhi and
  Zhang,  Xuan and Xu,  Xinyi and Xie,  Yaochen and Liu,  Meng and Dickerson,  Kaleb
  and Deng,  Cheng and Nakata,  Maho and Ji,  Shuiwang}, keywords = {Machine Learning
  (cs.LG),  Artificial Intelligence (cs.AI),  FOS: Computer and information sciences,  FOS:
  Computer and information sciences}, title = {Molecule3D: A Benchmark for Predicting
  3D Geometries from Molecular Graphs}, publisher = {arXiv}, year = {2021}, copyright
  = {arXiv.org perpetual,  non-exclusive license} }'
configs:
- config_name: Molecule3D_random_split
  data_files:
  - split: train
    path: Molecule3D_random_split/train-*
  - split: test
    path: Molecule3D_random_split/test-*
  - split: validation
    path: Molecule3D_random_split/validation-*
- config_name: Molecule3D_scaffold_split
  data_files:
  - split: train
    path: Molecule3D_scaffold_split/train-*
  - split: validation
    path: Molecule3D_scaffold_split/validation-*
  - split: test
    path: Molecule3D_scaffold_split/test-*
dataset_info:
- config_name: Molecule3D_random_split
  features:
  - name: index
    dtype: int64
  - name: SMILES
    dtype: string
  - name: sdf
    dtype: string
  - name: cid
    dtype: int64
  - name: dipole x
    dtype: float64
  - name: dipole y
    dtype: float64
  - name: dipole z
    dtype: float64
  - name: homo
    dtype: float64
  - name: lumo
    dtype: float64
  - name: Y
    dtype: float64
  - name: scf energy
    dtype: float64
  splits:
    - name: train
      num_bytes: 3175756092
      num_examples: 2339728
    - name: test
      num_bytes: 1058783091
      num_examples: 779895
    - name: validation
      num_bytes: 1058496510
      num_examples: 779903
  download_size: 1881829100
  dataset_size: 5293035693
- config_name: Molecule3D_scaffold_split
  features:
  - name: index
    dtype: int64
  - name: SMILES
    dtype: string
  - name: sdf
    dtype: string
  - name: cid
    dtype: int64
  - name: dipole x
    dtype: float64
  - name: dipole y
    dtype: float64
  - name: dipole z
    dtype: float64
  - name: homo
    dtype: float64
  - name: lumo
    dtype: float64
  - name: Y
    dtype: float64
  - name: scf energy
    dtype: float64
  splits:
  - name: train
    num_bytes: 3066815311
    num_examples: 2339742
  - name: validation
    num_bytes: 1095660967
    num_examples: 779925
  - name: test
    num_bytes: 1130559415
    num_examples: 779859
  download_size: 1867676945
  dataset_size: 5293035693
---

# Molecule3D
[Molecule3D](https://arxiv.org/abs/2110.01717) is a comprehensive dataset containing ground-state geometries derived from Density Functional Theory (DFT) calculations for approximately 4 million molecules. 
This is a mirror of the [Official Github repo](https://github.com/divelab/MoleculeX/tree/molx/Molecule3D) where the dataset was uploaded in 2021.


## Preprocseeing
[Update on 2025.08.16 - version 1.1.1]
We removed invalid SMILES strings which could not be parsed by RDKit.
- Random split
1. train : removed 60 smiles strings from 2339788 strings
2. test : removed 35 smiles strings from 779930 strings
3. validation : removed 26 smiles strings from 779929 strings
- Scaffold split
1. train : removed 46 smiles strings from 2339788 strings
2. test : removed 71 smiles strings from 779930 strings
3. validation : removed 4 smiles strings from 779929 strings

We also updated the `README.md` file.

We utilized the raw data uploaded on [Github](https://github.com/divelab/MoleculeX/tree/molx/Molecule3D/data/raw) and performed several preprocessing:
1. Sanitize the molecules using RDKit and MolVS (standardize SMILES format)
2. Combine the SMILES strings, SDF data, and 3D molecular properties for each molecule.
3. Split the dataset using random split and scaffold split (train, test, validation)

If you would like to try these processes with the original dataset, 
please follow the instructions in the [Preprocessing Script](https://huggingface.co/datasets/maomlab/Molecule3D/blob/main/Molecule3D_preprocessing.py) file located in our Molecule3D repository.



## Quickstart Usage

### Load a dataset in python
Each subset can be loaded into python using the Huggingface [datasets](https://huggingface.co/docs/datasets/index) library.
First, from the command line install the `datasets` library

    $ pip install datasets

then, from within python load the datasets library

    >>> import datasets
   
and load one of the `Molecule3D` datasets, e.g.,

    >>> Molecule3D = datasets.load_dataset('maomlab/Molecule3D', name = 'Molecule3D_random_split')   # can put 'Molecule3D_scaffold_split' for the name as well
    README.md: 100%  4.95k/4.95k [00:00<00:00, 559kB/s]
    Generating train split: 100%  2339788/2339788 [00:34<00:00, 85817.85 examples/s]
    Generating test split: 100%  779930/779930 [00:15<00:00, 96660.33 examples/s]
    Generating validation split:  100% 779929/779929 [00:09<00:00, 79064.99 examples/s]

and inspecting the dataset

    >>> Molecule3D
    DatasetDict({
    train: Dataset({
        features: ['index', 'SMILES', 'sdf', 'cid', 'dipole x', 'dipole y', 'dipole z', 'homo', 'lumo', 'Y', 'scf energy'],
        num_rows: 2339788
    })
    test: Dataset({
        features: ['index', 'SMILES', 'sdf', 'cid', 'dipole x', 'dipole y', 'dipole z', 'homo', 'lumo', 'Y', 'scf energy'],
        num_rows: 779930
    })
    validation: Dataset({
        features: ['index', 'SMILES', 'sdf', 'cid', 'dipole x', 'dipole y', 'dipole z', 'homo', 'lumo', 'Y', 'scf energy'],
        num_rows: 779929
    })
}) 


### Use a dataset to train a model
One way to use the dataset is through the [MolFlux](https://exscientia.github.io/molflux/) package developed by Exscientia.
First, from the command line, install `MolFlux` library with `catboost` and `rdkit` support

    pip install 'molflux[catboost,rdkit]'

then load, featurize, split, fit, and evaluate the catboost model

    import json
    from datasets import load_dataset
    from molflux.datasets import featurise_dataset
    from molflux.features import load_from_dicts as load_representations_from_dicts
    from molflux.splits import load_from_dict as load_split_from_dict
    from molflux.modelzoo import load_from_dict as load_model_from_dict
    from molflux.metrics import load_suite
    
    split_dataset = load_dataset('maomlab/Molecule3D', name = 'Molecule3D_random_split')  # can put 'Molecule3D_scaffold_split' for the name as well
    
    split_featurised_dataset = featurise_dataset(
      split_dataset,
      column = "SMILES",
      representations = load_representations_from_dicts([{"name": "morgan"}, {"name": "maccs_rdkit"}]))

    model = load_model_from_dict({
        "name": "cat_boost_regressor",
        "config": {
            "x_features": ['SMILES::morgan', 'SMILES::maccs_rdkit'],
            "y_features": ['Y']}})
    
    model.train(split_featurised_dataset["train"])
    preds = model.predict(split_featurised_dataset["test"])
    
    regression_suite = load_suite("regression")
    
    scores = regression_suite.compute(
        references=split_featurised_dataset["test"]['Y'],
        predictions=preds["cat_boost_regressor::Y"])    


## Citation
@misc{https://doi.org/10.48550/arxiv.2110.01717,
  doi = {10.48550/ARXIV.2110.01717},
  url = {https://arxiv.org/abs/2110.01717},
  author = {Xu,  Zhao and Luo,  Youzhi and Zhang,  Xuan and Xu,  Xinyi and Xie,  Yaochen and Liu,  Meng and Dickerson,  Kaleb and Deng,  Cheng and Nakata,  Maho and Ji,  Shuiwang},
  keywords = {Machine Learning (cs.LG),  Artificial Intelligence (cs.AI),  FOS: Computer and information sciences,  FOS: Computer and information sciences},
  title = {Molecule3D: A Benchmark for Predicting 3D Geometries from Molecular Graphs},
  publisher = {arXiv},
  year = {2021},
  copyright = {arXiv.org perpetual,  non-exclusive license}
}