{ "cells": [ { "cell_type": "markdown", "id": "70a9f07e", "metadata": {}, "source": [ "# Basic online search\n", "\n", "This notebook demonstrates live NIST Chemistry WebBook search calls. The documentation build renders pregenerated outputs and does not execute this notebook automatically." ] }, { "cell_type": "code", "execution_count": 1, "id": "24d94ef3", "metadata": { "execution": { "iopub.execute_input": "2026-05-20T17:37:51.393533Z", "iopub.status.busy": "2026-05-20T17:37:51.393343Z", "iopub.status.idle": "2026-05-20T17:37:52.394249Z", "shell.execute_reply": "2026-05-20T17:37:52.393784Z" } }, "outputs": [ { "data": { "text/plain": [ "NistSearch(success=True, num_compounds=1, lost=False, message='')" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import nistchempy as nist\n", "\n", "search = nist.run_search('benzene', 'name')\n", "search" ] }, { "cell_type": "code", "execution_count": 2, "id": "0204023d", "metadata": { "execution": { "iopub.execute_input": "2026-05-20T17:37:52.395951Z", "iopub.status.busy": "2026-05-20T17:37:52.395694Z", "iopub.status.idle": "2026-05-20T17:37:52.398581Z", "shell.execute_reply": "2026-05-20T17:37:52.398163Z" } }, "outputs": [ { "data": { "text/plain": [ "(True, 1, ['C71432'])" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "search.success, search.num_compounds, search.compound_ids[:5]" ] }, { "cell_type": "code", "execution_count": 3, "id": "bdfa157c", "metadata": { "execution": { "iopub.execute_input": "2026-05-20T17:37:52.399648Z", "iopub.status.busy": "2026-05-20T17:37:52.399513Z", "iopub.status.idle": "2026-05-20T17:37:53.069333Z", "shell.execute_reply": "2026-05-20T17:37:53.068870Z" } }, "outputs": [ { "data": { "text/plain": [ "NistCompound(ID=C71432)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "compounds = search.load_found_compounds()\n", "compounds[0]" ] }, { "cell_type": "code", "execution_count": 4, "id": "6c7945a4", "metadata": { "execution": { "iopub.execute_input": "2026-05-20T17:37:53.070933Z", "iopub.status.busy": "2026-05-20T17:37:53.070766Z", "iopub.status.idle": "2026-05-20T17:37:53.073897Z", "shell.execute_reply": "2026-05-20T17:37:53.073390Z" } }, "outputs": [ { "data": { "text/plain": [ "{'record_type': 'compound',\n", " 'compound_id': 'C71432',\n", " 'source_url': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432',\n", " 'retrieved_at': '',\n", " 'ID': 'C71432',\n", " 'name': 'Benzene',\n", " 'synonyms': ['[6]Annulene',\n", " 'Benzol',\n", " 'Benzole',\n", " 'Coal naphtha',\n", " 'Cyclohexatriene',\n", " 'Phenyl hydride',\n", " 'Pyrobenzol',\n", " 'Pyrobenzole',\n", " 'Benzolene',\n", " 'Bicarburet of hydrogen',\n", " 'Carbon oil',\n", " 'Mineral naphtha',\n", " 'Motor benzol',\n", " 'Benzeen',\n", " 'Benzen',\n", " 'Benzin',\n", " 'Benzine',\n", " 'Benzolo',\n", " 'Fenzen',\n", " 'NCI-C55276',\n", " 'Phene',\n", " 'Rcra waste number U019',\n", " 'UN 1114',\n", " 'NSC 67315',\n", " '1,3,5-Cyclohexatriene'],\n", " 'formula': 'C 6 H 6',\n", " 'mol_weight': 78.1118,\n", " 'inchi': 'InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H',\n", " 'inchi_key': 'UHOVQNZJYSORNB-UHFFFAOYSA-N',\n", " 'cas_rn': '71-43-2',\n", " 'mol_refs': {'mol2D': 'https://webbook.nist.gov/cgi/cbook.cgi?Str2File=C71432',\n", " 'mol3D': 'https://webbook.nist.gov/cgi/cbook.cgi?Str3File=C71432'},\n", " 'data_refs': {'cTG': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=1#Thermo-Gas',\n", " 'cTC': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=2#Thermo-Condensed',\n", " 'cTP': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=4#Thermo-Phase',\n", " 'cTR': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=8#Thermo-React',\n", " 'cSO': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=10#Solubility',\n", " 'cIE': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=20#Ion-Energetics',\n", " 'cIC': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=40#Ion-Cluster',\n", " 'cIR': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=80#IR-Spec',\n", " 'cMS': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=200#Mass-Spec',\n", " 'cUV': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=400#UV-Vis-Spec',\n", " 'cES': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=800#Electronic-Spec',\n", " 'cGC': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C71432&Mask=2000#Gas-Chrom',\n", " 'Fluid Properties': 'https://webbook.nist.gov/cgi/fluid.cgi?ID=C71432&Action=Page'},\n", " 'nist_public_refs': {'Electron-Impact Ionization Cross Sections (on physics web site)': 'https://physics.nist.gov/cgi-bin/Ionization/table.pl?ionization=C6H6xx0',\n", " 'Gas Phase Kinetics Database': 'https://kinetics.nist.gov/kinetics/rpSearch?cas=71432',\n", " 'X-ray Photoelectron Spectroscopy Database, version 5.0': 'https://srdata.nist.gov/xps/SpectralByCompdDd/2349',\n", " 'NIST Polycyclic Aromatic Hydrocarbon Structure Index': 'https://pah.nist.gov/?q=pah001'},\n", " 'nist_subscription_refs': {'NIST / TRC Web Thermo Tables, \"lite\" edition (thermophysical and thermochemical data)': 'https://wtt-lite.nist.gov/wtt-lite/index.html?cmp=benzene',\n", " 'NIST / TRC Web Thermo Tables, professional edition (thermophysical and thermochemical data)': 'https://wtt-pro.nist.gov/wtt-pro/index.html?cmp=benzene'}}" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "compounds[0].to_dict()" ] }, { "cell_type": "markdown", "id": "6157ada9", "metadata": {}, "source": [ "The local index is not required for ordinary online search. It is useful when you need broad local filtering by known WebBook section availability." ] } ], "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.13.13" } }, "nbformat": 4, "nbformat_minor": 5 }