{
"cells": [
{
"cell_type": "markdown",
"id": "22d177dc-6cfb-4de2-9509-f1eb45e10cf2",
"metadata": {},
"source": [
"# Generate core-hole pseudopotentials \n",
"\n",
"For the source code, see [core_hole_pseudo](https://workgraph-collections.readthedocs.io/en/latest/ase/espresso/module.html#workgraph_collections.ase.espresso.core_hole_pseudo.generate_core_hole_pseudo).\n",
"\n",
"\n",
"## Introduction\n",
"The core correction can be expressed as:\n",
"\n",
"$$\n",
"\\Delta E = (E_{\\text{tot}}^{\\text{excited}} - E_{\\text{totps}}^{\\text{excited}}) - (E_{\\text{tot}}^{\\text{ground}} - E_{\\text{totps}}^{\\text{ground}})\n",
"$$\n",
"\n",
"Where:\n",
"\n",
"- $E_{\\text{totps}}$ is the energy of the pseudo-potential part of the system.\n",
"- $E_{\\text{tot}}$ is the energy of the whole system.\n",
"\n",
"## Visualizing the WorkGraph Builder\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "1a8ebc0d",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from workgraph_collections.ase.espresso.core_hole_pseudo import core_hole_pseudo_workgraph\n",
"\n",
"task = core_hole_pseudo_workgraph.TaskCls()\n",
"task.to_html()\n",
"# comment out this line to visualize the workgraph in the Jupyter notebook\n",
"# task"
]
},
{
"cell_type": "markdown",
"id": "9e6360d8",
"metadata": {},
"source": [
"## Visualizing the WorkGraph"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "01bedd69",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from workgraph_collections.ase.espresso.core_hole_pseudo import core_hole_pseudo_workgraph\n",
"\n",
"wg = core_hole_pseudo_workgraph()\n",
"wg.to_html()\n",
"# comment out this line to visualize the workgraph in the Jupyter notebook\n",
"# wg"
]
},
{
"cell_type": "markdown",
"id": "efa095d0",
"metadata": {},
"source": [
"## Example: Core-hole pseudopotential for Pt\n",
"\n",
"### Prepare the inputs and submit the workflow\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "8ee799d2-0b5b-4609-957f-6b3f2cd451f0",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"WorkGraph process created, PK: 35419\n",
"Correction: 207.613 eV\n"
]
}
],
"source": [
"from aiida import load_profile\n",
"from workgraph_collections.ase.espresso.core_hole_pseudo import core_hole_pseudo_workgraph\n",
"from copy import deepcopy\n",
"\n",
"load_profile()\n",
"\n",
"metadata = {\n",
" \"options\": {\n",
" 'prepend_text' : \"\"\"eval \"$(conda shell.posix hook)\"\n",
" conda activate aiida\n",
" export OMP_NUM_THREADS=1\n",
" \"\"\",\n",
" }\n",
"}\n",
"\n",
"input_data = {\n",
" \"input\": {\n",
" \"title\": \"Pt\",\n",
" \"zed\": 78.0,\n",
" \"rel\": 1,\n",
" \"config\": \"[Xe] 4f14 6s1 6p0 5d9\",\n",
" \"iswitch\": 3,\n",
" \"dft\": \"PBE\"\n",
" },\n",
" \"inputp\": {\n",
" \"lpaw\": True,\n",
" \"use_xsd\": False,\n",
" \"pseudotype\": 3,\n",
" \"file_pseudopw\": \"Pt.pbe-n-kjpaw_psl.1.0.0.UPF\",\n",
" \"author\": \"AiiDA\",\n",
" \"lloc\": -1,\n",
" \"rcloc\": 2.4,\n",
" \"which_augfun\": \"PSQ\",\n",
" \"rmatch_augfun_nc\": True,\n",
" \"nlcc\": True,\n",
" \"new_core_ps\": True,\n",
" \"rcore\": 1.8,\n",
" \"tm\": True\n",
" },\n",
"}\n",
"pseudo_potential_test_cards = \"\"\"\n",
"6\n",
"6S 1 0 1.00 0.00 2.00 2.20 0.0\n",
"6S 1 0 0.00 4.40 2.00 2.20 0.0\n",
"6P 2 1 0.00 0.00 2.30 2.50 0.0\n",
"6P 2 1 0.00 6.40 2.30 2.50 0.0\n",
"5D 3 2 9.00 0.00 1.00 2.20 0.0\n",
"5D 3 2 0.00 0.80 1.00 2.20 0.0\n",
"\"\"\"\n",
"ground_inputs = {\"input_data\": input_data,\n",
" \"pseudo_potential_test_cards\": pseudo_potential_test_cards,\n",
" \"metadata\": metadata,\n",
" \"computer\": \"localhost\"\n",
" }\n",
"input_data_core_hole = deepcopy(input_data)\n",
"# remove one electron from 4f\n",
"input_data_core_hole[\"input\"][\"config\"] = \"[Xe] 4f13 6s1 6p0 5d9\"\n",
"input_data_core_hole[\"inputp\"][\"file_pseudopw\"] = \"Pt.star4f.pbe-n-kjpaw_psl.1.0.0.UPF\"\n",
"core_hole_inputs = {\"input_data\": input_data_core_hole, \"pseudo_potential_test_cards\": pseudo_potential_test_cards}\n",
"\n",
"metadata = {\n",
" \"options\": {\n",
" 'prepend_text' : \"\"\"eval \"$(conda shell.posix hook)\"\n",
" conda activate aiida\n",
" export OMP_NUM_THREADS=1\n",
" \"\"\",\n",
" }\n",
"}\n",
"\n",
"#------------------------- Set the inputs -------------------------\n",
"wg = core_hole_pseudo_workgraph(ground_inputs, core_hole_inputs)\n",
"wg.tasks[\"ground\"].set({\"computer\": \"localhost\",\n",
" \"metadata\": metadata})\n",
"wg.tasks[\"core_hole\"].set({\"computer\": \"localhost\",\n",
" \"metadata\": metadata})\n",
"#------------------------- Submit the calculation -------------------\n",
"# wg.run()\n",
"wg.submit(wait=True, timeout=200)\n",
"#------------------------- Print the output -------------------------\n",
"print('Correction: {:0.3f} eV'.format(wg.tasks['calc_correction'].outputs[\"result\"].value.value))\n",
"\n"
]
}
],
"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.10.0"
},
"vscode": {
"interpreter": {
"hash": "2f450c1ff08798c4974437dd057310afef0de414c25d1fd960ad375311c3f6ff"
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}