Structures Example

This section combines both the GAM structure generation and the structure generator examples into one unified tutorial.


🧱 PyGamLab structures Module — General Overview

The structures module in PyGamLab serves as the core framework for creating, manipulating, and visualizing atomic and molecular systems. It provides a consistent and extensible platform for generating nanomaterials and atomic-scale architectures across all dimensionalities — from zero-dimensional nanoclusters to three-dimensional bulk crystals.

The module is divided into two main subpackages, each addressing a different conceptual approach to structure generation:

GAM_architectures — Parametric and crystallographic atomic architectures

Generators — Dimensionality-based material builders (0D–3D)

Together, these subpackages enable researchers to explore a wide range of materials, from idealized lattice-based nanostructures to realistic, defect-containing systems.

Visualization tips:

efficient_plotly for interactive spinning/zooming, matplotlib for static figures, pyvista for advanced 3D (may require pyvistaqt).

🧬 1. GAM_architectures

The GAM_architectures subpackage is designed for constructing geometrically and crystallographically defined nanostructures. It focuses on materials that can be described by well-ordered lattice parameters, symmetries, and periodic boundary conditions.

This package is particularly useful for theoretical modeling, electronic structure simulations, and molecular visualization of materials such as graphene, silicene, phosphorene, carbon nanotubes, and metallic nanoparticles.

🎯 Purpose:

To generate and visualize atomistic architectures that follow well-defined crystalline or quasi-crystalline geometries.

🔹 Submodules under GAM_architectures:

Submodule Description

Graphene

Generates graphene sheets and related carbon-based 2D materials with customizable edge types (armchair, zigzag) and lattice parameters.

Silicene

Builds silicene structures, a silicon-based 2D analog of graphene with buckled geometry and tunable lattice constants.

Phosphorene

Constructs phosphorene nanosheets with adjustable dimensions, edge types, and puckering height.

Nanoparticles

Creates metallic and bimetallic nanoparticles with variable size, shape, and elemental distribution.

Nanotubes

Generates carbon nanotubes (SWCNT, MWCNT) and their doped or defected variants using chiral indices (n, m).

These modules are ideal for studying electronic, mechanical, and optical properties of low-dimensional nanostructures within a precisely defined atomic framework.

🧩 Category 1: Graphene Structures

Graphene is a two-dimensional nanomaterial consisting of a single layer of carbon atoms arranged in a hexagonal (honeycomb) lattice. Each carbon atom is bonded to three neighboring atoms through strong sp² hybridized covalent bonds. Graphene exhibits extraordinary electrical, mechanical, and thermal properties, making it one of the most promising materials for applications in nanoelectronics, sensors, and energy storage devices.

In this section, we use the PyGamLab package to generate different graphene sheets by adjusting parameters such as edge type, lattice constant, and sheet dimensions (width and length). Finally, each structure is visualized in several formats using the Molecular_Visualizer tool.

Notes about parameter conventions used here

lattice_constant is in Å (ångström).

width and length are given as number of unit cells in each lattice direction (dimensionless).

Approximate physical size (coarse estimate) = width × lattice_constant and length × lattice_constant (reported in Å and nm).

🔹 Example 1 – Graphene Sheet with Armchair Edge, width=10, length=10, default lattice (≈2.46 Å)

In this example, a graphene sheet is generated with Armchair-type edges, which correspond to a specific direction along the hexagonal lattice. Armchair edges typically appear smoother and more stable, and they exhibit different electronic properties compared to zigzag edges.

This configuration is useful for studying pristine graphene sheets or semiconducting armchair nanoribbons.

from PyGamLab.structures.GAM_architectures.GAM_Graphene import Graphene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Graphene(width=10, length=10, edge_type='armchair')
graphene1=builder.atoms

Molecular_Visualizer(graphene1,format='efficient_plotly')
Molecular_Visualizer(graphene1,format='matplotlib')
Molecular_Visualizer(graphene1,format='pyvista')
Visualizing 45 atoms using efficient_plotly format...
../_images/gam_st_4_1.png
Visualizing 45 atoms using matplotlib format...
../_images/gam_st_4_3.png
Visualizing 45 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_4_6.png

🔹 Example 2 – Graphene Sheet with Zigzag Edge, width=10, length=10, default lattice (≈2.46 Å)

Here, the graphene sheet is created with zigzag-type edges. Zigzag edges are known for producing localized edge states that can lead to magnetic behavior or enhanced chemical reactivity.

The sheet has a similar size to Example 1, but the atomic arrangement along the edges differs significantly.

This type of model is ideal for exploring edge magnetism and electron localization in graphene nanoribbons.

from PyGamLab.structures.GAM_architectures.GAM_Graphene import Graphene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Graphene(width=10, length=10, edge_type='zigzag')
graphene2=builder.atoms

Molecular_Visualizer(graphene2,format='efficient_plotly')
Molecular_Visualizer(graphene2,format='matplotlib')
Molecular_Visualizer(graphene2,format='pyvista')
Visualizing 45 atoms using efficient_plotly format...
../_images/gam_st_6_1.png
Visualizing 45 atoms using matplotlib format...
../_images/gam_st_6_3.png
Visualizing 45 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_6_6.png

🔹 Example 3 – Zigzag Graphene Sheet, width=5, length=5, lattice_constant=2.5 Å

In this case, a smaller graphene sheet is generated with zigzag edges and a slightly stretched lattice constant (2.5 Å). This effectively applies a small tensile strain (~1.6%) to the lattice, which can shift the electronic band structure or phonon properties.

It represents a compact, strained graphene cluster suitable for testing the effects of lattice deformation.

from PyGamLab.structures.GAM_architectures.GAM_Graphene import Graphene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Graphene(width=5, length=5, edge_type='zigzag',lattice_constant=2.5)
graphene3=builder.atoms

Molecular_Visualizer(graphene3,format='efficient_plotly')
Molecular_Visualizer(graphene3,format='matplotlib')
Molecular_Visualizer(graphene3,format='pyvista')
Visualizing 12 atoms using efficient_plotly format...
../_images/gam_st_8_1.png
Visualizing 12 atoms using matplotlib format...
../_images/gam_st_8_3.png
Visualizing 12 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_8_6.png

🔹 Example 4 – Armchair Graphene Sheet, width=5, length=5, lattice_constant=2.5 Å

This example is similar to the previous one but uses armchair edges instead of zigzag. By keeping the same size and lattice constant, you can directly compare the structural and potential electronic differences between the two edge configurations.

Such comparisons are valuable in edge-dependent studies or nanoribbon bandgap analyses.

from PyGamLab.structures.GAM_architectures.GAM_Graphene import Graphene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Graphene(width=5, length=5, edge_type='armchair',lattice_constant=2.5)
graphene4=builder.atoms

Molecular_Visualizer(graphene4,format='efficient_plotly')
Molecular_Visualizer(graphene4,format='matplotlib')
Molecular_Visualizer(graphene4,format='pyvista')
Visualizing 12 atoms using efficient_plotly format...
../_images/gam_st_10_1.png
Visualizing 12 atoms using matplotlib format...
../_images/gam_st_10_3.png
Visualizing 12 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_10_6.png

🔹 Example 5 – Elongated Armchair Nanoribbon, width=20, length=5, lattice_constant=2.5 Å

In this example, an elongated armchair graphene nanoribbon is created. This geometry mimics a quasi–one-dimensional ribbon, useful for studying quantum confinement and transport properties along the ribbon axis.

This structure combines manageable size with realistic nanoscale proportions.

It’s particularly suitable for exploring how ribbon width influences bandgap and conductivity.

from PyGamLab.structures.GAM_architectures.GAM_Graphene import Graphene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Graphene(width=20, length=5, edge_type='armchair',lattice_constant=2.5)
graphene5=builder.atoms

