<jupyter_start><jupyter_text>matplotlib[Matplotlib](https://matplotlib.org/) is a library for visualization in python.<jupyter_code>import matplotlib.pyplot as plt

# Create canvas
plt.figure(figsize=(3.5, 3.5))
# plot points
x = [0.0, 0.4, 0.9]
y = [0.0, 0.75, 0.3]
plt.scatter(x, y, marker="s", color=["orange", "blue", "violet"])
# display canvas
plt.show()<jupyter_output><empty_output><jupyter_text>NumPyNumPy is used extensively to manipulate vectors and arrays in the UF3 framework. The [Numpy basics page](https://numpy.org/doc/stable/user/absolute_beginners.html) is a great reference for users transitioning from other programming languages. The [NumPy fundamentals page](https://numpy.org/doc/stable/user/basics.html) is an excellent resource for understanding indexing and broadcasting, concepts that appear frequently in the UF3 code.<jupyter_code>import numpy as np

# water molecule coordinates
length = 0.958  # O-H length
angle = np.deg2rad(104.5)  # H-O-H bond angle
coordinates_list = [[0.0, 0.0, 0.0],  # oxygen
                    [1.0, 0.0, 0.0],   # hydrogen
                    [np.cos(angle), np.sin(angle), 0.0]]
coordinates = np.array(coordinates_list) 
coordinates *= length

print("Coordinates of OH2 aligned on x-axis")
print(coordinates)
plt.figure(figsize=(3.5, 3.5))
plt.scatter(coordinates[:, 0], coordinates[:, 1], 
            s=100, color=["orange", "blue", "blue"])
plt.xlim(-1, 1)
plt.ylim(-1, 1)
plt.show()
# Rotation about z-axis with rotation matrix
rotation_matrix = np.array([[np.cos(angle/2), -np.sin(angle/2), 0.0],
                            [np.sin(angle/2), np.cos(angle/2), 0.0],
                            [0.0, 0.0, 1.0]])
new_coordinates = np.dot(coordinates, rotation_matrix)

print("Coordinates of OH2, reoriented")
print(new_coordinates)
plt.figure(figsize=(3.5, 3.5))
plt.scatter(new_coordinates[:, 0], new_coordinates[:, 1], 
            s=100, color=["orange", "blue", "blue"])
plt.xlim(-1, 1)
plt.ylim(-1, 1)
plt.show()<jupyter_output><empty_output><jupyter_text>ASEThe UF3 framework uses the Atomic Simulation Environment (ASE) to define, write, and read atomic configurations.  ase.AtomsThe [ase.Atoms](https://wiki.fysik.dtu.dk/ase/ase/atoms.html) class is used to define atomic configurations.<jupyter_code>import ase
# elements of atoms in system
composition = ["Ca", "Ti", "O", "O", "O"]
# lattice cell for repeating unit cell
lattice_constant = 3.889
lattice_vectors = [[lattice_constant, 0.0, 0.0],
                   [0.0, lattice_constant, 0.0],
                   [0.0, 0.0, lattice_constant]]
# atom positions (cartesian coordinates)
frac_coordinates = [[0.5, 0.5, 0.5],  # Ca
                    [0.0, 0.0, 0.0],  # Ti
                    [0.0, 0.5, 0.0],  # O
                    [0.0, 0.0, 0.5],  # O
                    [0.5, 0.0, 0.0],  # O
                   ]
# periodic in x, y, and z directions
periodicity = [True, True, True]

geometry = ase.Atoms(symbols=composition,
                     scaled_positions=frac_coordinates,
                     cell=lattice_vectors,
                     pbc=periodicity)
print(geometry)
numbers = geometry.get_atomic_numbers()
cartesian_positions = geometry.get_positions()
volume = geometry.get_volume()

print("List of atomic numbers:", numbers)
print("Ca coordinate:", cartesian_positions[0])
print(f"Unit cell volume: {volume} cubic angstroms")<jupyter_output>List of atomic numbers: [20 22  8  8  8]
Ca coordinate: [1.9445 1.9445 1.9445]
Unit cell volume: 58.81848436899998 cubic angstroms<jupyter_text>ase.build[ase.build](https://wiki.fysik.dtu.dk/ase/ase/build/build.html) is a convenient module for creating Atoms from common crystal structures, surfaces, and molecule names.<jupyter_code>from ase import build as ase_build

# Bulk wurtzite
name = "ZnS"
lattice_constant = 3.848
geometry = ase_build.bulk(name,
                          crystalstructure="wurtzite",
                          a=lattice_constant)
print(geometry)
# Aluminum (111) surface
name = "Al"
lattice_constant = 2.856
geometry = ase_build.fcc111(name,
                            size=(3, 3, 2),
                            a=lattice_constant)
print(geometry)<jupyter_output>Atoms(symbols='Al18', pbc=[True, True, False], cell=[[6.05849090120634, 0.0, 0.0], [3.02924545060317, 5.246807029041566, 0.0], [0.0, 0.0, 0.0]], tags=...)
{'fraction_non_alphanumeric': 0.14249422632794456, 'fraction_numerical': 0.05704387990762125, 'mean_word_length': 3.2294921875, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '257835', 'license': 'Apache-2.0', 'n_tokens_mistral': 1656, 'n_tokens_neox': 1484, 'n_words': 367, 'path': 'examples/modules/00_dependencies.ipynb', 'repo_name': 'sxie22/uf3', 'size': '4330'}