Skip to content

Commit

Permalink
adding get_kinds problems in API-oriented jn doc
Browse files Browse the repository at this point in the history
  • Loading branch information
mikibonacci committed Feb 8, 2024
1 parent 19bf071 commit 0bca290
Showing 1 changed file with 65 additions and 45 deletions.
110 changes: 65 additions & 45 deletions docs/source/user_guide/structuredata/API_start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,30 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# The StructureData object"
"# <a id='toc1_'></a>[The StructureData object](#toc0_)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Table of contents**<a id='toc0_'></a> \n",
"- [The StructureData object](#toc1_) \n",
" - [Initialization of a StructureData instance](#toc1_1_) \n",
" - [How to define the properties](#toc1_1_1_) \n",
" - [Inspect the supported and stored properties from the StructureData instance:](#toc1_1_2_) \n",
" - [Missing: access the supported property from the class object](#toc1_1_2_1_) \n",
" - [The immutability of the StructureData instance](#toc1_1_3_) \n",
" - [How to get kinds](#toc1_1_4_) \n",
"\n",
"<!-- vscode-jupyter-toc-config\n",
"\tnumbering=false\n",
"\tanchor=true\n",
"\tflat=false\n",
"\tminLevel=1\n",
"\tmaxLevel=6\n",
"\t/vscode-jupyter-toc-config -->\n",
"<!-- THIS CELL WILL BE REPLACED ON TOC UPDATE. DO NOT WRITE YOUR TEXT IN THIS CELL -->"
]
},
{
Expand Down Expand Up @@ -38,27 +61,16 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[93m\u001b[1mWarning\u001b[0m: \u001b[22mYou are currently using a post release development version of AiiDA: 2.4.0.post0\u001b[0m\n",
"\u001b[93m\u001b[1mWarning\u001b[0m: \u001b[22mBe aware that this is not recommended for production and is not officially supported.\u001b[0m\n",
"\u001b[93m\u001b[1mWarning\u001b[0m: \u001b[22mDatabases used with this version may not be compatible with future releases of AiiDA\u001b[0m\n",
"\u001b[93m\u001b[1mWarning\u001b[0m: \u001b[22mas you might not be able to automatically migrate your data.\n",
"\u001b[0m\n"
]
},
{
"data": {
"text/plain": [
"Profile<uuid='827a33dde1bc4d498af8e022f9e9dece' name='mikibonacci'>"
]
},
"execution_count": 1,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -100,7 +112,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -121,7 +133,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -139,16 +151,16 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Mass(parent=<StructureData: uuid: d0f2b3b7-38e6-4193-a028-5f0f21bea03b (unstored)>, value=[6.941, 6.945], domain='intra-site', default_kind_threshold=0.001)"
"Mass(parent=<StructureData: uuid: 72047b25-c462-4737-b06a-e4274afbc105 (unstored)>, value=[6.941, 6.945], domain='intra-site', default_kind_threshold=0.001)"
]
},
"execution_count": 4,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -159,7 +171,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 20,
"metadata": {},
"outputs": [
{
Expand All @@ -168,7 +180,7 @@
"[6.941, 6.945]"
]
},
"execution_count": 5,
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -179,7 +191,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 21,
"metadata": {},
"outputs": [
{
Expand All @@ -188,7 +200,7 @@
"'intra-site'"
]
},
"execution_count": 6,
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -206,7 +218,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 22,
"metadata": {},
"outputs": [
{
Expand All @@ -215,7 +227,7 @@
"{'value': [6.941, 6.945]}"
]
},
"execution_count": 7,
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -228,21 +240,21 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Inspect the supported and stored properties from the StructureData instance:"
"### <a id='toc1_1_2_'></a>[Inspect the supported and stored properties from the StructureData instance:](#toc0_)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['positions', 'cell', 'pbc', 'mass', 'symbols', 'custom', 'charge']"
"['pbc', 'mass', 'custom', 'cell', 'symbols', 'charge', 'positions']"
]
},
"execution_count": 8,
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -253,16 +265,16 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['positions', 'cell', 'pbc', 'mass', 'symbols', 'charge']"
"['mass', 'cell', 'pbc', 'symbols', 'charge', 'positions']"
]
},
"execution_count": 9,
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -275,7 +287,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Missing: access the supported property from the class object\n",
"#### <a id='toc1_1_2_1_'></a>[Missing: access the supported property from the class object](#toc0_)\n",
"\n",
"```python\n",
"In [1]: StructureData.get_supported_properties()\n",
Expand All @@ -287,7 +299,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### The immutability of the StructureData instance"
"### <a id='toc1_1_3_'></a>[The immutability of the StructureData instance](#toc0_)"
]
},
{
Expand All @@ -303,7 +315,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 25,
"metadata": {},
"outputs": [
{
Expand All @@ -317,7 +329,7 @@
" 'charge': {'value': [1, 0]}}"
]
},
"execution_count": 10,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -329,7 +341,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -338,7 +350,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 27,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -347,7 +359,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 28,
"metadata": {},
"outputs": [
{
Expand All @@ -356,7 +368,7 @@
"[6.941, 6.941]"
]
},
"execution_count": 13,
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -369,14 +381,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### How to get kinds\n",
"### <a id='toc1_1_4_'></a>[How to get kinds](#toc0_)\n",
"\n",
"It is possible to get a list of kinds using the `get_kinds` method. This will generate the corresponding predicted kinds for all the properties (the \"intra-site\" ones) and then generate the list of global different kinds. \n"
]
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 29,
"metadata": {},
"outputs": [
{
Expand All @@ -395,7 +407,7 @@
" {'mass': [6.9415, 6.945500000000001], 'charge': [1.1250000000000002, 0.225]})"
]
},
"execution_count": 16,
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -408,12 +420,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"As you can see, basically the value of a property is not the starting value choosen, and this is a PROBLEM: we have TOFIX this, especially in case in which the value is zero. \n",
"The issue is that we are using a middle-point representative value.\n",
"\n",
"Kinds are determined using, for each property, a given threshold. There is a default threshold:"
]
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 30,
"metadata": {},
"outputs": [
{
Expand All @@ -422,7 +437,7 @@
"0.001"
]
},
"execution_count": 17,
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -441,6 +456,11 @@
"structure.get_kinds(thr={\"mass\":0.1})\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 0bca290

Please sign in to comment.