Skip to main content

No project description provided

Project description

PyPI version Python versions codecov

Graph ID

Graph ID is a universal identifier system for atomistic structures including crystals and molecules. It generates unique, deterministic identifiers based on the topological and compositional properties of atomic structures, enabling efficient structure comparison, database indexing, and materials discovery.

Overview

Graph ID works by:

  1. Converting atomic structures into graph representations where atoms are nodes and bonds are edges
  2. Analyzing the local chemical environment around each atom using compositional sequences
  3. Computing a hash-based identifier that captures both topology and composition
  4. Supporting various modes including topology-only comparisons and Wyckoff position analysis

Features

  • Universal Structure Identification: Generate unique IDs for any crystal or molecular structure
  • Topological Analysis: Option to generate topology-only IDs for structure type comparison
  • Wyckoff Position Support: Include crystallographic symmetry information in ID generation
  • Distance Clustering: Advanced clustering-based analysis for complex structures
  • C++ Performance: High-performance C++ backend with Python bindings
  • Multiple Neighbor Detection: Support for various neighbor-finding algorithms (MinimumDistanceNN, CrystalNN, etc.)

Installation

From PyPI

pip install graph-id-core
pip install graph-id-db  # optional database component

From Source

git clone https://github.com/kmu/graph-id-core.git
cd graph-id-core
git submodule update --init --recursive
pip install -e .

Quick Start

Basic Usage

from pymatgen.core import Structure, Lattice
from graph_id import GraphIDMaker

# Create a structure (NaCl)
structure = Structure.from_spacegroup(
    "Fm-3m",
    Lattice.cubic(5.692),
    ["Na", "Cl"],
    [[0, 0, 0], [0.5, 0.5, 0.5]]
)

# Generate Graph ID
maker = GraphIDMaker()
graph_id = maker.get_id(structure)
print(graph_id)  # Output: NaCl-88c8e156db1b0fd9

Loading from Files

from pymatgen.core import Structure
from graph_id_cpp import GraphIDGenerator

# Load structure from file
structure = Structure.from_file("path/to/structure.cif")
generator = GraphIDGenerator()
graph_id = generator.get_id(structure)

Advanced Configuration

from graph_id_cpp import GraphIDGenerator
from pymatgen.analysis.local_env import CrystalNN

# Topology-only comparison (ignores composition)
topo_gen = GraphIDGenerator(topology_only=True)
topo_id = topo_gen.get_id(structure)

# Include Wyckoff positions
wyckoff_gen = GraphIDGenerator(wyckoff=True)
wyckoff_id = wyckoff_gen.get_id(structure)

# Use different neighbor detection
crystal_gen = GraphIDGenerator(nn=CrystalNN())  # Faster CrystalNN using C++ is also available
crystal_id = crystal_gen.get_id(structure)

Search Structures from Database

Use graph-id-db to search structures in the Materials Project using precomputed Graph ID stored in graph-id-db

# pip install graph-id-db
from graph_id_cpp import GraphIDGenerator

from pymatgen.core import Structure, Lattice

structure = Structure.from_spacegroup(
    "Fm-3m",
    Lattice.cubic(5.692),
    ["Na", "Cl"],
    [[0, 0, 0], [0.5, 0.5, 0.5]]
).get_primitive_structure()
gen = GraphIDGenerator()
graph_id = gen.get_id(structure)
print(f"Graph ID of NaCl is {graph_id}")

from graph_id_db import Finder

# Search for structures in graph-id-db using GraphID
finder = Finder()
finder.find(graph_id)

Examples

More comprehensive examples can be found in the tests/ and examples/ directories.

Applications

Graph ID is particularly useful for:

  • Materials Databases: Efficient indexing and deduplication of structure databases
  • High-throughput Screening: Rapid identification of unique structures in computational workflows
  • Polymorph Identification: Distinguishing between different polymorphs of the same composition

Web Service (experimental)

You can search materials using Graph ID at matfinder.net.

Citation

If you use Graph ID in your research, please cite:

Muraoka, K., Tanimoto, T., Munekata, T. & Nakayama, A. Universal graph-based identifiers of chemical structures for linking large material databases. Nature Communications 17, 5409 (2026). https://doi.org/10.1038/s41467-026-74536-5

