Skip to content

Solid-State Structures

Visualize crystals, surfaces, and periodic systems with unit cell display.

Live Demo: Silicon Crystal

Silicon in diamond structure (2x2x2 supercell):


Live Demo: NaCl Crystal

Sodium chloride in rocksalt structure:


Live Demo: Au(111) + H₂O Adsorption

H₂O molecule adsorbing on Au(111) surface - relaxation trajectory with energy plot:


Live Demo: Graphene Phonons

Graphene nanoribbon with phonon normal modes (breathing, ZA, ZO modes):


Live Demo: Carbon Nanotube Vibrations

(5,0) Carbon nanotube with vibrational modes (RBM, longitudinal, G-band):


Live Demo: FCC Copper

Copper FCC crystal (3x3x3 supercell):


Building Crystals

Bulk Structures

from ase.build import bulk
from aseview import MolecularViewer

# Diamond structure (Si, C, Ge)
si = bulk('Si', 'diamond', a=5.43, cubic=True)
si = si * (2, 2, 2)  # 2x2x2 supercell

viewer = MolecularViewer(si, showCell=True)
viewer.show()
aseview POSCAR --style metallic
aseview structure.cif

Common Crystal Structures

Structure ASE Function Example
FCC bulk('Cu', 'fcc', a=3.61) Cu, Ag, Au, Al, Ni
BCC bulk('Fe', 'bcc', a=2.87) Fe, W, Cr, Mo
Diamond bulk('Si', 'diamond', a=5.43) Si, Ge, C
Rocksalt bulk('NaCl', 'rocksalt', a=5.64) NaCl, MgO, LiF
Zincblende bulk('GaAs', 'zincblende', a=5.65) GaAs, ZnS
Wurtzite bulk('ZnO', 'wurtzite', ...) ZnO, GaN
HCP bulk('Mg', 'hcp', a=3.21, c=5.21) Mg, Ti, Zn

Supercells

# Create supercell
atoms = bulk('Si', 'diamond', a=5.43)
supercell = atoms * (3, 3, 3)  # 3x3x3 supercell

viewer = MolecularViewer(supercell, showCell=True)
viewer.show()

Surfaces and Slabs

FCC Surfaces

from ase.build import fcc111, fcc100, fcc110

# Au(111) surface - 4 layers, 3x3 cell, 5A vacuum
au111 = fcc111('Au', size=(3, 3, 4), vacuum=5.0)

# Pt(100) surface
pt100 = fcc100('Pt', size=(4, 4, 3), vacuum=6.0)

viewer = MolecularViewer(au111, style="metallic", showCell=True)
viewer.show()

Surface Adsorption Trajectory

from ase.io import read
from aseview import MolecularViewer

# Read relaxation trajectory (e.g., from VASP or ASE optimizer)
traj = read("adsorption_relax.traj", index=":")

# Visualize with energy plot
viewer = MolecularViewer(
    traj,
    style="metallic",
    showCell=True,
    showEnergyPlot=True  # Shows energy convergence
)
viewer.show()

BCC Surfaces

from ase.build import bcc111, bcc100, bcc110

# Fe(110) surface
fe110 = bcc110('Fe', size=(3, 3, 4), vacuum=5.0)

viewer = MolecularViewer(fe110, showCell=True)
viewer.show()

General Surface

from ase.build import surface

# Create any Miller index surface
atoms = bulk('Cu', 'fcc', a=3.61)
cu_211 = surface(atoms, (2, 1, 1), layers=4, vacuum=5.0)

viewer = MolecularViewer(cu_211, showCell=True)
viewer.show()

Low-Dimensional Materials

Graphene

from ase.build import graphene_nanoribbon

# Zigzag nanoribbon
gnr = graphene_nanoribbon(4, 6, type='zigzag', saturated=True, vacuum=5.0)

# Armchair nanoribbon
gnr_arm = graphene_nanoribbon(4, 6, type='armchair', saturated=True, vacuum=5.0)

viewer = MolecularViewer(gnr, style="cartoon", showCell=True)
viewer.show()

Carbon Nanotubes

from ase.build import nanotube