Molecular_Visualizer(graphene5,format='efficient_plotly')
Molecular_Visualizer(graphene5,format='matplotlib')
Molecular_Visualizer(graphene5,format='pyvista')
Visualizing 42 atoms using efficient_plotly format...
../_images/gam_st_12_1.png
Visualizing 42 atoms using matplotlib format...
../_images/gam_st_12_3.png
Visualizing 42 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_12_6.png

⚛️ Category 2 — Silicene

Silicene is a two-dimensional (2D) allotrope of silicon, structurally similar to graphene but with key differences. While graphene is perfectly flat, silicene exhibits a slight buckling due to the larger size of silicon atoms and their partial sp³ hybridization. This buckling introduces a tunable electronic bandgap, making silicene promising for nanoelectronics, sensors, and spintronic devices.

In this section, we will generate and visualize several silicene sheets with varying edge types, dimensions, and buckling heights using PyGamLab.

🔹 Example 1 – Silicene Sheet with Armchair Edge, width=10, length=10, default buckling (≈0.44 Å)

In this example, a silicene sheet is created with armchair-type edges. Armchair edges, similar to those in graphene, produce smoother terminations with relatively uniform electronic density along the boundary.

The default buckling height (~0.44 Å) is automatically applied to mimic the out-of-plane displacement of silicon atoms.

Such configurations are often used to study strain effects or bandgap modulation in armchair silicene nanoribbons.

from PyGamLab.structures.GAM_architectures.GAM_sillicene import Silicene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Silicene(width=10, length=10, edge_type='armchair')
silicene1=builder.atoms

Molecular_Visualizer(silicene1,format='efficient_plotly')
Molecular_Visualizer(silicene1,format='matplotlib')
Molecular_Visualizer(silicene1,format='pyvista')
Visualizing 98 atoms using efficient_plotly format...
../_images/gam_st_15_1.png
Visualizing 98 atoms using matplotlib format...
../_images/gam_st_15_3.png
Visualizing 98 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_15_6.png

🔹 Example 2 – Silicene Sheet with Zigzag Edge, width=10, length=10, default buckling (≈0.44 Å)

Here, a silicene sheet is constructed with zigzag-type edges. Zigzag terminations can produce edge-localized states similar to graphene, but due to silicene’s buckling, they may also lead to spin-polarized edge currents.

The model is square-shaped and represents a balanced structure between size and computational efficiency.

It’s especially useful for investigating edge magnetism or electronic asymmetry between the two sublattices.

from PyGamLab.structures.GAM_architectures.GAM_sillicene import Silicene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Silicene(width=10, length=10, edge_type='zigzag')
silicene2=builder.atoms

Molecular_Visualizer(silicene2,format='efficient_plotly')
Molecular_Visualizer(silicene2,format='matplotlib')
Molecular_Visualizer(silicene2,format='pyvista')
Visualizing 98 atoms using efficient_plotly format...
../_images/gam_st_17_1.png
Visualizing 98 atoms using matplotlib format...
../_images/gam_st_17_3.png
Visualizing 98 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_17_6.png

🔹 Example 3 – Zigzag Silicene Sheet, width=5, length=10, default buckling (≈0.44 Å)

This smaller rectangular silicene sheet features zigzag edges along one axis. The asymmetric geometry allows simulation of directional electronic transport or anisotropic strain.

The reduced width introduces stronger quantum confinement effects, while the zigzag edge enhances the potential for spin-polarized states. Such structures model realistic silicene nanoribbons used in transistor-scale simulations.

from PyGamLab.structures.GAM_architectures.GAM_sillicene import Silicene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Silicene(width=5, length=10, edge_type='zigzag')
silicene3=builder.atoms

Molecular_Visualizer(silicene3,format='efficient_plotly')
Molecular_Visualizer(silicene3,format='matplotlib')
Molecular_Visualizer(silicene3,format='pyvista')
Visualizing 70 atoms using efficient_plotly format...
../_images/gam_st_19_1.png
Visualizing 70 atoms using matplotlib format...
../_images/gam_st_19_3.png
Visualizing 70 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_19_6.png

🔹 Example 4 – Zigzag Silicene Sheet, width=5, length=5, buckling_height=0.2 Å

In this case, a smaller silicene sheet is generated with reduced buckling (0.2 Å). This adjustment flattens the structure closer to a graphene-like geometry, reducing the influence of sp³ hybridization.

Smaller buckling values can simulate external pressure, substrate effects, or thermal flattening. This configuration helps explore how lattice planarity influences bandgap closure or electron mobility.

from PyGamLab.structures.GAM_architectures.GAM_sillicene import Silicene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Silicene(width=5, length=5, edge_type='zigzag',buckling_height=0.2)
silicene4=builder.atoms

Molecular_Visualizer(silicene4,format='efficient_plotly')
Molecular_Visualizer(silicene4,format='matplotlib')
Molecular_Visualizer(silicene4,format='pyvista')
Visualizing 50 atoms using efficient_plotly format...
../_images/gam_st_21_1.png
Visualizing 50 atoms using matplotlib format...
../_images/gam_st_21_3.png
Visualizing 50 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_21_6.png

🔹 Example 5 – Zigzag Silicene Sheet, width=5, length=5, buckling_height=0.4 Å

This example increases the buckling height to 0.4 Å, creating a more realistic silicene surface with pronounced out-of-plane distortion. Higher buckling enhances spin–orbit coupling and can induce a small topological bandgap, relevant for quantum spin Hall effect studies.

The sheet’s size remains compact for quick visualization and computational analysis. It’s an excellent model to compare directly with the flatter configuration in Example 4.

from PyGamLab.structures.GAM_architectures.GAM_sillicene import Silicene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Silicene(width=5, length=5, edge_type='zigzag',buckling_height=0.4)
silicene5=builder.atoms

Molecular_Visualizer(silicene5,format='efficient_plotly')
Molecular_Visualizer(silicene5,format='matplotlib')
Molecular_Visualizer(silicene5,format='pyvista')
Visualizing 50 atoms using efficient_plotly format...
../_images/gam_st_23_1.png
Visualizing 50 atoms using matplotlib format...
../_images/gam_st_23_3.png
Visualizing 50 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_23_6.png

⚛️ Category 3 — Phosphorene

Phosphorene is a two-dimensional (2D) form of black phosphorus, consisting of a single or few puckered atomic layers of phosphorus atoms. Unlike flat materials such as graphene, phosphorene has a corrugated or “puckered” structure due to its sp³ hybridization, giving it highly anisotropic properties — meaning its electronic, optical, and mechanical behavior depends strongly on the direction.

Phosphorene exhibits a direct bandgap (unlike graphene’s zero bandgap) that varies with thickness, making it highly attractive for field-effect transistors (FETs), photodetectors, and thermoelectric applications. Its structural flexibility and high carrier mobility make it one of the most promising next-generation 2D semiconductors.

In this section, we generate phosphorene sheets with varying dimensions, edge orientations, and puckering heights to explore their geometric and structural differences.

🔹 Example 1 – Phosphorene Sheet with Armchair Edge, width=10, length=10, default puckering height (≈2.1 Å)

In this example, a phosphorene monolayer is constructed with armchair-type edges and a default puckering height of approximately 2.1 Å. This structure displays the characteristic ridged geometry of phosphorene, where alternating atoms are displaced vertically, forming a wavy surface.

With both width and length set to 10, the sheet is a balanced model for visualizing atomic arrangement and simulating isotropic deformation.

Armchair edges in phosphorene typically yield smoother electronic transitions and are less reactive than zigzag edges.

from PyGamLab.structures.GAM_architectures.GAM_phosphorene import Phosphorene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Phosphorene(width=10, length=10, edge_type='armchair')
phosphorene1=builder.atoms

