Skip to main content

No project description provided

Project description

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.

Developer's notes

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 run pytest

If you changed C++ codes, poetry install again to reflect the changes.

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.13.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.13-cp312-cp312-win_amd64.whl (261.7 kB view details)

Uploaded CPython 3.12Windows x86-64

graph_id_core-0.1.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (304.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

graph_id_core-0.1.13-cp312-cp312-macosx_15_0_arm64.whl (251.5 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

graph_id_core-0.1.13-cp311-cp311-win_amd64.whl (261.1 kB view details)

Uploaded CPython 3.11Windows x86-64

graph_id_core-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (306.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

graph_id_core-0.1.13-cp311-cp311-macosx_15_0_arm64.whl (252.2 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for graph_id_core-0.1.13.tar.gz
Algorithm Hash digest
SHA256 3e19a3bcc24767217391706987e237fdc1e185544a8d315bfa3a78ff63499402
MD5 303c295bdbc70139057a5e92660534e9
BLAKE2b-256 a7670ee60224f8bf6e2f455ec6833bd48b0408e6d61b77ab9a86f06e8b6ad74e

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.13.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.13-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b2f39d233073639b7801a9d3a5565149c403d155cf8efdbaf5772e6666533261
MD5 5da6abfac835852804a5c073d09b6bde
BLAKE2b-256 38a8132a08232ecd8a323e7eac6e4f869be53da2d9a7493fae550c30532cc01b

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.13-cp312-cp312-win_amd64.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.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1c1dc89ad49e14ab14e204afe5ff9d8931b05307e96f1a643796e574d1d8d58
MD5 a23083bdb9508a3a906bd5bc238ba639
BLAKE2b-256 c441db48a67389b2ba37dcb8f1bf7b1c10d0a187c137c9c9a41185c9f7b15d9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_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.13-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.13-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 9f147d46f71484f16e140ac05669dd6295027669cfc1f56ac33e4fbb2071511a
MD5 fbac23265d2fe83c4d5273f7eccf72f7
BLAKE2b-256 db5329b61a21dc0fa47e9c5f0ed19c829067bd9802314d54be2ecc7aa4590c2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.13-cp312-cp312-macosx_15_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.13-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2b0afc1ea2591535891e43a2d43405592b37bfef12bf8e9d6e5787c6afd661c2
MD5 25d97ba5f2869cb73cd2aa26c2c67655
BLAKE2b-256 0b931aacc1096027671a130f72798a44cbf00f2c8bb9a26525dd56dbb36817a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.13-cp311-cp311-win_amd64.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.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b5dddac20f4062268b19ca9f985466624d83f06a09ad04e8b099f28b69724d18
MD5 5bf04fe1d6c92bab0038c894bd74816f
BLAKE2b-256 f86942b09fc04db3ae400e66601923527c0ffc2789a811049b7511a2c228c950

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_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.13-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.13-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 af95fa74610895b7e7fa86db9deaaa1402b9980bc0865f39b1b43a665ffe9c0b
MD5 7b6ed47b1ee04b4f771e7375c622a106
BLAKE2b-256 e25d59cc748269e87897bf8d96938de94c33e63f7a4ea3d104c166900e34636e

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.13-cp311-cp311-macosx_15_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