coflandscaper.VisualizeCOF

class coflandscaper.VisualizeCOF(width=800, height=600, background='white', style='stick')[source]

Visualize optimized COF structures with py3Dmol.

The viewer can render single files, folders, or selected mode outputs and supports optional supercell expansion before display.

Attributes

background

height

style

width

Methods

view

Visualize every CIF in one folder and return py3Dmol views.

visualize_cof

Visualize optimized COF structures for the selected stacking mode(s).

visualize_single_layer

Visualize all single-layer CIFs in one folder.

Parameters:
view(folder, add_unit_cell=True, style=None, print_names=True)[source]

Visualize every CIF in one folder and return py3Dmol views.

Parameters:
  • folder (str | Path) – Folder containing CIF files.

  • add_unit_cell (bool) – If True, draw the unit cell. Defaults to True.

  • style (str | dict[str, Any] | None) – Optional style override. Defaults to None (uses instance default style).

  • print_names (bool) – If True, print filenames during rendering. Defaults to True.

Returns:

List of py3Dmol view objects.

Raises:
visualize_cof(cof_name, mode='both', input_base=None, dft=False, add_unit_cell=True, supercell_size_serr=(2, 2, 1), supercell_size_incl=(2, 2, 2))[source]

Visualize optimized COF structures for the selected stacking mode(s).

Parameters:
  • cof_name (str) – COF name used for folder naming.

  • mode (str) – Mode selector. Allowed values are “incl”, “serr”, or “both”. Defaults to “both”.

  • input_base (str | Path | None) – Optional base folder containing per-mode subfolders. Defaults to None (uses {cof_name}/4_{cof_name}_optimization).

  • dft (bool) – If True, read structures from dft_{mode} subfolders. Defaults to False.

  • add_unit_cell (bool) – If True, draw the unit cell. Defaults to True.

  • supercell_size_serr (tuple[int, int, int]) – Supercell size for serrated structures. Defaults to (2, 2, 1).

  • supercell_size_incl (tuple[int, int, int]) – Supercell size for inclined structures. Defaults to (2, 2, 2).

Returns:

List of py3Dmol views.

Notes

Viewer appearance is fixed to defaults (width=800, height=600, background=”white”, style=”stick”).

visualize_single_layer(input_folder='1_ILCOF-1_single_layer', add_unit_cell=True, supercell_size=(2, 2, 1))[source]

Visualize all single-layer CIFs in one folder.

Parameters:
  • input_folder (str | Path) – Folder containing single-layer .cif files. Defaults to “1_ILCOF-1_single_layer”.

  • add_unit_cell (bool) – If True, draw the unit cell. Defaults to True.

  • supercell_size (tuple[int, int, int]) – Supercell size applied before visualization. Defaults to (2, 2, 1).

Returns:

List of py3Dmol views.

Notes

  • No mode argument is used.

  • All .cif files are read directly from input_folder (no subfolder traversal).

  • ILS is computed with inclined logic for reporting.