Molecular_Visualizer(phosphorene1,format='efficient_plotly')
Molecular_Visualizer(phosphorene1,format='matplotlib')
Molecular_Visualizer(phosphorene1,format='pyvista')
Visualizing 35 atoms using efficient_plotly format...
../_images/gam_st_26_1.png
Visualizing 35 atoms using matplotlib format...
../_images/gam_st_26_3.png
Visualizing 35 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_26_6.png

🔹 Example 2 – Armchair Phosphorene Sheet, width=5, length=10, default puckering height (≈2.1 Å)

Here, a rectangular phosphorene sheet is created with reduced width (5) but the same length (10), making it narrower in one direction and useful for studying directional strain and anisotropic electronic transport.

The armchair edge configuration maintains stable bonding, while the smaller width enhances quantum confinement effects — an important factor in designing nanoscale phosphorene ribbons.

from PyGamLab.structures.GAM_architectures.GAM_phosphorene import Phosphorene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Phosphorene(width=5, length=10, edge_type='armchair')
phosphorene2=builder.atoms

Molecular_Visualizer(phosphorene2,format='efficient_plotly')
Molecular_Visualizer(phosphorene2,format='matplotlib')
Molecular_Visualizer(phosphorene2,format='pyvista')
Visualizing 18 atoms using efficient_plotly format...
../_images/gam_st_28_1.png
Visualizing 18 atoms using matplotlib format...
../_images/gam_st_28_3.png
Visualizing 18 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_28_6.png

🔹 Example 3 – Zigzag Phosphorene Sheet, width=10, length=10, default puckering height (≈2.1 Å)

This model represents a phosphorene sheet with zigzag-type edges, which differ significantly from armchair terminations. Zigzag edges in phosphorene often show enhanced edge reactivity and can localize electronic states at the boundaries.

The sheet size (10 × 10) makes it large enough to clearly display the puckered ridges across the surface. Such configurations are typically employed in studies involving edge passivation, electronic bandgap tuning, or chemical adsorption at reactive sites.

from PyGamLab.structures.GAM_architectures.GAM_phosphorene import Phosphorene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Phosphorene(width=10, length=10, edge_type='zigzag')
phosphorene3=builder.atoms

Molecular_Visualizer(phosphorene3,format='efficient_plotly')
Molecular_Visualizer(phosphorene3,format='matplotlib')
Molecular_Visualizer(phosphorene3,format='pyvista')
Visualizing 35 atoms using efficient_plotly format...
../_images/gam_st_30_1.png
Visualizing 35 atoms using matplotlib format...
../_images/gam_st_30_3.png
Visualizing 35 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_30_6.png

🔹 Example 4 – Armchair Phosphorene Sheet with Reduced Puckering, width=10, length=10, puckering_height=1.5 Å

In this case, the puckering height is explicitly reduced to 1.5 Å, producing a less corrugated phosphorene layer. This flattens the ridges slightly and can simulate substrate-induced flattening or external compression.

A smaller puckering height reduces the structural anisotropy, potentially narrowing the bandgap and improving charge carrier mobility along the armchair direction. Such modifications are relevant for strain engineering and mechanical tuning of phosphorene’s electronic behavior.

from PyGamLab.structures.GAM_architectures.GAM_phosphorene import Phosphorene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Phosphorene(width=10, length=10, edge_type='armchair',puckering_height=1.5)
phosphorene4=builder.atoms

Molecular_Visualizer(phosphorene4,format='efficient_plotly')
Molecular_Visualizer(phosphorene4,format='matplotlib')
Molecular_Visualizer(phosphorene4,format='pyvista')
Visualizing 35 atoms using efficient_plotly format...
../_images/gam_st_32_1.png
Visualizing 35 atoms using matplotlib format...
../_images/gam_st_32_3.png
Visualizing 35 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_32_6.png

🔹 Example 5 – Armchair Phosphorene Sheet with Enhanced Puckering, width=10, length=10, puckering_height=3.0 Å

In the final example, the puckering height is increased to 3.0 Å, exaggerating the corrugation of the phosphorene lattice. A larger puckering amplitude enhances out-of-plane orbital overlap and may significantly alter the effective bandgap and optical absorption characteristics.

This configuration can represent phosphorene grown under low-strain conditions or on weakly interacting substrates that allow greater structural relaxation. It’s ideal for visual studies of how puckering depth influences interlayer distance and anisotropic bonding geometry.

from PyGamLab.structures.GAM_architectures.GAM_phosphorene import Phosphorene

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Phosphorene(width=10, length=10, edge_type='armchair',puckering_height=3)
phosphorene4=builder.atoms

Molecular_Visualizer(phosphorene4,format='efficient_plotly')
Molecular_Visualizer(phosphorene4,format='matplotlib')
Molecular_Visualizer(phosphorene4,format='pyvista')
Visualizing 35 atoms using efficient_plotly format...
../_images/gam_st_34_1.png
Visualizing 35 atoms using matplotlib format...
../_images/gam_st_34_3.png
Visualizing 35 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_34_6.png

⚛️ Category 4 — Nanoparticles

Nanoparticles (NPs) are zero-dimensional (0D) nanomaterials whose dimensions typically range between 1 and 100 nanometers. At these scales, quantum confinement, surface-to-volume ratio, and atomic coordination effects become dominant — leading to unique optical, electronic, and catalytic properties that differ drastically from their bulk counterparts.

Unlike 2D materials such as graphene or silicene, which extend in two directions, nanoparticles are confined in all three spatial dimensions — giving rise to quantum confinement, size-dependent properties, and enhanced surface activity.

Because a significant fraction of atoms lie on the surface, nanoparticles often display remarkable optical, electrical, magnetic, and catalytic behaviors that differ fundamentally from their bulk counterparts. They can be composed of metals (e.g., Au, Ag, Pt), semiconductors (e.g., CdSe, ZnO), oxides, or even hybrid composites, each offering unique functionalities.

Nanoparticles are widely used in:

Catalysis (e.g., Au or Pt nanoparticles in chemical reactions),

Biomedicine (drug delivery, imaging, photothermal therapy),

Optoelectronics (quantum dots in LEDs or solar cells), and

Energy storage (battery and supercapacitor electrodes).

In the following examples, we focus on metallic nanoparticles—specifically gold (Au) and gold–silver (Au–Ag) alloy systems. The goal is to explore how size, composition, and atomic distribution affect their physical structure and potential applications.

🔹 Example 1 – Pure Gold Nanoparticle, element=“Au”, size_nm=2.0

In this example, a pure gold (Au) nanoparticle of 2.0 nm diameter is generated using the Nanoparticle_Generator class. This small cluster consists of only a few hundred atoms, exhibiting pronounced quantum confinement effects. Such nanoparticles are known for their strong plasmonic absorption and are used in bioimaging and nanophotonics.

from PyGamLab.structures.GAM_architectures.GAM_nano_particles import Nanoparticle_Generator

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nanoparticle_Generator(element="Au", size_nm=2.0)
Au1=builder.atoms

Molecular_Visualizer(Au1,format='efficient_plotly')
Molecular_Visualizer(Au1,format='matplotlib')
Molecular_Visualizer(Au1,format='pyvista')
Visualizing 249 atoms using efficient_plotly format...
../_images/gam_st_37_1.png
Visualizing 249 atoms using matplotlib format...
../_images/gam_st_37_3.png
Visualizing 249 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_37_6.png

🔹 Example 2 – Pure Gold Nanoparticle, element=“Au”, size_nm=4.0

Here, the nanoparticle size is increased to 4.0 nm. As the particle grows larger, quantum effects weaken and bulk-like metallic properties begin to emerge. This example demonstrates how increasing nanoparticle size changes its surface-to-volume ratio and, consequently, its chemical and optical behavior.

