Skip to content

Viewer Settings

Every viewer takes these settings as keyword arguments, in snake_case or camelCase (show_cell=True and showCell=True are the same). Unknown names raise TypeError with a suggestion, values are validated, and a setting that does not apply to a viewer is rejected. The same names work in the JavaScript module and through setSettings messages.

from aseview import MolecularViewer

MolecularViewer(atoms, style="glossy", show_cell=True, cell_repeat={"a": [0, 1]})

aseview.settings_schema() returns the same table as data, and aseview.normalize_settings(kwargs, mode) validates a dict without building a viewer. Settings marked not in the sidebar are set when the viewer is created.

Selection

Setting Type Default Values Viewers Description
copy_format str "xyz" xyz, extxyz, cif, vasp-poscar FragSelector Text format for copying the selected and unselected atoms.

Surfaces

Setting Type Default Values Viewers Description
surface_index int 0 0 – 1000 SurfaceViewer Which surface of each frame to show when frames carry several (surface sequences). (not in the sidebar)
surface_style str "solid" solid, mesh, contour, dot SurfaceViewer Draw isosurfaces as solid, wireframe mesh, horizontal contour slices or dots.
contour_slices int 21 4 – 160 SurfaceViewer Number of horizontal slices in contour style.
surface_opacity_scale float 1 0.05 – 1 SurfaceViewer Multiplies every shell's opacity.
show_molecule bool True SurfaceViewer Draw the atoms and bonds under the surfaces.
shell_visibility dict[int, bool] — SurfaceViewer Visibility per shell keyed by index; unlisted shells are shown. (not in the sidebar)
shell_colors dict[int, str] — SurfaceViewer Color overrides per shell keyed by index. (not in the sidebar)
shell_opacities dict[int, float] — SurfaceViewer Opacity overrides per shell keyed by index. (not in the sidebar)

Vibration

Setting Type Default Values Viewers Description
mode_index int 0 0 – 100000 NormalViewer Index of the normal mode to animate.
amplitude float 0.75 0.05 – 3 NormalViewer Largest atom displacement in Å.
show_mode_vector bool False NormalViewer Draw displacement arrows for the selected mode.

Structures

Setting Type Default Values Viewers Description
align_structures bool False OverlayViewer Superimpose every structure on the first with a Kabsch rotation; off shows the original coordinates.
reorder_atoms bool True OverlayViewer Before fitting, match atoms element-wise to the first structure (for shuffled atom orders); off pairs atoms by index.
align_indices list[int] or str — OverlayViewer Atom indices of the first structure used for the fit, e.g. "0-5, 8"; empty fits on all atoms. The rotation moves the whole structure.
structure_visibility dict[int, bool] — OverlayViewer Visibility per structure keyed by index; unlisted structures use the first-three default.
structure_colors dict[int, str] — OverlayViewer Color overrides per structure keyed by index.
structure_opacities dict[int, float] — OverlayViewer Opacity per structure keyed by index.

Structure

Setting Type Default Values Viewers Description
high_performance bool False MolecularViewer Opt-in analytic atom and bond rendering for Minimal, Cartoon, Default and Glossy, with eight future trajectory frames prepared off the UI thread. Other styles and shadows use the standard renderer.
style str "cartoon" minimal, default, 2d, cartoon, neon, glossy, metallic, cinematic, bubble, rowan, grey, cartoon-v3, glossy-v3, matte-v3, metallic-v3, flat-v3, neon-v3, grey-v3 all Rendering style for atoms and bonds; the looks marked (v3) are alternative variants.
atom_size float 0.4 0.1 – 2 all Scale factor applied to covalent radii.
radius_contrast float 1 0 – 1 all How much atom sizes differ by element: 1 keeps covalent radii, 0 draws every element the same size.
radius_contrast_mode str "log" log, linear all Compress radii toward their geometric mean (log) or arithmetic mean (linear).
bond_thickness float 0.09 0.02 – 0.5 all Bond cylinder radius in Å.
shading bool True all Offset the camera light for visible shading; off lights atoms head-on (flat).

Bonds & polyhedra

