This module contains widgets to perform selected tasks such as viewing/modifying plots interactively. Use Jupyterlab>=3, Notebook or VS Code, Google Colab may not work! For troubleshooting plotly's FigureWidget see Plotly's help

  Index 
  Example 
  StaticPlots 
  InteractivePlots 
  SpinProjectedSurfaces 
  StructureIO 
  Widgets● 
  MainAPI 

css_style[source]

css_style(colors_dict, _class='main_wrapper')

Return style based on colors_dict available as pp.light_colors, pp.dark_colors etc

get_files_gui[source]

get_files_gui(auto_fill='vasprun.xml', theme_colors=None, height=320)

  • Creates a GUI interface for files/folders filtering.
  • Parmeters
    • auto_fill : Default is vasprun.xml, any file/folder.
    • theme_colors : None,Any of pivotpy.[dark,light,simple]_colors.
    • height : Height of Grid box.
  • Returns
    • Tuple(GUI_gridbox,Files_Dropdown). Access second one by item itself.
full_box,files_w = get_files_gui(theme_colors=light_colors,height=400)

class InputGui[source]

InputGui(sys_info=None, theme_colors=None, height=400)

generate_summary[source]

generate_summary(paths_list=None)

class VasprunApp[source]

VasprunApp(height=610)

Display a GUI for vasp output analysis. self.theme_colors can be used to edit custom theme.

Usage Example

import pivotpy as pp
va = pp.VasprunApp()
va.set_options(
    cache_data = False, #Turn off cache globally.
    mode = 'bands', #Change graph mode from 'markers' to 'bands'. Setting it to 'lines' is not recommended in live graph, it could hang all UI.
    interp_nk = dict(n = 2, k = 2), #Add 2 points between data points with quadratic interpolation.
)
va.show() #Displays App and do work!
va.theme_colors = pp.dark_colors #Set theme to dark externally and edit dictionary values to make your own theme
va.splot(**kwargs) #Get matplotlib plot of current data.
va.df #After you do some analysis and hit `Project Summary` button, get DataFrame or directly by.df
va.fig #Get current fig in Notebook cell.
va = VasprunApp()
# va.set_options(cache_data = False, mode= 'markers')  
# va.show()
va.set_theme_colors({'next_bg': 'whitesmoke',
 'hover_bg': 'skyblue',
 'accent': 'black',
 'main_bg': 'white',
 'main_fg': 'black'})

App Attributes

Note: If you used pivotpy.sio.get_kpath for generating KPOINTS file, your kticks will be automatically filled. If not, you can still add this example string at end of first line of first KPOINTS file with your own values, (not required in all KPOINST files, one time fill is enough if whole project is based on same kpath) [Do not modify names of variables!].
HSK-INDS = [0, 29, -1], LABELS = ['M', 'Γ|M', 'L'], SEG-INDS = [21, 29]

va = VasprunApp()
va.input # is dictionary which is unpacked in plot arguments.
va.result # is what you see in table. 
va.fig # is current figure.  
va.set_options(
    cache_data = False, #Turn off cache globally.
    mode = 'bands', #Change graph mode from 'markers' to 'bands'. Setting it to'lines' is not recommended in live graph, it could hang all UI.
    interp_nk = dict(n = 2, k = 2), #Add 2 points between data points withquadratic interpolation.
    **kwargs
) 
va.iplot # and 
va.splot # give current figure(detached) and its matplotlib figure respectively. Their `kwargs` correspond to current figure's command e.g if `Bands` figure is there, `kwargs` are passed to `iplot_rgb_lines` for `va.iplot` and to `splot_rgb_lines` for `va.splot`.

Almost every other attribute is a gui or collection of widgets. E.g. va.dds is dictionary that contains all dropdowns in app. Make sure to not change any key in any dictionary, if done by mistake use, dictionary.pop(key,None).

Edit Custom Theme

You can set va.set_theme_colors(<va.theme_colors after edit>) and then apply Custom from theme dropdown to display theme of your choice. Used CSS-compatible color values only.

Extend Functionality (Example: Save Matplotlib's figure on clicking Update/Latest Graph)

You can extend app as you choose, see how it saves a figure on button(within app) click.

import pivotpy as pp
import ipywidgets as ipw, os

va = pp.VasprunApp()
va.show() 

#Create Additional Functionality 
out = ipw.Output()

@out.capture(clear_output=True, wait=True)
def update_mpl(change): 
    if change:
        va.splot(colorbar=False)
        path = os.path.join(os.path.dirname(va.path),'mpl_plot.png')
        pp.savefig(path,transparent=True,dpi=600) #Prevents overwiting existing files
        pp._show()
        print(va.data.sys_info.incar)
va.buttons['load_graph'].on_click(update_mpl)   
out

class KPathApp[source]

KPathApp(path='POSCAR')

View and trace path on BZ.

  • Usage

    ka = KPathApp() ka.show() #Display app ka.splot() #get matplotlib figure

#ka.show()

Interactive Rich Slides in Jupyter Notebook

Navigate to ipyslides or do pip install ipyslides to create beautiful data driven presentation in Jupyter Notebook.

  Index 
  Example 
  StaticPlots 
  InteractivePlots 
  SpinProjectedSurfaces 
  StructureIO 
  Widgets● 
  MainAPI