{ "cells": [ { "cell_type": "markdown", "id": "22d177dc-6cfb-4de2-9509-f1eb45e10cf2", "metadata": {}, "source": [ "# X-ray photoelectron spectroscopy (XPS)\n", "\n", "## Visualizing the WorkGraph Builder\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "6be40ba7", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from workgraph_collections.cp2k.xps import xps_workgraph\n", "\n", "task = xps_workgraph.TaskCls()\n", "task.to_html()" ] }, { "cell_type": "markdown", "id": "9e6360d8", "metadata": {}, "source": [ "## Visualizing the WorkGraph" ] }, { "cell_type": "code", "execution_count": 6, "id": "01bedd69", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from workgraph_collections.cp2k.xps import xps_workgraph\n", "from aiida import load_profile\n", "load_profile()\n", "\n", "wg = xps_workgraph()\n", "wg.to_html()" ] }, { "cell_type": "markdown", "id": "efa095d0", "metadata": {}, "source": [ "## Example: ETFA molecule\n", "\n", "### Prepare the inputs and submit the workflow\n" ] }, { "cell_type": "code", "execution_count": null, "id": "8ee799d2-0b5b-4609-957f-6b3f2cd451f0", "metadata": {}, "outputs": [], "source": [ "from ase.io import read\n", "from aiida.orm import Dict, load_code, load_node, StructureData\n", "from aiida import load_profile\n", "from workgraph_collections.cp2k.xps import xps_workgraph\n", "\n", "load_profile()\n", "\n", "\n", "#===================================================================\n", "# cp2k_code = load_code(\"cp2k-ssmp-2024.1@localhost\")\n", "cp2k_code = load_code(\"cp2k-psmp-2024.1@eiger\")\n", "basis_file = load_node(18339)\n", "pseudo_file = load_node(18340)\n", "basis_pseudo_files = {\n", " \"basis\": basis_file,\n", " \"pseudo\": pseudo_file,\n", " }\n", "# Structure.\n", "etfa = read(\"datas/ETFA.xyz\")\n", "# view(pt_111_333)\n", "structure = StructureData(ase=etfa)\n", "structure.label = \"ETFA molecule, vacuum 5.0 Angstroms\"\n", "# Parameters.\n", "parameters = {\n", " \"GLOBAL\": {\n", " \"RUN_TYPE\": \"ENERGY_FORCE\",\n", " },\n", " \"FORCE_EVAL\": {\n", " \"METHOD\": \"Quickstep\",\n", " \"DFT\": {\n", " \"BASIS_SET_FILE_NAME\": \"BASIS_MOLOPT\",\n", " \"POTENTIAL_FILE_NAME\": \"POTENTIALS\",\n", " # \"UKS\": True,\n", " # \"MULTIPLICITY\": 1,\n", " \"SCF\": {\n", " \"EPS_DIIS\": 0.1,\n", " \"EPS_SCF\": 1e-06,\n", " \"OUTER_SCF\": {\n", " \"MAX_SCF\": 20,\n", " \"EPS_SCF\": 1e-06,\n", " },\n", " \"OT\": {\n", " \"ORTHO_IRAC\": \"CHOL\",\n", " \"N_HISTORY_VEC\": 7,\n", " \"SAFE_DIIS\": False,\n", " \"PRECONDITIONER\": \"FULL_ALL\",\n", " \"ENERGY_GAP\": 0.05,\n", " \"MINIMIZER\": \"CG\",\n", " \"ALGORITHM\": \"IRAC\",\n", " \"EPS_IRAC_SWITCH\": 0.01,\n", " },\n", " },\n", " \"QS\": {\n", " \"METHOD\": \"GPW\",\n", " \"EPS_DEFAULT\": 1.0e-12,\n", " \"EXTRAPOLATION_ORDER\": 3,\n", " },\n", " \"MGRID\": {\n", " \"NGRIDS\": 4,\n", " \"CUTOFF\": 500,\n", " \"REL_CUTOFF\": 50,\n", " },\n", " \"XC\": {\n", " \"XC_FUNCTIONAL\": {\n", " \"PBE\": {\n", " \"PARAMETRIZATION\": \"PBESOL\",\n", " }\n", " },\n", " },\n", " },\n", " \"SUBSYS\": {\n", " \"KIND\": [\n", " {\n", " \"_\": \"O\",\n", " \"BASIS_SET\": \"DZVP-MOLOPT-GTH\",\n", " \"POTENTIAL\": \"GTH-PBESOL-q6\",\n", " },\n", " {\n", " \"_\": \"C\",\n", " \"BASIS_SET\": \"DZVP-MOLOPT-GTH\",\n", " \"POTENTIAL\": \"GTH-PBESOL-q4\",\n", " },\n", " {\n", " \"_\": \"F\",\n", " \"BASIS_SET\": \"DZVP-MOLOPT-GTH\",\n", " \"POTENTIAL\": \"GTH-PBE\",\n", " },\n", " {\n", " \"_\": \"H\",\n", " \"BASIS_SET\": \"DZVP-MOLOPT-GTH\",\n", " \"POTENTIAL\": \"GTH-PBE\",\n", " },\n", " {\n", " \"_\": \"Pt\",\n", " \"ELEMENT\": \"Pt\",\n", " \"BASIS_SET\": \"DZVP-MOLOPT-SR-GTH-q18\",\n", " \"POTENTIAL\": \"GTH-PBESOL-q18\",\n", " },\n", " ],\n", " },\n", " },\n", " }\n", "metadata = {\"options\": {'custom_scheduler_commands' : 'export OMP_NUM_THREADS=4',\n", " 'resources': {\n", " 'num_machines' : 1,\n", " 'num_mpiprocs_per_machine' : 1,\n", " }\n", " }\n", " }\n", "metadata_eiger = {\"options\": {\n", " 'custom_scheduler_commands' : '#SBATCH --account=mr32',\n", " 'resources': {\n", " 'num_machines' : 1,\n", " 'num_mpiprocs_per_machine' : 128,\n", " }\n", " }\n", " }\n", "#---------------------------------------------------------------\n", "core_hole_pseudos = {\n", " \"C\": {\n", " \"_\": \"X\",\n", " \"ELEMENT\": \"C\",\n", " \"BASIS_SET\": \"DZVP-MOLOPT-GTH\",\n", " \"POTENTIAL\": \"GTH-PBESOL-q5_1s1\",\n", " \"CORE_CORRECTION\": 1,\n", " },\n", " \"O\": {\n", " \"_\": \"X\",\n", " \"ELEMENT\": \"O\",\n", " \"BASIS_SET\": \"DZVP-MOLOPT-GTH\",\n", " \"POTENTIAL\": \"GTH-PBESOL-q7_1s1\",\n", " \"CORE_CORRECTION\": 1,\n", " },\n", " \"Pt\": {\n", " \"_\": \"X\",\n", " \"ELEMENT\": \"Pt\",\n", " \"BASIS_SET\": \"DZVP-MOLOPT-SR-GTH-q18\",\n", " \"POTENTIAL\": \"GTH-PBESOL-q19_4f13\",\n", " \"CORE_CORRECTION\": 1,\n", " }\n", "}\n", "correction_energies = {\n", " \"C\": 397.4,\n", " \"O\": 746.4,\n", " \"Pt\": 460.6,\n", " \"Au\": 296.1,\n", " }\n", "wg = xps_workgraph(\n", " structure=structure,\n", " # atoms_list = [0, 1],\n", " element_list=[\"C\"],\n", " parameters = parameters,\n", " code=cp2k_code,\n", " basis_pseudo_files=basis_pseudo_files,\n", " core_hole_pseudos=core_hole_pseudos,\n", " metadata=metadata_eiger,\n", " core_hole_treatment=\"full\",\n", " correction_energies = correction_energies,\n", " is_molecule=True,\n", ")\n", "\n", "wg.name = \"ETFA\"\n", "wg.submit(wait=True, timeout=300)\n", "# wg.run()\n", "print(\"Binding energy: \", wg.tasks[\"binding_energy\"].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 }