Skip to main content

Tools for implementing and consuming OPTiMaDe APIs.

Project description

Build Status

A library of tools for implementing and consuming OPTiMaDe APIs in Python.

The aim of OPTiMaDe is to develop a common API, compliant with the JSON API 1.0 spec, to enable interoperability among databases that contain calculated properties of existing and hypothetical materials.

Status

This library is under development. Progress is expected during the CECAM Workshop on Open Databases Integration for Materials Design during the week of June 11, 2018 to June 15, 2018.

Getting Started

Install via pip install optimade. Example use:

from optimade.filter import Parser

p = Parser(version=(0, 9, 5))
p.parse("filter=a<3")
Tree(start, [Token(KEYWORD, 'filter='), Tree(expression, [Tree(term, [Tree(atom, [Tree(comparison, [Token(VALUE, 'a'), Token(OPERATOR, '<'), Token(VALUE, '3')])])])])])
p = Parser()
p.version
(0, 9, 5)
tree = p.parse('filter=_mp_bandgap > 5.0 AND _cod_molecular_weight < 350')
print(p)
start
  filter=
  expression
    term
      term
        atom
          comparison
            _mp_bandgap
            >
            5.0
      AND
      atom
        comparison
          _cod_molecular_weight
          <
          350
# Assumes graphviz installed on system and `pip install pydot`
from lark.tree import pydot__tree_to_png

pydot__tree_to_png(tree, "exampletree.png")

example tree

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

optimade-0.1.12.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

optimade-0.1.12-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page