diff --git a/docs/source/jupyter/quantum-espresso.ipynb b/docs/source/jupyter/quantum-espresso.ipynb deleted file mode 100644 index 31b4255..0000000 --- a/docs/source/jupyter/quantum-espresso.ipynb +++ /dev/null @@ -1,447 +0,0 @@ -{ - "metadata": { - "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 - }, - "orig_nbformat": 2, - "kernelspec": { - "name": "python_defaultSpec_1597048081738", - "display_name": "Python 3.8.2 64-bit" - } - }, - "nbformat": 4, - "nbformat_minor": 2, - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Tutorial: Quantum Espresso Wrapper\n", - "\n", - "In this tutorial we will go through a simple example of how to use the wrapper for the Quantum Espresso simulation engine.\n", - "You can find the wrapper [here](https://github.com/simphony/quantum-espresso-wrapper).\n", - "\n", - "## Background\n", - "This is an example of a slightly different design based upon the input-output functionality of certain simulation engines such as Quantum Espresso and Gromacs.\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Let's get hands-on\n", - "### Installation\n", - "To run the local installation of Quantum Espresso, simply run `./install_engine.sh`. This should check for the prerequisites and compile the code for Quantum Espresso for you.\n", - "\n", - "If the script runs into an error finding openmpi-bin or something like that, try running `apt-get update` and try again. \n", - "Once the installation has completed, try running `pw.x` to see if the installation has succeeded. If this does not work, then try adding `export PATH=$PATH:/home/username/qe-6.1/bin/` at the end of `.bashrc` located at your home folder. \n", - " \n", - "Once you have verified that `pw.x` works, install the ontology via `pico install ontology.simlammps.yml`, and make sure to run `python3 setup.py` located in the root of the quantum espresso wrapper folder. \n", - "\n", - "That should be all needed to use Quantum Espresso!\n", - "\n", - "### Simple example\n", - "\n", - "This is an adaptation of quantum-espresso-wrapper/examples/Simple.py. As usual, we need to import the necessary components:" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np \n", - "\n", - "from osp.core.namespaces import QE\n", - "from osp.core.utils import pretty_print\n", - "from osp.wrappers.quantumespresso.qe_session import qeSession" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Next, we create simulation and its K points, which determine at what points it samples the cell" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "sim = QE.Simulation()\n", - "k = QE.K_POINTS(vector = (7, 7, 7), unit = \"\")\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Next, we create a cell, the element Silicon, a pseudopotential, an atom and the cell parameters. Note that the pseudopotential files should ALWAYS be located inside of a folder named `$PSEUDO_DIR` inside of wherever you are running the simulation." - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "SiCell = QE.Cell()\n", - "Si = QE.Element(name = \"Si\")\n", - "SiPseudo = QE.PSEUDOPOTENTIAL(name = \"Si.pbe-n-kjpaw_psl.1.0.0.UPF\")\n", - "Si1 = QE.Atom()\n", - "SiParams = QE.CellParams()\n", - "celldm1 = QE.Celldm1(value = 5.43070, unit = \"au\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Next, we connect these all to each other using the `add` method." - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": "" - }, - "metadata": {}, - "execution_count": 4 - } - ], - "source": [ - "Si.add(SiPseudo, Si1)\n", - "Si.add(QE.Mass(value = 28.085, unit = \"amu\"))\n", - "SiCell.add(Si1, SiParams)\n", - "Si1.add(QE.Position(vector = (0, 0, 0), unit = \"\"))\n", - "SiCell.add(celldm1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We specify the cell parameters:" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": "[,\n ,\n ]" - }, - "metadata": {}, - "execution_count": 5 - } - ], - "source": [ - "SiParams.add(QE.CellParameterX(vector = (0.5, 0.5, 0), unit = \"\"),\n", - " QE.CellParameterY(vector = (0.5, 0, 0.5), unit = \"\"),\n", - " QE.CellParameterZ(vector = (0, 0.5, 0.5), unit = \"\"))" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "And then we add everything created so far to the simulation:\n" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": "" - }, - "metadata": {}, - "execution_count": 6 - } - ], - "source": [ - "sim.add(SiCell)\n", - "sim.add(Si)\n", - "sim.add(k)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "While we're add it, let's add some variables to the simulation which we can check to see if they have been updated. They will not be taken into account when simulating, so they're there for control purposes.\n" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": "" - }, - "metadata": {}, - "execution_count": 7 - } - ], - "source": [ - "sim.add(QE.Pressure(value = 100, unit = \"kbar\"))\n", - "sim.add(QE.StressTensor(tensor2 = np.zeros((3, 3)), unit = \"kbar\"))" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Let's check out what this simulation looks like now with the `pretty_print` function:" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "tags": [] - }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "- Cuds object:\n uuid: 903145ad-50e3-46fc-9d28-1aa1ec364e8a\n type: qe.Simulation\n superclasses: cuba.Class, cuba.Entity, qe.Simulation\n description: \n All components of the simulation that are needed to run the model\n\n |_Relationship qe.HAS_PART:\n - qe.Cell cuds object:\n . uuid: 67a0fcb4-4977-49df-9bcb-13bca17b2763\n . |_Relationship qe.HAS_PART:\n . - qe.Atom cuds object:\n . . uuid: 1bad1c25-609a-4bc0-8c65-3c0167cfdbe2\n . . |_Relationship qe.HAS_PART:\n . . - qe.Position cuds object:\n . . uuid: c70afbb3-0012-488d-8059-b44d775c6b23\n . . vector: [0. 0. 0.]\n . . unit: \n . - qe.CellParams cuds object:\n . . uuid: f444899a-e850-4ab2-b79e-c91026523eb3\n . . |_Relationship qe.HAS_PART:\n . . - qe.CellParameterX cuds object:\n . . . uuid: 0ebdeed9-1d8a-498d-94c9-bafccb05d652\n . . . vector: [0.5 0.5 0. ]\n . . . unit: \n . . - qe.CellParameterY cuds object:\n . . . uuid: fea8789c-8c07-49f9-9971-8d42bdd6ba3f\n . . . vector: [0.5 0. 0.5]\n . . . unit: \n . . - qe.CellParameterZ cuds object:\n . . uuid: 1474d106-4204-428d-827b-2d5e2cb4af51\n . . vector: [0. 0.5 0.5]\n . . unit: \n . - qe.Celldm1 cuds object:\n . uuid: be8f3915-3eb7-4221-a441-345eda51832b\n . unit: au\n . value: 5.4307\n - qe.Element cuds object named :\n . uuid: 8628ceb7-1c02-4014-95a4-d9450aab4753\n . |_Relationship qe.HAS_PART:\n . - qe.Atom cuds object:\n . . uuid: 1bad1c25-609a-4bc0-8c65-3c0167cfdbe2\n . . (already printed)\n . - qe.Mass cuds object:\n . . uuid: 1aee515a-4e12-40e6-bbd6-23bf5c95fe84\n . . unit: amu\n . . value: 28.085\n . - qe.PSEUDOPOTENTIAL cuds object named :\n . uuid: cb27bcb9-27c6-48a9-8f1e-8977b16567c5\n - qe.K_POINTS cuds object:\n . uuid: 6847a5f0-8d20-4f73-9eb3-043e78053182\n . vector: [7. 7. 7.]\n . unit: \n - qe.Pressure cuds object:\n . uuid: d281d93d-fd10-41fd-868c-0cda3b510431\n . unit: kbar\n . value: 100.0\n - qe.StressTensor cuds object:\n uuid: 2f302f8b-89b8-4d7a-a2a7-4f6e19737f00\n unit: kbar\n tensor2: [[0. 0. 0.]\n [0. 0. 0.]\n [0. 0. 0.]]\n" - } - ], - "source": [ - "pretty_print(sim)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Now, it's time to get the simulation running:" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "tags": [] - }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "Running calculation...\n/mnt/c/iwm/docs/si.pwscf.in\npw.x -i /mnt/c/iwm/docs/si.pwscf.in > /mnt/c/iwm/docs/si.pwscf.out\n" - } - ], - "source": [ - "session = qeSession()\n", - "quantum_espresso_wrapper = QE.QEWrapper(session = session)\n", - "quantum_espresso_wrapper.add(sim)\n", - "print(\"Running calculation...\")\n", - "\n", - "quantum_espresso_wrapper.session._run(simulation = sim, prefix = \"si\", command_type = \"pw.x\", calculation_type = \"scf\", root = \"\", CONTROL = {'pseudo_dir': \"'.'\"})" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Now let's check the results of our calculation:" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "tags": [] - }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "- Cuds object:\n uuid: 903145ad-50e3-46fc-9d28-1aa1ec364e8a\n type: qe.Simulation\n superclasses: cuba.Class, cuba.Entity, qe.Simulation\n description: \n All components of the simulation that are needed to run the model\n\n |_Relationship qe.HAS_PART:\n - qe.Cell cuds object:\n . uuid: 67a0fcb4-4977-49df-9bcb-13bca17b2763\n . |_Relationship qe.HAS_PART:\n . - qe.Atom cuds object:\n . . uuid: 1bad1c25-609a-4bc0-8c65-3c0167cfdbe2\n . . |_Relationship qe.HAS_PART:\n . . - qe.Position cuds object:\n . . uuid: c70afbb3-0012-488d-8059-b44d775c6b23\n . . vector: [0. 0. 0.]\n . . unit: \n . - qe.CellParams cuds object:\n . . uuid: f444899a-e850-4ab2-b79e-c91026523eb3\n . . |_Relationship qe.HAS_PART:\n . . - qe.CellParameterX cuds object:\n . . . uuid: 0ebdeed9-1d8a-498d-94c9-bafccb05d652\n . . . vector: [0.5 0.5 0. ]\n . . . unit: \n . . - qe.CellParameterY cuds object:\n . . . uuid: fea8789c-8c07-49f9-9971-8d42bdd6ba3f\n . . . vector: [0.5 0. 0.5]\n . . . unit: \n . . - qe.CellParameterZ cuds object:\n . . uuid: 1474d106-4204-428d-827b-2d5e2cb4af51\n . . vector: [0. 0.5 0.5]\n . . unit: \n . - qe.Celldm1 cuds object:\n . uuid: be8f3915-3eb7-4221-a441-345eda51832b\n . unit: au\n . value: 5.4307\n - qe.Element cuds object named :\n . uuid: 8628ceb7-1c02-4014-95a4-d9450aab4753\n . |_Relationship qe.HAS_PART:\n . - qe.Atom cuds object:\n . . uuid: 1bad1c25-609a-4bc0-8c65-3c0167cfdbe2\n . . (already printed)\n . - qe.Mass cuds object:\n . . uuid: 1aee515a-4e12-40e6-bbd6-23bf5c95fe84\n . . unit: amu\n . . value: 28.085\n . - qe.PSEUDOPOTENTIAL cuds object named :\n . uuid: cb27bcb9-27c6-48a9-8f1e-8977b16567c5\n - qe.K_POINTS cuds object:\n . uuid: 6847a5f0-8d20-4f73-9eb3-043e78053182\n . vector: [7. 7. 7.]\n . unit: \n - qe.Pressure cuds object:\n . uuid: d281d93d-fd10-41fd-868c-0cda3b510431\n . unit: kbar\n . value: 100.0\n - qe.PwOut cuds object:\n . uuid: 15c6637e-9124-44dd-a1d3-f225203c1bfc\n . path: /mnt/c/iwm/docs/si.pwscf.out\n - qe.StressTensor cuds object:\n uuid: 2f302f8b-89b8-4d7a-a2a7-4f6e19737f00\n unit: kbar\n tensor2: [[0. 0. 0.]\n [0. 0. 0.]\n [0. 0. 0.]]\n" - } - ], - "source": [ - "pretty_print(sim)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "As you can see, the original part of the cuds tree is still there, with everything mostly the same. The new parts are:\n", - "\n", - "- The qe.PwOut cuds object. This is the output file of the simulation, in case there is something that the wrapper does not parse but that you would still like to see.\n", - "- The qe.TotalEnergy cuds object. This was parsed from the qe.PwOut file itself.\n", - "- The qe.Force cuds object. This represents the force exerted on the atom(s).\n", - "\n", - "The updated parts are:\n", - "\n", - "- The qe.Pressure cuds object, having changed in value from 100 kbar to 5723.64 kbar.\n", - "- The qe.StressTensor cuds object, which is no longer zero." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Let's see if we can do better and calculate some bands structures:" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [ - { - "output_type": "error", - "ename": "TypeError", - "evalue": "_run() missing 1 required positional argument: 'simulation'", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mquantum_espresso_wrapper\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_run\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprefix\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"si\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommand_type\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"pw.x\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcalculation_type\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"bands\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mquantum_espresso_wrapper\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_run\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprefix\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"si\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommand_type\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"bands.x\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcalculation_type\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mTypeError\u001b[0m: _run() missing 1 required positional argument: 'simulation'" - ] - } - ], - "source": [ - "quantum_espresso_wrapper.session._run(prefix = \"si\", command_type = \"pw.x\", calculation_type = \"bands\")\n", - "quantum_espresso_wrapper.session._run(prefix = \"si\", command_type = \"bands.x\", calculation_type = \"\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Although the cuds structure won't have changed much by this, the data is there in the folder.\n", - "\n", - "Now let's try to relax this cell. While it isn't a real cell, we can still perform the calculations to relax it to know what the movement of the atoms would be like if it were a real cell (warning, perform vc-relax type calculations with caution. These examples are designed to be lightweight and non-indicative of real-world applications)." - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [ - { - "output_type": "error", - "ename": "TypeError", - "evalue": "_run() missing 1 required positional argument: 'simulation'", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mquantum_espresso_wrapper\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_run\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprefix\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"si\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommand_type\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"pw.x\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcalculation_type\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"relax\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mIONS\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m'ion_dynamics'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m\"'bfgs'\"\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m: _run() missing 1 required positional argument: 'simulation'" - ] - } - ], - "source": [ - "quantum_espresso_wrapper.session._run(simulation = sim, prefix = \"si\", command_type = \"pw.x\", calculation_type = \"relax\", IONS = {'ion_dynamics': \"'bfgs'\"})" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "tags": [] - }, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "- Cuds object:\n uuid: 90361daa-6905-4566-979e-11b3b0dd4e85\n type: qe.Simulation\n superclasses: cuba.Class, cuba.Entity, qe.Simulation\n description: \n All components of the simulation that are needed to run the model\n\n |_Relationship qe.HAS_PART:\n - qe.Cell cuds object:\n . uuid: f7548873-28e9-4d76-86da-6fddb687d29e\n . |_Relationship qe.HAS_PART:\n . - qe.Atom cuds object:\n . . uuid: 53114a1f-ebbb-4e4b-a115-080925d9eaa8\n . . |_Relationship qe.HAS_PART:\n . . - qe.Position cuds object:\n . . uuid: 48d4483b-7c72-4454-8041-581dc73fd216\n . . vector: [0. 0. 0.]\n . . unit: \n . - qe.CellParams cuds object:\n . . uuid: 9d61e990-2509-474b-935e-618ca11bb40d\n . . |_Relationship qe.HAS_PART:\n . . - qe.CellParameterX cuds object:\n . . . uuid: f2655054-efa7-4b39-9f0a-cf6453be68ec\n . . . vector: [0.5 0.5 0. ]\n . . . unit: \n . . - qe.CellParameterY cuds object:\n . . . uuid: 55647575-ea8f-4ef7-aee8-2a3333a4ec71\n . . . vector: [0.5 0. 0.5]\n . . . unit: \n . . - qe.CellParameterZ cuds object:\n . . uuid: 92be9c63-ee80-46d9-8853-ccb562e94a5b\n . . vector: [0. 0.5 0.5]\n . . unit: \n . - qe.Celldm1 cuds object:\n . . uuid: db776c65-9d2e-448e-bc55-5fe0f9c7ee75\n . . unit: au\n . . value: 5.4307\n . - qe.Element cuds object named :\n . uuid: 14dacecb-023c-4ace-9e83-35b0ecaa1032\n . |_Relationship qe.HAS_PART:\n . - qe.Atom cuds object:\n . . uuid: 53114a1f-ebbb-4e4b-a115-080925d9eaa8\n . . (already printed)\n . - qe.Atom cuds object:\n . . uuid: c2094a19-8769-4298-a50a-be1f8befe5bf\n . . |_Relationship qe.HAS_PART:\n . . - qe.Position cuds object:\n . . uuid: 4087ce47-16f0-4449-b8c4-4577e6d265e2\n . . vector: [0.25 0.25 0.26]\n . . unit: \n . - qe.Mass cuds object:\n . . uuid: 5d57a768-d315-4f91-84a8-fcfad9aae382\n . . unit: amu\n . . value: 28.085\n . - qe.PSEUDOPOTENTIAL cuds object named :\n . uuid: ab064983-5cc9-418e-a9e7-3357c04388f5\n - qe.Element cuds object named :\n . uuid: 14dacecb-023c-4ace-9e83-35b0ecaa1032\n . (already printed)\n - qe.K_POINTS cuds object:\n . uuid: 38385f3b-128c-491f-91f4-44de15055d56\n . vector: [7. 7. 7.]\n . unit: \n - qe.Pressure cuds object:\n . uuid: 57f47fa8-4588-488f-8c89-fa8a0f37f567\n . unit: kbar\n . value: 100.0\n - qe.Pressure cuds object:\n . uuid: beac6977-01cf-4b4d-b89b-1b4d4eecf5c0\n . unit: kbar\n . value: 100.0\n - qe.PwOut cuds object:\n . uuid: 7890c86c-9f6f-42b3-a02c-cd57f5307c75\n . path: si.pwscf.out\n - qe.PwOut cuds object:\n . uuid: 5c7e31f9-6e55-4ddf-af62-5a3e58811464\n . path: si.pwscf.out\n - qe.StressTensor cuds object:\n . uuid: 16b33d51-0f6d-4451-a919-da494a13082f\n . unit: kbar\n . tensor2: [[0. 0. 0.]\n [0. 0. 0.]\n [0. 0. 0.]]\n - qe.StressTensor cuds object:\n uuid: 590ad64e-d110-4711-90c6-0986bb53dafc\n unit: kbar\n tensor2: [[0. 0. 0.]\n [0. 0. 0.]\n [0. 0. 0.]]\n" - } - ], - "source": [ - "pretty_print(sim)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "In this example, the position hasn't changed. So let's spice things up a little bit and add another atom, and then relax:" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "tags": [] - }, - "outputs": [ - { - "output_type": "error", - "ename": "ValueError", - "evalue": " is already in the container", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mSi2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mQE\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAtom\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mSi2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0madd\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mQE\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPosition\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mvector\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;36m0.25\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0.25\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0.26\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0munit\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mSiCell\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0madd\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mSi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0mSi\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0madd\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mSi2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mpretty_print\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msim\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/mnt/c/IWM/osp-core-3.4.0-dev/osp/core/cuds.py\u001b[0m in \u001b[0;36madd\u001b[0;34m(self, rel, *args)\u001b[0m\n\u001b[1;32m 161\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrel\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_neighbors\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0marg\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0muid\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_neighbors\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mrel\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 162\u001b[0m \u001b[0mmessage\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'{!r} is already in the container'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 163\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0marg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 164\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msession\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0marg\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 165\u001b[0m \u001b[0marg\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_recursive_store\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0marg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mold_objects\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mValueError\u001b[0m: is already in the container" - ] - } - ], - "source": [ - "Si2 = QE.Atom()\n", - "Si2.add(QE.Position(vector = (0.25, 0.25, 0.26), unit = \"\"))\n", - "SiCell.add(Si)\n", - "Si.add(Si2)\n", - "pretty_print(sim)" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "output_type": "error", - "ename": "TypeError", - "evalue": "_run() missing 1 required positional argument: 'simulation'", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mquantum_espresso_wrapper\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_run\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprefix\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"si\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommand_type\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"pw.x\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcalculation_type\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"relax\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mIONS\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m'ion_dynamics'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m\"'bfgs'\"\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mpretty_print\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msim\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mTypeError\u001b[0m: _run() missing 1 required positional argument: 'simulation'" - ] - } - ], - "source": [ - "quantum_espresso_wrapper.session._run(simulation = sim, prefix = \"si\", command_type = \"pw.x\", calculation_type = \"relax\", IONS = {'ion_dynamics': \"'bfgs'\"})\n", - "pretty_print(sim)" - ] - } - ], - "metadata": {}, - "nbformat": 4, - "nbformat_minor": 2 -}