{ "cells": [ { "cell_type": "markdown", "id": "similar-reply", "metadata": {}, "source": [ "# Quick Start - From Python\n", "Here we present a broad overview of using the PyBigDFT library to drive BigDFT calculations using Python. If you have installed from source, you should make sure you have setup the proper environment variables using the following command:\n", "\n", "```\n", "source install/bin/bigdftvars.sh\n", "```" ] }, { "cell_type": "markdown", "id": "59c59d05", "metadata": {}, "source": [ "## System Manipulation\n", "Here we define a system which is compsed of two fragments: H2 and Helium." ] }, { "cell_type": "code", "execution_count": 1, "id": "ede8e9ce", "metadata": {}, "outputs": [], "source": [ "import warnings\n", "warnings.filterwarnings(\"ignore\")" ] }, { "cell_type": "code", "execution_count": 2, "id": "jewish-country", "metadata": {}, "outputs": [], "source": [ "from BigDFT.Systems import System\n", "from BigDFT.Fragments import Fragment\n", "from BigDFT.Atoms import Atom\n", "from BigDFT.Visualization import InlineVisualizer" ] }, { "cell_type": "code", "execution_count": 3, "id": "bored-scottish", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "H2:1 H [0.0, 0.0, 0.0]\n", "H2:1 H [0.0, 0.0, 1.4]\n", "He:2 He [10.0, 0.0, 0.0]\n" ] } ], "source": [ "# Create Three Atoms\n", "at1 = Atom({\"r\": [0, 0, 0], \"sym\": \"H\", \"units\": \"bohr\"})\n", "at2 = Atom({\"r\": [0, 0, 1.4], \"sym\": \"H\", \"units\": \"bohr\"})\n", "at3 = Atom({\"r\": [10, 0, 0], \"sym\": \"He\", \"units\": \"bohr\"})\n", "\n", "# Construct a System from Two Fragments (H2, He)\n", "sys = System()\n", "sys[\"H2:1\"] = Fragment([at1, at2])\n", "sys[\"He:2\"] = Fragment([at3])\n", "\n", "# Iterate Over The System\n", "for fragid, frag in sys.items():\n", " for at in frag:\n", " print(fragid, at.sym, at.get_position())" ] }, { "cell_type": "code", "execution_count": 4, "id": "colonial-bottom", "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n",
" jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n",
" jupyter labextension install jupyterlab_3dmol