Building Perovskite Structures from their Ions Components with pyrovskite.
This notebook demonstrates how to use the python package pyrovskite to build hypothetical structures using the ions components. We will create a hypothetical Dion-Jacobson perovskite structure using the cations extracted from the Halide Perovskite Ions database.
Let's start by installing the package and importing the necessary libraries.
! pip install pyrovskite
Requirement already satisfied: pyrovskite in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (1.0.0) Requirement already satisfied: pymatgen in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pyrovskite) (2024.5.1) Requirement already satisfied: ase in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pyrovskite) (3.22.1) Requirement already satisfied: matplotlib>=3.1.0 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from ase->pyrovskite) (3.10.0) Requirement already satisfied: numpy>=1.15.0 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from ase->pyrovskite) (1.26.4) Requirement already satisfied: scipy>=1.1.0 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from ase->pyrovskite) (1.14.1) Requirement already satisfied: monty>=2024.2.2 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (2024.12.10) Requirement already satisfied: networkx>=2.2 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (3.4.2) Requirement already satisfied: palettable>=3.1.1 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (3.3.3) Requirement already satisfied: pandas in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (2.2.3) Requirement already satisfied: plotly>=4.5.0 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (5.24.1) Requirement already satisfied: pybtex in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (0.24.0) Requirement already satisfied: requests in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (2.31.0) Requirement already satisfied: ruamel.yaml>=0.17.0 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (0.18.6) Requirement already satisfied: spglib>=2.0.2 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (2.5.0) Requirement already satisfied: sympy in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (1.13.3) Requirement already satisfied: tabulate in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (0.8.9) Requirement already satisfied: tqdm in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (4.67.1) Requirement already satisfied: uncertainties>=3.1.4 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (3.2.2) Requirement already satisfied: joblib in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pymatgen->pyrovskite) (1.4.2) Requirement already satisfied: contourpy>=1.0.1 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase->pyrovskite) (1.3.1) Requirement already satisfied: cycler>=0.10 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase->pyrovskite) (0.12.1) Requirement already satisfied: fonttools>=4.22.0 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase->pyrovskite) (4.55.3) Requirement already satisfied: kiwisolver>=1.3.1 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase->pyrovskite) (1.4.7) Requirement already satisfied: packaging>=20.0 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase->pyrovskite) (24.2) Requirement already satisfied: pillow>=8 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase->pyrovskite) (10.0.1) Requirement already satisfied: pyparsing>=2.3.1 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase->pyrovskite) (3.2.0) Requirement already satisfied: python-dateutil>=2.7 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase->pyrovskite) (2.9.0.post0) Requirement already satisfied: tenacity>=6.2.0 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from plotly>=4.5.0->pymatgen->pyrovskite) (9.0.0) Requirement already satisfied: ruamel.yaml.clib>=0.2.7 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from ruamel.yaml>=0.17.0->pymatgen->pyrovskite) (0.2.12) Requirement already satisfied: pytz>=2020.1 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pandas->pymatgen->pyrovskite) (2024.2) Requirement already satisfied: tzdata>=2022.7 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pandas->pymatgen->pyrovskite) (2024.2) Requirement already satisfied: PyYAML>=3.01 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pybtex->pymatgen->pyrovskite) (6.0.2) Requirement already satisfied: latexcodec>=1.0.4 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pybtex->pymatgen->pyrovskite) (3.0.0) Requirement already satisfied: six in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from pybtex->pymatgen->pyrovskite) (1.17.0) Requirement already satisfied: charset-normalizer<4,>=2 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from requests->pymatgen->pyrovskite) (3.4.0) Requirement already satisfied: idna<4,>=2.5 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from requests->pymatgen->pyrovskite) (3.10) Requirement already satisfied: urllib3<3,>=1.21.1 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from requests->pymatgen->pyrovskite) (1.26.20) Requirement already satisfied: certifi>=2017.4.17 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from requests->pymatgen->pyrovskite) (2024.12.14) Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/pepe_marquez/NOMAD/nomad/.pyenv/lib/python3.11/site-packages (from sympy->pymatgen->pyrovskite) (1.3.0) [notice] A new release of pip is available: 24.0 -> 24.3.1 [notice] To update, run: pip install --upgrade pip
import os
import ase.io
In this notebook we will be using already downloaded data from the Halide Perovskite Ions database. We will use a Methilammonium (MA) cation, 2-(2-azaniumylethyldisulfanyl)ethylazanium (AESE) as a separator, a Bromide (Br) anion, and a Tin (Sn) cation to build a Dion-Jacobson perovskite structure.
You can also retrieve further structures using the NOMAD API.
if not os.path.isdir('builder_outputs'):
os.mkdir('builder_outputs')
from pyrovskite.builder import *
A = ase.io.read('CNH6.xyz')
Ap = ase.io.read('C2NH7S.xyz')
from ase.visualize import view
from pyrovskite.builder import make_dj
dion_jacobson = make_dj(
Ap=Ap,
A=A,
B='Sn',
X='Br',
n=2,
BX_dist=2.8,
Ap_Rx=0,
Ap_Ry=90,
Ap_Rz=0,
penet=-0.2,
Bp='Sn',
)
Let's increase the system size and visualize the structure.
large_dion_jacobson = dion_jacobson.repeat((4, 2, 2))
view(large_dion_jacobson, viewer='x3d')
Great! Save your structure and feel free to bring it to the next step to relax the structure with your favorite DFT code or your or machine learning model. Explore the pyrovskite package and build your own structures using the ions components from the Halide Perovskite Ions database.
dion_jacobson.write('builder_outputs/dion_jacobson.cif')