# (n, m) nanotube indices
cnt_6_0 = nanotube(6, 0, length=4, vacuum=5.0)   # Zigzag
cnt_6_6 = nanotube(6, 6, length=4, vacuum=5.0)   # Armchair
cnt_8_4 = nanotube(8, 4, length=4, vacuum=5.0)   # Chiral

viewer = MolecularViewer(cnt_6_0, style="neon", backgroundColor="#000000")
viewer.show()

Phonon / Vibrational Modes

Visualize phonon modes for periodic systems using NormalViewer:

CNT Radial Breathing Mode

from ase.build import nanotube
from aseview import NormalViewer
import numpy as np

cnt = nanotube(5, 0, length=2, vacuum=5.0)
positions = cnt.get_positions()
center = positions.mean(axis=0)

# Create radial breathing mode (RBM)
mode_rbm = []
for pos in positions:
    r = pos[:2] - center[:2]
    r_norm = np.linalg.norm(r)
    if r_norm > 0.1:
        disp = r / r_norm * 0.4  # Radial displacement
        mode_rbm.append([disp[0], disp[1], 0.0])
    else:
        mode_rbm.append([0.0, 0.0, 0.0])

viewer = NormalViewer(
    cnt,
    mode_vectors=[mode_rbm],
    frequencies=[280.0],  # RBM frequency
    showModeVector=True,
    style="neon",
    backgroundColor="#000000"
)
viewer.show()

Graphene Phonons

from ase.build import graphene_nanoribbon
from aseview import NormalViewer
import numpy as np

graphene = graphene_nanoribbon(3, 3, type='zigzag', saturated=False, vacuum=5.0)
positions = graphene.get_positions()

# Out-of-plane ZA mode
mode_za = []
for pos in positions:
    phase = 0.5 * (pos[0] + pos[1])
    mode_za.append([0.0, 0.0, 0.4 * np.sin(phase)])

viewer = NormalViewer(
    graphene,
    mode_vectors=[mode_za],
    frequencies=[450.0],
    showModeVector=True,
    style="cartoon"
)
viewer.show()

Unit Cell Display

Toggle unit cell visibility:

viewer = MolecularViewer(
    crystal,
    showCell=True,      # Show unit cell
    cellLineWidth=2.0,  # Cell line thickness
    cellColor="#888888" # Cell color
)
viewer.show()

Reading Structure Files

VASP

from ase.io import read
from aseview import MolecularViewer

# Read POSCAR/CONTCAR
atoms = read("POSCAR")
viewer = MolecularViewer(atoms, showCell=True)
viewer.show()
aseview POSCAR
aseview CONTCAR

CIF Files

atoms = read("structure.cif")
viewer = MolecularViewer(atoms, showCell=True)
viewer.show()
aseview crystal.cif

Other Formats

Format Extension Example
VASP POSCAR, CONTCAR aseview POSCAR
CIF .cif aseview structure.cif
XSF .xsf aseview charge.xsf
Quantum ESPRESSO .in aseview pw.in -f espresso-in
LAMMPS .data aseview system.data -f lammps-data

Trajectory for Solid-State

MD Trajectory

from ase.io import read
from aseview import MolecularViewer

# Read VASP MD trajectory
traj = read("XDATCAR", index=":")

viewer = MolecularViewer(traj, showCell=True, showEnergyPlot=True)
viewer.show()
# VASP MD trajectory
aseview XDATCAR -i :

# ASE trajectory format
aseview md.traj -i :

Relaxation Trajectory

# Read optimization trajectory
from ase.io import read

opt_traj = read("relax.traj", index=":")

viewer = MolecularViewer(
    opt_traj,
    showCell=True,
    showEnergyPlot=True
)
viewer.show()

Style Recommendations

Structure Type Recommended Style
Metals metallic
Semiconductors glossy
Ionic crystals default
Carbon materials cartoon or neon
Surfaces metallic

Tips for Large Systems

For systems with many atoms:

viewer = MolecularViewer(
    large_system,
    atomSize=0.3,        # Smaller atoms
    bondThickness=0.08,  # Thinner bonds
    bondThreshold=0.9    # Fewer bonds detected
)
viewer.show()