{ "cells": [ { "cell_type": "markdown", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "# Getting Molecules\n", "\n", "This example shows how to get a molecule from QCArchive in a number of contexts." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## From an ID\n", "\n", "Every molecule computed with QCArchive is assigned a unique ID.\n", "If a molecule's ID is known, it can be queried from the Molecules table. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "import qcportal as ptl\n", "client = ptl.FractalClient()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For example, molecule 1234 is 1,2,3-trimethylbenzene." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

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

\n
\n", "text/html": [ "
\n", "

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

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mol = client.query_molecules(1234)[0]\n", "mol " ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Geometry (in Angstrom), charge = 0.0, multiplicity = 1:\n", "\n", " Center X Y Z \n", " ------------ ----------------- ----------------- -----------------\n", " C 0.776479871994 1.156134463385 0.121542591228\n", " C 0.438429690334 0.679567908122 -1.141595091975\n", " C 0.439577078821 0.423533055514 1.255585387764\n", " C -0.363723536834 -0.465178778108 -1.279725991730\n", " C -0.415502828385 -0.685937227907 1.160631416613\n", " C -0.792912983429 -1.170236644458 -0.121804279943\n", " C -0.744392084678 -0.917923156500 -2.666766549983\n", " C -0.856925058179 -1.374181477949 2.427060703777\n", " C -1.703936690413 -2.374380900784 -0.246989621254\n", " H 1.380610203168 2.049406423411 0.216714048921\n", " H 0.770290662964 1.232461941773 -2.011963177510\n", " H 0.769502950936 0.784464203584 2.222141623291\n", " H -0.238962510978 -1.878436765084 -2.898916777516\n", " H -0.447809351101 -0.177691478927 -3.439954373507\n", " H -1.844638825192 -1.050455805875 -2.735084841327\n", " H -1.962016543060 -1.480103641644 2.438815782834\n", " H -0.562925111565 -0.802128403465 3.332572326307\n", " H -0.383242656300 -2.377541231755 2.485353500027\n", " H -2.761425129123 -2.038610393380 -0.229251405356\n", " H -1.542976842368 -3.097214459361 0.578338572599\n", " H -1.519884697209 -2.938478658464 -1.182927991461\n", "\n" ] } ], "source": [ "print(mol)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The following sections show how to find molecule IDs from Collections." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## From a Dataset\n", "Load a `Dataset`:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "import qcportal as ptl\n", "client = ptl.FractalClient()\n", "\n", "ds = client.get_collection(\"Dataset\", \"SMIRNOFF Coverage Set 1\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`get_molecules` returns molecules corresponding to row of the `Dataset`:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
molecule
index
C(CBr)c1n[nH]nn1-1Geometry (in Angstrom), charge = 0.0, mult...
C(CBr)c1n[nH]nn1-2Geometry (in Angstrom), charge = 0.0, mult...
C(CBr)c1n[nH]nn1-3Geometry (in Angstrom), charge = 0.0, mult...
C(CBr)c1n[n-]nn1-0Geometry (in Angstrom), charge = -1.0, mul...
C(CBr)c1n[n-]nn1-1Geometry (in Angstrom), charge = -1.0, mul...
......
CSSCCN=C=S-7Geometry (in Angstrom), charge = 0.0, mult...
CSSCCN=C=S-8Geometry (in Angstrom), charge = 0.0, mult...
CSSCCN=C=S-9Geometry (in Angstrom), charge = 0.0, mult...
CSSCCN=C=S-10Geometry (in Angstrom), charge = 0.0, mult...
CSSCCN=C=S-11Geometry (in Angstrom), charge = 0.0, mult...
\n", "

1109 rows × 1 columns

\n", "
" ], "text/plain": [ " molecule\n", "index \n", "C(CBr)c1n[nH]nn1-1 Geometry (in Angstrom), charge = 0.0, mult...\n", "C(CBr)c1n[nH]nn1-2 Geometry (in Angstrom), charge = 0.0, mult...\n", "C(CBr)c1n[nH]nn1-3 Geometry (in Angstrom), charge = 0.0, mult...\n", "C(CBr)c1n[n-]nn1-0 Geometry (in Angstrom), charge = -1.0, mul...\n", "C(CBr)c1n[n-]nn1-1 Geometry (in Angstrom), charge = -1.0, mul...\n", "... ...\n", "CSSCCN=C=S-7 Geometry (in Angstrom), charge = 0.0, mult...\n", "CSSCCN=C=S-8 Geometry (in Angstrom), charge = 0.0, mult...\n", "CSSCCN=C=S-9 Geometry (in Angstrom), charge = 0.0, mult...\n", "CSSCCN=C=S-10 Geometry (in Angstrom), charge = 0.0, mult...\n", "CSSCCN=C=S-11 Geometry (in Angstrom), charge = 0.0, mult...\n", "\n", "[1109 rows x 1 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "molecules = ds.get_molecules()\n", "molecules" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Individual `Molecule` objects may be picked out of the dataframe:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

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

\n
\n", "text/html": [ "
\n", "

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

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "molecules.loc[\"C(CBr)c1n[n-]nn1-0\", \"molecule\"]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For large datasets, you may not want to query all molecules at once. `get_molecules` accepts a subset option for selecting specific molecules:" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
molecule
index
C(CBr)c1n[n-]nn1-0Geometry (in Angstrom), charge = -1.0, mul...
CSSCCN=C=S-10Geometry (in Angstrom), charge = 0.0, mult...
\n", "
" ], "text/plain": [ " molecule\n", "index \n", "C(CBr)c1n[n-]nn1-0 Geometry (in Angstrom), charge = -1.0, mul...\n", "CSSCCN=C=S-10 Geometry (in Angstrom), charge = 0.0, mult..." ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.get_molecules(subset=['C(CBr)c1n[n-]nn1-0','CSSCCN=C=S-10'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If a single string is provided for `subset`, the `Molecule` object is returned directly. " ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

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

\n
\n", "text/html": [ "
\n", "

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

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.get_molecules(subset='CSSCCN=C=S-10')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## From a ReactionDataset\n", "\n", "Load a `ReactionDataset`:" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "import qcportal as ptl\n", "client = ptl.FractalClient()\n", "\n", "ds = client.get_collection(\"ReactionDataset\", \"S22\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`get_molecules` returns molecules corresponding to each reaction. By default, the final molecule is returned for every reaction:" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
molecule
namestoichiometryidx
2-Pyridone-2-Aminopyridine Complexdefault0Geometry (in Angstrom), charge = 0.0, mult...
Adenine-Thymine Complex Stackdefault0Geometry (in Angstrom), charge = 0.0, mult...
Adenine-Thymine Complex WCdefault0Geometry (in Angstrom), charge = 0.0, mult...
Ammonia Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
Benzene Dimer PDdefault0Geometry (in Angstrom), charge = 0.0, mult...
Benzene Dimer T-Shapedefault0Geometry (in Angstrom), charge = 0.0, mult...
Benzene-Ammonia Complexdefault0Geometry (in Angstrom), charge = 0.0, mult...
Benzene-HCN Complexdefault0Geometry (in Angstrom), charge = 0.0, mult...
Benzene-Methane Complexdefault0Geometry (in Angstrom), charge = 0.0, mult...
Benzene-Water Complexdefault0Geometry (in Angstrom), charge = 0.0, mult...
Ethene Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
Ethene-Ethine Complexdefault0Geometry (in Angstrom), charge = 0.0, mult...
Formamide Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
Formic Acid Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
Indole-Benzene Complex Stackdefault0Geometry (in Angstrom), charge = 0.0, mult...
Indole-Benzene Complex T-Shapedefault0Geometry (in Angstrom), charge = 0.0, mult...
Methane Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
Phenol Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
Pyrazine Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
Uracil Dimer HBdefault0Geometry (in Angstrom), charge = 0.0, mult...
Uracil Dimer Stackdefault0Geometry (in Angstrom), charge = 0.0, mult...
Water Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
\n", "
" ], "text/plain": [ " molecule\n", "name stoichiometry idx \n", "2-Pyridone-2-Aminopyridine Complex default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Adenine-Thymine Complex Stack default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Adenine-Thymine Complex WC default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Ammonia Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Benzene Dimer PD default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Benzene Dimer T-Shape default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Benzene-Ammonia Complex default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Benzene-HCN Complex default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Benzene-Methane Complex default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Benzene-Water Complex default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Ethene Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Ethene-Ethine Complex default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Formamide Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Formic Acid Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Indole-Benzene Complex Stack default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Indole-Benzene Complex T-Shape default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Methane Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Phenol Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Pyrazine Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Uracil Dimer HB default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Uracil Dimer Stack default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", "Water Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult..." ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dimers = ds.get_molecules()\n", "dimers" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Individual `Molecule` objects may be picked out of the dataframe:" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

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

\n
\n", "text/html": [ "
\n", "

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

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dimers.loc['Adenine-Thymine Complex WC', 'molecule'][0]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Reactants and products (or monomers and complexes) may be picked out with the `stoich` keyword. For the case of an interaction energy dataset like S22, `stoich=\"default\"` corresponds to complexes and `stoich=\"default1\"` corresponds to the monomers without counterpoise corrections. " ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
molecule
namestoichiometryidx
2-Pyridone-2-Aminopyridine Complexdefault10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
Adenine-Thymine Complex Stackdefault10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
Adenine-Thymine Complex WCdefault10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
Ammonia Dimerdefault10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
Benzene Dimer PDdefault10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
\n", "
" ], "text/plain": [ " molecule\n", "name stoichiometry idx \n", "2-Pyridone-2-Aminopyridine Complex default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult...\n", "Adenine-Thymine Complex Stack default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult...\n", "Adenine-Thymine Complex WC default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult...\n", "Ammonia Dimer default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult...\n", "Benzene Dimer PD default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult..." ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "monomers = ds.get_molecules(stoich=\"default1\")\n", "monomers.head(10)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As before, the individual `Molecule` objects for the monomers may be extracted from the DataFrame:" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

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

\n
\n", "text/html": [ "
\n", "

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

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "monomers.loc['Adenine-Thymine Complex WC', 'molecule'][0]" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

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

\n
\n", "text/html": [ "
\n", "

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

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "monomers.loc['Adenine-Thymine Complex WC', 'molecule'][1]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that it is possible to get all molecules involved in a reaction by specifying a list for `stoich`:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
molecule
namestoichiometryidx
2-Pyridone-2-Aminopyridine Complexdefault0Geometry (in Angstrom), charge = 0.0, mult...
default10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
Adenine-Thymine Complex Stackdefault0Geometry (in Angstrom), charge = 0.0, mult...
default10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
Adenine-Thymine Complex WCdefault0Geometry (in Angstrom), charge = 0.0, mult...
default10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
Ammonia Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
default10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
Benzene Dimer PDdefault0Geometry (in Angstrom), charge = 0.0, mult...
default10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
\n", "
" ], "text/plain": [ " molecule\n", "name stoichiometry idx \n", "2-Pyridone-2-Aminopyridine Complex default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult...\n", "Adenine-Thymine Complex Stack default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult...\n", "Adenine-Thymine Complex WC default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult...\n", "Ammonia Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult...\n", "Benzene Dimer PD default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult..." ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.get_molecules(stoich=['default', 'default1']).head(15)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Counterpoise-corrected calcuations are available through `stoich=\"cp\"` and `stoich=\"cp1\"`. Counterpoise-corrected monomers contain ghost atoms:" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

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

\n
\n", "text/html": [ "
\n", "

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

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.get_molecules(stoich=\"cp1\").loc['Adenine-Thymine Complex WC', 'molecule'][0]" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

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

\n
\n", "text/html": [ "
\n", "

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

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.get_molecules(stoich=\"cp1\").loc['Adenine-Thymine Complex WC', 'molecule'][1]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For large datasets, you may not want to query all molecules at once. `get_molecules` accepts a subset option for selecting specific reactions:" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
molecule
namestoichiometryidx
Adenine-Thymine Complex WCdefault0Geometry (in Angstrom), charge = 0.0, mult...
\n", "
" ], "text/plain": [ " molecule\n", "name stoichiometry idx \n", "Adenine-Thymine Complex WC default 0 Geometry (in Angstrom), charge = 0.0, mult..." ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.get_molecules(subset='Adenine-Thymine Complex WC')" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
molecule
namestoichiometryidx
Adenine-Thymine Complex WCdefault0Geometry (in Angstrom), charge = 0.0, mult...
default10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
Ammonia Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
default10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
Water Dimerdefault0Geometry (in Angstrom), charge = 0.0, mult...
default10Geometry (in Angstrom), charge = 0.0, mult...
1Geometry (in Angstrom), charge = 0.0, mult...
\n", "
" ], "text/plain": [ " molecule\n", "name stoichiometry idx \n", "Adenine-Thymine Complex WC default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult...\n", "Ammonia Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult...\n", "Water Dimer default 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " default1 0 Geometry (in Angstrom), charge = 0.0, mult...\n", " 1 Geometry (in Angstrom), charge = 0.0, mult..." ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.get_molecules(subset=['Adenine-Thymine Complex WC', 'Ammonia Dimer', 'Water Dimer'], stoich=['default', 'default1'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## From an OptimizationDataset\n", "\n", "Load an `OptimizationDataset`:" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "import qcportal as ptl\n", "client = ptl.FractalClient()\n", "\n", "client.list_collections()\n", "ds = client.get_collection(\"OptimizationDataset\", \"SMIRNOFF Coverage Set 1\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Show some available molecules:" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
COC(O)OC-0
C[S-]-0
CS-0
CO-0
CCO-0
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: []\n", "Index: [COC(O)OC-0, C[S-]-0, CS-0, CO-0, CCO-0]" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.df.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Show available specifications:" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Description
Name
defaultStandard OpenFF optimization quantum chemistry...
\n", "
" ], "text/plain": [ " Description\n", "Name \n", "default Standard OpenFF optimization quantum chemistry..." ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.list_specifications()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Obtain a specific record from a molecule and specification:" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "r = ds.get_record(\"CCO-0\",\"default\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Get the optimized molecule:" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

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

\n
\n", "text/html": [ "
\n", "

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

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r.get_final_molecule()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Get the optimization trajectory:" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/plain": [ "[,\n", " ,\n", " ,\n", " ,\n", " ,\n", " ,\n", " ,\n", " ]" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r.get_molecular_trajectory()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## From a TorsionDriveDataset" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "import qcportal as ptl\n", "client = ptl.FractalClient()\n", "\n", "ds = client.get_collection(\"TorsionDriveDataset\", \"SMIRNOFF Coverage Torsion Set 1\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Show some available torsions:" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
[CH3:1][O:2][CH:3]([OH:4])OC
[CH3:1][O:2][CH:3](O)[O:4]C
CO[CH:3]([OH:4])[O:2][CH3:1]
C[O:4][CH:3](O)[O:2][CH3:1]
[H:4][C:3](O)([O:2][CH3:1])OC
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: []\n", "Index: [[CH3:1][O:2][CH:3]([OH:4])OC, [CH3:1][O:2][CH:3](O)[O:4]C, CO[CH:3]([OH:4])[O:2][CH3:1], C[O:4][CH:3](O)[O:2][CH3:1], [H:4][C:3](O)([O:2][CH3:1])OC]" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.df.head() " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Show available specifications:" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Description
Name
defaultStandard OpenFF torsiondrive specification.
\n", "
" ], "text/plain": [ " Description\n", "Name \n", "default Standard OpenFF torsiondrive specification." ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.list_specifications()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Get a specific torsiondrive:" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "td = ds.get_record(\"CO[CH:3]([OH:4])[O:2][CH3:1]\", \"default\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Get molecules for each angle along the torsion scan:" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "text/plain": [ "{(-75,): ,\n", " (-90,): ,\n", " (-60,): ,\n", " (-105,): ,\n", " (-30,): ,\n", " (-45,): ,\n", " (-120,): ,\n", " (0,): ,\n", " (-15,): ,\n", " (15,): ,\n", " (-150,): ,\n", " (180,): ,\n", " (-165,): ,\n", " (-135,): ,\n", " (30,): ,\n", " (150,): ,\n", " (45,): ,\n", " (165,): ,\n", " (60,): ,\n", " (75,): ,\n", " (135,): ,\n", " (90,): ,\n", " (120,): ,\n", " (105,): }" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "td.get_final_molecules()" ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

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

\n
\n", "text/html": [ "
\n", "

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

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "td.get_final_molecules()[(30,)]" ] } ], "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.7.4" }, "pycharm": { "stem_cell": { "cell_type": "raw", "metadata": { "collapsed": false }, "source": [] } } }, "nbformat": 4, "nbformat_minor": 1 }