# Visualizing System objects¶

In this notebook, experimental plotting methods of pyscal is illustrated. The plotting functionality works only through jupyter notebooks or jupyter lab. It depends on ipywidgets and plotly to render the output. There is some extra configuration that needs to be done which can be found here.

In short, for jupyter lab (>3):

pip install "jupyterlab>=3" "ipywidgets>=7.6"
pip install jupyter-dash


In notebooks:

pip install "notebook>=5.3" "ipywidgets>=7.5"


We start by importing the necessary modules

[1]:

import pyscal as pc


Now we can set up a system and read in a file to be visualized

[2]:

sys = pc.System()


We will further calculate some q values and also the solid particles in the system which will be used later for visualization

[3]:

sys.find_neighbors(method="cutoff", cutoff=0)
sys.calculate_q([4, 5, 6], averaged=True)
sys.find_solids()

[3]:

448


In order to visualize the system, the show method can be used. This method renders a widget which a slider for the radius of atoms and a text box for entering the colormap to be used for coloring atoms. A list of colormaps can be found here. The widget also has a Render plot button which will generate the plot.

[4]:

sys.show()


This is just a general rendering of the system. Further customization can be done. For example, we can color the atoms using the averaged q6 values.

[5]:

sys.show(colorby="aq6")


We can also select which atoms are to be plotted. For example we can refine the figure to only plot the atoms that are identified as solid in the find_solids method.

[6]:

sys.show(colorby="aq6", filterby="solid")


Any atom property can used to color the map. These include any Atom attribute, calculated q values which can be accessed by qx or aqx, for traditional and averaged Steinhardts parameters respectively. x stands for the number of q. It can also be attributes that are stored in the Atom.custom variable. In the above code bit, when the file was read in, the custom variable was used to read in the velocities for each atom. We will color atoms using the velocity in x direction, that is vx attribute.

[7]:

sys.show(colorby="vx")