In [13]:
import nglview

import IPython.display
import ipywidgets
from IPython.display import display,display_svg,SVG,Image, HTML

import __main__
from time import sleep
import pymol

import numpy as np

import matplotlib.pyplot as plt
%matplotlib inline

Скачали файлы, преобразовываем dppc.gro и b_64.gro в pdb файлы.

In [6]:
%%bash
genconf -f dppc.gro -o b_64.gro -nbox 4 4 4
                         :-)  G  R  O  M  A  C  S  (-:

                               Grunge ROck MAChoS

                            :-)  VERSION 4.5.5  (-:

        Written by Emile Apol, Rossen Apostolov, Herman J.C. Berendsen,
      Aldert van Buuren, Pär Bjelkmar, Rudi van Drunen, Anton Feenstra, 
        Gerrit Groenhof, Peter Kasson, Per Larsson, Pieter Meulenhoff, 
           Teemu Murtola, Szilard Pall, Sander Pronk, Roland Schulz, 
                Michael Shirts, Alfons Sijbers, Peter Tieleman,

               Berk Hess, David van der Spoel, and Erik Lindahl.

       Copyright (c) 1991-2000, University of Groningen, The Netherlands.
            Copyright (c) 2001-2010, The GROMACS development team at
        Uppsala University & The Royal Institute of Technology, Sweden.
            check out http://www.gromacs.org for more information.

         This program is free software; you can redistribute it and/or
          modify it under the terms of the GNU General Public License
         as published by the Free Software Foundation; either version 2
             of the License, or (at your option) any later version.

                               :-)  genconf  (-:

Option     Filename  Type         Description
------------------------------------------------------------
  -f       dppc.gro  Input        Structure file: gro g96 pdb tpr etc.
  -o       b_64.gro  Output       Structure file: gro g96 pdb etc.
-trj       traj.xtc  Input, Opt.  Trajectory: xtc trr trj gro g96 pdb cpt

Option       Type   Value   Description
------------------------------------------------------
-[no]h       bool   no      Print help info and quit
-[no]version bool   no      Print version info and quit
-nice        int    0       Set the nicelevel
-nbox        vector 4 4 4   Number of boxes
-dist        vector 0 0 0   Distance between boxes
-seed        int    0       Random generator seed, if 0 generated from the
                            time
-[no]rot     bool   no      Randomly rotate conformations
-[no]shuffle bool   no      Random shuffling of molecules
-[no]sort    bool   no      Sort molecules on X coord
-block       int    1       Divide the box in blocks on this number of cpus
-nmolat      int    3       Number of atoms per molecule, assumed to start
                            from 0. If you set this wrong, it will screw up
                            your system!
-maxrot      vector 180 180 180  Maximum random rotation
-[no]renumber  bool yes     Renumber residues


gcq#223: "These are Ideas, They are Not Lies" (Magnapop)

In [7]:
%%bash
editconf -f dppc.gro -o dppc.pdb
Read 50 atoms
Volume: 1.5477 nm^3, corresponds to roughly 600 electrons
No velocities found
                         :-)  G  R  O  M  A  C  S  (-:

                      GROwing Monsters And Cloning Shrimps

                            :-)  VERSION 4.5.5  (-:

        Written by Emile Apol, Rossen Apostolov, Herman J.C. Berendsen,
      Aldert van Buuren, Pär Bjelkmar, Rudi van Drunen, Anton Feenstra, 
        Gerrit Groenhof, Peter Kasson, Per Larsson, Pieter Meulenhoff, 
           Teemu Murtola, Szilard Pall, Sander Pronk, Roland Schulz, 
                Michael Shirts, Alfons Sijbers, Peter Tieleman,

               Berk Hess, David van der Spoel, and Erik Lindahl.

       Copyright (c) 1991-2000, University of Groningen, The Netherlands.
            Copyright (c) 2001-2010, The GROMACS development team at
        Uppsala University & The Royal Institute of Technology, Sweden.
            check out http://www.gromacs.org for more information.

         This program is free software; you can redistribute it and/or
          modify it under the terms of the GNU General Public License
         as published by the Free Software Foundation; either version 2
             of the License, or (at your option) any later version.

                               :-)  editconf  (-:

Option     Filename  Type         Description
------------------------------------------------------------
  -f       dppc.gro  Input        Structure file: gro g96 pdb tpr etc.
  -n      index.ndx  Input, Opt.  Index file
  -o       dppc.pdb  Output, Opt! Structure file: gro g96 pdb etc.
-mead      mead.pqr  Output, Opt. Coordinate file for MEAD
 -bf      bfact.dat  Input, Opt.  Generic data file

Option       Type   Value   Description
------------------------------------------------------
-[no]h       bool   no      Print help info and quit
-[no]version bool   no      Print version info and quit
-nice        int    0       Set the nicelevel
-[no]w       bool   no      View output .xvg, .xpm, .eps and .pdb files
-[no]ndef    bool   no      Choose output from default index groups
-bt          enum   triclinic  Box type for -box and -d: triclinic, cubic,
                            dodecahedron or octahedron
-box         vector 0 0 0   Box vector lengths (a,b,c)
-angles      vector 90 90 90  Angles between the box vectors (bc,ac,ab)
-d           real   0       Distance between the solute and the box
-[no]c       bool   no      Center molecule in box (implied by -box and -d)
-center      vector 0 0 0   Coordinates of geometrical center
-aligncenter vector 0 0 0   Center of rotation for alignment
-align       vector 0 0 0   Align to target vector
-translate   vector 0 0 0   Translation
-rotate      vector 0 0 0   Rotation around the X, Y and Z axes in degrees
-[no]princ   bool   no      Orient molecule(s) along their principal axes
-scale       vector 1 1 1   Scaling factor
-density     real   1000    Density (g/L) of the output box achieved by
                            scaling
-[no]pbc     bool   no      Remove the periodicity (make molecule whole again)
-resnr       int    -1       Renumber residues starting from resnr
-[no]grasp   bool   no      Store the charge of the atom in the B-factor
                            field and the radius of the atom in the occupancy
                            field
-rvdw        real   0.12    Default Van der Waals radius (in nm) if one can
                            not be found in the database or if no parameters
                            are present in the topology file
-sig56       real   0       Use rmin/2 (minimum in the Van der Waals
                            potential) rather than sigma/2 
-[no]vdwread bool   no      Read the Van der Waals radii from the file
                            vdwradii.dat rather than computing the radii
                            based on the force field
-[no]atom    bool   no      Force B-factor attachment per atom
-[no]legend  bool   no      Make B-factor legend
-label       string A       Add chain label for all residues
-[no]conect  bool   no      Add CONECT records to a .pdb file when written.
                            Can only be done when a topology is present


gcq#118: "Blessed is He Who In the Name Of Charity and Good Will Shepherds the Weak Through the Valley Of Darkness, For He is Truly His Brother's Keeper and the Finder Of Lost Children." (Pulp Fiction)

In [8]:
%%bash
editconf -f b_64.gro -o b_64.pdb
Read 3200 atoms
Volume: 99.0529 nm^3, corresponds to roughly 44500 electrons
No velocities found
                         :-)  G  R  O  M  A  C  S  (-:

                     Gyas ROwers Mature At Cryogenic Speed

                            :-)  VERSION 4.5.5  (-:

        Written by Emile Apol, Rossen Apostolov, Herman J.C. Berendsen,
      Aldert van Buuren, Pär Bjelkmar, Rudi van Drunen, Anton Feenstra, 
        Gerrit Groenhof, Peter Kasson, Per Larsson, Pieter Meulenhoff, 
           Teemu Murtola, Szilard Pall, Sander Pronk, Roland Schulz, 
                Michael Shirts, Alfons Sijbers, Peter Tieleman,

               Berk Hess, David van der Spoel, and Erik Lindahl.

       Copyright (c) 1991-2000, University of Groningen, The Netherlands.
            Copyright (c) 2001-2010, The GROMACS development team at
        Uppsala University & The Royal Institute of Technology, Sweden.
            check out http://www.gromacs.org for more information.

         This program is free software; you can redistribute it and/or
          modify it under the terms of the GNU General Public License
         as published by the Free Software Foundation; either version 2
             of the License, or (at your option) any later version.

                               :-)  editconf  (-:

Option     Filename  Type         Description
------------------------------------------------------------
  -f       b_64.gro  Input        Structure file: gro g96 pdb tpr etc.
  -n      index.ndx  Input, Opt.  Index file
  -o       b_64.pdb  Output, Opt! Structure file: gro g96 pdb etc.
-mead      mead.pqr  Output, Opt. Coordinate file for MEAD
 -bf      bfact.dat  Input, Opt.  Generic data file

Option       Type   Value   Description
------------------------------------------------------
-[no]h       bool   no      Print help info and quit
-[no]version bool   no      Print version info and quit
-nice        int    0       Set the nicelevel
-[no]w       bool   no      View output .xvg, .xpm, .eps and .pdb files
-[no]ndef    bool   no      Choose output from default index groups
-bt          enum   triclinic  Box type for -box and -d: triclinic, cubic,
                            dodecahedron or octahedron
-box         vector 0 0 0   Box vector lengths (a,b,c)
-angles      vector 90 90 90  Angles between the box vectors (bc,ac,ab)
-d           real   0       Distance between the solute and the box
-[no]c       bool   no      Center molecule in box (implied by -box and -d)
-center      vector 0 0 0   Coordinates of geometrical center
-aligncenter vector 0 0 0   Center of rotation for alignment
-align       vector 0 0 0   Align to target vector
-translate   vector 0 0 0   Translation
-rotate      vector 0 0 0   Rotation around the X, Y and Z axes in degrees
-[no]princ   bool   no      Orient molecule(s) along their principal axes
-scale       vector 1 1 1   Scaling factor
-density     real   1000    Density (g/L) of the output box achieved by
                            scaling
-[no]pbc     bool   no      Remove the periodicity (make molecule whole again)
-resnr       int    -1       Renumber residues starting from resnr
-[no]grasp   bool   no      Store the charge of the atom in the B-factor
                            field and the radius of the atom in the occupancy
                            field
-rvdw        real   0.12    Default Van der Waals radius (in nm) if one can
                            not be found in the database or if no parameters
                            are present in the topology file
-sig56       real   0       Use rmin/2 (minimum in the Van der Waals
                            potential) rather than sigma/2 
-[no]vdwread bool   no      Read the Van der Waals radii from the file
                            vdwradii.dat rather than computing the radii
                            based on the force field
-[no]atom    bool   no      Force B-factor attachment per atom
-[no]legend  bool   no      Make B-factor legend
-label       string A       Add chain label for all residues
-[no]conect  bool   no      Add CONECT records to a .pdb file when written.
                            Can only be done when a topology is present


gcq#55: "Kissing You is Like Kissing Gravel" (Throwing Muses)

In [12]:
__main__.pymol_argv = ['pymol','-qc']
pymol.finish_launching()
pymol.cmd.reinitialize()
pymol.cmd.load('b_64.pdb')
pymol.cmd.do('''
    png b_64.png
''')
Image(filename='b_64.png')
Out[12]:

Заменили 34 на 64 в файле b.top

In [14]:
%%bash
editconf -f b_64.gro -o b_ec -d 0.5
In [15]:
%%bash
grompp -f em -c b_ec -p b -o b_em -maxwarn 2 
mdrun -deffnm b_em -v
In [16]:
%%bash
genbox -cp b_em -p b -cs spc216 -o b_s
In [17]:
%%bash
grompp -f pr -c b_s -p b -o b_pr -maxwarn 1
mdrun -deffnm b_pr -v
In [18]:
%%bash
editconf -f b_pr.gro -o b_pr.pdb
editconf -f b_s.gro -o b_s.pdb
In [22]:
__main__.pymol_argv = ['pymol','-qc'] 
pymol.finish_launching()
pymol.cmd.load('b_s.pdb')
pymol.cmd.do('''
    png b_s.png
''')
Image(filename='b_s.png') #картинка, когда добавили воду
Out[22]:
In [20]:
__main__.pymol_argv = ['pymol','-qc'] 
pymol.finish_launching()

pymol.cmd.reinitialize()
pymol.cmd.load('b_pr.pdb')
pymol.cmd.do('''
    png b_pr.png
''')
Image(filename='b_pr.png') #картинка, когда утрясли воду
Out[20]:

В самом деле, последняя картинка менее "беспорядочна".

Запустил на Ломоносове 1652073 test, output.log пустой, в error.log ошибка GPU

Попробовал еще раз, 1652110 test2, то же самое, но вроде это нормально.

Запустил основное моделирование 1652128

Скачал файлы после окончания, вроде бы в error-gpu.log все хорошо

Анализ

In [2]:
# ! trjconv -f b_md.xtc -s b_md.tpr -o b_pbc_1.pdb -skip 20 -pbc mol

В целом, исходная структура сразу "ломается", и кажется, что где-то к 65 кадру мы видим четкое разделение на два слоя

In [7]:
Image(filename='fr0001.png')
Out[7]:
In [8]:
Image(filename='fr0035.png')
Out[8]:
In [9]:
Image(filename='fr0065.png') # 65-ый фрейм
Out[9]:
In [10]:
Image(filename='fr0101.png') # конечное состояние
Out[10]:

REMARK GENERATED BY TRJCONV

TITLE bilayer in water t= 32000.00000

REMARK THIS IS A SIMULATION BOX

CRYST1 75.084 53.290 40.208 90.00 90.00 90.00 P 1 1

MODEL 65

Определите площадь занимаемую одним липидом.

In [16]:
# g_traj -f b_md.xtc -s b_md.tpr -ob box_1.xvg

x - нормаль

In [18]:
import pandas as pd
In [30]:
coordinates = pd.read_csv('box_1.xvg', header = None, skiprows = 24, sep='\t')
coordinates = coordinates[[1,2,3,4]]
coordinates.columns = ['t', 'x', 'y', 'z']
coordinates.head(10)
Out[30]:
t x y z
0 0 6.26000 4.44300 5.77800
1 25 6.24466 4.43211 5.82057
2 50 6.21430 4.41056 5.84937
3 75 6.18851 4.39226 5.88993
4 100 6.17829 4.38501 5.94154
5 125 6.14924 4.36439 5.96442
6 150 6.14533 4.36162 5.99908
7 175 6.13719 4.35584 6.01078
8 200 6.12541 4.34748 6.02149
9 225 6.12478 4.34702 6.03089
In [46]:
plt.figure(figsize=(15,8))
lip_sizes = np.array(coordinates['y'])*np.array(coordinates['z'])/32. #32 - количество липидов в слое
plt.plot(np.array(coordinates['t']), lip_sizes);

Структура стремится к порядку.

Изменение гидрофобной и гидрофильной поверхности в ходе самосборки.

In [49]:
#! g_sas -f b_md.xtc -s b_md.tpr -o sas_b.xvg -dt 100
In [51]:
hydro = pd.read_csv('sas_b.xvg', header = None, skiprows = 22, sep='\s+')
hydro = hydro[[0,1,2]]
hydro.columns = ['t', 'Hydrophobic', 'Hydrophilic']
hydro.head(10)
Out[51]:
t Hydrophobic Hydrophilic
0 0 202.615 131.130
1 100 195.118 145.619
2 200 175.434 158.098
3 300 169.159 160.839
4 400 155.751 160.570
5 500 140.823 159.090
6 600 134.516 159.394
7 700 127.349 158.546
8 800 137.257 157.679
9 900 118.201 151.240
In [52]:
plt.figure(figsize=(17,8))
plt.plot(np.array(hydro['t']), hydro['Hydrophobic'], label='Hydrophobic', color='red');
plt.plot(np.array(hydro['t']), hydro['Hydrophilic'], label='Hydrophilic', color='blue');
plt.legend();

Обе площади уменьшаются, тем самым уменьшая энергию системы и приводя к самосборке

Мера порядка

In [53]:
! wget http://kodomo.cmm.msu.ru/~golovin/bilayer/sn1.ndx
In [54]:
%%bash
g_order -s b_md -f b_md.xtc -o ord_end.xvg -n sn1.ndx -b 45000 -d X #для конца траектории
In [55]:
%%bash
g_order -s b_md -f b_md.xtc -o ord_start.xvg -n sn1.ndx -e 5000 -d X #для начала траектории
In [56]:
start = pd.read_csv('ord_start.xvg', header = None, skiprows = 12, sep='\s+')
end = pd.read_csv('ord_end.xvg', header = None, skiprows = 12, sep='\s+')
In [58]:
start.head()
Out[58]:
0 1 2 3
0 1 -0.059238 -0.042308 0.101547
1 2 -0.075473 -0.066661 0.142134
2 3 -0.062383 -0.071392 0.133775
3 4 -0.064212 -0.071674 0.135886
4 5 -0.072326 -0.056380 0.128707
In [57]:
plt.figure(figsize=(17,8))
plt.plot(np.array(start[0]), start[3], label='Start', color='red');
plt.plot(np.array(end[0]), end[3], label='End', color='green');
plt.legend();

Упорядоченность в конце сборки сильно выше, чем в начале

In [ ]: