{ "cells": [ { "cell_type": "markdown", "id": "b572dd07", "metadata": {}, "source": [ "# TMol How-To Guide — Advanced Kinematics\n", "\n", "[](https://colab.research.google.com/github/RosettaCommons/tmol/blob/main/docs/tutorial/07_advanced_kinematics.ipynb)" ] }, { "cell_type": "markdown", "id": "0417440f", "metadata": {}, "source": [ "## 7. Advanced kinematics" ] }, { "cell_type": "markdown", "id": "d59f62a6", "metadata": {}, "source": [ "Named torsions (phi/psi/chi, already used since section 1) exist for nucleic acids and ligands too. The `FoldForest` that section 2 treated as a black box is itself just a small, directly-constructible data structure — both get covered in more depth here." ] }, { "cell_type": "markdown", "id": "c6153ddf", "metadata": {}, "source": [ "### Setup" ] }, { "cell_type": "markdown", "id": "f3faed33", "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": "fa5b577b", "metadata": { "execution": { "iopub.execute_input": "2026-10-20T00:49:09.453984Z", "iopub.status.busy": "2026-10-20T00:49:09.453720Z", "iopub.status.idle": "2026-10-20T00:51:18.530624Z", "shell.execute_reply": "2026-10-20T00:51:18.523947Z" }, "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": "2831cd17", "metadata": {}, "source": [ "### Named torsions" ] }, { "cell_type": "markdown", "id": "4445647a", "metadata": {}, "source": [ "#### Querying and setting by name: protein, NA" ] }, { "cell_type": "markdown", "id": "ad6cf395", "metadata": {}, "source": [ "`tmol.get_torsion_names`/`get_named_torsions`/`set_named_torsions` are generic -- they work on any residue type's declared torsions, protein or nucleic acid alike. [1BNA](https://www.rcsb.org/structure/1BNA) (B-form DNA, from section 3) declares the standard backbone torsions (alpha through zeta), the glycosidic `chi1`, and the sugar-pucker torsions `nu0`/`nu1`/`nu4`." ] }, { "cell_type": "code", "execution_count": 2, "id": "bd96f17e", "metadata": { "execution": { "iopub.execute_input": "2026-10-20T00:51:18.546360Z", "iopub.status.busy": "2026-10-20T00:51:18.545888Z", "iopub.status.idle": "2026-10-20T00:51:58.952920Z", "shell.execute_reply": "2026-10-20T00:51:58.952164Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "DG is seen only at a chain terminus and N1, N2 could each carry its other connection; none of them is a conventional backbone, so it cannot be told apart. A copy of the residue in a chain would settle it.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "torsion names: ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'chi1', 'nu0', 'nu1', 'nu4']\n", "alpha: -62.6 deg\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/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.