diff --git a/Lecture1.ipynb b/Lecture1.ipynb index 90ff9b5..80810a2 100644 --- a/Lecture1.ipynb +++ b/Lecture1.ipynb @@ -23,16 +23,901 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting pymatgen\n", + " Downloading pymatgen-2023.10.11.tar.gz (7.3 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.3/7.3 MB\u001b[0m \u001b[31m22.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", + "\u001b[?25h Installing build dependencies ... \u001b[?25ldone\n", + "\u001b[?25h Getting requirements to build wheel ... \u001b[?25ldone\n", + "\u001b[?25h Installing backend dependencies ... \u001b[?25ldone\n", + "\u001b[?25h Preparing metadata (pyproject.toml) ... \u001b[?25ldone\n", + "\u001b[?25hCollecting matplotlib>=1.5 (from pymatgen)\n", + " Obtaining dependency information for matplotlib>=1.5 from https://files.pythonhosted.org/packages/98/a7/3883b2bd4e5cff02bdb578eadf09910581220660257183145b6d2253e018/matplotlib-3.8.0-cp310-cp310-macosx_11_0_arm64.whl.metadata\n", + " Downloading matplotlib-3.8.0-cp310-cp310-macosx_11_0_arm64.whl.metadata (5.8 kB)\n", + "Collecting monty>=3.0.2 (from pymatgen)\n", + " Obtaining dependency information for monty>=3.0.2 from https://files.pythonhosted.org/packages/5e/e5/d1d98b6c601ecab8d460efbff288724996e5c7aa7d54886fc67d8b2e5f57/monty-2023.9.25-py3-none-any.whl.metadata\n", + " Using cached monty-2023.9.25-py3-none-any.whl.metadata (2.9 kB)\n", + "Collecting networkx>=2.2 (from pymatgen)\n", + " Using cached networkx-3.1-py3-none-any.whl (2.1 MB)\n", + "Requirement already satisfied: numpy>=1.25.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen) (1.26.0)\n", + "Collecting palettable>=3.1.1 (from pymatgen)\n", + " Using cached palettable-3.3.3-py2.py3-none-any.whl (332 kB)\n", + "Collecting pandas (from pymatgen)\n", + " Obtaining dependency information for pandas from https://files.pythonhosted.org/packages/ff/5a/c7359edec58500b35da8dc40a69ea7b0a3be48a479e1c91e8e8d0a2d9aa7/pandas-2.1.1-cp310-cp310-macosx_11_0_arm64.whl.metadata\n", + " Downloading pandas-2.1.1-cp310-cp310-macosx_11_0_arm64.whl.metadata (18 kB)\n", + "Collecting plotly>=4.5.0 (from pymatgen)\n", + " Obtaining dependency information for plotly>=4.5.0 from https://files.pythonhosted.org/packages/df/79/c80174d711ee26ee5da55a9cc3e248f1ec7a0188b5e4d6bbbbcd09b974b0/plotly-5.17.0-py2.py3-none-any.whl.metadata\n", + " Using cached plotly-5.17.0-py2.py3-none-any.whl.metadata (7.0 kB)\n", + "Collecting pybtex (from pymatgen)\n", + " Using cached pybtex-0.24.0-py2.py3-none-any.whl (561 kB)\n", + "Requirement already satisfied: requests in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen) (2.31.0)\n", + "Collecting ruamel.yaml>=0.17.0 (from pymatgen)\n", + " Obtaining dependency information for ruamel.yaml>=0.17.0 from https://files.pythonhosted.org/packages/79/a9/ae2f346226fcec5beb172ae3cab6d47ae0baa986f1ed1bdf08d96b469b27/ruamel.yaml-0.17.35-py3-none-any.whl.metadata\n", + " Downloading ruamel.yaml-0.17.35-py3-none-any.whl.metadata (18 kB)\n", + "Requirement already satisfied: scipy>=1.5.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen) (1.11.3)\n", + "Collecting spglib>=2.0.2 (from pymatgen)\n", + " Using cached spglib-2.1.0.tar.gz (2.8 MB)\n", + " Installing build dependencies ... \u001b[?25ldone\n", + "\u001b[?25h Getting requirements to build wheel ... \u001b[?25ldone\n", + "\u001b[?25h Installing backend dependencies ... \u001b[?25ldone\n", + "\u001b[?25h Preparing metadata (pyproject.toml) ... \u001b[?25ldone\n", + "\u001b[?25hCollecting sympy (from pymatgen)\n", + " Using cached sympy-1.12-py3-none-any.whl (5.7 MB)\n", + "Collecting tabulate (from pymatgen)\n", + " Using cached tabulate-0.9.0-py3-none-any.whl (35 kB)\n", + "Collecting tqdm (from pymatgen)\n", + " Obtaining dependency information for tqdm from https://files.pythonhosted.org/packages/00/e5/f12a80907d0884e6dff9c16d0c0114d81b8cd07dc3ae54c5e962cc83037e/tqdm-4.66.1-py3-none-any.whl.metadata\n", + " Using cached tqdm-4.66.1-py3-none-any.whl.metadata (57 kB)\n", + "Collecting uncertainties>=3.1.4 (from pymatgen)\n", + " Using cached uncertainties-3.1.7-py2.py3-none-any.whl (98 kB)\n", + "Collecting joblib (from pymatgen)\n", + " Obtaining dependency information for joblib from https://files.pythonhosted.org/packages/10/40/d551139c85db202f1f384ba8bcf96aca2f329440a844f924c8a0040b6d02/joblib-1.3.2-py3-none-any.whl.metadata\n", + " Using cached joblib-1.3.2-py3-none-any.whl.metadata (5.4 kB)\n", + "Collecting contourpy>=1.0.1 (from matplotlib>=1.5->pymatgen)\n", + " Obtaining dependency information for contourpy>=1.0.1 from https://files.pythonhosted.org/packages/a9/65/544d66da0716b20084874297ff7596704e435cf011512f8e576638e83db2/contourpy-1.1.1-cp310-cp310-macosx_11_0_arm64.whl.metadata\n", + " Downloading contourpy-1.1.1-cp310-cp310-macosx_11_0_arm64.whl.metadata (5.9 kB)\n", + "Collecting cycler>=0.10 (from matplotlib>=1.5->pymatgen)\n", + " Obtaining dependency information for cycler>=0.10 from https://files.pythonhosted.org/packages/e7/05/c19819d5e3d95294a6f5947fb9b9629efb316b96de511b418c53d245aae6/cycler-0.12.1-py3-none-any.whl.metadata\n", + " Downloading cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB)\n", + "Collecting fonttools>=4.22.0 (from matplotlib>=1.5->pymatgen)\n", + " Obtaining dependency information for fonttools>=4.22.0 from https://files.pythonhosted.org/packages/f3/71/aadd0fb29ef6b57d57c10c7856082eed686942ff2977a5bb09aba79c62a8/fonttools-4.43.1-cp310-cp310-macosx_10_9_universal2.whl.metadata\n", + " Downloading fonttools-4.43.1-cp310-cp310-macosx_10_9_universal2.whl.metadata (152 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m152.4/152.4 kB\u001b[0m \u001b[31m16.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting kiwisolver>=1.0.1 (from matplotlib>=1.5->pymatgen)\n", + " Obtaining dependency information for kiwisolver>=1.0.1 from https://files.pythonhosted.org/packages/23/11/6fb190bae4b279d712a834e7b1da89f6dcff6791132f7399aa28a57c3565/kiwisolver-1.4.5-cp310-cp310-macosx_11_0_arm64.whl.metadata\n", + " Using cached kiwisolver-1.4.5-cp310-cp310-macosx_11_0_arm64.whl.metadata (6.4 kB)\n", + "Requirement already satisfied: packaging>=20.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from matplotlib>=1.5->pymatgen) (23.1)\n", + "Collecting pillow>=6.2.0 (from matplotlib>=1.5->pymatgen)\n", + " Obtaining dependency information for pillow>=6.2.0 from https://files.pythonhosted.org/packages/92/a4/c164eb1f692585982e1aa9bf2c1126da9721c2193cd1aba1eaf46fe7f1d7/Pillow-10.1.0-cp310-cp310-macosx_11_0_arm64.whl.metadata\n", + " Downloading Pillow-10.1.0-cp310-cp310-macosx_11_0_arm64.whl.metadata (9.5 kB)\n", + "Collecting pyparsing>=2.3.1 (from matplotlib>=1.5->pymatgen)\n", + " Obtaining dependency information for pyparsing>=2.3.1 from https://files.pythonhosted.org/packages/39/92/8486ede85fcc088f1b3dba4ce92dd29d126fd96b0008ea213167940a2475/pyparsing-3.1.1-py3-none-any.whl.metadata\n", + " Using cached pyparsing-3.1.1-py3-none-any.whl.metadata (5.1 kB)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from matplotlib>=1.5->pymatgen) (2.8.2)\n", + "Collecting tenacity>=6.2.0 (from plotly>=4.5.0->pymatgen)\n", + " Obtaining dependency information for tenacity>=6.2.0 from https://files.pythonhosted.org/packages/f4/f1/990741d5bb2487d529d20a433210ffa136a367751e454214013b441c4575/tenacity-8.2.3-py3-none-any.whl.metadata\n", + " Using cached tenacity-8.2.3-py3-none-any.whl.metadata (1.0 kB)\n", + "Collecting ruamel.yaml.clib>=0.2.7 (from ruamel.yaml>=0.17.0->pymatgen)\n", + " Obtaining dependency information for ruamel.yaml.clib>=0.2.7 from https://files.pythonhosted.org/packages/61/ee/4874c9fc96010fce85abefdcbe770650c5324288e988d7a48b527a423815/ruamel.yaml.clib-0.2.8-cp310-cp310-macosx_13_0_arm64.whl.metadata\n", + " Downloading ruamel.yaml.clib-0.2.8-cp310-cp310-macosx_13_0_arm64.whl.metadata (2.2 kB)\n", + "Collecting future (from uncertainties>=3.1.4->pymatgen)\n", + " Using cached future-0.18.3-py3-none-any.whl\n", + "Requirement already satisfied: pytz>=2020.1 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pandas->pymatgen) (2023.3.post1)\n", + "Collecting tzdata>=2022.1 (from pandas->pymatgen)\n", + " Using cached tzdata-2023.3-py2.py3-none-any.whl (341 kB)\n", + "Requirement already satisfied: PyYAML>=3.01 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pybtex->pymatgen) (6.0)\n", + "Collecting latexcodec>=1.0.4 (from pybtex->pymatgen)\n", + " Using cached latexcodec-2.0.1-py2.py3-none-any.whl (18 kB)\n", + "Requirement already satisfied: six in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pybtex->pymatgen) (1.16.0)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from requests->pymatgen) (2.0.4)\n", + "Requirement already satisfied: idna<4,>=2.5 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from requests->pymatgen) (3.4)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from requests->pymatgen) (1.26.16)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from requests->pymatgen) (2023.7.22)\n", + "Collecting mpmath>=0.19 (from sympy->pymatgen)\n", + " Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)\n", + "Downloading matplotlib-3.8.0-cp310-cp310-macosx_11_0_arm64.whl (7.5 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.5/7.5 MB\u001b[0m \u001b[31m54.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hUsing cached monty-2023.9.25-py3-none-any.whl (63 kB)\n", + "Using cached plotly-5.17.0-py2.py3-none-any.whl (15.6 MB)\n", + "Downloading ruamel.yaml-0.17.35-py3-none-any.whl (112 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m112.9/112.9 kB\u001b[0m \u001b[31m14.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hUsing cached joblib-1.3.2-py3-none-any.whl (302 kB)\n", + "Downloading pandas-2.1.1-cp310-cp310-macosx_11_0_arm64.whl (10.9 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m10.9/10.9 MB\u001b[0m \u001b[31m53.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m0:01\u001b[0m\n", + "\u001b[?25hUsing cached tqdm-4.66.1-py3-none-any.whl (78 kB)\n", + "Downloading contourpy-1.1.1-cp310-cp310-macosx_11_0_arm64.whl (232 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m232.4/232.4 kB\u001b[0m \u001b[31m24.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hDownloading cycler-0.12.1-py3-none-any.whl (8.3 kB)\n", + "Downloading fonttools-4.43.1-cp310-cp310-macosx_10_9_universal2.whl (2.7 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.7/2.7 MB\u001b[0m \u001b[31m48.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hUsing cached kiwisolver-1.4.5-cp310-cp310-macosx_11_0_arm64.whl (66 kB)\n", + "Downloading Pillow-10.1.0-cp310-cp310-macosx_11_0_arm64.whl (3.3 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.3/3.3 MB\u001b[0m \u001b[31m51.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hUsing cached pyparsing-3.1.1-py3-none-any.whl (103 kB)\n", + "Downloading ruamel.yaml.clib-0.2.8-cp310-cp310-macosx_13_0_arm64.whl (133 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m134.0/134.0 kB\u001b[0m \u001b[31m21.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hUsing cached tenacity-8.2.3-py3-none-any.whl (24 kB)\n", + "Building wheels for collected packages: pymatgen, spglib\n", + " Building wheel for pymatgen (pyproject.toml) ... \u001b[?25ldone\n", + "\u001b[?25h Created wheel for pymatgen: filename=pymatgen-2023.10.11-cp310-cp310-macosx_11_0_arm64.whl size=7845965 sha256=40636fd20f6af0075940653bc5ae8d97c4430f5e4566a0221f1265b93a5fb442\n", + " Stored in directory: /Users/adam/Library/Caches/pip/wheels/2d/9c/3b/50025bc61ace60e3c333e86ca326dc066ed3ecf173c0532f12\n", + " Building wheel for spglib (pyproject.toml) ... \u001b[?25ldone\n", + "\u001b[?25h Created wheel for spglib: filename=spglib-2.1.0-cp310-cp310-macosx_14_0_arm64.whl size=792865 sha256=62595066ba236b590d5bdaa2581ac6e1f40b98837fa8b914562ecda33a78e166\n", + " Stored in directory: /Users/adam/Library/Caches/pip/wheels/7f/49/e5/f762f83e49850a2bdcbad1ae9ce8c872a2610c709aba8350b4\n", + "Successfully built pymatgen spglib\n", + "Installing collected packages: mpmath, tzdata, tqdm, tenacity, tabulate, sympy, spglib, ruamel.yaml.clib, pyparsing, pillow, palettable, networkx, monty, latexcodec, kiwisolver, joblib, future, fonttools, cycler, contourpy, uncertainties, ruamel.yaml, pybtex, plotly, pandas, matplotlib, pymatgen\n", + "Successfully installed contourpy-1.1.1 cycler-0.12.1 fonttools-4.43.1 future-0.18.3 joblib-1.3.2 kiwisolver-1.4.5 latexcodec-2.0.1 matplotlib-3.8.0 monty-2023.9.25 mpmath-1.3.0 networkx-3.1 palettable-3.3.3 pandas-2.1.1 pillow-10.1.0 plotly-5.17.0 pybtex-0.24.0 pymatgen-2023.10.11 pyparsing-3.1.1 ruamel.yaml-0.17.35 ruamel.yaml.clib-0.2.8 spglib-2.1.0 sympy-1.12 tabulate-0.9.0 tenacity-8.2.3 tqdm-4.66.1 tzdata-2023.3 uncertainties-3.1.7\n" + ] + } + ], + "source": [ + "!pip install pymatgen" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting pysipfenn\n", + " Obtaining dependency information for pysipfenn from https://files.pythonhosted.org/packages/97/70/d3e58845aef72c328e24ef966f3c68adaf67cec6806bf01d77b3fabf1a85/pysipfenn-0.13.0-py3-none-any.whl.metadata\n", + " Downloading pysipfenn-0.13.0-py3-none-any.whl.metadata (9.9 kB)\n", + "Requirement already satisfied: pymatgen>=2023.2.22 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pysipfenn) (2023.10.11)\n", + "Collecting torch>=1.11.0 (from pysipfenn)\n", + " Obtaining dependency information for torch>=1.11.0 from https://files.pythonhosted.org/packages/ab/6a/0debe1ec3c63b1fd7487ec7dd8fb1adf19898bef5a8dc151265d79ffd915/torch-2.1.0-cp310-none-macosx_11_0_arm64.whl.metadata\n", + " Downloading torch-2.1.0-cp310-none-macosx_11_0_arm64.whl.metadata (24 kB)\n", + "Collecting onnx2torch>=1.5.2 (from pysipfenn)\n", + " Obtaining dependency information for onnx2torch>=1.5.2 from https://files.pythonhosted.org/packages/72/92/70b5cc3658d8abf77c968bbcf191b52d5c85707ba0bcb6a4d5fc1bb08613/onnx2torch-1.5.12-py3-none-any.whl.metadata\n", + " Downloading onnx2torch-1.5.12-py3-none-any.whl.metadata (22 kB)\n", + "Collecting onnx>=1.13.0 (from pysipfenn)\n", + " Obtaining dependency information for onnx>=1.13.0 from https://files.pythonhosted.org/packages/b2/05/46fa3a7576d9deaf619700967b73f7c4ddda18e55c071fe77166eba7e1c9/onnx-1.14.1-cp310-cp310-macosx_10_12_universal2.whl.metadata\n", + " Using cached onnx-1.14.1-cp310-cp310-macosx_10_12_universal2.whl.metadata (15 kB)\n", + "Requirement already satisfied: numpy>=1.22.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pysipfenn) (1.26.0)\n", + "Requirement already satisfied: tqdm>=4.65.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pysipfenn) (4.66.1)\n", + "Collecting natsort>=8.3.0 (from pysipfenn)\n", + " Obtaining dependency information for natsort>=8.3.0 from https://files.pythonhosted.org/packages/ef/82/7a9d0550484a62c6da82858ee9419f3dd1ccc9aa1c26a1e43da3ecd20b0d/natsort-8.4.0-py3-none-any.whl.metadata\n", + " Using cached natsort-8.4.0-py3-none-any.whl.metadata (21 kB)\n", + "Collecting pymongo>=4.2 (from pysipfenn)\n", + " Obtaining dependency information for pymongo>=4.2 from https://files.pythonhosted.org/packages/76/ea/9c84561b42ea769b19f701959d838efd585c3a89019e41ad5d5513dedca8/pymongo-4.5.0-cp310-cp310-macosx_10_9_universal2.whl.metadata\n", + " Using cached pymongo-4.5.0-cp310-cp310-macosx_10_9_universal2.whl.metadata (22 kB)\n", + "Collecting pySmartDL>=1.3.4 (from pysipfenn)\n", + " Using cached pySmartDL-1.3.4-py3-none-any.whl (20 kB)\n", + "Collecting dnspython (from pysipfenn)\n", + " Obtaining dependency information for dnspython from https://files.pythonhosted.org/packages/f6/b4/0a9bee52c50f226a3cbfb54263d02bb421c7f2adc136520729c2c689c1e5/dnspython-2.4.2-py3-none-any.whl.metadata\n", + " Using cached dnspython-2.4.2-py3-none-any.whl.metadata (4.9 kB)\n", + "Collecting protobuf>=3.20.2 (from onnx>=1.13.0->pysipfenn)\n", + " Obtaining dependency information for protobuf>=3.20.2 from https://files.pythonhosted.org/packages/88/12/efb5896c901382548ecb58d0449885a8f9aa62bb559d65e5a8a47f122629/protobuf-4.24.4-cp37-abi3-macosx_10_9_universal2.whl.metadata\n", + " Downloading protobuf-4.24.4-cp37-abi3-macosx_10_9_universal2.whl.metadata (540 bytes)\n", + "Requirement already satisfied: typing-extensions>=3.6.2.1 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from onnx>=1.13.0->pysipfenn) (4.7.1)\n", + "Collecting torchvision>=0.9.0 (from onnx2torch>=1.5.2->pysipfenn)\n", + " Obtaining dependency information for torchvision>=0.9.0 from https://files.pythonhosted.org/packages/de/5c/63da40bcac00e06eae06b52b4a82ba089b44d2cbd232020fe9194ea75ea9/torchvision-0.16.0-cp310-cp310-macosx_11_0_arm64.whl.metadata\n", + " Downloading torchvision-0.16.0-cp310-cp310-macosx_11_0_arm64.whl.metadata (6.6 kB)\n", + "Requirement already satisfied: matplotlib>=1.5 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (3.8.0)\n", + "Requirement already satisfied: monty>=3.0.2 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (2023.9.25)\n", + "Requirement already satisfied: networkx>=2.2 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (3.1)\n", + "Requirement already satisfied: palettable>=3.1.1 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (3.3.3)\n", + "Requirement already satisfied: pandas in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (2.1.1)\n", + "Requirement already satisfied: plotly>=4.5.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (5.17.0)\n", + "Requirement already satisfied: pybtex in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (0.24.0)\n", + "Requirement already satisfied: requests in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (2.31.0)\n", + "Requirement already satisfied: ruamel.yaml>=0.17.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (0.17.35)\n", + "Requirement already satisfied: scipy>=1.5.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (1.11.3)\n", + "Requirement already satisfied: spglib>=2.0.2 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (2.1.0)\n", + "Requirement already satisfied: sympy in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (1.12)\n", + "Requirement already satisfied: tabulate in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (0.9.0)\n", + "Requirement already satisfied: uncertainties>=3.1.4 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (3.1.7)\n", + "Requirement already satisfied: joblib in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pymatgen>=2023.2.22->pysipfenn) (1.3.2)\n", + "Collecting filelock (from torch>=1.11.0->pysipfenn)\n", + " Obtaining dependency information for filelock from https://files.pythonhosted.org/packages/5e/5d/97afbafd9d584ff1b45fcb354a479a3609bd97f912f8f1f6c563cb1fae21/filelock-3.12.4-py3-none-any.whl.metadata\n", + " Downloading filelock-3.12.4-py3-none-any.whl.metadata (2.8 kB)\n", + "Requirement already satisfied: jinja2 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from torch>=1.11.0->pysipfenn) (3.1.2)\n", + "Collecting fsspec (from torch>=1.11.0->pysipfenn)\n", + " Obtaining dependency information for fsspec from https://files.pythonhosted.org/packages/fe/d3/e1aa96437d944fbb9cc95d0316e25583886e9cd9e6adc07baad943524eda/fsspec-2023.9.2-py3-none-any.whl.metadata\n", + " Downloading fsspec-2023.9.2-py3-none-any.whl.metadata (6.7 kB)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from matplotlib>=1.5->pymatgen>=2023.2.22->pysipfenn) (1.1.1)\n", + "Requirement already satisfied: cycler>=0.10 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from matplotlib>=1.5->pymatgen>=2023.2.22->pysipfenn) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from matplotlib>=1.5->pymatgen>=2023.2.22->pysipfenn) (4.43.1)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from matplotlib>=1.5->pymatgen>=2023.2.22->pysipfenn) (1.4.5)\n", + "Requirement already satisfied: packaging>=20.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from matplotlib>=1.5->pymatgen>=2023.2.22->pysipfenn) (23.1)\n", + "Requirement already satisfied: pillow>=6.2.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from matplotlib>=1.5->pymatgen>=2023.2.22->pysipfenn) (10.1.0)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from matplotlib>=1.5->pymatgen>=2023.2.22->pysipfenn) (3.1.1)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from matplotlib>=1.5->pymatgen>=2023.2.22->pysipfenn) (2.8.2)\n", + "Requirement already satisfied: tenacity>=6.2.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from plotly>=4.5.0->pymatgen>=2023.2.22->pysipfenn) (8.2.3)\n", + "Requirement already satisfied: ruamel.yaml.clib>=0.2.7 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from ruamel.yaml>=0.17.0->pymatgen>=2023.2.22->pysipfenn) (0.2.8)\n", + "Requirement already satisfied: future in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from uncertainties>=3.1.4->pymatgen>=2023.2.22->pysipfenn) (0.18.3)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from jinja2->torch>=1.11.0->pysipfenn) (2.1.1)\n", + "Requirement already satisfied: pytz>=2020.1 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pandas->pymatgen>=2023.2.22->pysipfenn) (2023.3.post1)\n", + "Requirement already satisfied: tzdata>=2022.1 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pandas->pymatgen>=2023.2.22->pysipfenn) (2023.3)\n", + "Requirement already satisfied: PyYAML>=3.01 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pybtex->pymatgen>=2023.2.22->pysipfenn) (6.0)\n", + "Requirement already satisfied: latexcodec>=1.0.4 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pybtex->pymatgen>=2023.2.22->pysipfenn) (2.0.1)\n", + "Requirement already satisfied: six in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from pybtex->pymatgen>=2023.2.22->pysipfenn) (1.16.0)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from requests->pymatgen>=2023.2.22->pysipfenn) (2.0.4)\n", + "Requirement already satisfied: idna<4,>=2.5 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from requests->pymatgen>=2023.2.22->pysipfenn) (3.4)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from requests->pymatgen>=2023.2.22->pysipfenn) (1.26.16)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from requests->pymatgen>=2023.2.22->pysipfenn) (2023.7.22)\n", + "Requirement already satisfied: mpmath>=0.19 in /Users/adam/opt/anaconda3/envs/580demo/lib/python3.10/site-packages (from sympy->pymatgen>=2023.2.22->pysipfenn) (1.3.0)\n", + "Using cached pysipfenn-0.13.0-py3-none-any.whl (163 kB)\n", + "Using cached natsort-8.4.0-py3-none-any.whl (38 kB)\n", + "Using cached onnx-1.14.1-cp310-cp310-macosx_10_12_universal2.whl (15.2 MB)\n", + "Downloading onnx2torch-1.5.12-py3-none-any.whl (78 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m78.3/78.3 kB\u001b[0m \u001b[31m1.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hUsing cached pymongo-4.5.0-cp310-cp310-macosx_10_9_universal2.whl (529 kB)\n", + "Using cached dnspython-2.4.2-py3-none-any.whl (300 kB)\n", + "Downloading torch-2.1.0-cp310-none-macosx_11_0_arm64.whl (59.5 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m59.5/59.5 MB\u001b[0m \u001b[31m45.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", + "\u001b[?25hDownloading protobuf-4.24.4-cp37-abi3-macosx_10_9_universal2.whl (409 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m409.4/409.4 kB\u001b[0m \u001b[31m29.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hDownloading torchvision-0.16.0-cp310-cp310-macosx_11_0_arm64.whl (1.6 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.6/1.6 MB\u001b[0m \u001b[31m31.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hUsing cached filelock-3.12.4-py3-none-any.whl (11 kB)\n", + "Using cached fsspec-2023.9.2-py3-none-any.whl (173 kB)\n", + "Installing collected packages: pySmartDL, protobuf, natsort, fsspec, filelock, dnspython, torch, pymongo, onnx, torchvision, onnx2torch, pysipfenn\n", + "Successfully installed dnspython-2.4.2 filelock-3.12.4 fsspec-2023.9.2 natsort-8.4.0 onnx-1.14.1 onnx2torch-1.5.12 protobuf-4.24.4 pySmartDL-1.3.4 pymongo-4.5.0 pysipfenn-0.13.0 torch-2.1.0 torchvision-0.16.0\n" + ] + } + ], + "source": [ + "!pip install pysipfenn" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Manipulating and analyzing materials" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To start working with atomic structures, often referred to as atomic configurations or simply materials, we need to be able to represent and manipulate them. One of the most powerful and mature tools to do so is [pymatgen](https://github.com/materialsproject/pymatgen) which we just installed. The critical component of pymatgen is its library of representations of fundamental materials objects, such as `Structure` and `Molecule`, contained in the `pymatgen.core` module. Let's import it and create a simple cubic structure of Al, like we did in the DFTTK tutorial last week:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Basics" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [], + "source": [ + "from pymatgen.core import Structure\n", + "\n", + "s = Structure(lattice=[[4.0384, 0, 0], [0, 4.0384, 0], [0, 0, 4.0384]],\n", + " species=['Al', 'Al', 'Al', 'Al'],\n", + " coords=[[0.0, 0.0, 0.0], [0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now, `s` holds our initialized structure and we can apply print on it to see what it looks like:" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Full Formula (Al4)\n", + "Reduced Formula: Al\n", + "abc : 4.038400 4.038400 4.038400\n", + "angles: 90.000000 90.000000 90.000000\n", + "pbc : True True True\n", + "Sites (4)\n", + " # SP a b c\n", + "--- ---- --- --- ---\n", + " 0 Al 0 0 0\n", + " 1 Al 0 0.5 0.5\n", + " 2 Al 0.5 0 0.5\n", + " 3 Al 0.5 0.5 0\n" + ] + } + ], + "source": [ + "print(s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Initialized** is a critical word here, because the `Structure` object is not just a collection of \"numbers\". It holds a lot of information we can access using the `Structure` object's attributes and methods. For example, density of the material is immediately available:" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2.721120664587368" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.density" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can also \"mutate\" the object with a few intuitive methods like `apply_strain`:" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Structure Summary\n", + "Lattice\n", + " abc : 4.442240000000001 4.442240000000001 4.442240000000001\n", + " angles : 90.0 90.0 90.0\n", + " volume : 87.66092623767148\n", + " A : 4.442240000000001 0.0 0.0\n", + " B : 0.0 4.442240000000001 0.0\n", + " C : 0.0 0.0 4.442240000000001\n", + " pbc : True True True\n", + "PeriodicSite: Al (0.0, 0.0, 0.0) [0.0, 0.0, 0.0]\n", + "PeriodicSite: Al (0.0, 2.221, 2.221) [0.0, 0.5, 0.5]\n", + "PeriodicSite: Al (2.221, 0.0, 2.221) [0.5, 0.0, 0.5]\n", + "PeriodicSite: Al (2.221, 2.221, 0.0) [0.5, 0.5, 0.0]" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.apply_strain(0.1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Importantly, as you can see `s` has been printed out when we ran the command, as if the `s.apply_strain` returned a modified `Structure` object. This is true! However, by default, pymatgen will also strain the original object, as you can see looking at the `s` density:" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2.0444182303436262" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.density" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This is a very convenient feature, but it can be dangerous if you are not careful and, for instance, try to generate 10 structures with increasing strains" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Full Formula (Al4)\n", + "Reduced Formula: Al\n", + "abc : 297.826681 297.826681 297.826681\n", + "angles: 90.000000 90.000000 90.000000\n", + "pbc : True True True\n", + "Sites (4)\n", + " # SP a b c\n", + "--- ---- --- --- ---\n", + " 0 Al 0 0 0\n", + " 1 Al 0 0.5 0.5\n", + " 2 Al 0.5 0 0.5\n", + " 3 Al 0.5 0.5 0\n", + "Full Formula (Al4)\n", + "Reduced Formula: Al\n", + "abc : 297.826681 297.826681 297.826681\n", + "angles: 90.000000 90.000000 90.000000\n", + "pbc : True True True\n", + "Sites (4)\n", + " # SP a b c\n", + "--- ---- --- --- ---\n", + " 0 Al 0 0 0\n", + " 1 Al 0 0.5 0.5\n", + " 2 Al 0.5 0 0.5\n", + " 3 Al 0.5 0.5 0\n" + ] + } + ], + "source": [ + "strainedList = [s.apply_strain(0.1 * i) for i in range(1, 11)]\n", + "for strained in strainedList[:2]:\n", + " print(strained)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "we will now end up with a single object with 67 times the original volume (1.1 * 1.2 * ... * 2.0) repeated 10 times. To avoid this, we can get regenerate original `s` and use the `copy` method to create a new object each time:" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [], + "source": [ + "from copy import copy\n", + "\n", + "s = Structure(lattice=[[4.0384, 0, 0], [0, 4.0384, 0], [0, 0, 4.0384]],\n", + " species=['Al', 'Al', 'Al', 'Al'],\n", + " coords=[[0.0, 0.0, 0.0], [0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]])" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Full Formula (Ni3 Au1)\n", + "Reduced Formula: Ni3Au\n", + "abc : 4.038400 4.038400 4.038400\n", + "angles: 90.000000 90.000000 90.000000\n", + "pbc : True True True\n", + "Sites (4)\n", + " # SP a b c\n", + "--- ---- --- --- ---\n", + " 0 Au 0 0 0\n", + " 1 Ni 0 0.5 0.5\n", + " 2 Ni 0.5 0 0.5\n", + " 3 Ni 0.5 0.5 0\n", + "Full Formula (Ni3 Au1)\n", + "Reduced Formula: Ni3Au\n", + "abc : 4.442240 4.442240 4.442240\n", + "angles: 90.000000 90.000000 90.000000\n", + "pbc : True True True\n", + "Sites (4)\n", + " # SP a b c\n", + "--- ---- --- --- ---\n", + " 0 Au 0 0 0\n", + " 1 Ni 0 0.5 0.5\n", + " 2 Ni 0.5 0 0.5\n", + " 3 Ni 0.5 0.5 0\n" + ] + } + ], + "source": [ + "strainedList = [copy(s).apply_strain(0.1 * i) for i in range(0, 11)]\n", + "for strained in strainedList[:2]:\n", + " print(strained)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "And now everything works as expected! We can also easily do some modifications to the structure, like replacing one of the atoms with another" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Full Formula (Ni3 Au1)\n", + "Reduced Formula: Ni3Au\n", + "abc : 4.038400 4.038400 4.038400\n", + "angles: 90.000000 90.000000 90.000000\n", + "pbc : True True True\n", + "Sites (4)\n", + " # SP a b c\n", + "--- ---- --- --- ---\n", + " 0 Au 0 0 0\n", + " 1 Ni 0 0.5 0.5\n", + " 2 Ni 0.5 0 0.5\n", + " 3 Ni 0.5 0.5 0\n" + ] + } + ], + "source": [ + "s.replace(0, \"Au\")\n", + "print(s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "or all of the atoms of a given element at once" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Structure Summary\n", + "Lattice\n", + " abc : 4.0384 4.0384 4.0384\n", + " angles : 90.0 90.0 90.0\n", + " volume : 65.860951343104\n", + " A : 4.0384 0.0 0.0\n", + " B : 0.0 4.0384 0.0\n", + " C : 0.0 0.0 4.0384\n", + " pbc : True True True\n", + "PeriodicSite: Au (0.0, 0.0, 0.0) [0.0, 0.0, 0.0]\n", + "PeriodicSite: Ni (0.0, 4.038, 4.038) [0.0, 0.5, 0.5]\n", + "PeriodicSite: Ni (4.038, 0.0, 4.038) [0.5, 0.0, 0.5]\n", + "PeriodicSite: Ni (4.038, 4.038, 0.0) [0.5, 0.5, 0.0]" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.replace_species({\"Al\": \"Ni\"})" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Lastly, with `Structure` objects, we also have access to lower-order primitives, such as `Composition`" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Composition('Au1 Ni3')" + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c = s.composition\n", + "c" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "which may look like a simple string but is actually a powerful object that can be used to do things like calculate the fraction of each element in the structure:" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Composition('Au0.25 Ni0.75')" + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c.fractional_composition" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "including the weight fractions (I wrote this part of pymatgen 🙂):" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Au': 0.5279943035775228, 'Ni': 0.47200569642247725}" + ] + }, + "execution_count": 75, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c.to_weight_dict" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Symmetry Analysis\n", + "\n", + "With some basics of the way, let's look at some more advanced features of pymatgen that come from integration with 3rd party libraries like [spglib](https://spglib.readthedocs.io/en/latest/index.html) which is a high performance library for symmetry analysis (1) written in C, (2) wrapped in Python by the authors, and finally (3) wrapped in pymatgen for convenience.\n", + "\n", + "Such approach introduces a lot of perfromance bottlenecks (4-20x slower and 50x RAM needs compared to my interface written in [Nim](https://nim-lang.org)), but allowing us to get started with things like symmetry analysis in with just one line of code, where `SpacegroupAnalyzer` puts `s` in a new context:" + ] + }, + { + "cell_type": "code", + "execution_count": 76, "metadata": {}, "outputs": [], + "source": [ + "from pymatgen.symmetry.analyzer import SpacegroupAnalyzer\n", + "spgA = SpacegroupAnalyzer(s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now many useful methods are available to us, allowing quickly getting `crystal_system`, `space_group_symbol`, and `point_group_symbol`:" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'cubic'" + ] + }, + "execution_count": 89, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "spgA.get_crystal_system()" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Pm-3m'" + ] + }, + "execution_count": 90, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "spgA.get_space_group_symbol()" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'m-3m'" + ] + }, + "execution_count": 91, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "spgA.get_point_group_symbol()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can also do some more advanced operations involving symmetry. For example, as some may have noticed, the `s` structure we created is primitive, but if we fix its symmetry, we can describe it with just 1 face centered atom instead of 3 as they are symmetrically equivalent. We can do this with the `get_symmetrized_structure` " + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "SymmetrizedStructure\n", + "Full Formula (Ni3 Au1)\n", + "Reduced Formula: Ni3Au\n", + "Spacegroup: Pm-3m (221)\n", + "abc : 4.038400 4.038400 4.038400\n", + "angles: 90.000000 90.000000 90.000000\n", + "Sites (4)\n", + " # SP a b c Wyckoff\n", + "--- ---- --- --- --- ---------\n", + " 0 Au 0 0 0 1a\n", + " 1 Ni 0 0.5 0.5 3c" + ] + }, + "execution_count": 99, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "symmetrized = spgA.get_symmetrized_structure()\n", + "symmetrized" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "which we can then use to get the primitive or conventional structure back (here they are the same):" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Structure Summary\n", + "Lattice\n", + " abc : 4.0384 4.0384 4.0384\n", + " angles : 90.0 90.0 90.0\n", + " volume : 65.860951343104\n", + " A : 4.0384 0.0 2.472806816838336e-16\n", + " B : -2.472806816838336e-16 4.0384 2.472806816838336e-16\n", + " C : 0.0 0.0 4.0384\n", + " pbc : True True True\n", + "PeriodicSite: Ni (-1.236e-16, 2.019, 2.019) [0.0, 0.5, 0.5]\n", + "PeriodicSite: Ni (2.019, 0.0, 2.019) [0.5, 0.0, 0.5]\n", + "PeriodicSite: Ni (2.019, 2.019, 2.473e-16) [0.5, 0.5, 0.0]\n", + "PeriodicSite: Au (0.0, 0.0, 0.0) [0.0, 0.0, 0.0]" + ] + }, + "execution_count": 104, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "symmetrized.to_primitive()" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Structure Summary\n", + "Lattice\n", + " abc : 4.0384 4.0384 4.0384\n", + " angles : 90.0 90.0 90.0\n", + " volume : 65.860951343104\n", + " A : 4.0384 0.0 2.472806816838336e-16\n", + " B : -2.472806816838336e-16 4.0384 2.472806816838336e-16\n", + " C : 0.0 0.0 4.0384\n", + " pbc : True True True\n", + "PeriodicSite: Ni (-1.236e-16, 2.019, 2.019) [0.0, 0.5, 0.5]\n", + "PeriodicSite: Ni (2.019, 0.0, 2.019) [0.5, 0.0, 0.5]\n", + "PeriodicSite: Ni (2.019, 2.019, 2.473e-16) [0.5, 0.5, 0.0]\n", + "PeriodicSite: Au (0.0, 0.0, 0.0) [0.0, 0.0, 0.0]" + ] + }, + "execution_count": 105, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "symmetrized.to_conventional()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### More Complex Structures\n", + "\n", + "Armed with all the basics, let's look at some more complex structures." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Manipulating and analyzing materials" + "

\n", + " \n", + "

" ] }, { @@ -78,8 +963,22 @@ } ], "metadata": { + "kernelspec": { + "display_name": "580demo", + "language": "python", + "name": "python3" + }, "language_info": { - "name": "python" + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.13" }, "orig_nbformat": 4 }, diff --git a/assets/0-Cr8Fe18Ni4.POSCAR b/assets/0-Cr8Fe18Ni4.POSCAR new file mode 100644 index 0000000..0f9a39e --- /dev/null +++ b/assets/0-Cr8Fe18Ni4.POSCAR @@ -0,0 +1,38 @@ +Cr8 Fe18 Ni4 +1.0 +8.547048 0.000000 0.000000 +0.000000 8.547048 0.000000 +0.000000 0.000000 4.477714 +Cr Fe Ni +8 18 4 +direct +0.737702 0.063709 0.000000 Cr +0.262298 0.936291 0.000000 Cr +0.436291 0.237702 0.500000 Cr +0.762298 0.563709 0.500000 Cr +0.563709 0.762298 0.500000 Cr +0.237702 0.436291 0.500000 Cr +0.063709 0.737702 0.000000 Cr +0.936291 0.262298 0.000000 Cr +0.000000 0.000000 0.000000 Fe +0.500000 0.500000 0.500000 Fe +0.463029 0.129472 0.000000 Fe +0.536971 0.870528 0.000000 Fe +0.370528 0.963029 0.500000 Fe +0.036971 0.629472 0.500000 Fe +0.629472 0.036971 0.500000 Fe +0.963029 0.370528 0.500000 Fe +0.129472 0.463029 0.000000 Fe +0.870528 0.536971 0.000000 Fe +0.182718 0.182718 0.251726 Fe +0.817282 0.817282 0.748274 Fe +0.817282 0.817282 0.251726 Fe +0.317282 0.682718 0.751726 Fe +0.317282 0.682718 0.248274 Fe +0.182718 0.182718 0.748274 Fe +0.682718 0.317282 0.248274 Fe +0.682718 0.317282 0.751726 Fe +0.399910 0.399910 0.000000 Ni +0.600090 0.600090 0.000000 Ni +0.100090 0.899910 0.500000 Ni +0.899910 0.100090 0.500000 Ni diff --git a/assets/112-Cr12Fe10Ni8.png b/assets/112-Cr12Fe10Ni8.png new file mode 100644 index 0000000..1a7e79c Binary files /dev/null and b/assets/112-Cr12Fe10Ni8.png differ