from PyGamLab.structures.GAM_architectures.GAM_nano_particles import Nanoparticle_Generator

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nanoparticle_Generator(element="Au", size_nm=4.0)
Au2=builder.atoms

Molecular_Visualizer(Au2,format='efficient_plotly')
Molecular_Visualizer(Au2,format='matplotlib')
Molecular_Visualizer(Au2,format='pyvista')
Visualizing 1985 atoms using efficient_plotly format...
../_images/gam_st_39_1.png
Visualizing 1985 atoms using matplotlib format...
../_images/gam_st_39_3.png
Visualizing 1985 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_39_6.png

🔹 Example 3 – Au–Ag Random Alloy Nanoparticle, add_element(“Ag”, 20%, “random”)

In this case, silver (Ag) atoms are randomly introduced into a gold nanoparticle, forming a random alloy with 20 atomic percent Ag. This configuration modifies the electronic structure and optical response, resulting in a material that combines the stability of Au with the reactivity of Ag — a common strategy in plasmonic and catalytic design.

from PyGamLab.structures.GAM_architectures.GAM_nano_particles import Nanoparticle_Generator

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nanoparticle_Generator(element="Au", size_nm=2.0)
builder.add_element("Ag",20.0,distribution="random")
Au3=builder.atoms

Molecular_Visualizer(Au3,format='efficient_plotly')
Molecular_Visualizer(Au3,format='matplotlib')
Molecular_Visualizer(Au3,format='pyvista')
Added Ag (20.0%) with random distribution
Visualizing 249 atoms using efficient_plotly format...
../_images/gam_st_41_1.png
Visualizing 249 atoms using matplotlib format...
../_images/gam_st_41_3.png
Visualizing 249 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/gam_st_41_6.png

🔹 Example 4 – Au–Ag Random Alloy Nanoparticle, add_element(“Ag”, 40%, “random”)

Here, the silver concentration increases to 40%, further shifting the structural and electronic balance toward Ag. Higher Ag content typically causes a blue shift in the plasmonic resonance and enhances chemical activity, which can be useful for surface-enhanced Raman spectroscopy (SERS) and sensor technologies.

from PyGamLab.structures.GAM_architectures.GAM_nano_particles import Nanoparticle_Generator

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nanoparticle_Generator(element="Au", size_nm=2.0)
builder.add_element("Ag",40.0,distribution="random")
Au4=builder.atoms

Molecular_Visualizer(Au4,format='efficient_plotly')
Molecular_Visualizer(Au4,format='matplotlib')
Molecular_Visualizer(Au4,format='pyvista')

🔹 Example 5 – Au–Ag Surface-Enriched Nanoparticle, add_element(“Ag”, 10%, “surface”)

This final example creates a core–shell-like nanoparticle, where 10% silver atoms are distributed only on the surface (distribution=“surface”). Such particles exhibit hybrid functionality — a gold core ensuring stability and a silver shell offering high surface reactivity. This configuration is particularly relevant in catalysis and plasmonic enhancement applications.

from PyGamLab.structures.GAM_architectures.GAM_nano_particles import Nanoparticle_Generator

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nanoparticle_Generator(element="Au", size_nm=2.0)
builder.add_element("Ag",10.0,distribution="surface")
Au5=builder.atoms

Molecular_Visualizer(Au5,format='efficient_plotly')
Molecular_Visualizer(Au5,format='matplotlib')
Molecular_Visualizer(Au5,format='pyvista')

🌀 Category 5 — Nanotubes

Nanotubes are one-dimensional nanostructures with diameters typically in the nanometer range and lengths that can reach several micrometers. They can be imagined as rolled-up sheets of two-dimensional materials such as graphene, forming cylindrical structures that exhibit extraordinary mechanical, electrical, and thermal properties.

Among the various types of nanotubes, carbon nanotubes (CNTs) are the most studied and widely used. Depending on how the graphene sheet is rolled, nanotubes can have different chiralities, defined by the pair of integers (n, m). These parameters determine whether the nanotube behaves as a metal or a semiconductor.

Nanotubes can exist as:

Single-walled nanotubes (SWCNTs) → one cylindrical layer of atoms.

Multi-walled nanotubes (MWCNTs) → several concentric nanotube layers.

Their properties can also be tuned by introducing dopants (foreign atoms like Si, N, or B) or by creating defects (vacancies, substitutions, etc.), which modify their conductivity and chemical reactivity.

Applications include:

Nanoelectronics (transistors, sensors, interconnects),

Composite materials (lightweight, strong structures),

Energy storage (battery electrodes), and

Catalysis and gas adsorption.

Below are five examples demonstrating how different nanotube configurations can be generated and visualized using Nanotube_Generator in PyGamLab.

🔹 Example 1 – Single-Walled Carbon Nanotube, (n=10, m=10), length=10.0 nm

In this example, a single-walled carbon nanotube (SWCNT) with chiral indices (10, 10) is generated. The (10,10) configuration corresponds to an armchair nanotube, which exhibits metallic electrical behavior and very high mechanical strength. The nanotube length is set to 10 nm, making it suitable for structural and electronic simulations.

from PyGamLab.structures.GAM_architectures.GAM_nanotubes import Nanotube_Generator

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nanotube_Generator(n=10, m=10, length=10.0, atom_type='C')
swcnt1=builder.atoms

Molecular_Visualizer(swcnt1,format='efficient_plotly')
Molecular_Visualizer(swcnt1,format='matplotlib')
Molecular_Visualizer(swcnt1,format='pyvista')

🔹 Example 2 – Single-Walled Carbon Nanotube, (n=20, m=10), length=10.0 nm

Here, the chirality changes to (20, 10), producing a chiral nanotube (neither purely armchair nor zigzag). Chiral CNTs typically exhibit semiconducting properties, depending on the exact (n, m) combination. This example illustrates how modifying the chirality indices alters the nanotube’s electronic band structure and symmetry.

from PyGamLab.structures.GAM_architectures.GAM_nanotubes import Nanotube_Generator

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nanotube_Generator(n=20, m=10, length=10.0, atom_type='C')
swcnt2=builder.atoms

Molecular_Visualizer(swcnt2,format='efficient_plotly')
Molecular_Visualizer(swcnt2,format='matplotlib')
Molecular_Visualizer(swcnt2,format='pyvista')

🔹 Example 3 – Multi-Walled Carbon Nanotube (MWCNT), multi_wall=[(20,20)]

This example generates a multi-walled carbon nanotube (MWCNT) consisting of two concentric layers: an inner (10,10) tube and an outer (20,20) shell. MWCNTs display enhanced mechanical stability and thermal conductivity due to interlayer van der Waals interactions. They are frequently used in composite reinforcement and thermal management systems.

from PyGamLab.structures.GAM_architectures.GAM_nanotubes import Nanotube_Generator

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nanotube_Generator(n=10, m=10, length=10.0, atom_type='C',multi_wall=[(20,20)])
mwcnt=builder.atoms

Molecular_Visualizer(mwcnt,format='efficient_plotly')
Molecular_Visualizer(mwcnt,format='matplotlib')
Molecular_Visualizer(mwcnt,format='pyvista')

🔹 Example 4 – Si-Doped Carbon Nanotube, doping={‘dopant’:‘Si’, ‘concentration’:0.1, ‘pattern’:‘random’}

In this model, silicon (Si) atoms are randomly substituted into the carbon lattice at a 10% concentration. Such doping can tune the electrical conductivity and chemical reactivity of CNTs, enabling applications in gas sensors and semiconductor devices. Random distribution ensures that dopants are spread throughout the nanotube surface, affecting local bonding and curvature.

