diff --git a/.gitignore b/.gitignore index 7e99e36..69435bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*.pyc \ No newline at end of file +*.pyc +.ipynb_checkpoints diff --git a/examples/1_Getting_Started.ipynb b/examples/1_Getting_Started.ipynb index ea56a5e..dd5d6de 100644 --- a/examples/1_Getting_Started.ipynb +++ b/examples/1_Getting_Started.ipynb @@ -91,7 +91,7 @@ "metadata": {}, "source": [ "## Annoate Crystal Structure \n", - "Is identified crystal structures is satisfactory add information to the knowledge graph" + "If identified crystal structures is satisfactory add information to the knowledge graph" ] }, { diff --git a/examples/2_Setting_Crystal_Structure.ipynb b/examples/2_Setting_Crystal_Structure.ipynb new file mode 100644 index 0000000..d9fb8cf --- /dev/null +++ b/examples/2_Setting_Crystal_Structure.ipynb @@ -0,0 +1,104 @@ +{ + "cells": [ + { + "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": "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": [ + "## Set Crystal Structure Manually" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "annotate_crystal.set_crystal_structure(\"fcc\")\n", + "annotate_crystal.set_lattice_constant(4.5)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Annoate Crystal Structure \n", + "Add information to the knowledge graph" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "annotate_crystal.annotate_crystal_structure()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Write ouput crystal structure file" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "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 +} diff --git a/examples/3_Identify_Point_Defects.ipynb b/examples/3_Identify_Point_Defects.ipynb new file mode 100644 index 0000000..02a337c --- /dev/null +++ b/examples/3_Identify_Point_Defects.ipynb @@ -0,0 +1,153 @@ +{ + "cells": [ + { + "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": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "file_path = \"../tests/data/fcc/Al/defect/vacancy/Al_vacancy.cif\"\n", + "\n", + "annotate_crystal_vacancy = AnnotateCrystal()\n", + "\n", + "annotate_crystal_vacancy.read_crystal_structure_file(file_path)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Identify and Annotate Crystal Structure" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[92mCrystal structure: fcc\u001b[0m\n", + "\u001b[92mLattice constant: 4.05\u001b[0m\n" + ] + } + ], + "source": [ + "# Identify the crystal structure\n", + "annotate_crystal_vacancy.identify_crystal_structure()\n", + "\n", + "# Annotate the crystal structure\n", + "annotate_crystal_vacancy.annotate_crystal_structure()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Identify Point defects\n", + "Point defects are identified using the Wigner-Seitz algorithm, which requires a reference file structure for identification." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[92mIdentified defects:\u001b[0m\n", + "\u001b[92mvacancies:\u001b[0m Count: 40 Concentration: 0.01\n" + ] + } + ], + "source": [ + "ref_file = \"../tests/data/fcc/Al/no_defect/Al.cif\"\n", + "\n", + "# Identify point defects using the reference file\n", + "annotate_crystal_vacancy.identify_point_defects(\n", + " reference_data_file=ref_file, ref_format=\"cif\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Add information to Knowledge graph" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "annotate_crystal_vacancy.annotate_point_defects()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Write ouput crystal structure file" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "annotate_crystal_vacancy.write_to_file(\"crystal_kg.ttl\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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 +} diff --git a/examples/4_Set_Point_Defects.ipynb b/examples/4_Set_Point_Defects.ipynb new file mode 100644 index 0000000..7c75cb2 --- /dev/null +++ b/examples/4_Set_Point_Defects.ipynb @@ -0,0 +1,163 @@ +{ + "cells": [ + { + "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": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "file_path = \"../tests/data/fcc/Al/defect/vacancy/Al_vacancy.cif\"\n", + "\n", + "annotate_crystal_vacancy = AnnotateCrystal()\n", + "\n", + "annotate_crystal_vacancy.read_crystal_structure_file(file_path)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Identify and Annotate Crystal Structure" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[92mCrystal structure: fcc\u001b[0m\n", + "\u001b[92mLattice constant: 4.05\u001b[0m\n" + ] + } + ], + "source": [ + "# Identify the crystal structure\n", + "annotate_crystal_vacancy.identify_crystal_structure()\n", + "\n", + "# Annotate the crystal structure\n", + "annotate_crystal_vacancy.annotate_crystal_structure()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Identify Point defects\n", + "Point defects are identified using the Wigner-Seitz algorithm, which requires a reference file structure for identification." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[92mIdentified defects:\u001b[0m\n", + "\u001b[92mvacancies:\u001b[0m Count: 40 Concentration: 0.01\n" + ] + } + ], + "source": [ + "ref_file = \"../tests/data/fcc/Al/no_defect/Al.cif\"\n", + "\n", + "# Identify point defects using the reference file\n", + "annotate_crystal_vacancy.identify_point_defects(\n", + " reference_data_file=ref_file, ref_format=\"cif\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Set Point defects\n", + "If the identified point defects differ from the expected results, users have the option to manually set the point defect information." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "annotate_crystal_vacancy.add_vacancy_information(concentration=0.015, number=60)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Add information to Knowledge graph" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "annotate_crystal_vacancy.annotate_point_defects()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Write ouput crystal structure file" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "annotate_crystal_vacancy.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 +}