Setting Type Default Values Viewers Description
show_bond bool True all Draw bonds between atoms.
bond_threshold float 1.2 0.5 – 2 all Bond if distance < scale × (sum of covalent radii), for every element pair.
custom_bond_cutoffs bool False all Advanced: set the maximum bond distance for each element pair.
bond_cutoffs dict[str, float] — all Maximum bond distance per element pair, e.g. {"C-H": 1.2}; 0 disables the pair.
show_h_bond bool False MolecularViewer Dashed H···A contacts (D, A = N, O, F; |D–A| ≤ 3.5 Å).
h_bond_threshold float 2.5 1.5 – 3.5 MolecularViewer Maximum H···A distance in Å.
show_polyhedron bool False MolecularViewer Coordination polyhedra (automatic, or from polyhedron pairs); drawn only when every vertex atom is drawn.
polyhedron_pairs list[str] — MolecularViewer Center–neighbor element pairs such as ["Ti-O"]; empty = automatic: every site with at least four neighbors that are all more electronegative (Crystal Toolkit rule).
polyhedron_neighbors str "shell" shell, bonds MolecularViewer Nearest shell: atoms within (1 + tolerance) × the closest distance, periodic images included (pretty-lattice / MinimumDistanceNN); bonds: the drawn bonds.
polyhedron_tolerance float 0.1 0 – 0.5 MolecularViewer Nearest-shell width relative to the closest neighbor distance (MinimumDistanceNN tol).
polyhedron_color_mode str "center" center, neighbor, coordination, geometry MolecularViewer Color polyhedra by center atom, neighbor atoms, coordination number or geometry.
polyhedron_opacity float 0.5 0.05 – 1 MolecularViewer Polyhedron face opacity.
show_polyhedron_edge bool True MolecularViewer Outline polyhedron edges.
show_rings bool False MolecularViewer Fill 4–8 membered rings in the color of their most common element.
ring_opacity float 0.3 0.05 – 1 MolecularViewer Ring face opacity.

Cell

Setting Type Default Values Viewers Description
show_cell bool True all Draw the periodic cell.
cell_ranges_enabled bool False all Show only whole atoms whose centers lie inside the selected reciprocal cell ranges. (not in the sidebar)
cell_boundary_planes bool False all Show translucent red, green and blue faces at the cell range boundaries. (not in the sidebar)
cell_range_a_start float 0 0 – 1 all Normalized start of the perpendicular a range across the selected cells. (not in the sidebar)
cell_range_a_end float 1 0 – 1 all Normalized end of the perpendicular a range across the selected cells. (not in the sidebar)
cell_range_b_start float 0 0 – 1 all Normalized start of the perpendicular b range across the selected cells. (not in the sidebar)
cell_range_b_end float 1 0 – 1 all Normalized end of the perpendicular b range across the selected cells. (not in the sidebar)
cell_range_c_start float 0 0 – 1 all Normalized start of the perpendicular c range across the selected cells. (not in the sidebar)
cell_range_c_end float 1 0 – 1 all Normalized end of the perpendicular c range across the selected cells. (not in the sidebar)
cell_repeat dict[str, [int, int]] {"a": [0, 0], "b": [0, 0], "c": [0, 0]} MolecularViewer, SurfaceViewer Extra cells along −/+ of a, b and c (VESTA style), e.g. {"a": [1, 1]} for 3 cells along a.
show_boundary_atoms bool False MolecularViewer, SurfaceViewer Also draw the periodic copies of atoms that sit on cell faces, edges and corners.
show_bonded_neighbors bool False MolecularViewer, SurfaceViewer Complete bonds that cross the cell boundary by drawing the bonded atom outside (one hop).

Color