from PyGamLab.structures.GAM_architectures.GAM_nanotubes import Nanotube_Generator

from PyGamLab.structures.gamvis import Molecular_Visualizer

doping_elements = {'dopant':'Si','concentration':0.1, 'pattern':'random'}
builder = Nanotube_Generator(n=10, m=10, length=10.0, atom_type='C',doping=doping_elements)
cnt1=builder.atoms

Molecular_Visualizer(cnt1,format='efficient_plotly')
Molecular_Visualizer(cnt1,format='matplotlib')
Molecular_Visualizer(cnt1,format='pyvista')

🔹 Example 5 – Defective Carbon Nanotube, defects={‘vacancies’:0.1, ‘substitutions’:{‘atom’:‘Si’, ‘ratio’:0.05}}

In the final example, structural defects are introduced intentionally:

10% atomic vacancies, representing missing carbon atoms, and

5% silicon substitutions, simulating impurity atoms replacing carbon sites.

These imperfections play a critical role in determining chemical activity, adsorption behavior, and mechanical flexibility. Defect engineering is a powerful tool in tailoring CNTs for catalysis, energy storage, and functional coatings.

from PyGamLab.structures.GAM_architectures.GAM_nanotubes import Nanotube_Generator

from PyGamLab.structures.gamvis import Molecular_Visualizer

defects = {'vacancies': 0.1, 'substitutions': {'atom': 'Si', 'ratio': 0.05}}
builder = Nanotube_Generator(n=10, m=10, length=10.0, atom_type='C',defects=defects)
cnt2=builder.atoms

Molecular_Visualizer(cnt2,format='efficient_plotly')
Molecular_Visualizer(cnt2,format='matplotlib')
Molecular_Visualizer(cnt2,format='pyvista')

⚙️ 2. Generators

The Generators subpackage provides a dimensionality-based material generation system. Unlike GAM_architectures, which focuses on specific lattice-defined materials, Generators enables the creation of general-purpose nanostructures and bulk materials with customizable composition, defects, and topology.

This approach allows users to systematically explore materials across different dimensions — from discrete nanoclusters to extended 3D solids — while maintaining full control over atomic arrangements and boundary conditions.

🎯 Purpose:

To build, modify, and analyze nanomaterials across 0D, 1D, 2D, and 3D domains using flexible, parameter-driven builders.

🔹 Submodules under Generators:

Submodule Dimensionality Description

zero_d 0D (Zero-Dimensional)

Generates nanoclusters, nanoparticles, or core-shell systems, including alloys and defected structures.

one_d 1D (One-Dimensional)

Builds nanowires, nanotubes, or nanorods with optional defects, dopants, or lattice relaxation.

two_d 2D (Two-Dimensional)

Creates nanosheets and monolayers such as graphene, silicene, TMDs, and phosphorene, supporting both periodic and finite configurations.

auto_bulk 3D (Bulk)

Constructs bulk crystalline materials and multi-component alloys with customizable lattice parameters and supercell sizes.

Each generator integrates seamlessly with the Molecular_Visualizer utility, supporting multiple visualization modes (plotly, matplotlib, and pyvista) for interactive analysis of atomic structures.

Category 1 – Zero-Dimensional (0D) Nanostructures

Zero-dimensional (0D) nanostructures are nanoscale materials that are confined in all three spatial dimensions (x, y, and z). This means electrons, phonons, and other excitations are quantized in every direction, giving rise to unique quantum confinement effects.

Common examples include:

Nanoclusters – small aggregates of atoms with discrete electronic states.

Nanoparticles – larger, often crystalline, particles with tunable size and surface morphology.

Quantum dots – semiconductor 0D structures exhibiting size-dependent optical properties.

These materials often show size-dependent color, reactivity, and electronic behavior, making them essential in:

Catalysis (due to high surface-to-volume ratio)

Optoelectronics and quantum devices (e.g., LEDs, quantum dots)

Biomedical imaging and drug delivery

The Nano_ZeroD_Builder class in PyGamLab allows the creation of such 0D nanostructures by defining their composition, size, crystal structure, and even defects or alloy configurations.

Below are five examples demonstrating different types of 0D nanostructures — from simple nanoclusters to multi-element alloys.

🔹 Example 1 – Gold Nanocluster (material=“Au”, size=4, noshells=4, fcc lattice=4.08 Å)

In this example, a gold (Au) nanocluster is created with 4 atomic shells using an FCC (face-centered cubic) crystal structure. The lattice constant of gold is set to 4.08 Å, and the cluster size is limited to a few nanometers, corresponding to a few dozen atoms.

Nanoclusters like this are highly relevant for catalysis and plasmonic studies, where small changes in size can drastically affect optical absorption and surface energy.

from PyGamLab.structures.Generators.zero_d import Nano_ZeroD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_ZeroD_Builder(material="Au", structure_type="nanocluster", size=4, noshells=4, crystal_structure="fcc", lattice_constant=4.08)
zerod1=builder.atoms

Molecular_Visualizer(zerod1,format='efficient_plotly')
Molecular_Visualizer(zerod1,format='matplotlib')
Molecular_Visualizer(zerod1,format='pyvista')
Visualizing 147 atoms using efficient_plotly format...
../_images/generator_st_3_1.png
Visualizing 147 atoms using matplotlib format...
../_images/generator_st_3_3.png

🔹 Example 2 – Copper Nanocluster (material=“Cu”, size=5, noshells=5, fcc lattice=3.61 Å)

This case generates a copper (Cu) nanocluster composed of five atomic shells, with an FCC structure and a lattice constant of 3.61 Å. Compared to gold, copper clusters often exhibit stronger metallic bonding and different surface reconstruction behavior.

Such small Cu nanoclusters are useful in catalytic CO₂ reduction and hydrogen evolution applications due to their tunable active surface sites.

from PyGamLab.structures.Generators.zero_d import Nano_ZeroD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_ZeroD_Builder(material="Cu", structure_type="nanocluster", size=5, noshells=5, crystal_structure="fcc", lattice_constant=3.61)
zerod2=builder.atoms

Molecular_Visualizer(zerod2,format='efficient_plotly')
Molecular_Visualizer(zerod2,format='matplotlib')
#Molecular_Visualizer(zerod2,format='pyvista')
Visualizing 309 atoms using efficient_plotly format...
../_images/generator_st_5_1.png
Visualizing 309 atoms using matplotlib format...
../_images/generator_st_5_3.png

🔹 Example 3 – Gold Nanoparticle with Defects (material=“Au”, size=80, surfaces=[(111),(100)], defects=interstitials 5% H/C)

Here, a larger gold nanoparticle (≈80 Å) is generated, exposing both the (111) and (100) crystal facets with respective surface energies of 0.5 and 0.7 J/m². Defects are introduced using add_defects() — in this case, interstitial atoms (H and C) at 5% concentration.

This mimics real experimental nanoparticles where surface defects and impurities can alter catalytic activity, adsorption behavior, and electronic density at the surface.

from PyGamLab.structures.Generators.zero_d import Nano_ZeroD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_ZeroD_Builder(material="Au", structure_type="nanoparticle", size=80, lattice_constant=4.08,surfaces=[(1,1,1),(1,0,0)],surface_energies=[0.5,0.7])
builder.add_defects(defect_type="interstitial", concentration=0.05, elements=["H", "C"])
zerod3=builder.atoms


Molecular_Visualizer(zerod3,format='efficient_plotly')
Molecular_Visualizer(zerod3,format='matplotlib')
Molecular_Visualizer(zerod3,format='pyvista')
Visualizing 89 atoms using efficient_plotly format...
../_images/generator_st_7_1.png
Visualizing 89 atoms using matplotlib format...
../_images/generator_st_7_3.png

