{ "cells": [ { "cell_type": "markdown", "id": "9b71d06a", "metadata": {}, "source": [ "# TMol How-To Guide — Ligands and NCAAs\n", "\n", "[](https://colab.research.google.com/github/RosettaCommons/tmol/blob/main/docs/tutorial/04_ligands_and_ncaas.ipynb)" ] }, { "cell_type": "markdown", "id": "5a8eb77f", "metadata": {}, "source": [ "## 4. Ligands and NCAAs" ] }, { "cell_type": "markdown", "id": "46535788", "metadata": {}, "source": [ "Small-molecule ligands and non-canonical amino acids both go through the same preparation pipeline (`prepare_ligands=True`) seen briefly in section 1. This notebook goes further: reusing prepared chemistry, saving/loading it, splitting a ligand into independently-scored fragments, and the handful of NCAAs that don't need the pipeline at all." ] }, { "cell_type": "markdown", "id": "c8b6f5f8", "metadata": {}, "source": [ "### Setup" ] }, { "cell_type": "markdown", "id": "c8469669", "metadata": {}, "source": [ "Wheel install, imports, seeding, and device selection live in [notebook_setup.py](https://github.com/RosettaCommons/tmol/blob/main/docs/tutorial/notebook_setup.py)." ] }, { "cell_type": "code", "execution_count": 1, "id": "5a1647c7", "metadata": { "execution": { "iopub.execute_input": "2026-10-20T00:48:56.194765Z", "iopub.status.busy": "2026-10-20T00:48:56.194407Z", "iopub.status.idle": "2026-10-20T00:49:07.074108Z", "shell.execute_reply": "2026-10-20T00:49:07.060516Z" }, "tags": [ "collapse-code" ] }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Environment variable CCD_MIRROR_PATH not set. Will not be able to use function requiring this variable. To set it you may:\n", " (1) add the line 'export VAR_NAME=path/to/variable' to your .bashrc or .zshrc file\n", " (2) set it in your current shell with 'export VAR_NAME=path/to/variable'\n", " (3) write it to a .env file in the root of the atomworks.io repository\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "Environment variable PDB_MIRROR_PATH not set. Will not be able to use function requiring this variable. To set it you may:\n", " (1) add the line 'export VAR_NAME=path/to/variable' to your .bashrc or .zshrc file\n", " (2) set it in your current shell with 'export VAR_NAME=path/to/variable'\n", " (3) write it to a .env file in the root of the atomworks.io repository\n" ] } ], "source": [ "try:\n", " import google.colab # noqa: F401\n", "except ImportError:\n", " IN_COLAB = False\n", "else:\n", " IN_COLAB = True\n", "\n", "if IN_COLAB:\n", " from urllib.request import urlretrieve\n", "\n", " urlretrieve(\n", " \"https://raw.githubusercontent.com/RosettaCommons/tmol/\"\n", " \"main/docs/tutorial/notebook_setup.py\",\n", " \"notebook_setup.py\",\n", " )\n", "\n", "from notebook_setup import * # noqa: F401,F403\n", "\n", "device, param_db = setup()\n" ] }, { "cell_type": "markdown", "id": "639d463f", "metadata": {}, "source": [ "### Ligands" ] }, { "cell_type": "markdown", "id": "3c3ffa1c", "metadata": {}, "source": [ "#### Automatic pipeline" ] }, { "cell_type": "markdown", "id": "1d526f6a", "metadata": {}, "source": [ "We return to [3PTB](https://www.rcsb.org/structure/3PTB) (trypsin + the small-molecule inhibitor benzamidine, BEN) from section 1 and go further: relax the whole complex, then read off a ligand-protein interaction energy and the ligand's own internal strain." ] }, { "cell_type": "code", "execution_count": 2, "id": "8aabef6f", "metadata": { "execution": { "iopub.execute_input": "2026-10-20T00:49:07.078961Z", "iopub.status.busy": "2026-10-20T00:49:07.078448Z", "iopub.status.idle": "2026-10-20T00:52:48.988557Z", "shell.execute_reply": "2026-10-20T00:52:48.987254Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "==============================\n", "*** Open Babel Warning in WriteMolecule\n", " No 2D or 3D coordinates exist. Stereochemical information will be stored using an Open Babel extension. To generate 2D or 3D coordinates instead use --gen2D or --gen3D.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "n_poses=1, max_n_blocks=225\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/home/runner/work/tmol/tmol/tmol/io/_pose_stack_from_biotite.py:1401: UserWarning: Renumbering chain A of the output AtomArray: biotite's CIF writer does not support numbering that decreases within a chain\n", " warnings.warn(\n", "/home/runner/work/tmol/tmol/.venv/lib/python3.12/site-packages/biotite/structure/io/pdb/file.py:629: DeprecationWarning: The chararray class is deprecated and will be removed in a future release. Use an ndarray with a string or bytes dtype instead.\n", " record = np.char.array(np.where(array.hetero, \"HETATM\", \"ATOM\"))\n" ] }, { "data": { "application/3dmoljs_load.v0": "
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.