Introduction

by Joseph Wong 5/28/2019

This notebook demonstrates how you can create mixed grain boundaries. Here we use MgO as an example.

Mixed GB

First, we specify which rotation-axis, Σ value, and structure we will be using for the mixed grain boundary.

In [1]:
from aimsgb import GrainBoundary, Grain
axis = [0, 0, 1]
sigma = 5
initial_struct = Grain.from_file("POSCAR_MgO")

Mixed GB

Next, we create supercells of tilt and twist grain boundaries which will later be combined together to create the mixed grain boundary. To do this, we create grain boundary structures then convert them to grain objects for subsequent structural manipulations.

In [2]:
gb_tilt = GrainBoundary(axis, sigma, [1,2,0], initial_struct)
gb_twist = GrainBoundary(axis, sigma, [0,0,1], initial_struct)
grain_tilt = Grain.from_sites(gb_tilt.build_gb(to_primitive=False)[:]) 
grain_tilt.make_supercell([1,1,2])
grain_twist = Grain.from_sites(gb_twist.build_gb(to_primitive=False)[:])
grain_twist.make_supercell([1,2,1])

Once the supercells are created, we need to update the lattice parameters to create space for the atoms of the other cell to fit into each cell. Essentially, an empty space is created once the lattice parameters are increased. The atoms of the other cell will fill this empty space once the two cells are combined. Once the new lattice is obtained, it is used to update the fractional coordinates of the tilt and twist grain boundaries. In the case of the twist grain, we shift the cartesian coordinates over by the lattice parameter of the tilt grain so that the atoms do not overlap when the cells are combined. Once the fractional coordinates and lattice parameters are obtained, they are used to create Grain objects.

In [3]:
abc_tilt = list(grain_tilt.lattice.abc)
abc_twist, angles = list(grain_twist.lattice.lengths_and_angles)
abc_tilt[0] += abc_twist[0]
new_lat = Lattice.from_lengths_and_angles(abc_tilt, angles)
twist_fcoords = new_lat.get_fractional_coords(
    grain_twist.cart_coords + [grain_tilt.lattice.abc[0],0,0])
tilt_fcoords = new_lat.get_fractional_coords(grain_tilt.cart_coords)
grain_tilt = Grain(new_lat, grain_tilt.species, tilt_fcoords)
grain_twist = Grain(new_lat, grain_twist.species, twist_fcoords)

Finally, the Grain objects are used to create the mixed grain boundary structure. This mixed grain boundary structure can then be written to a file.

In [4]:
abc_tilt = list(grain_tilt.lattice.abc)
grain_mixed = Grain.from_sites(grain_tilt[:] + grain_twist[:])
grain_mixed = grain_mixed.get_sorted_structure()
grain_mixed.to(filename="grain_mixed.vasp",fmt="poscar")
Trulli