🔹 Example 4 – Au–Si Alloy Nanoparticle (elements=[“Au”, “Si”], compositions=[0.5, 0.5])

In this example, the builder creates a binary alloy nanoparticle containing 50% gold and 50% silicon atoms. Such Au–Si alloys are well-known for their role in nanowire growth (VLS mechanism) and heterogeneous catalysis.

Alloying alters the bonding environment and lattice strain, leading to modified optical, mechanical, and chemical properties compared to pure gold nanoparticles.

from PyGamLab.structures.Generators.zero_d import Nano_ZeroD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_ZeroD_Builder(material="Au", structure_type="nanoparticle", size=80, lattice_constant=4.08,surfaces=[(1,1,1),(1,0,0)],surface_energies=[0.5,0.7])
builder.create_alloy(elements=["Au", "Si"], compositions=[0.5, 0.5])
zerod4=builder.atoms

Molecular_Visualizer(zerod4,format='efficient_plotly')
Molecular_Visualizer(zerod4,format='matplotlib')
#Molecular_Visualizer(zerod4,format='pyvista')
Visualizing 85 atoms using efficient_plotly format...
../_images/generator_st_9_1.png
Visualizing 85 atoms using matplotlib format...
../_images/generator_st_9_3.png

🔹 Example 5 – Cu–Ni–Co Multi-Component Alloy Nanoparticle (elements=[“Cu”,“Ni”,“Co”], compositions=[0.3,0.4,0.3])

This final example demonstrates a ternary alloy nanoparticle composed of Cu, Ni, and Co in proportions of 30%, 40%, and 30%, respectively. Such high-entropy alloy (HEA) nanoparticles are a cutting-edge class of materials known for their exceptional structural stability, catalytic efficiency, and resistance to oxidation.

The random mixing of different metallic atoms leads to unique surface geometries and heterogeneous electronic distributions, which can significantly enhance catalytic and magnetic performance.

from PyGamLab.structures.Generators.zero_d import Nano_ZeroD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder.create_alloy(elements=["Cu", "Ni", "Co"], compositions=[0.3, 0.4, 0.3])
zerod5=builder.atoms

Molecular_Visualizer(zerod5,format='efficient_plotly')
Molecular_Visualizer(zerod5,format='matplotlib')
#Molecular_Visualizer(zerod5,format='pyvista')
Visualizing 85 atoms using efficient_plotly format...
../_images/generator_st_11_1.png
Visualizing 85 atoms using matplotlib format...
../_images/generator_st_11_3.png

🧵 Category 2 – One-Dimensional (1D) Nanostructures

One-dimensional (1D) nanostructures are materials that are confined in two spatial dimensions (x and y), but extended in one dimension (z). This means electrons and phonons can move freely only along the length of the structure, while motion in the other two directions is quantized.

Common 1D nanostructures include:

Nanowires

Nanorods

Nanotubes

Because of their high aspect ratio (length≫diameter), they show anisotropic mechanical, electrical, and optical properties. They are key components in:

Nanoelectronics (as conductive or semiconductive channels)

Photonic and plasmonic devices

Sensors and catalysis platforms

In PyGamLab, the Nano_OneD_Builder class enables precise generation of 1D nanostructures by specifying parameters such as:

Material type (C, Au, Si, etc.)

Crystal structure and lattice constant

Length and radius

Vacuum spacing (for periodic simulations)

Defect engineering (vacancies, interstitials, dopants)

Below are five examples demonstrating how different 1D nanostructures can be generated, visualized, and customized.

🔹 Example 1 – Carbon Nanotube (material=“C”, structure_type=“nanotube”, length=5.0, vacuum=8.0)

In this example, a carbon nanotube (CNT) is generated with a length of 5 nm and a vacuum spacing of 8 Å to isolate it from periodic images. Carbon nanotubes are hollow cylindrical structures formed by rolling up graphene sheets, and they exhibit extraordinary electrical conductivity, mechanical strength, and thermal stability.

This setup creates a single-walled CNT (SWCNT) — ideal for electronic and transport simulations under periodic boundary conditions.

from PyGamLab.structures.Generators.one_d import Nano_OneD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_OneD_Builder(material="C", structure_type="nanotube", length=5.0, vacuum=8.0)
oned1=builder.atoms

Molecular_Visualizer(oned1,format='efficient_plotly')
Molecular_Visualizer(oned1,format='matplotlib')
Molecular_Visualizer(oned1,format='pyvista')
Visualizing 480 atoms using efficient_plotly format...
../_images/generator_st_14_1.png
Visualizing 480 atoms using matplotlib format...
../_images/generator_st_14_3.png
Visualizing 480 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/generator_st_14_6.png

🔹 Example 2 – Gold Nanowire (material=“Au”, structure_type=“nanowire”, fcc lattice=4.08 Å, radius=1.5 nm, length=10 nm, vacuum=12 Å)

Here, a gold (Au) nanowire is built using an FCC crystal structure with a lattice constant of 4.08 Å. The wire has a radius of 1.5 nm and a length of 10 nm, with a 12 Å vacuum around it to prevent interaction with neighboring cells.

Gold nanowires are key in nanoscale interconnects, plasmonic waveguides, and mechanical testing at the atomic scale. Their 1D morphology enables quantized conductance and unique surface electron behavior.

from PyGamLab.structures.Generators.one_d import Nano_OneD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_OneD_Builder(material="Au", structure_type="nanowire", lattice_constant=4.08, crystal_structure="fcc", radius=1.5, length=10.0, vacuum=12.0)
oned2=builder.atoms

Molecular_Visualizer(oned2,format='efficient_plotly')
Molecular_Visualizer(oned2,format='matplotlib')
Molecular_Visualizer(oned2,format='pyvista')
Visualizing 5237 atoms using efficient_plotly format...
../_images/generator_st_16_1.png
Visualizing 5237 atoms using matplotlib format...
../_images/generator_st_16_3.png

🔹 Example 3 – Silicon Nanorod (material=“Si”, structure_type=“nanorod”, diamond lattice=5.43 Å, radius=2.0 nm, length=8 nm, vacuum=10 Å)

This example constructs a silicon nanorod with a diamond cubic crystal structure and a lattice constant of 5.43 Å. The nanorod’s radius is 2 nm, and its length extends to 8 nm.

Silicon nanorods are widely used in photonic crystals, sensors, and field-emission devices, where their quantum confinement and surface oxidation behavior can significantly alter their electronic bandgap.

This type of structure bridges the gap between 0D nanoclusters and 2D nanowires, maintaining stability while being tunable in size and length.

from PyGamLab.structures.Generators.one_d import Nano_OneD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_OneD_Builder(material="Si", structure_type="nanorod", lattice_constant=5.43, crystal_structure="diamond", radius=2.0, length=8.0, vacuum=10.0)
oned3=builder.atoms

Molecular_Visualizer(oned3,format='efficient_plotly')
Molecular_Visualizer(oned3,format='matplotlib')
Molecular_Visualizer(oned3,format='pyvista')
Visualizing 5378 atoms using efficient_plotly format...
../_images/generator_st_18_1.png
Visualizing 5378 atoms using matplotlib format...
../_images/generator_st_18_3.png

🔹 Example 4 – Defective Carbon Nanotube (material=“C”, structure_type=“nanotube”, length=6.0, defect_type=“vacancy”, concentration=0.1)

In this case, a carbon nanotube of 6 nm length is created, and vacancy defects are introduced at a 10% concentration. A random seed (seed=42) ensures reproducibility of the defect pattern.

Vacancy defects — missing atoms in the lattice — strongly influence the electrical conductivity, mechanical stiffness, and chemical reactivity of CNTs. Such defective models are important for simulating real experimental systems, where imperfections play a crucial role in material performance.

