{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "08ee4c09-7fb5-4ce1-a7a3-5c5c52a6d4d5", "metadata": { "tags": [] }, "outputs": [], "source": [ "from ase import Atoms, Atom\n", "from ase.io import read, write\n", "from ase.data import chemical_symbols, covalent_radii, vdw_alvarez\n", "from ase.parallel import paropen as open\n", "from gpaw import GPAW, PW, FermiDirac, LCAO\n", "# from gpaw.new.ase_interface import GPAW\n", "from gpaw import Davidson\n", "from gpaw import Mixer, MixerSum, MixerDif\n", "from gpaw.directmin.etdm_lcao import LCAOETDM\n", "from gpaw.cdft.cdft import CDFT\n", "from pathlib import Path\n", "import os\n", "import numpy as np\n", "from pymatgen.core import Element\n", "from tqdm.auto import tqdm\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": null, "id": "90887faa-1601-4c4c-9c44-d16731471d7f", "metadata": { "tags": [] }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b30d4d05feb144d9aaf062206dabc9c6", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/16 [00:00 0: \n", "# magmoms = atoms.get_magnetic_moments()\n", "\n", "# atoms.set_initial_magnetic_moments(magmoms)\n", " # m = min(abs(magmoms[0])*1.2, m)\n", " # magmoms = magmoms*m/np.abs(magmoms)\n", "\n", " e[i] = atoms.get_potential_energy()\n", "\n", " atoms.calc.results.update({\n", " \"forces\": atoms.get_forces()\n", " })\n", "\n", " write(traj_fpath, atoms, append=True)\n", " except Exception as e:\n", " print(e)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "06118461-8db9-49f0-8aae-2150146ab9b5", "metadata": { "tags": [] }, "outputs": [], "source": [ "!echo $GPAW_NEW" ] }, { "cell_type": "code", "execution_count": null, "id": "a0ac2c09-370b-4fdd-bf74-ea5c4ade0215", "metadata": {}, "outputs": [], "source": [ "\n", "\n", "df = pd.DataFrame(columns=['name', 'method', 'R', 'E', 'F', 'S^2'])\n", "\n", "\n", "\n", "for symbol in tqdm(chemical_symbols):\n", " \n", " for magnetism in ['AFM', 'FM', 'NM']:\n", " \n", " da = symbol + symbol\n", "\n", " # out_dir = Path(da)\n", " out_dir = Path(str(da + f\"_{magnetism}\"))\n", "\n", " traj_fpath = out_dir / \"traj.extxyz\"\n", "\n", " if traj_fpath.exists():\n", " traj = read(traj_fpath, index=\":\")\n", " else:\n", " continue\n", "\n", " Rs, Es, Fs, S2s = [], [], [], []\n", " for atoms in traj:\n", "\n", " vec = atoms.positions[1] - atoms.positions[0]\n", " r = np.linalg.norm(vec)\n", " e = atoms.get_potential_energy()\n", " # f = np.inner(vec/r, atoms.get_forces()[1])\n", " # s2 = np.mean(np.power(atoms.get_magnetic_moments(), 2))\n", "\n", " Rs.append(r)\n", " Es.append(e)\n", " # Fs.append(f)\n", " # S2s.append(s2)\n", "\n", " data = {\n", " 'name': da,\n", " 'method': f'GGA-PBE (GPAW): {magnetism}',\n", " 'R': Rs,\n", " 'E': Es,\n", " 'F': Fs,\n", " 'S^2': S2s\n", " }\n", "\n", " df = pd.concat([df, pd.DataFrame([data])], ignore_index=True)\n", "\n", "json_fpath = 'homonuclear-diatomics.json'\n", "\n", "df.to_json(json_fpath, orient='records') " ] }, { "cell_type": "code", "execution_count": null, "id": "5d4a7312-a619-411f-9c6f-36c40cd47a34", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "mlip-arena", "language": "python", "name": "mlip-arena" }, "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.10" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": { "08bb114ae5674fd1af84c459d1407555": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": { "layout": "IPY_MODEL_43a625312a50485faa2f10807c19a5c3", "style": "IPY_MODEL_7d3e41a01d7f4a3f997b510ad7be62c7", "value": "  0%" } }, "16d09a1085ce4b7c94d3c9838e7b6047": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "ProgressStyleModel", "state": { "description_width": "" } }, "378fd424e42c4a02a76319ddf1f4773e": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": { "layout": "IPY_MODEL_f6e60cbeb3a246a189de60bfddf1ea24", "style": "IPY_MODEL_6deae131201c46af8be20e2129d17176", "value": " 0/28 [00:00<?, ?it/s]" } }, "398c7fc38b92419a956e17bb3f69f61f": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HBoxModel", "state": { "children": [ "IPY_MODEL_9dbfeae19c864b1cb2df6c4b39bfa9c9", "IPY_MODEL_3bb3f03b83284c0bbdc316fdc313384f", "IPY_MODEL_378fd424e42c4a02a76319ddf1f4773e" ], "layout": "IPY_MODEL_cd8b7bf098b84df197fcd498084e5afd" } }, "3bb3f03b83284c0bbdc316fdc313384f": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "FloatProgressModel", "state": { "layout": "IPY_MODEL_c98b44b3cdfc4d1180786cf11521d9d3", "max": 28, "style": "IPY_MODEL_787e84a3b17d4f8ba132db1a5ed466b3" } }, "43a625312a50485faa2f10807c19a5c3": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "43e1040562d1439b801ecfedf5035aee": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": { "description_width": "", "font_size": null, "text_color": null } }, "45675de1547d489d9f935cb432b4fadf": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "FloatProgressModel", "state": { "bar_style": "danger", "layout": "IPY_MODEL_4d3c75a82de345ad9d01ef5507126023", "max": 29, "style": "IPY_MODEL_79037b808e294df393a993227a4ff8c3" } }, "4cd7b5fa3e214f74a66ed4d99d5025a4": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HBoxModel", "state": { "children": [ "IPY_MODEL_67252eabaa4348d8a3fd4cf0c7653e97", "IPY_MODEL_988805506e274daaa19a059f19fb51b8", "IPY_MODEL_a0e545db7c0b4b8289e72e53c19fdc3c" ], "layout": "IPY_MODEL_b75fa1272c794c1cbb66cb39d61a5375" } }, "4d3c75a82de345ad9d01ef5507126023": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "51a4c221d21544bdb91e98fe6e10dd43": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": { "description_width": "", "font_size": null, "text_color": null } }, "67252eabaa4348d8a3fd4cf0c7653e97": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": { "layout": "IPY_MODEL_b624b02837f44ae78ec7ecd29ed0f73b", "style": "IPY_MODEL_51a4c221d21544bdb91e98fe6e10dd43", "value": "100%" } }, "6deae131201c46af8be20e2129d17176": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": { "description_width": "", "font_size": null, "text_color": null } }, "787e84a3b17d4f8ba132db1a5ed466b3": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "ProgressStyleModel", "state": { "description_width": "" } }, "79037b808e294df393a993227a4ff8c3": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "ProgressStyleModel", "state": { "description_width": "" } }, "7d3e41a01d7f4a3f997b510ad7be62c7": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": { "description_width": "", "font_size": null, "text_color": null } }, "805f79a3d7bd493092168b98de443e0b": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "8383a80b3a504b58a50458f237ecafd8": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "91aa307807cd4abc909e1a0330674020": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "988805506e274daaa19a059f19fb51b8": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "FloatProgressModel", "state": { "bar_style": "success", "layout": "IPY_MODEL_91aa307807cd4abc909e1a0330674020", "max": 28, "style": "IPY_MODEL_16d09a1085ce4b7c94d3c9838e7b6047", "value": 28 } }, "9dbfeae19c864b1cb2df6c4b39bfa9c9": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": { "layout": "IPY_MODEL_805f79a3d7bd493092168b98de443e0b", "style": "IPY_MODEL_bb9f29e22202434b9988e1850ac188fc", "value": "  0%" } }, "a0e545db7c0b4b8289e72e53c19fdc3c": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": { "layout": "IPY_MODEL_8383a80b3a504b58a50458f237ecafd8", "style": "IPY_MODEL_faf0fccdc8044bc69f12c930c57d4e9f", "value": " 28/28 [7:25:40<00:00, 2734.24s/it]" } }, "ac2f01b8c798419cbd4daf5c12384219": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HBoxModel", "state": { "children": [ "IPY_MODEL_08bb114ae5674fd1af84c459d1407555", "IPY_MODEL_45675de1547d489d9f935cb432b4fadf", "IPY_MODEL_e4a50abf99f3496f901a8bb16495cc91" ], "layout": "IPY_MODEL_cd191bca40d541228d4826c3885066d7" } }, "ac7f987a9bcc4c558b6773d573d97134": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "b624b02837f44ae78ec7ecd29ed0f73b": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "b75fa1272c794c1cbb66cb39d61a5375": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "bb9f29e22202434b9988e1850ac188fc": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": { "description_width": "", "font_size": null, "text_color": null } }, "c98b44b3cdfc4d1180786cf11521d9d3": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "cd191bca40d541228d4826c3885066d7": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "cd8b7bf098b84df197fcd498084e5afd": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "e4a50abf99f3496f901a8bb16495cc91": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": { "layout": "IPY_MODEL_ac7f987a9bcc4c558b6773d573d97134", "style": "IPY_MODEL_43e1040562d1439b801ecfedf5035aee", "value": " 0/29 [00:06<?, ?it/s]" } }, "f6e60cbeb3a246a189de60bfddf1ea24": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {} }, "faf0fccdc8044bc69f12c930c57d4e9f": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": { "description_width": "", "font_size": null, "text_color": null } } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }