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