Creating Grain Boundaries#
In this notebook, creation and querying of GBs are discussed. These features are still under active development.
from atomrdf import KnowledgeGraph
import atomrdf.build as build
from ase.visualize import view
kg = KnowledgeGraph()
We start by creating a \(\Sigma 5 (3 \bar{1} 0)\)
struct_gb_1 = build.defect.grain_boundary(axis=[0,0,1],
sigma=5,
gb_plane=[3, -1, 0],
element='Fe',
graph=kg)
We can visualise the structure
view(struct_gb_1, viewer='x3d')
Some other examples, \(\Sigma 3 (1\bar{-1}0)\) and \(\Sigma 19 (111)\)
struct_gb_2 = build.defect.grain_boundary(axis=[1,1,2],
sigma=3,
gb_plane=[1, -1, 0],
element='Fe',
graph=kg)
struct_gb_3 = build.defect.grain_boundary(axis=[1,1,1],
sigma=19,
gb_plane=[1, 1, 1],
element='Fe',
graph=kg)
What are all the samples with symmetric tilt grain boundaries?
res = kg.query_sample(kg.ontology.terms.pldo.SymmetricalTiltGrainBoundary)
res
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[6], line 1
----> 1 res = kg.query_sample(kg.ontology.terms.pldo.SymmetricalTiltGrainBoundary)
2 res
AttributeError: 'KnowledgeGraph' object has no attribute 'query_sample'
We see we have one structure in the database. We can also find what is the sigma value of this structure by modifying our query.
res = kg.query_sample([kg.ontology.terms.pldo.SymmetricalTiltGrainBoundary,
kg.ontology.terms.pldo.hasSigmaValue])
res
| AtomicScaleSample | SymmetricalTiltGrainBoundary | hasSigmaValuevalue | |
|---|---|---|---|
| 0 | sample:4878c894-b017-4e05-be07-6669c450888f | sample:4878c894-b017-4e05-be07-6669c450888f_Sy... | 5 |
We can choose the sample, and save it
sample = res.AtomicScaleSample[0]
sample
rdflib.term.URIRef('sample:4878c894-b017-4e05-be07-6669c450888f')
kg.to_file(sample, filename="POSCAR", format="vasp")
! head -20 POSCAR
Fe
1.0000000000000000
18.1514737693664969 -0.0000000000000006 0.0000000000000000
0.0000000000000000 9.0757368846832485 0.0000000000000000
0.0000000000000011 0.0000000000000006 2.8699999999999997
Fe
40
Cartesian
0.0000000000000000 0.0000000000000000 0.0000000000000000
2.7227210654049743 0.9075736884683246 0.0000000000000002
1.8151473769366497 3.6302947538732990 0.0000000000000003
0.9075736884683242 6.3530158192782737 0.0000000000000004
5.4454421308099485 1.8151473769366493 0.0000000000000004
4.5378684423416242 4.5378684423416233 0.0000000000000006
3.6302947538732995 7.2605895077465981 0.0000000000000007
8.1681631962149215 2.7227210654049738 0.0000000000000007
7.2605895077465972 5.4454421308099477 0.0000000000000008
6.3530158192782693 8.1681631962149215 0.0000000000000009
0.9075736884683249 1.8151473769366495 1.4350000000000001
3.6302947538732990 2.7227210654049743 1.4350000000000003