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

Uploaded CPython 3.12Windows x86-64

graph_id_core-0.1.14-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.14-cp312-cp312-macosx_15_0_arm64.whl (251.5 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

graph_id_core-0.1.14-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.14-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.14.tar.gz.

File metadata

  • Download URL: graph_id_core-0.1.14.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.14.tar.gz
Algorithm Hash digest
SHA256 49c792b8af369d3f12910e9f7cdaad3bde000a3e9e8ec712c6f1ebfc2b9d3750
MD5 2024d8a6c11c02577b0e3431a7ea2c3b
BLAKE2b-256 1e18068a9d87846bd448a1f612259a715a2a8a7d5397f9dbd813e3143a3d7860

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for graph_id_core-0.1.14-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8b0ae7c440818094f924db186dd6122d761e2b3b40eb756cdc02e9a50b616e44
MD5 e715a8a3ecaa37801cbb21c472d5a2fd
BLAKE2b-256 c8ab0044e5dad2ffa015326c95c571355a2c483901dfd7fed1e40e882ffb295b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for graph_id_core-0.1.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 09a57f1283850c2eaf897ddc2cbd54b04edc1b083391ad45a3744d0a6cc678b2
MD5 93a01f4c085ba725cec01dadd166ff93
BLAKE2b-256 08e6e4d5c018d66ed3ad4bdf91f9dd0aeefc7b9a73f5dc67c516ce9c84789a7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.14-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.14-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.14-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 25199ba19fd5782bef072cfc06179f700e43d74426ebfe1c8f40b487fa7ffea9
MD5 4b744edee8fe622d8e7cfd29947f8c74
BLAKE2b-256 5b02cd5a9ce226f875fc2032f5c003daf281ff16e340864845952cb50e54913e

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.14-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.14-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.14-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 41239950badb7ba4a44856f016323c9acc8212cd8ca35040f30bc1844f136d1d
MD5 287ac6d6499b5467ba0326cf5a10018e
BLAKE2b-256 50cfcc531b986d2875901439011c54a3f502dfb0ce65a67fc21105fc279323cf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for graph_id_core-0.1.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ddbd89d078d4aa9e4a585cf42a4fda34d37be83285a6088bd34015f6bd872d93
MD5 74c0695d7141ebf9c8eb6e9a43c231ab
BLAKE2b-256 6468cbb9fcb43ecaa9633fad4ace3974200ec914f2429ac330fb826422a292bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.14-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.14-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.14-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 46a9fe2a249440ba5e2750f8af57e32e28ea5888dca6b9395b7a85bac72d8507
MD5 aba9b55e113113f44b6ec9bef621a5ca
BLAKE2b-256 30d968b1f041b7a78ee1c93152b800e5a16e433d4ab34073a65c19b94dbe6d87

See more details on using hashes here.

Provenance

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