{ "cells": [ { "cell_type": "markdown", "id": "380036a3", "metadata": {}, "source": [ "# Notebook02: Export the reconstructed trajectory\n", "\n", "In [Notebook01](Notebook_01_buildH_calc_OP.ipynb) we showed you the basic use of **buildH** which consists in reconstructing hydrogens on a trajectory \"internally\" and calculate the order parameters. In the present notebook, we show you in addition how to output the trajectory with the newly reconstructed hydrogens.\n", "\n", "Before going on, we advise you to get started with [Notebook01](Notebook_01_buildH_calc_OP.ipynb) if you are not familiar with basic features of **buildH** and Jupyter notebooks (e.g. do you know what `!` means in a Jupyter cell?). \n", "\n", "## Checking buildH activation\n", "\n", "As explained in [Notebook01](Notebook_01_buildH_calc_OP.ipynb), you should have activated **buildH** before launching this notebook, thus you should obtain the following when invoking `buildH` in a Unix terminal:" ] }, { "cell_type": "code", "execution_count": 1, "id": "9de846da", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "usage: buildH [-h] [-v] -c COORD [-t TRAJ] -l LIPID\n", " [-lt LIPID_TOPOLOGY [LIPID_TOPOLOGY ...]] -d DEFOP\n", " [-opx OPDBXTC] [-o OUT] [-b BEGIN] [-e END] [-igch3]\n", "buildH: error: the following arguments are required: -c/--coord, -l/--lipid, -d/--defop\n", "\u001b[0m" ] } ], "source": [ "!buildH" ] }, { "cell_type": "markdown", "id": "d4131572", "metadata": {}, "source": [ "If you see this, you can go on. If not, please go to [Notebook01](Notebook_01_buildH_calc_OP.ipynb) and see the explanations there on how to activate **buildH**.\n", "\n", "## Downloading the example files\n", "\n", "The example shown in this Notebook are taken from a simplified trajectory of 25 frames (0-25 ns, one frame / ns) of a POPC membrane simulated with the Berger force field. The starting gro file and the trajectory of 25 frames can be directly downloaded from the **buildH** repo in the directory https://github.com/patrickfuchs/buildH/tree/master/docs/Berger_POPC_test_case. Here we'll download them with `wget` (recall to download all files in raw format):" ] }, { "cell_type": "code", "execution_count": 2, "id": "99f49f87", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--2021-07-06 16:57:58-- https://raw.githubusercontent.com/patrickfuchs/buildH/master/docs/Berger_POPC_test_case/start_128popc.pdb\n", "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.111.133, ...\n", "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 2253759 (2.1M) [text/plain]\n", "Saving to: ‘start_128popc.pdb’\n", "\n", "start_128popc.pdb 100%[===================>] 2.15M --.-KB/s in 0.1s \n", "\n", "2021-07-06 16:57:59 (14.9 MB/s) - ‘start_128popc.pdb’ saved [2253759/2253759]\n", "\n" ] } ], "source": [ "!wget https://raw.githubusercontent.com/patrickfuchs/buildH/master/docs/Berger_POPC_test_case/start_128popc.pdb" ] }, { "cell_type": "code", "execution_count": 3, "id": "660bea50", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--2021-07-06 16:58:04-- https://raw.githubusercontent.com/patrickfuchs/buildH/master/docs/Berger_POPC_test_case/popc0-25ns_dt1000.xtc\n", "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.111.133, 185.199.108.133, ...\n", "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 2725936 (2.6M) [application/octet-stream]\n", "Saving to: ‘popc0-25ns_dt1000.xtc’\n", "\n", "popc0-25ns_dt1000.x 100%[===================>] 2.60M 9.33MB/s in 0.3s \n", "\n", "2021-07-06 16:58:04 (9.33 MB/s) - ‘popc0-25ns_dt1000.xtc’ saved [2725936/2725936]\n", "\n" ] } ], "source": [ "!wget https://raw.githubusercontent.com/patrickfuchs/buildH/master/docs/Berger_POPC_test_case/popc0-25ns_dt1000.xtc" ] }, { "cell_type": "code", "execution_count": 4, "id": "e491f275", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "img\n", "Notebook_01_buildH_calc_OP.ipynb\n", "Notebook_02_buildH_calc_OP_outputwH.ipynb\n", "Notebook_03_mixture_POPC_POPE.ipynb\n", "Notebook_04_library.ipynb\n", "Notebook_05_mixture_POPC_cholesterol.ipynb\n", "popc0-25ns_dt1000.xtc\n", "start_128popc.pdb\n" ] } ], "source": [ "!ls" ] }, { "cell_type": "markdown", "id": "85dbfdb4", "metadata": {}, "source": [ "We also need the def file corresponding to POPC. It can be downloaded from the **buildH** repo in the directory https://github.com/patrickfuchs/buildH/tree/master/def_files (again remember to use raw file):" ] }, { "cell_type": "code", "execution_count": 5, "id": "85b8c5f2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--2021-07-06 16:58:12-- https://raw.githubusercontent.com/patrickfuchs/buildH/master/def_files/Berger_POPC.def\n", "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.111.133, ...\n", "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 2135 (2.1K) [text/plain]\n", "Saving to: ‘Berger_POPC.def’\n", "\n", "Berger_POPC.def 100%[===================>] 2.08K --.-KB/s in 0s \n", "\n", "2021-07-06 16:58:12 (4.50 MB/s) - ‘Berger_POPC.def’ saved [2135/2135]\n", "\n" ] } ], "source": [ "!wget https://raw.githubusercontent.com/patrickfuchs/buildH/master/def_files/Berger_POPC.def" ] }, { "cell_type": "code", "execution_count": 6, "id": "920c8e1a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Berger_POPC.def\n", "img\n", "Notebook_01_buildH_calc_OP.ipynb\n", "Notebook_02_buildH_calc_OP_outputwH.ipynb\n", "Notebook_03_mixture_POPC_POPE.ipynb\n", "Notebook_04_library.ipynb\n", "Notebook_05_mixture_POPC_cholesterol.ipynb\n", "popc0-25ns_dt1000.xtc\n", "start_128popc.pdb\n" ] } ], "source": [ "!ls" ] }, { "cell_type": "markdown", "id": "869db564", "metadata": {}, "source": [ "## Launching **buildH**\n", "\n", "Great, we have all the files, we can now launch **buildH**. For that we will need, as in `Notebook01`, a few arguments :\n", "\n", "- `-c` with the initial pdb or gro file containing the system;\n", "- `-t` containing the trajectory;\n", "- `-l` for telling **buildH** what lipid to consider (here `Berger_POPC`);\n", "- `-o` for specifying the name of the output file for the order parameters;\n", "- `-d` for the def file which specifies what C-H to analyze; importantly, since we want to output a trajectory with newly reconstructed hydrogens, *the def file has to contain all possible hydrogens to reconstruct*; this is the case in all lipids present in the [def file directory](https://github.com/patrickfuchs/buildH/tree/master/def_files) of the **buildH** repository from which we downloaded the current def file.\n", "\n", "So far these were all the flags we used in `Notebook01`. Here we use in addition one other flag:\n", "\n", "- `-opx` which tells **buildH** to generate a pdb and an xtc file with the newly reconstructed hydrogens. Not that a filename *without extension* has to be supplied; **buildH** will automatically add the extentions to both pdb and xtc files.\n", "\n", "Now we can launch **buildH**:" ] }, { "cell_type": "code", "execution_count": 8, "id": "c1d289ab", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Constructing the system...\n", "System has 28526 atoms\n", "Writing new pdb with hydrogens.\n", "Writing trajectory with hydrogens in xtc file.\n", "Dealing with frame 0 at 0.0 ps.\n", "Dealing with frame 1 at 1000.0 ps.\n", "Dealing with frame 2 at 2000.0 ps.\n", "Dealing with frame 3 at 3000.0 ps.\n", "Dealing with frame 4 at 4000.0 ps.\n", "Dealing with frame 5 at 5000.0 ps.\n", "Dealing with frame 6 at 6000.0 ps.\n", "Dealing with frame 7 at 7000.0 ps.\n", "Dealing with frame 8 at 8000.0 ps.\n", "Dealing with frame 9 at 9000.0 ps.\n", "Dealing with frame 10 at 10000.0 ps.\n", "Dealing with frame 11 at 11000.0 ps.\n", "Dealing with frame 12 at 12000.0 ps.\n", "Dealing with frame 13 at 13000.0 ps.\n", "Dealing with frame 14 at 14000.0 ps.\n", "Dealing with frame 15 at 15000.0 ps.\n", "Dealing with frame 16 at 16000.0 ps.\n", "Dealing with frame 17 at 17000.0 ps.\n", "Dealing with frame 18 at 18000.0 ps.\n", "Dealing with frame 19 at 19000.0 ps.\n", "Dealing with frame 20 at 20000.0 ps.\n", "Dealing with frame 21 at 21000.0 ps.\n", "Dealing with frame 22 at 22000.0 ps.\n", "Dealing with frame 23 at 23000.0 ps.\n", "Dealing with frame 24 at 24000.0 ps.\n", "Dealing with frame 25 at 25000.0 ps.\n", "Results written to OP_POPC.dat\n", "\u001b[0m" ] } ], "source": [ "!buildH -c start_128popc.pdb -l Berger_POPC -t popc0-25ns_dt1000.xtc -d Berger_POPC.def -o OP_POPC.dat -opx traj_POPC_wH" ] }, { "cell_type": "markdown", "id": "ece73656", "metadata": {}, "source": [ "## Looking at the results\n", "\n", "**buildH** have run, we can now get a look at the results." ] }, { "cell_type": "code", "execution_count": 9, "id": "6e4b6da1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Berger_POPC.def\n", "img\n", "Notebook_01_buildH_calc_OP.ipynb\n", "Notebook_02_buildH_calc_OP_outputwH.ipynb\n", "Notebook_03_mixture_POPC_POPE.ipynb\n", "Notebook_04_library.ipynb\n", "Notebook_05_mixture_POPC_cholesterol.ipynb\n", "OP_POPC.dat\n", "popc0-25ns_dt1000.xtc\n", "start_128popc.pdb\n", "traj_POPC_wH.pdb\n", "traj_POPC_wH.xtc\n" ] } ], "source": [ "!ls" ] }, { "cell_type": "markdown", "id": "b41c638f", "metadata": {}, "source": [ "The order parameters are in `OP_POPC.dat`." ] }, { "cell_type": "code", "execution_count": 10, "id": "26efb054", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "# OP_name resname atom1 atom2 OP_mean OP_stddev OP_stem\n", "#--------------------------------------------------------------------\n", "gamma1_1 POPC C1 H11 0.01304 0.12090 0.01069\n", "gamma1_2 POPC C1 H12 0.00666 0.09279 0.00820\n", "gamma1_3 POPC C1 H13 -0.01531 0.09141 0.00808\n", "gamma2_1 POPC C2 H21 0.01511 0.12080 0.01068\n", "gamma2_2 POPC C2 H22 -0.02050 0.09386 0.00830\n", "gamma2_3 POPC C2 H23 -0.00660 0.09137 0.00808\n", "gamma3_1 POPC C3 H31 0.01430 0.11796 0.01043\n", "gamma3_2 POPC C3 H32 -0.00513 0.08670 0.00766\n", "gamma3_3 POPC C3 H33 -0.00103 0.09096 0.00804\n", "beta1 POPC C5 H51 0.04934 0.11999 0.01061\n", "beta2 POPC C5 H52 0.07162 0.12108 0.01070\n", "alpha1 POPC C6 H61 0.11839 0.15261 0.01349\n", "alpha2 POPC C6 H62 0.13903 0.19003 0.01680\n", "g3_1 POPC C12 H121 -0.28674 0.09135 0.00807\n", "g3_2 POPC C12 H122 -0.16195 0.14832 0.01311\n", "g2_1 POPC C13 H131 -0.15159 0.14511 0.01283\n", "g1_1 POPC C32 H321 0.21133 0.22491 0.01988\n", "g1_2 POPC C32 H322 0.09638 0.16189 0.01431\n", "palmitoyl_C2a POPC C36 H361 -0.18236 0.09339 0.00825\n", "palmitoyl_C2b POPC C36 H362 -0.17005 0.08920 0.00788\n", "palmitoyl_C3a POPC C37 H371 -0.20072 0.09066 0.00801\n", "palmitoyl_C3b POPC C37 H372 -0.19557 0.07428 0.00657\n", "palmitoyl_C4a POPC C38 H381 -0.20089 0.09223 0.00815\n", "palmitoyl_C4b POPC C38 H382 -0.17997 0.08733 0.00772\n", "palmitoyl_C5a POPC C39 H391 -0.21088 0.08251 0.00729\n", "palmitoyl_C5b POPC C39 H392 -0.18860 0.07564 0.00669\n", "palmitoyl_C6a POPC C40 H401 -0.19824 0.08149 0.00720\n", "palmitoyl_C6b POPC C40 H402 -0.18946 0.08086 0.00715\n", "palmitoyl_C7a POPC C41 H411 -0.18585 0.08082 0.00714\n", "palmitoyl_C7b POPC C41 H412 -0.19800 0.08446 0.00747\n", "palmitoyl_C8a POPC C42 H421 -0.17450 0.07543 0.00667\n", "palmitoyl_C8b POPC C42 H422 -0.18744 0.09321 0.00824\n", "palmitoyl_C9a POPC C43 H431 -0.17542 0.08454 0.00747\n", "palmitoyl_C9b POPC C43 H432 -0.17275 0.07915 0.00700\n", "palmitoyl_C10a POPC C44 H441 -0.16439 0.08560 0.00757\n", "palmitoyl_C10b POPC C44 H442 -0.15272 0.08612 0.00761\n", "palmitoyl_C11a POPC C45 H451 -0.15392 0.08059 0.00712\n", "palmitoyl_C11b POPC C45 H452 -0.13054 0.09505 0.00840\n", "palmitoyl_C12a POPC C46 H461 -0.13008 0.08130 0.00719\n", "palmitoyl_C12b POPC C46 H462 -0.12733 0.08828 0.00780\n", "palmitoyl_C13a POPC C47 H471 -0.11683 0.07894 0.00698\n", "palmitoyl_C13b POPC C47 H472 -0.11505 0.08294 0.00733\n", "palmitoyl_C14a POPC C48 H481 -0.08165 0.08224 0.00727\n", "palmitoyl_C14b POPC C48 H482 -0.09691 0.08313 0.00735\n", "palmitoyl_C15a POPC C49 H491 -0.07789 0.08728 0.00771\n", "palmitoyl_C15b POPC C49 H492 -0.07646 0.08192 0.00724\n", "palmitoyl_C16a POPC C50 H501 0.11209 0.09937 0.00878\n", "palmitoyl_C16b POPC C50 H502 -0.07783 0.08694 0.00768\n", "palmitoyl_C16c POPC C50 H503 -0.07660 0.08224 0.00727\n", "oleoyl_C2a POPC C17 H171 -0.15994 0.09434 0.00834\n", "oleoyl_C2b POPC C17 H172 -0.18016 0.08797 0.00778\n", "oleoyl_C3a POPC C18 H181 -0.17150 0.07948 0.00703\n", "oleoyl_C3b POPC C18 H182 -0.18450 0.07601 0.00672\n", "oleoyl_C4a POPC C19 H191 -0.16958 0.08625 0.00762\n", "oleoyl_C4b POPC C19 H192 -0.19367 0.08334 0.00737\n", "oleoyl_C5a POPC C20 H201 -0.17511 0.08233 0.00728\n", "oleoyl_C5b POPC C20 H202 -0.18184 0.07799 0.00689\n", "oleoyl_C6a POPC C21 H211 -0.17102 0.07651 0.00676\n", "oleoyl_C6b POPC C21 H212 -0.16069 0.08159 0.00721\n", "oleoyl_C7a POPC C22 H221 -0.16198 0.08101 0.00716\n", "oleoyl_C7b POPC C22 H222 -0.16187 0.07195 0.00636\n", "oleoyl_C8a POPC C23 H231 -0.10457 0.08064 0.00713\n", "oleoyl_C8b POPC C23 H232 -0.10468 0.07768 0.00687\n", "oleoyl_C9a POPC C24 H241 -0.07384 0.08795 0.00777\n", "oleoyl_C10a POPC C25 H251 -0.01405 0.09695 0.00857\n", "oleoyl_C11a POPC C26 H261 -0.06138 0.09196 0.00813\n", "oleoyl_C11b POPC C26 H262 -0.04590 0.09627 0.00851\n", "oleoyl_C12a POPC C27 H271 -0.09346 0.08328 0.00736\n", "oleoyl_C12b POPC C27 H272 -0.09704 0.08287 0.00732\n", "oleoyl_C13a POPC C28 H281 -0.09307 0.07657 0.00677\n", "oleoyl_C13b POPC C28 H282 -0.08427 0.08647 0.00764\n", "oleoyl_C14a POPC C29 H291 -0.09291 0.07618 0.00673\n", "oleoyl_C14b POPC C29 H292 -0.09232 0.08611 0.00761\n", "oleoyl_C15a POPC C30 H301 -0.07331 0.08235 0.00728\n", "oleoyl_C15b POPC C30 H302 -0.07558 0.08218 0.00726\n", "oleoyl_C16a POPC C31 H311 -0.07262 0.08300 0.00734\n", "oleoyl_C16b POPC C31 H312 -0.07200 0.08320 0.00735\n", "oleoyl_C17a POPC CA1 HA11 -0.04622 0.07990 0.00706\n", "oleoyl_C17b POPC CA1 HA12 -0.04141 0.08677 0.00767\n", "oleoyl_C18a POPC CA2 HA21 0.03691 0.08420 0.00744\n", "oleoyl_C18b POPC CA2 HA22 -0.04603 0.07979 0.00705\n", "oleoyl_C18c POPC CA2 HA23 -0.04145 0.08636 0.00763\n" ] } ], "source": [ "!cat OP_POPC.dat" ] }, { "cell_type": "markdown", "id": "fbba463c", "metadata": {}, "source": [ "Let us have a look to the pdb file containing newly built hydrogens." ] }, { "cell_type": "code", "execution_count": 11, "id": "4357121b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ATOM 1 C1 POPC 1 4.940 8.210 18.070 1.00 0.00 C\n", "ATOM 2 H11 POPC 1 5.987 7.946 17.919 1.00 0.00 H\n", "ATOM 3 H12 POPC 1 4.308 7.376 17.765 1.00 0.00 H\n", "ATOM 4 H13 POPC 1 4.769 8.429 19.124 1.00 0.00 H\n", "ATOM 5 C2 POPC 1 4.730 8.880 15.890 1.00 0.00 C\n", "ATOM 6 H21 POPC 1 5.740 8.501 15.732 1.00 0.00 H\n", "ATOM 7 H22 POPC 1 4.527 9.680 15.178 1.00 0.00 H\n", "ATOM 8 H23 POPC 1 4.012 8.073 15.744 1.00 0.00 H\n", "ATOM 9 C3 POPC 1 5.650 10.420 17.410 1.00 0.00 C\n", "ATOM 10 H31 POPC 1 6.631 9.954 17.319 1.00 0.00 H\n", "ATOM 11 H32 POPC 1 5.560 10.889 18.390 1.00 0.00 H\n", "ATOM 12 H33 POPC 1 5.533 11.176 16.633 1.00 0.00 H\n", "ATOM 13 N4 POPC 1 4.610 9.400 17.260 1.00 0.00 N\n", "ATOM 14 C5 POPC 1 3.220 9.880 17.360 1.00 0.00 C\n", "ATOM 15 H51 POPC 1 2.665 9.284 16.635 1.00 0.00 H\n", "ATOM 16 H52 POPC 1 3.257 10.917 17.026 1.00 0.00 H\n", "ATOM 17 C6 POPC 1 2.340 9.900 18.610 1.00 0.00 C\n", "ATOM 18 H61 POPC 1 1.465 10.519 18.412 1.00 0.00 H\n", "ATOM 19 H62 POPC 1 2.911 10.330 19.433 1.00 0.00 H\n", "ATOM 20 O7 POPC 1 1.900 8.590 18.990 1.00 0.00 O\n", "ATOM 21 P8 POPC 1 0.800 8.850 20.140 1.00 0.00 P\n", "ATOM 22 O9 POPC 1 0.280 10.200 19.870 1.00 0.00 O\n", "ATOM 23 O10 POPC 1 -0.090 7.660 20.220 1.00 0.00 O\n", "ATOM 24 O11 POPC 1 1.820 8.900 21.380 1.00 0.00 O\n", "ATOM 25 C12 POPC 1 1.980 7.550 21.830 1.00 0.00 C\n", "ATOM 26 H121 POPC 1 2.256 6.929 20.978 1.00 0.00 H\n", "ATOM 27 H122 POPC 1 1.031 7.204 22.239 1.00 0.00 H\n", "ATOM 28 C13 POPC 1 3.060 7.410 22.910 1.00 0.00 C\n", "ATOM 29 H131 POPC 1 4.063 7.386 22.483 1.00 0.00 H\n", "ATOM 30 O14 POPC 1 2.870 6.170 23.610 1.00 0.00 O\n" ] } ], "source": [ "!head -30 traj_POPC_wH.pdb" ] }, { "cell_type": "markdown", "id": "f541bf70", "metadata": {}, "source": [ "We can see that `traj_POPC_wH.pdb` contains all the newly build hydrogens. This is also the case for `traj_POPC_wH.xtc` containing the trajectory. At this stage, you can watch -- and enjoy ;-) -- the trajectory with hydrogens using VMD:\n", "\n", "```\n", "$ vmd traj_POPC_wH.pdb traj_POPC_wH.xtc\n", "```\n", "\n", "We don't show you here how to plot the order parameters. If you want to do so, please have a look to `Notebook01`.\n", "\n", "## Conclusion\n", "\n", "In this notebook, we showed you how to use **buildH** to build hydrogens from a united-atom trajectory, calculate the order parameters on it, and generate pdb and xtc output files containing the trajectory with newly built hydrogens. These new files are usable in a visualisation software such as VMD, or any other analysis tool." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.8.10" } }, "nbformat": 4, "nbformat_minor": 5 }