From 1392064cce1f12ae6786a79720e809e008dca5af Mon Sep 17 00:00:00 2001 From: Simon Humpohl <simon.humpohl@rwth-aachen.de> Date: Tue, 9 Apr 2024 10:41:17 +0200 Subject: [PATCH] Split notebook in genmeration and analysis --- DataAnalysis.ipynb | 75 ++++++++++++++++++++++++++++ ML4QDM.ipynb => DataGeneration.ipynb | 32 +++--------- requirements.txt | 2 + simulation.py | 2 + 4 files changed, 87 insertions(+), 24 deletions(-) create mode 100644 DataAnalysis.ipynb rename ML4QDM.ipynb => DataGeneration.ipynb (77%) diff --git a/DataAnalysis.ipynb b/DataAnalysis.ipynb new file mode 100644 index 0000000..348b669 --- /dev/null +++ b/DataAnalysis.ipynb @@ -0,0 +1,75 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "b115b402-4588-49a0-b984-e8983488aebc", + "metadata": {}, + "source": [ + "# Data analysis" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3df6f25e-a136-4524-8081-96524ed88848", + "metadata": {}, + "outputs": [], + "source": [ + "import xarray as xr\n", + "\n", + "lj_data = xr.load_dataset('lj_data.ndf')\n", + "emt_data = xr.load_dataset('emt_data.ndf')\n", + "all_data = xr.concat([lj_data, emt_data], xr.Variable('Method', ['LennardJones', 'EMT']))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d9a52cce-24aa-4286-9732-6c772389425a", + "metadata": {}, + "outputs": [], + "source": [ + "all_data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c5c696be-1713-4cd0-8cdf-bf890af3156b", + "metadata": {}, + "outputs": [], + "source": [ + "lj_data['Energy'].loc[..., 'Al', :].plot.line(x='lattice_constant')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4a51b954-c2ed-4f94-a7a6-35a45254f8c3", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "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.11.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/ML4QDM.ipynb b/DataGeneration.ipynb similarity index 77% rename from ML4QDM.ipynb rename to DataGeneration.ipynb index 7cc68d5..dab1dc1 100644 --- a/ML4QDM.ipynb +++ b/DataGeneration.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "136f209c-91a7-4a11-8386-ef5535eeba9a", + "id": "524f1ba2-39ab-40a9-9cab-dd170c39bf16", "metadata": {}, "source": [ "# Data generation\n", @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "e18e2f2d-e0da-43eb-b378-2b617dbb73fa", "metadata": {}, "outputs": [], @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "eaa1b986-1329-491d-850f-4d5edefe5b14", "metadata": {}, "outputs": [], @@ -44,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "36aac675-21f5-4c7b-b225-416c3681b0b8", "metadata": {}, "outputs": [], @@ -59,26 +59,10 @@ "lj_df.to_csv('lj_data.csv')" ] }, - { - "cell_type": "markdown", - "id": "f7a5a554-26ce-4695-aa37-c787df57268d", - "metadata": {}, - "source": [ - "# Data analysis" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "941fe208-519d-4c9f-ab6d-1d973181c66f", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "code", "execution_count": null, - "id": "028e3710-8ab2-44c6-809b-f7b1ae1a3e98", + "id": "54f57a76-f131-459f-98d0-f16b5b59b297", "metadata": {}, "outputs": [], "source": [] @@ -86,9 +70,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Project (ml4q DM workshop Simulation)", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "simulation_venv" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -100,7 +84,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.2" } }, "nbformat": 4, diff --git a/requirements.txt b/requirements.txt index d22d5d0..81e611f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ numpy==1.25 ase==3.22.1 xarray==2024.2.0 +ipympl==0.9.3 +h5netcdf==1.3.0 \ No newline at end of file diff --git a/simulation.py b/simulation.py index 11292dc..9957a1f 100644 --- a/simulation.py +++ b/simulation.py @@ -7,12 +7,14 @@ import xarray as xr from ase.build import bulk from ase.calculators.emt import EMT from ase.calculators.lj import LennardJones +from ase.calculators.eam import EAM CALCULATORS = { # Effective Medium Theory 'EMT': EMT, # LennardJones potential 'LennardJones': LennardJones, + 'EAM': EAM, } def simulate_properties(material, lattice_constant, calculator: Literal['EMT', 'EAM']): -- GitLab