Point defects: vacancies, interstitials, substitutionals#

atomRDF can build common point defects on top of any bulk structure and annotate them with the PODO (Point-Defect Ontology) terms, so they can be queried later just like any other sample.

In this notebook we will:

  1. Build a bulk Fe matrix.

  2. Add a vacancy, an interstitial and a substitutional defect.

  3. Use the term-builder to query the graph for samples that contain a specific defect type.

from atomrdf import KnowledgeGraph
import atomrdf.build as build
kg = KnowledgeGraph()

1. The pristine matrix#

bulk_fe = build.bulk("Fe", cubic=True, repeat=3, graph=kg)

2. Vacancy#

Remove one atom at random; the resulting sample is annotated as a podo:Vacancy.

vac = build.defect.vacancy(
    "Fe",
    no_of_vacancies=1,
    crystalstructure="bcc",
    cubic=True,
    repeat=3,
    graph=kg,
)

3. Octahedral self-interstitial#

inter = build.defect.interstitial(
    bulk_fe,
    element="Fe",
    void_type="octahedral",
    number=1,
    graph=kg,
)

4. Substitutional Cr atom#

sub = build.defect.substitutional(
    bulk_fe,
    element="Cr",
    number=1,
    graph=kg,
)

5. Browse and query#

How many samples are now in the graph?

kg.n_samples
4

Find all samples that contain a vacancy (PODO term). The fluent term builder kg.terms.podo.Vacancy makes the SPARQL implicit when the ontology network is available; otherwise the equivalent SPARQL works everywhere.

q = """
PREFIX podo: <http://purls.helmholtz-metadaten.de/podo/>
PREFIX cmso: <http://purls.helmholtz-metadaten.de/cmso/>
SELECT DISTINCT ?sample
WHERE {
    ?sample cmso:hasMaterial/cmso:hasDefect ?d .
    ?d a podo:Vacancy .
}
"""
kg.query(q)
sample

Now ask for substitutional defects:

q = """
PREFIX podo: <http://purls.helmholtz-metadaten.de/podo/>
PREFIX cmso: <http://purls.helmholtz-metadaten.de/cmso/>
SELECT DISTINCT ?sample
WHERE {
    ?sample cmso:hasMaterial/cmso:hasDefect ?d .
    ?d a podo:SubstitutionalDefect .
}
"""
kg.query(q)
sample

Persist the whole defect mini-database to Turtle so it can be reloaded or shared.

kg.write("defects.ttl", format="ttl")