Setting Type Default Values Viewers Description
color_by str "element" element, charge, magmom, fragment, structure, colormap all Atom coloring mode.
color_scheme str "jmol" jmol, cpk, pymol, vmd all Element color table.
element_colors dict[str, str] — all Per-element color overrides, e.g. {"C": "#333333"}.
normalize_charges bool False MolecularViewer Scale positive and negative values separately to their own extremes.
show_charge_labels bool False MolecularViewer Print each atom's charge/magmom next to it.
fragment_colormap str "default" default, viridis, plasma, coolwarm, jet, rainbow, grayscale MolecularViewer Deterministic palette: fragment k of n takes color k (default) or colormap position k/(n-1).
fragment_colors dict[int, str] — MolecularViewer Per-fragment color overrides keyed by fragment index.
overlay_colormap str "viridis" viridis, plasma, coolwarm, jet, rainbow, grayscale OverlayViewer Structure k of n takes colormap position k/(n-1).
background_color str (#rrggbb) "#ffffff" all Canvas background color.

Visibility

Setting Type Default Values Viewers Description
show_annotations bool True MolecularViewer Draw active molecular annotation boxes and captions.
annotation_color str (#rrggbb) "#f59e0b" MolecularViewer Box stroke color when an annotation has no color override.
annotation_line_width int 3 1 – 8 MolecularViewer Annotation box stroke width in CSS pixels.
annotation_padding int 8 0 – 32 MolecularViewer Space around the projected atom radii in CSS pixels.
annotation_font_size int 14 8 – 32 MolecularViewer Annotation caption font size in CSS pixels.
opacity float 1 0 – 1 all Whole-structure atom and bond opacity.
custom_element_appearance bool True all Apply per-element visibility and opacity; turn off to use global opacity while retaining element settings.
element_visibility dict[str, bool] — all Per-element visibility keyed by case-sensitive symbol; hiding retains the element opacity.
element_opacities dict[str, float] — all Per-element opacity keyed by case-sensitive symbol; multiplied with global, structure and fragment opacity.
fragment_opacities dict[int, float] — MolecularViewer Per-fragment opacity keyed by fragment index; multiplied with opacity.
hide_hydrogens bool False all Hide hydrogen atoms and their bonds.
show_forces bool False MolecularViewer Draw force arrows.
force_scale float 1 0.1 – 10 MolecularViewer Arrow length per eV/Å.
show_constraint bool False MolecularViewer Mark atoms fixed by ASE constraints.

View

Setting Type Default Values Viewers Description
trajectory_framing str "first" first, all MolecularViewer Fit a fixed camera extent to the first frame or all loaded trajectory frames; advancing frames does not refit the camera.
show_atom_indices bool False all Show zero-based atom indices at the centers of visible atoms.
projection str "orthographic" orthographic, perspective all Camera projection.
rotation_mode str "trackball" trackball, orbit all Trackball rotates freely about the screen axes; orbit turns the structure about its up axis like a turntable.
layout str "single" single, grid all Single view, or a 2x2 grid of four tetrahedral views that rotate together.
theme str "spring" spring, simple, glass, dark, darkgreen all Interface theme, chosen when the viewer is created (theme=... in Python). (not in the sidebar)
chrome str "full" full, minimal all full: sidebar and toolbar; minimal: only the structure and the player (LiteViewer, view()). (not in the sidebar)
view_preset str "auto" auto, x, y, z, a, b, c all Starting camera direction: along x/y/z, or along the a/b/c lattice vectors; auto uses a for crystals and the (1, 1, 1) diagonal for molecules. (not in the sidebar)
view_direction [float, float, float] — all Initial direction from the structure toward the camera, e.g. [1, 1, 1]; overrides the automatic preset. (not in the sidebar)
view_up [float, float, float] — all Screen-up direction for viewDirection; defaults to +y, or +z when looking along y. (not in the sidebar)
show_shadow bool False all Atoms and bonds cast shadows from the key light.
show_blur bool False all Soft blur over the canvas (also applied to PNG export).
blur_strength float 1.5 0.5 – 8 all Blur radius in CSS pixels.
show_axis bool True all Show the XYZ axis indicator.
show_energy_plot bool False MolecularViewer Plot energy per frame; click the plot to jump to a frame.
show_force_max_plot bool True MolecularViewer Add the largest atomic force per frame (right axis, eV/Å) to the energy plot.

Animation

Setting Type Default Values Viewers Description
fps int 20 1 – 60 all Playback speed.