from PyGamLab.structures.Generators.one_d import Nano_OneD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_OneD_Builder(material="C", structure_type="nanotube", length=6.0)
builder.add_defects(defect_type="vacancy", concentration=0.1, seed=42)
oned4=builder.atoms

Molecular_Visualizer(oned4,format='efficient_plotly')
Molecular_Visualizer(oned4,format='matplotlib')
Molecular_Visualizer(oned4,format='pyvista')
Visualizing 519 atoms using efficient_plotly format...
../_images/generator_st_20_1.png
Visualizing 519 atoms using matplotlib format...
../_images/generator_st_20_3.png

🔹 Example 5 – Defective Gold Nanowire (material=“Au”, structure_type=“nanowire”, radius=1.0 nm, length=6 nm, defect_type=“interstitial”, concentration=0.05)

Finally, a gold nanowire with a 1 nm radius and 6 nm length is generated, followed by the introduction of interstitial defects at 5% concentration. Interstitials are extra atoms inserted into the lattice, often increasing local strain and altering electronic density near the defect site.

This example demonstrates how Nano_OneD_Builder allows for defect engineering, which is essential for modeling mechanical deformation, diffusion processes, or conductivity changes in nanowires under real-world conditions.

from PyGamLab.structures.Generators.one_d import Nano_OneD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_OneD_Builder(material="Au", structure_type="nanowire", lattice_constant=4.08, crystal_structure="fcc", radius=1.0, length=6.0)
builder.add_defects(defect_type="interstitial", concentration=0.05, seed=1)
oned5=builder.atoms

Molecular_Visualizer(oned5,format='efficient_plotly')
Molecular_Visualizer(oned5,format='matplotlib')
Molecular_Visualizer(oned5,format='pyvista')

🧱 Category 3 – Bulk Materials (3D Crystalline Structures)

Bulk materials are three-dimensional (3D) crystalline systems with periodic atomic arrangements extending in all spatial directions. They represent the infinite or macroscopic limit of materials — unlike nanoclusters (0D), nanowires (1D), or nanosheets (2D), which are spatially confined.

In computational materials science, bulk structures serve as the fundamental building blocks for:

Deriving surface slabs, grain boundaries, and nanoparticles

Computing elastic constants, electronic band structures, and phonon spectra

Performing density functional theory (DFT) simulations with periodic boundary conditions

The AdvancedAlloys class in PyGamLab allows users to automatically generate crystalline bulk structures, including:

Pure crystals and binary/multicomponent alloys

FCC, BCC, and HCP lattice types

Control over elemental composition, supercell size, and random distribution (via seed control)

Below are several examples showing how to generate and visualize various bulk systems with different compositions, structures, and sizes.

🔹 Example 1 – Cu–Ni Alloy (FCC Structure, Equal Fraction 50–50)

In this example, a Cu–Ni binary alloy is generated with equal atomic fractions (0.5 Cu, 0.5 Ni). Both copper and nickel share the face-centered cubic (FCC) crystal structure, making them fully miscible in the solid state.

This example demonstrates how substitutional alloying can be modeled in a random atomic arrangement, suitable for simulating solid-solution behavior and lattice distortion effects.

📘 Applications: Modeling mechanical strengthening in Cu–Ni alloys, diffusion, and phase stability.

from PyGamLab.structures.Generators.auto_bulk import AdvancedAlloys

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = AdvancedAlloys(elements=["Cu", "Ni"], fractions=[0.5, 0.5])
bulk1=builder.atoms

Molecular_Visualizer(bulk1,format='efficient_plotly')
Molecular_Visualizer(bulk1,format='matplotlib')
Molecular_Visualizer(bulk1,format='pyvista')
Generated alloy with composition:
  Cu: 13 atoms (48.15%)
  Ni: 14 atoms (51.85%)
Total atoms: 27
Crystal structure based on Cu: fcc with lattice constant 3.615
Supercell size: (3, 3, 3)
Visualizing 27 atoms using efficient_plotly format...
../_images/generator_st_25_1.png
Visualizing 27 atoms using matplotlib format...
../_images/generator_st_25_3.png
Visualizing 27 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/generator_st_25_6.png

🔹 Example 2 – Fe–Cr Alloy (BCC Structure, 2×2×2 Supercell)

Here, an iron–chromium alloy is constructed with 70% Fe and 30% Cr, expanded to a 2×2×2 supercell. Both Fe and Cr typically crystallize in the body-centered cubic (BCC) structure, and this configuration is often used for simulating ferritic steels.

📘 Applications: Studying corrosion resistance, magnetic properties, and thermal expansion in Fe–Cr systems.

from PyGamLab.structures.Generators.auto_bulk import AdvancedAlloys

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = AdvancedAlloys(elements=["Fe", "Cr"], fractions=[0.7, 0.3], supercell_size=(2, 2, 2))
bulk2=builder.atoms

Molecular_Visualizer(bulk2,format='efficient_plotly')
Molecular_Visualizer(bulk2,format='matplotlib')
Molecular_Visualizer(bulk2,format='pyvista')
Generated alloy with composition:
  Fe: 6 atoms (75.00%)
  Cr: 2 atoms (25.00%)
Total atoms: 8
Crystal structure based on Fe: bcc with lattice constant 2.866
Supercell size: (2, 2, 2)
Visualizing 8 atoms using efficient_plotly format...
../_images/generator_st_27_1.png
Visualizing 8 atoms using matplotlib format...
../_images/generator_st_27_3.png

🔹 Example 3 – Large Fe–Cr Alloy Supercell (5×5×5 Expansion)

In this case, the Fe–Cr alloy is scaled up to a 5×5×5 supercell, generating a much larger atomic system. Such models are useful for Monte Carlo or Molecular Dynamics simulations, where bulk-like statistical behavior and defect diffusion are of interest.

📘 Applications: Thermodynamic stability, large-scale defect simulations, or mechanical stress testing under periodic conditions.

from PyGamLab.structures.Generators.auto_bulk import AdvancedAlloys

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = AdvancedAlloys(elements=["Fe", "Cr"], fractions=[0.7, 0.3], supercell_size=(5, 5, 5))
bulk3=builder.atoms

Molecular_Visualizer(bulk3,format='efficient_plotly')
Molecular_Visualizer(bulk3,format='matplotlib')
Molecular_Visualizer(bulk3,format='pyvista')
Generated alloy with composition:
  Fe: 87 atoms (69.60%)
  Cr: 38 atoms (30.40%)
Total atoms: 125
Crystal structure based on Fe: bcc with lattice constant 2.866
Supercell size: (5, 5, 5)
Visualizing 125 atoms using efficient_plotly format...
../_images/generator_st_29_1.png
Visualizing 125 atoms using matplotlib format...
../_images/generator_st_29_3.png

🔹 Example 4 – Al–Mg Random Alloy (FCC, Seed Control for Reproducibility)

This example creates an Al–Mg solid solution with a 60–40 atomic ratio. The parameter seed=42 ensures that the random distribution of Mg atoms within the Al matrix is reproducible across different runs.

📘 Applications: Al–Mg alloys are widely used in lightweight structural materials, aerospace, and automotive industries. This simulation setup helps study how Mg atoms influence mechanical hardening and defect migration.

from PyGamLab.structures.Generators.auto_bulk import AdvancedAlloys

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = AdvancedAlloys(elements=["Al", "Mg"], fractions=[0.6, 0.4], seed=42)
bulk4=builder.atoms

Molecular_Visualizer(bulk4,format='efficient_plotly')
Molecular_Visualizer(bulk4,format='matplotlib')
Molecular_Visualizer(bulk4,format='pyvista')
Generated alloy with composition:
  Al: 16 atoms (59.26%)
  Mg: 11 atoms (40.74%)
