uppasd_tools.visualize
- uppasd_tools.visualize.plot_supercell(uppout: UppOut, x='x', y='y', z='z', type_col='at_type', width=700, height=500, scale=0.15, rotation='0x,0y,0z', xlim: tuple[float | None, float | None] | None = None, ylim: tuple[float | None, float | None] | None = None, zlim: tuple[float | None, float | None] | None = None, type_to_symbol=None, symbol_to_color=None, symbol_to_scale=None, show_axes=False)
Render atoms from UppOut coord data using ASE (static matplotlib plot).
- Returns:
Figure and axes.
- Return type:
tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]
- uppasd_tools.visualize.view_to_png(view, output_path: str | Path, width: int = 700, height: int = 500, wait_ms: int = 1000) Path
Render a py3Dmol view to a PNG using Playwright.
- Requires Playwright to be installed:
pip install playwright playwright install chromium
- async uppasd_tools.visualize.view_to_png_async(view, output_path: str | Path, width: int = 700, height: int = 500, wait_ms: int = 1000) Path
Render a py3Dmol view to a PNG using Playwright (async).
- uppasd_tools.visualize.visualize_final_config(uppout: UppOut, ens_index=0, x='x', y='y', z='z', type_col='at_type', width=700, height=500, scale=0.15, orthographic=True, xlim: tuple[float | None, float | None] | None = None, ylim: tuple[float | None, float | None] | None = None, zlim: tuple[float | None, float | None] | None = None, type_to_symbol=None, symbol_to_color=None, symbol_to_scale=None, show_sticks=False, stick_radius=0.08, mom_length=0.3, mom_radius=0.05, mom_color='gray', rotate=None)
Render atoms and magnetic moments from an UppOut final configuration using py3Dmol.
- Parameters:
uppout (UppOut) – An instance of the UppOut class containing parsed output data.
ens_index (int) – Index of the configuration to visualize (default first).
x (str) – Column names for the x, y, z coordinates.
y (str) – Column names for the x, y, z coordinates.
z (str) – Column names for the x, y, z coordinates.
type_col (str) – Column name for the atom type.
width (int) – Dimensions of the 3D view.
height (int) – Dimensions of the 3D view.
scale (float) – Base scale for atom spheres.
orthographic (bool) – Whether to use orthographic projection.
xlim (tuple[float | None, float | None] | None) – Optional axis limits.
ylim (tuple[float | None, float | None] | None) – Optional axis limits.
zlim (tuple[float | None, float | None] | None) – Optional axis limits.
type_to_symbol (dict) – Mapping from atom type to element symbol (or pseudo-symbol).
symbol_to_color (dict) – Optional mapping from symbol to color.
symbol_to_scale (dict) – Optional mapping from symbol to scale.
show_sticks (bool) – Whether to show sticks between atoms.
stick_radius (float) – Radius of the sticks if shown.
mom_length (float) – Arrow length for magnetic moments.
mom_radius (float) – Arrow radius for magnetic moments.
mom_color (str) – Arrow color for magnetic moments.
rotate (tuple[float, float, float] | None) – Rotation angles (deg) around x, y, z.
- Returns:
A py3Dmol view object with the rendered atoms and moments.
- Return type:
py3Dmol.view
- uppasd_tools.visualize.visualize_supercell(uppout: UppOut, x='x', y='y', z='z', type_col='at_type', width=700, height=500, scale=0.15, orthographic=True, xlim: tuple[float | None, float | None] | None = None, ylim: tuple[float | None, float | None] | None = None, zlim: tuple[float | None, float | None] | None = None, type_to_symbol=None, symbol_to_color=None, symbol_to_scale=None, show_sticks=False, stick_radius=0.08, rotate=None)
Render atoms from UppOut coord data using py3Dmol.
- Parameters:
uppout (UppOut) – An instance of the UppOut class containing parsed output data.
x (str) – Column names for the x, y, z coordinates.
y (str) – Column names for the x, y, z coordinates.
z (str) – Column names for the x, y, z coordinates.
type_col (str) – Column name for the atom type.
width (int) – Dimensions of the 3D view.
height (int) – Dimensions of the 3D view.
scale (float) – Base scale for atom spheres.
orthographic (bool) – Whether to use orthographic projection.
xlim (tuple[float | None, float | None] | None) – Optional axis limits.
ylim (tuple[float | None, float | None] | None) – Optional axis limits.
zlim (tuple[float | None, float | None] | None) – Optional axis limits.
type_to_symbol (dict) – Mapping from atom type to element symbol (or pseudo-symbol).
symbol_to_color (dict) – Optional mapping from symbol to color.
symbol_to_scale (dict) – Optional mapping from symbol to scale.
show_sticks (bool) – Whether to show sticks between atoms.
stick_radius (float) – Radius of the sticks if shown.
rotate (tuple[float, float, float] | None) – Rotation angles (deg) around x, y, z.
- Returns:
A py3Dmol view object with the rendered atoms.
- Return type:
py3Dmol.view