Creating Grain Boundaries#
In this notebook, creation and querying of GBs are discussed. These features are still under active development.
from atomrdf import KnowledgeGraph, System
kg = KnowledgeGraph()
We start by creating a \(\Sigma 5 (3 \bar{1} 0)\)
struct_gb_1 = System.create.defect.grain_boundary(axis=[0,0,1],
sigma=5,
gb_plane=[3, -1, 0],
element='Fe',
graph=kg)
We can visualise the structure
struct_gb_1.show.all()
Some other examples, \(\Sigma 3 (1\bar{-1}0)\) and \(\Sigma 19 (111)\)
struct_gb_2 = System.create.defect.grain_boundary(axis=[1,1,2],
sigma=3,
gb_plane=[1, -1, 0],
element='Fe',
graph=kg)
struct_gb_3 = System.create.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
AtomicScaleSample | SymmetricalTiltGrainBoundary | |
---|---|---|
0 | sample:fcfffdab-8b6f-4d8b-88fb-eb3224f44b2a | sample:fcfffdab-8b6f-4d8b-88fb-eb3224f44b2a_Sy... |
1 | sample:36ff2c47-557d-460a-8e0e-c1cecb8e9e3f | sample:36ff2c47-557d-460a-8e0e-c1cecb8e9e3f_Gr... |
2 | sample:05242aa6-3055-4485-b2b3-62487353484b | sample:05242aa6-3055-4485-b2b3-62487353484b_Tw... |
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:fcfffdab-8b6f-4d8b-88fb-eb3224f44b2a | sample:fcfffdab-8b6f-4d8b-88fb-eb3224f44b2a_Sy... | 5 |
1 | sample:36ff2c47-557d-460a-8e0e-c1cecb8e9e3f | sample:36ff2c47-557d-460a-8e0e-c1cecb8e9e3f_Gr... | 3 |
2 | sample:05242aa6-3055-4485-b2b3-62487353484b | sample:05242aa6-3055-4485-b2b3-62487353484b_Tw... | 19 |
We can choose the sample, and save it
sample = res.AtomicScaleSample[0]
sample
rdflib.term.URIRef('sample:fcfffdab-8b6f-4d8b-88fb-eb3224f44b2a')
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