Introduction¶

by Joseph Wong 5/27/2019

This notebook demonstrates how you can use the GBInformation class to construct grain boundaries in a systematic fashion. Here we use Co2VGa as an example.

Build GB in order of increasing angle θ¶

First we import the relevant aimsgb modules and select a rotation-axis and grain structure to be used for the grain boundary

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


Next, we will extract information using the GBInformation function by iterating through possible Σ values and storing the information in a dict (info). The Σ values are only odd numbers so we can skip the even Σ values to save some time. When a Σ value does not exist for a particular rotation axis, the GBInformation will raise a ValueError. We can tell python to do nothing when it encounters this error and continue iterating through the loop with try and except clauses.

In [2]:
info = {}
for sigma in range(3, 30, 2):
try:
info.update(GBInformation(axis, sigma, specific=True))
except ValueError:
pass


Once the information is extracted and stored in the dict, we can sort the dict by any metric of our choice (θ in this case) and loop through the contents, creating grain boundaries at each iteration. The information dict uses possible Σ values as keys and a dict of grain boundary information as values for each Σ key. The dict of grain boundary information has two keys: 'theta' and 'plane'. The Σ value, θ, plane, and initial structure are used to build the grain boundary for each iteration.

In [3]:
stp = {}
for sigma, value in sorted(info.iteritems(), key=lambda (s, v): min(v["theta"])):
stp["sigma"] = sigma
stp["theta"] = min(value["theta"])
theta_index = value["theta"].index(min(value["theta"]))
stp["plane"] = value["plane"][theta_index][0]
gb = GrainBoundary(axis, stp["sigma"], stp["plane"], initial_struct)
gb.build_gb(to_primitive=False).to(filename="POSCAR_Co2VGa"+"_gb{0:.2f}.vasp".format(stp["theta"])