Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plot Materials Structure - Pymatgen

Tags:

python

plot

vtk

Is there anyone ever use pymatgen? When I visit the official site of pymatgen. I saw the quick start tutorial. I think this package is very nice. My question is I want to plot materials structure look likes in this figure. enter image description here

I got an information from that site, to plot structures

#Visualize a structure. Requires VTK to be installed.

pmg view filename

I've download VTK. But I do not know, how to use it. I could not understand clearly.

like image 489
user46543 Avatar asked Oct 11 '25 15:10

user46543


2 Answers

Me and my colleages use pymatgen a lot but we add an external package to display pymatgen structures in jupyter notebooks called nglview.

conda install -c conda-forge nglview 

to display the structure_to_show (a pymatgen structure object):

    import nglview as nv

    view = nv.show_pymatgen(structure_to_show)
    view.add_unitcell()
    view

this can handle very large structures very fast

like image 89
setten Avatar answered Oct 14 '25 05:10

setten


Please install vtk with python support, depending on your python version on the machine.

For python 3

conda install -c clinicalgraphics vtk

For python 2

conda install -c anaconda vtk
like image 26
Jack Zhang Avatar answered Oct 14 '25 05:10

Jack Zhang