Prepare data#

It provides a prepare_data function that allows to generate input data of MOFTransformer (i.e., atom-wise graph embeddings and energy-grids) The details are explained in the Data Preparation section.

In order to run prepare_data, you need to install GRIDAY to calculate energy-grids from cif files.

You can download GRIDAY using command-line or python

$ moftransformer install-griday

Example for running prepare-data#

As an example, you can run prepare_data with 10 cif files in moftransformer/examples/raw directory (For more information, see Dataset Preparation)

from moftransformer.examples import example_path
from moftransformer.utils import prepare_data

# Get example path
root_cifs = example_path['root_cif']
root_dataset = example_path['root_dataset']
downstream = example_path['downstream']

train_fraction = 0.8  # default value
test_fraction = 0.1   # default value

# Run prepare data
prepare_data(root_cifs, root_dataset, downstream=downstream, 
             train_fraction=train_fraction, test_fraction=test_fraction)