From 891ea4409d2844832dc38564781e3efff8b0c238 Mon Sep 17 00:00:00 2001 From: Ninad Date: Mon, 15 Jul 2024 07:05:23 +0530 Subject: [PATCH] Add initial example (#38) --- examples/1_Getting_Started.ipynb | 144 +++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 examples/1_Getting_Started.ipynb diff --git a/examples/1_Getting_Started.ipynb b/examples/1_Getting_Started.ipynb new file mode 100644 index 0000000..ea56a5e --- /dev/null +++ b/examples/1_Getting_Started.ipynb @@ -0,0 +1,144 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Getting Started" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from atomid.annotate import AnnotateCrystal" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Read crystal structure file" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 1. Using read_crystal_structure_file function" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "file_path = \"../tests/data/fcc/Al/no_defect/Al.cif\"\n", + "\n", + "annotate_crystal = AnnotateCrystal()\n", + "\n", + "annotate_crystal.read_crystal_structure_file(file_path)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 2. Read file during class initiation" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "file_path = \"../tests/data/fcc/Al/no_defect/Al.cif\"\n", + "\n", + "annotate_crystal = AnnotateCrystal(file_path)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Identify Crystal Structure" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[92mCrystal structure: fcc\u001b[0m\n", + "\u001b[92mLattice constant: 4.05\u001b[0m\n" + ] + } + ], + "source": [ + "annotate_crystal.identify_crystal_structure()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Annoate Crystal Structure \n", + "Is identified crystal structures is satisfactory add information to the knowledge graph" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "annotate_crystal.annotate_crystal_structure()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Write ouput crystal structure file" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "annotate_crystal.write_to_file(\"crystal_kg.ttl\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "atomid-venv", + "language": "python", + "name": "atomid-venv" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.18" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}