Skip to main content

Tools for making OPTIMADE APIs from raw structural data.

Project description

optimade-maker

PyPI - Version PyPI - License GitHub Actions Workflow Status

Tools for making OPTIMADE APIs from various formats of structural data (e.g. an archive of CIF files).

This repository contains the src/optimade-maker Python package and the corresponding CLI tool optimake, which together provide this functionality. Features include

  • definition of a config file format (optimade.yaml) for annotating data archives to be used in the OPTIMADE ecosystem;
  • conversion of the raw data into corresponding OPTIMADE types using pre-existing parsers (e.g., ASE for structures);
  • conversion of the annotated data archive into the OPTIMADE JSON Lines file format (spec) that can be ingested into a database and used to serve a full OPTIMADE API.
  • serving either an annotated data archive or a JSON Lines file as an OPTIMADE API (using the optimade-python-tools reference server implementation).

Installation and usage

Install with

pip install optimade-maker
# or to get all ingestion plugins (e.g. pymatgen, aiida):
pip install optimade-maker[ingest]

this will also make the optimake CLI utility available.

For a folder containing the data archive and the optimade.yaml file (such as in /examples), run

  • optimake convert . to convert the entry into the JSONL format (see below).
  • optimake serve . to start the OPTIMADE API (this also converts the entry, if needed);

For more detailed information see also optimake --help.

Annotating with optimade.yaml

To annotate your structural data for optimade-maker, the data archive needs to be accompanied by an optimade.yaml config file. The following is a simple example for a zip archive (structures.zip) of cif files together with an optional property file (properties.csv):

config_version: 0.1.1
database_description: Simple database

entries:
  - entry_type: structures
    entry_paths:
      - file: structures.zip
        matches:
          - cifs/*/*.cif
    # (optional) property file and definitions:
    property_paths:
      - file: properties.csv
    property_definitions:
      - name: energy
        title: Total energy
        description: DFT total energy
        unit: eV/atom
        type: float

See ./examples for a more complete set of supported formats and corresponding optimade.yaml config files.

Structure ids and property files

optimade-maker will assign an id for each structure based on its full path in the archive, following a simple deterministic rule: from the set of all archive paths, the maximum common path prefix and postfix (including file extensions) are removed. E.g.

structures.zip/cifs/set1/101.cif
structures.zip/cifs/set2/102.cif

produces ["set1/101", "set2/102"].

The property files need to either refer to these ids or the full path in the archive to be associated with a structure. E.g. a possible property csv file could be

id,energy
set1/101,2.5
structures.zip/cifs/set2/102.cif,3.2

Relevant links

For developers

Releasing a new version

This project uses setuptools_scm, which reads the version from git tags. To release a new version:

git checkout main
git pull
git tag -a vX.Y.Z -m "Release X.Y.Z"
git push --tags

This will trigger the Github Action that will create 1) a Github release; and 2) build and publish the package on pypi.

Acknowledgements

This project was funded by the NCCR MARVEL, a National Centre of Competence in Research, funded by the Swiss National Science Foundation (grant number 205602). We also acknowledge support by the Open Research Data Program of the Swiss ETH Board (project "API-03 IntER").

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

optimade_maker-0.9.0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

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

optimade_maker-0.9.0-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file optimade_maker-0.9.0.tar.gz.

File metadata

  • Download URL: optimade_maker-0.9.0.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for optimade_maker-0.9.0.tar.gz
Algorithm Hash digest
SHA256 fbcabd7c13d7a2628ed2e51d944e79dd4c86f4cb7fcb804ec05dfd4f384d5393
MD5 bd490d48d0292b4ec4f8953be9173996
BLAKE2b-256 6baf5c0c8eb1799fc235ab18cac72380d1f0648f15f60397ecdb71417e5b1cd7

See more details on using hashes here.

File details

Details for the file optimade_maker-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: optimade_maker-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for optimade_maker-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d623564b3718140fc9dfd00f510d8ba43851b2b0214680dfb2d97555dbb6af1
MD5 272a0ec174963248c31bc4c9e7e7f481
BLAKE2b-256 8c0780d3f0b0e73d315138934e38b8130dc91ae8bf6ea45b6a7575438bb5aa56

See more details on using hashes here.

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