{ "cells": [ { "cell_type": "markdown", "id": "03527051-56fb-4913-b3e5-7f888c66cf8b", "metadata": {}, "source": [ "## Initialization" ] }, { "cell_type": "code", "execution_count": 2, "id": "e27e35b5-a435-46e0-92e4-ea20d1ffb665", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "PLAMS working folder: /path/plams/ADFNBO/plams_workdir.002\n" ] } ], "source": [ "from scm.plams import Settings, Molecule, init, AMSJob\n", "from scm.plams.recipes.adfnbo import ADFNBOJob\n", "\n", "# this line is not required in AMS2025+\n", "init()" ] }, { "cell_type": "markdown", "id": "c8e10d95-f2d1-4bfc-90f9-d99f56d8c618", "metadata": {}, "source": [ "## Define molecule" ] }, { "cell_type": "code", "execution_count": 5, "id": "b5f2cd23-3358-4c50-b37c-f2cd93e6667d", "metadata": {}, "outputs": [], "source": [ "# mol = Molecule(\"methane.xyz\")\n", "def get_molecule(input_string):\n", " job = AMSJob.from_input(input_string)\n", " return job.molecule[\"\"]\n", "\n", "\n", "mol = get_molecule(\n", " \"\"\"\n", "System\n", " Atoms\n", " C 0.000000 0.000000 0.000000\n", " H 0.631600 0.631600 0.631600\n", " H 0.631600 -0.631600 -0.631600\n", " H -0.631600 0.631600 -0.631600\n", " H -0.631600 -0.631600 0.631600\n", " End\n", "End\n", "\"\"\"\n", ")" ] }, { "cell_type": "markdown", "id": "f9d316d3-4892-4c1a-a938-af8ffae5c2a7", "metadata": {}, "source": [ "## Create and run job" ] }, { "cell_type": "code", "execution_count": 6, "id": "694502ee-6430-42d0-b8ae-91b4d4bc6819", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[05.03|14:48:57] JOB plamsjob STARTED\n", "[05.03|14:48:57] JOB plamsjob RUNNING\n", "[05.03|14:48:59] JOB plamsjob FINISHED\n", "[05.03|14:48:59] JOB plamsjob SUCCESSFUL\n" ] } ], "source": [ "s = Settings()\n", "s.input.AMS.Task = \"SinglePoint\"\n", "s.input.ADF.basis.type = \"DZP\"\n", "s.input.ADF.xc.lda = \"SCF VWN\"\n", "s.input.ADF.relativity.level = \"scalar\"\n", "s.adfnbo = [\"write\", \"spherical\", \"fock\"]\n", "\n", "j = ADFNBOJob(molecule=mol, settings=s)\n", "r = j.run()" ] }, { "cell_type": "markdown", "id": "9373fb7d-16bc-491d-afbd-516e2ea9774d", "metadata": {}, "source": [ "## Print results" ] }, { "cell_type": "code", "execution_count": 7, "id": "4d85acae-8903-48bd-9560-c81392636569", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " NATURAL BOND ORBITALS (Summary):\n", "\n", " Principal Delocalizations\n", " NBO Occupancy Energy (geminal,vicinal,remote)\n", " ===============================================================================\n", " Molecular unit 1 (CH4)\n", " ------ Lewis --------------------------------------\n", " 1. CR ( 1) C 1 2.00000 -9.77904\n", " 2. BD ( 1) C 1- H 2 1.99927 -0.42240\n", " 3. BD ( 1) C 1- H 3 1.99927 -0.42240\n", " 4. BD ( 1) C 1- H 4 1.99927 -0.42240\n", " 5. BD ( 1) C 1- H 5 1.99927 -0.42240\n", " ------ non-Lewis ----------------------------------\n", " 6. BD*( 1) C 1- H 2 0.00023 0.46676\n", " 7. BD*( 1) C 1- H 3 0.00023 0.46676\n", " 8. BD*( 1) C 1- H 4 0.00023 0.46676\n", " 9. BD*( 1) C 1- H 5 0.00023 0.46676\n", " 10. RY ( 1) C 1 0.00000 4.16091\n", " 11. RY ( 2) C 1 0.00000 20.97822\n", " 12. RY ( 3) C 1 0.00000 0.62722\n", " 13. RY ( 4) C 1 0.00000 0.99946\n", " 14. RY ( 5) C 1 0.00000 0.62722\n", " 15. RY ( 6) C 1 0.00000 2.08484\n", " 16. RY ( 7) C 1 0.00000 2.16053\n", " 17. RY ( 8) C 1 0.00000 2.30880\n", " 18. RY ( 9) C 1 0.00000 1.79930\n", " 19. RY (10) C 1 0.00000 1.79930\n", " 20. RY ( 1) H 2 0.00049 0.37840\n", " 21. RY ( 2) H 2 0.00000 0.95619\n", " 22. RY ( 3) H 2 0.00000 0.95619\n", " 23. RY ( 4) H 2 0.00000 1.52007\n", " 24. RY ( 1) H 3 0.00049 0.37840\n", " 25. RY ( 2) H 3 0.00000 0.95619\n", " 26. RY ( 3) H 3 0.00000 0.95619\n", " 27. RY ( 4) H 3 0.00000 1.52007\n", " 28. RY ( 1) H 4 0.00049 0.37840\n", " 29. RY ( 2) H 4 0.00000 0.95619\n", " 30. RY ( 3) H 4 0.00000 0.95619\n", " 31. RY ( 4) H 4 0.00000 1.52007\n", " 32. RY ( 1) H 5 0.00049 0.37840\n", " 33. RY ( 2) H 5 0.00000 0.95619\n", " 34. RY ( 3) H 5 0.00000 0.95619\n", " 35. RY ( 4) H 5 0.00000 1.52007\n", " -------------------------------\n", " Total Lewis 9.99709 ( 99.9709%)\n", " Valence non-Lewis 0.00093 ( 0.0093%)\n", " Rydberg non-Lewis 0.00199 ( 0.0199%)\n", " -------------------------------\n", " Total unit 1 10.00000 (100.0000%)\n", " Charge unit 1 0.00000\n" ] } ], "source": [ "lines = r.get_output_chunk(begin=\"NATURAL BOND ORBITALS (Summary):\", end=\"Charge unit\", inc_begin=True, inc_end=True)\n", "for line in lines:\n", " print(line)" ] }, { "cell_type": "code", "execution_count": null, "id": "ae619ea6-0f0e-4037-945e-c8b5d4062203", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.8.12" } }, "nbformat": 4, "nbformat_minor": 5 }