Total atoms: 27
Crystal structure based on Al: fcc with lattice constant 4.05
Supercell size: (3, 3, 3)
Visualizing 27 atoms using efficient_plotly format...
../_images/generator_st_31_1.png
Visualizing 27 atoms using matplotlib format...
../_images/generator_st_31_3.png

🔹 Example 5 – Ti–Al Alloy (HCP Crystal, User-Defined Lattice Constants)

In the final example, a Ti–Al binary alloy is generated, both using hexagonal close-packed (HCP) crystal structures with user-defined lattice constants: a = 2.95 Å, c = 4.68 Å.

This configuration represents an ordered Ti–Al intermetallic phase, which is significant in high-temperature alloys and turbine applications.

📘 Applications: Modeling TiAl-based intermetallics, phase transformations, and anisotropic mechanical behavior.

from PyGamLab.structures.Generators.auto_bulk import AdvancedAlloys

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = AdvancedAlloys(elements=["Ti", "Al"], fractions=[0.5, 0.5], crystal_structures=["hcp", "hcp"], lattice_constants=[{"a": 2.95, "c": 4.68}, {"a": 2.95, "c": 4.68}])
bulk5=builder.atoms

Molecular_Visualizer(bulk5,format='efficient_plotly')
Molecular_Visualizer(bulk5,format='matplotlib')
Molecular_Visualizer(bulk5,format='pyvista')
Generated alloy with composition:
  Ti: 27 atoms (50.00%)
  Al: 27 atoms (50.00%)
Total atoms: 54
Crystal structure based on Ti: hcp with lattice constant {'a': 2.95, 'c': 4.68}
Supercell size: (3, 3, 3)
Visualizing 54 atoms using efficient_plotly format...
../_images/generator_st_33_1.png
Visualizing 54 atoms using matplotlib format...
../_images/generator_st_33_3.png

🧩 Category 4 – Two-Dimensional (2D) Materials

Two-dimensional (2D) materials are crystalline structures that consist of a single or few atomic layers. They represent a class of materials where atoms are strongly bonded within the plane but weakly bonded between layers via van der Waals interactions.

This reduced dimensionality gives rise to remarkable physical, chemical, and electronic properties, such as:

High carrier mobility and mechanical strength (e.g., in graphene)

Tunable band gaps (e.g., in MoS₂ or WS₂)

High surface area-to-volume ratio

Excellent flexibility and transparency

The Nano_TwoD_Builder in PyGamLab provides a powerful way to automatically construct different types of 2D materials, including:

Nanosheets like graphene, silicene, phosphorene

Transition metal dichalcogenides (TMDs) such as WS₂, MoS₂, VSe₂

These 2D systems are the foundation of next-generation electronics, sensors, catalysts, and energy storage devices.

🔹 Example 1 – Graphene Nanosheet

In this example, a graphene nanosheet is generated using the Nano_TwoD_Builder. Graphene is composed of sp²-bonded carbon atoms arranged in a hexagonal honeycomb lattice. It exhibits exceptional electrical conductivity, mechanical strength, and thermal stability.

📘 Applications: Transistors, flexible electronics, conductive coatings, and composite reinforcement.

from PyGamLab.structures.Generators.two_d import Nano_TwoD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_TwoD_Builder(material="graphene", structure_type="nanosheet")
twod1=builder.atoms

Molecular_Visualizer(twod1,format='efficient_plotly')
Molecular_Visualizer(twod1,format='matplotlib')
Molecular_Visualizer(twod1,format='pyvista')
Visualizing 200 atoms using efficient_plotly format...
../_images/generator_st_36_1.png
Visualizing 200 atoms using matplotlib format...
../_images/generator_st_36_3.png

🔹 Example 2 – Silicene Nanosheet

This example builds a silicene sheet, a 2D allotrope of silicon with a slightly buckled hexagonal structure due to its larger atomic radius compared to carbon. Although it shares graphene’s honeycomb arrangement, silicene exhibits different electronic behavior, often showing Dirac-like dispersion but with a tunable bandgap.

📘 Applications: Nanoelectronics, spintronics, and silicon-compatible device integration.

from PyGamLab.structures.Generators.two_d import Nano_TwoD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_TwoD_Builder(material="silicene", structure_type="nanosheet")
twod2=builder.atoms

Molecular_Visualizer(twod2,format='efficient_plotly')
Molecular_Visualizer(twod2,format='matplotlib')
Molecular_Visualizer(twod2,format='pyvista')
Visualizing 200 atoms using efficient_plotly format...
../_images/generator_st_38_1.png
Visualizing 200 atoms using matplotlib format...
../_images/generator_st_38_3.png

🔹 Example 3 – WS₂ Monolayer (Transition Metal Dichalcogenide)

Here, a tungsten disulfide (WS₂) monolayer is generated, representing a TMD (Transition Metal Dichalcogenide) structure. Unlike graphene, WS₂ has a direct bandgap in the monolayer form, making it ideal for optoelectronic and photonic applications.

📘 Applications: Photodetectors, field-effect transistors (FETs), and valleytronic devices.

from PyGamLab.structures.Generators.two_d import Nano_TwoD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_TwoD_Builder(material="ws2", structure_type="tmd")
twod3=builder.atoms

Molecular_Visualizer(twod3,format='efficient_plotly')
Molecular_Visualizer(twod3,format='matplotlib')
Molecular_Visualizer(twod3,format='pyvista')
Visualizing 300 atoms using efficient_plotly format...
../_images/generator_st_40_1.png
Visualizing 300 atoms using matplotlib format...
../_images/generator_st_40_3.png

🔹 Example 4 – VSe₂ Monolayer (Magnetic TMD)

In this example, a vanadium diselenide (VSe₂) monolayer is generated. It belongs to the TMD family but is unique because it exhibits intrinsic magnetism in its monolayer form — a property not common in 2D systems.

📘 Applications: 2D magnetism studies, spintronic devices, and magnetic heterostructures.

from PyGamLab.structures.Generators.two_d import Nano_TwoD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_TwoD_Builder(material="vse2", structure_type="tmd")
twod4=builder.atoms

Molecular_Visualizer(twod4,format='efficient_plotly')
Molecular_Visualizer(twod4,format='matplotlib')
Molecular_Visualizer(twod4,format='pyvista')
Visualizing 300 atoms using efficient_plotly format...
../_images/generator_st_42_1.png
Visualizing 300 atoms using matplotlib format...
../_images/generator_st_42_3.png

🔹 Example 5 – Phosphorene Nanosheet

Finally, a phosphorene nanosheet (a single layer of black phosphorus) is created. Phosphorene has a puckered orthorhombic structure and exhibits anisotropic electrical and mechanical properties, meaning its behavior depends on the direction within the plane.

📘 Applications: Energy storage (Li-ion batteries), sensors, and field-effect transistors with tunable bandgaps.

from PyGamLab.structures.Generators.two_d import Nano_TwoD_Builder

from PyGamLab.structures.gamvis import Molecular_Visualizer

builder = Nano_TwoD_Builder(material="phosphorene", structure_type="nanosheet")
twod4=builder.atoms

Molecular_Visualizer(twod4,format='efficient_plotly')
Molecular_Visualizer(twod4,format='matplotlib')
Molecular_Visualizer(twod4,format='pyvista')
Visualizing 200 atoms using efficient_plotly format...
../_images/generator_st_44_1.png
Visualizing 200 atoms using matplotlib format...
../_images/generator_st_44_3.png
Visualizing 200 atoms using pyvista format...
C:Userskarimminiconda3envsscience_envlibsite-packagespyvistajupyternotebook.py:37: UserWarning:

Failed to use notebook backend:

No module named 'trame'

Falling back to a static output.
../_images/generator_st_44_6.png