Skip to content
forked from zotko/xyz2graph

Convert an xyz file into a molecular graph and create a 3D visualisation of the graph.

License

Notifications You must be signed in to change notification settings

chrinide/xyz2graph

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xyz2graph

xyz2graph is a Python package for reading of .xyz files and constructing of molecular graphs from atomic coordinates. The molecular graph can be converted into NetworkX graph or Plotly figure for 3D visualization in a browser window or in a Jupyter notebook.

Requirements

Installation

!pip install -i https://test.pypi.org/simple/ xyz2graph

Usage

from xyz2graph import MolGraph, to_networkx_graph, to_plotly_figure
from plotly.offline import offline

# Create the MolGraph object
mg = MolGraph()

# Read the data from the .xyz file
mg.read_xyz('path/molecule.xyz')

# Create the Plotly figure object
fig = to_plotly_figure(mg)

# Plot the figure
offline.plot(fig)

# Convert the molecular graph to the NetworkX graph
G = to_networkx_graph(mg)

Usage in Jupyter Notebook

from xyz2graph import MolGraph, to_networkx_graph, to_plotly_figure
from plotly.offline import init_notebook_mode, iplot

# Initiate the Plotly notebook mode
init_notebook_mode(connected=True)

# Create the MolGraph object
mg = MolGraph()

# Read the data from the .xyz file
mg.read_xyz('path/molecule.xyz')

# Create the Plotly figure object
fig = to_plotly_figure(mg)

# Plot the figure
iplot(fig)

About

Convert an xyz file into a molecular graph and create a 3D visualisation of the graph.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%