@article{muraoka2026graphid,
  title   = {Universal graph-based identifiers of chemical structures for linking large material databases},
  author  = {Muraoka, Koki and Tanimoto, Taku and Munekata, Tsubasa and Nakayama, Akira},
  journal = {Nature Communications},
  volume  = {17},
  number  = {1},
  pages   = {5409},
  year    = {2026},
  doi     = {10.1038/s41467-026-74536-5}
}

Developer's notes

This repo is managed by poetry.

Installation

  1. Clone the repository:
git clone https://github.com/kmu/graph-id-core.git
cd graph-id-core
  1. Initialize git submodules (required for the C++ build):
git submodule update --init --recursive
  1. Install the package and dependencies using Poetry:
poetry install
  1. Install pre-commit
pre-commit install

Note: The git submodules (library/pybind11, library/eigen, library/gtl) are required for building the C++ extension. Without them, the installation will fail during the CMake build step.

Testing

poetry install
poetry run pytest

If you have made changes to the C++ code, run poetry run pip install -e --force-reinstall to apply the changes before running the tests.

Releasing

  • Bump version in pyproject.toml.
  • Create a new PR from main branch to release branch.

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

graph_id_core-0.1.20.tar.gz (5.6 MB view details)

Uploaded Source

Built Distributions

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

graph_id_core-0.1.20-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl (306.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

graph_id_core-0.1.20-cp313-cp313-macosx_11_0_arm64.whl (262.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

graph_id_core-0.1.20-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl (306.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

graph_id_core-0.1.20-cp312-cp312-macosx_11_0_arm64.whl (262.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

graph_id_core-0.1.20-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl (307.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

graph_id_core-0.1.20-cp311-cp311-macosx_11_0_arm64.whl (262.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file graph_id_core-0.1.20.tar.gz.

File metadata

  • Download URL: graph_id_core-0.1.20.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for graph_id_core-0.1.20.tar.gz
Algorithm Hash digest
SHA256 f9d140a558af5a3333fbd5fc382adef09b3d242d07c8110f182dcde21dbf5a41
MD5 5b977b4fafa31be4b59d05ecba3c6913
BLAKE2b-256 ecceb3f8ddecc51c0a40eed2f161c6f59b052c17e5617f7156294b91b47b3ab5

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.20.tar.gz:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.20-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.20-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 0f04352df3a6d28d6caf3f16d87c7547911bd1653c10ba01312fddda89f20e93
MD5 0dbbf07bd7b6b4aa26e92da87ccbde85
BLAKE2b-256 5747f38c7a8317a3fc589f36cc21afff73e9b197efb87921c44a998d469ec66c

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.20-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.20-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.20-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df49959d1126a6d66938cd0520e0efbd20767acb63db41319b420d09a46b014c
MD5 1007e203121ee3261d295a6028660238
BLAKE2b-256 108c64a2fec601f0c7b546e7cb17769e49d87670b12b238f223d8143b661eafc

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.20-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.20-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.20-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 5b56cd5dbeecf4aab85d67a69f5ad84d565f45754458eaf633cab3b222591c69
MD5 5c6703f52209d409b32a7b5aae9ba553
BLAKE2b-256 6dfcb5bad176beebd137ee12f6db0a6a8cd9bff9dcd008c5c9aba3e12dbd9157

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.20-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.20-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.20-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cae83e11f9800d9f4dc46512beb7e3161375970524b3a342def9d621cb13c5df
MD5 5f9f4599733c062ef53b378368379680
BLAKE2b-256 d962dd0efd7e69ea8d6fb8d563a40130316ee338032300cfe75cf197e45ccec5

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.20-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.20-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.20-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 3699889bf86864fcde8053b1dd68235a0e47a97166506094b9c87e743dda78d3
MD5 6141d6bece4421c6c319f1952f9aa2bd
BLAKE2b-256 97239c4ee1d2286eab25c8760ddf09ddd62ebc9cb744245cbaa2a23111a54d6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.20-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.20-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.20-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 411b5aacc7cf29ca53c1c7de8e1053c61a44dedf674e9413f9443dbc43dc04a0
MD5 8770fc200d70e332d6037c077d766937
BLAKE2b-256 85d4b3b4b5487f465af54d36e48f48f55b544187bbffbd56abaccd866d0e956f

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.20-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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