|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Kinetic Monte Carlo Using Gromacs" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "markdown", |
| 12 | + "metadata": {}, |
| 13 | + "source": [ |
| 14 | + "## Requirements\n", |
| 15 | + "* You will need to install **VOTCA** using the instructions described [here](https://github.com/votca/votca/blob/master/share/doc/INSTALL.rst)\n", |
| 16 | + "* Once the installation is completed you need to activate the VOTCA enviroment by running the `VOTCARC.bash` script that has been installed at the `bin` subfolder for the path that you have provided for the installation step above" |
| 17 | + ] |
| 18 | + }, |
| 19 | + { |
| 20 | + "cell_type": "markdown", |
| 21 | + "metadata": {}, |
| 22 | + "source": [ |
| 23 | + "## Setting the environment\n", |
| 24 | + "Create a folder to store the input `Options` for XTP" |
| 25 | + ] |
| 26 | + }, |
| 27 | + { |
| 28 | + "cell_type": "code", |
| 29 | + "execution_count": null, |
| 30 | + "metadata": {}, |
| 31 | + "outputs": [], |
| 32 | + "source": [ |
| 33 | + "!mkdir -p OPTIONFILES" |
| 34 | + ] |
| 35 | + }, |
| 36 | + { |
| 37 | + "cell_type": "markdown", |
| 38 | + "metadata": {}, |
| 39 | + "source": [ |
| 40 | + "### Notes\n", |
| 41 | + "> * The `${VOTCASHARE}` environmental variable is set to the path that you provided during the VOTCA installation, by the default is set to `/usr/local/votca`.\n", |
| 42 | + "> * In Jupyter the `!` symbol means: *run the following command as a standard unix command*\n", |
| 43 | + "> * In Jupyter the command `%env` set an environmental variable" |
| 44 | + ] |
| 45 | + }, |
| 46 | + { |
| 47 | + "cell_type": "markdown", |
| 48 | + "metadata": {}, |
| 49 | + "source": [ |
| 50 | + "## KMC simulations of multiple holes or electrons in periodic boundary conditions\n", |
| 51 | + "Lets copy the default options for KMC in our local input folder," |
| 52 | + ] |
| 53 | + }, |
| 54 | + { |
| 55 | + "cell_type": "code", |
| 56 | + "execution_count": null, |
| 57 | + "metadata": {}, |
| 58 | + "outputs": [], |
| 59 | + "source": [ |
| 60 | + "!cp $VOTCASHARE/xtp/xml/kmcmultiple.xml OPTIONFILES" |
| 61 | + ] |
| 62 | + }, |
| 63 | + { |
| 64 | + "cell_type": "markdown", |
| 65 | + "metadata": {}, |
| 66 | + "source": [ |
| 67 | + "You should have a *XML* file with the `kmcmultiple` options that looks like" |
| 68 | + ] |
| 69 | + }, |
| 70 | + { |
| 71 | + "cell_type": "code", |
| 72 | + "execution_count": null, |
| 73 | + "metadata": {}, |
| 74 | + "outputs": [], |
| 75 | + "source": [ |
| 76 | + "!head -n 10 OPTIONFILES/kmcmultiple.xml" |
| 77 | + ] |
| 78 | + }, |
| 79 | + { |
| 80 | + "cell_type": "markdown", |
| 81 | + "metadata": {}, |
| 82 | + "source": [ |
| 83 | + "We will use the following python function to change the input for the `kmcmultiple` calculator. We need to update the `kmcmultiple` options with the file containing the definition of the system. For doing, so we will use the python module `xml_editor`. The first argument is the name of the calculator (i.e. `kmcmultiple`), the seconds argument is the name of the option to change and the third one, the value to use.\n", |
| 84 | + "\n", |
| 85 | + "For a detailed description of the available options have a look at [kmcmultiple options and defaults](https://votca.github.io/kmcmultiple.html)" |
| 86 | + ] |
| 87 | + }, |
| 88 | + { |
| 89 | + "cell_type": "code", |
| 90 | + "execution_count": null, |
| 91 | + "metadata": {}, |
| 92 | + "outputs": [], |
| 93 | + "source": [ |
| 94 | + "from xml_editor import edit_calculator\n", |
| 95 | + "edit_calculator(\"kmcmultiple\", \"runtime\", \"100\")\n", |
| 96 | + "edit_calculator(\"kmcmultiple\", \"outputtime\", \"10\")\n", |
| 97 | + "edit_calculator(\"kmcmultiple\", \"field\", \"0 0 0\")\n", |
| 98 | + "edit_calculator(\"kmcmultiple\", \"carriertype\", \"singlet\")\n", |
| 99 | + "edit_calculator(\"kmcmultiple\", \"rates\", \"calculate\")" |
| 100 | + ] |
| 101 | + }, |
| 102 | + { |
| 103 | + "cell_type": "markdown", |
| 104 | + "metadata": {}, |
| 105 | + "source": [ |
| 106 | + "Now we can run the KMC simulation as follows," |
| 107 | + ] |
| 108 | + }, |
| 109 | + { |
| 110 | + "cell_type": "code", |
| 111 | + "execution_count": null, |
| 112 | + "metadata": {}, |
| 113 | + "outputs": [], |
| 114 | + "source": [ |
| 115 | + "!xtp_run -e kmcmultiple -o OPTIONFILES/kmcmultiple.xml -f state.hdf5" |
| 116 | + ] |
| 117 | + }, |
| 118 | + { |
| 119 | + "cell_type": "markdown", |
| 120 | + "metadata": {}, |
| 121 | + "source": [ |
| 122 | + "## Perform Kinetic Monte Carlo simulations of singlets with decay\n", |
| 123 | + "Let us first copy the defaults and change just the `numberofinsertions`. For a complete description of the calculators options see [kmclifetime options and defaults](https://votca.github.io/kmclifetime.html)." |
| 124 | + ] |
| 125 | + }, |
| 126 | + { |
| 127 | + "cell_type": "code", |
| 128 | + "execution_count": null, |
| 129 | + "metadata": {}, |
| 130 | + "outputs": [], |
| 131 | + "source": [ |
| 132 | + "!cp $VOTCASHARE/xtp/xml/kmclifetime.xml OPTIONFILES/\n", |
| 133 | + "edit_calculator(\"kmclifetime\", \"numberofinsertions\", \"5\")" |
| 134 | + ] |
| 135 | + }, |
| 136 | + { |
| 137 | + "cell_type": "markdown", |
| 138 | + "metadata": {}, |
| 139 | + "source": [ |
| 140 | + "Finally, we run the calculation using the `lifetimes.xml` file that we have created by hand," |
| 141 | + ] |
| 142 | + }, |
| 143 | + { |
| 144 | + "cell_type": "code", |
| 145 | + "execution_count": null, |
| 146 | + "metadata": {}, |
| 147 | + "outputs": [], |
| 148 | + "source": [ |
| 149 | + "!xtp_run -e kmclifetime -o OPTIONFILES/kmclifetime.xml -f state.hdf5" |
| 150 | + ] |
| 151 | + } |
| 152 | + ], |
| 153 | + "metadata": { |
| 154 | + "kernelspec": { |
| 155 | + "display_name": "Python 3", |
| 156 | + "language": "python", |
| 157 | + "name": "python" |
| 158 | + }, |
| 159 | + "language_info": { |
| 160 | + "codemirror_mode": { |
| 161 | + "name": "ipython", |
| 162 | + "version": 3 |
| 163 | + }, |
| 164 | + "file_extension": ".py", |
| 165 | + "mimetype": "text/x-python", |
| 166 | + "name": "python", |
| 167 | + "nbconvert_exporter": "python", |
| 168 | + "pygments_lexer": "ipython3", |
| 169 | + "version": "3.8.3" |
| 170 | + } |
| 171 | + }, |
| 172 | + "nbformat": 4, |
| 173 | + "nbformat_minor": 4 |
| 174 | +} |
0 commit comments