Skip to main content

Package for reading of .xyz files and constructing of molecular graphs from atomic coordinates.

Project description

xyz2graph

PyPI version Python Version License Documentation DOI Binder

GitHub Actions Workflow Status codecov

PyPI Downloads GitHub Stars GitHub Forks

A Python package to convert XYZ molecular files into NetworkX graphs with interactive 3D visualization using Plotly.

Try it live 🚀

Features

Installation

pip install xyz2graph

Requirements

  • Python 3.9+
  • Dependencies: NumPy, Plotly, NetworkX

Quick Start

import numpy as np
from xyz2graph import MolGraph

# Create molecular graph and read XYZ file
mg = MolGraph()
mg.read_xyz('molecule.xyz')

# Generate interactive 3D visualization
fig = mg.to_plotly()
fig.show()

# Convert to NetworkX graph
G = mg.to_networkx()

G.nodes[0]
# Output: {'element': 'C', 'xyz': (0.1718396797, 1.4440789224, 0.2473852864)}

G.edges[(0, 1)]
# Output: {'length': np.float64(1.49623)}

Command Line

# Save visualization as HTML
xyz2graph molecule.xyz

# Specify output file
xyz2graph molecule.xyz --output viz.html

# Open directly in browser
xyz2graph molecule.xyz --browser

Documentation

Read the documentation for guides, API reference, and examples.

Help & Discussion

🪲 Report a bug
Request a feature

Contributing

Contributions are welcome! Please see the Contributing Guide for guidelines.

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

xyz2graph-3.5.1.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

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

xyz2graph-3.5.1-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file xyz2graph-3.5.1.tar.gz.

File metadata

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

File hashes

Hashes for xyz2graph-3.5.1.tar.gz
Algorithm Hash digest
SHA256 ea49072e7818387a2dfce70030b8a2456954721ef09effb7c720c048d7cb7b71
MD5 b5a3cb448737986a5479941d20f43bbd
BLAKE2b-256 9536eb59613b201a75b705417510aa0929ef6b0b2b0c27c32bdf219f38d37b1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for xyz2graph-3.5.1.tar.gz:

Publisher: publish.yml on zotko/xyz2graph

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

File details

Details for the file xyz2graph-3.5.1-py3-none-any.whl.

File metadata

  • Download URL: xyz2graph-3.5.1-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xyz2graph-3.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8915083ad7c2a2188f923526d5d6f27e0682b2da7a959936710e7cbe86f9be04
MD5 6e51121cb438ed38c7520b9907ac4a5a
BLAKE2b-256 a0f298eeac2f7a602348cefa2256b98cb8dc8e644fff8c1f639c6b917527e30c

See more details on using hashes here.

Provenance

The following attestation bundles were made for xyz2graph-3.5.1-py3-none-any.whl:

Publisher: publish.yml on zotko/xyz2graph

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